From owner-svn-src-stable@freebsd.org Sun Sep 8 01:58: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 0EF02E498D; Sun, 8 Sep 2019 01:58:03 +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 46QvZf6ggRz4Lw9; Sun, 8 Sep 2019 01:58:02 +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 C86B3ECAE; Sun, 8 Sep 2019 01:58:02 +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 x881w2H1068753; Sun, 8 Sep 2019 01:58:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x881w2uC068752; Sun, 8 Sep 2019 01:58:02 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909080158.x881w2uC068752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 8 Sep 2019 01:58: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: r352027 - in stable: 11/lib/libc/nameser 12/lib/libc/nameser X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/lib/libc/nameser 12/lib/libc/nameser X-SVN-Commit-Revision: 352027 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, 08 Sep 2019 01:58:03 -0000 Author: cy Date: Sun Sep 8 01:58:02 2019 New Revision: 352027 URL: https://svnweb.freebsd.org/changeset/base/352027 Log: MFC r351889: Bounds check again after advancing cp, otherwise we have a possible heap buffer overflow. This was discovered by a Google fuzzer test. This can lead to remote denial of service. User interaction and execution privileges are not a prerequisite for exploitation. Reported by: enh at Google, to FreeBSD by maya@NetBSD.org Obtained from: enh at Google See also: NetBSD ns_name.c r1.12 Reviewed by: delphij, ume MFC after: 3 days https://android-review.googlesource.com/c/platform/bionic/+/1093130 Differential Revision: https://reviews.freebsd.org/D21523 Modified: stable/11/lib/libc/nameser/ns_name.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libc/nameser/ns_name.c Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libc/nameser/ns_name.c ============================================================================== --- stable/11/lib/libc/nameser/ns_name.c Sat Sep 7 23:39:30 2019 (r352026) +++ stable/11/lib/libc/nameser/ns_name.c Sun Sep 8 01:58:02 2019 (r352027) @@ -682,7 +682,7 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) { const u_char *cp; u_int n; - int l; + int l = 0; cp = *ptrptr; while (cp < eom && (n = *cp++) != 0) { @@ -692,7 +692,7 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) cp += n; continue; case NS_TYPE_ELT: /*%< EDNS0 extended label */ - if ((l = labellen(cp - 1)) < 0) { + if (cp < eom && (l = labellen(cp - 1)) < 0) { errno = EMSGSIZE; /*%< XXX */ return (-1); } From owner-svn-src-stable@freebsd.org Sun Sep 8 01:58: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 637F3E4992; Sun, 8 Sep 2019 01:58:03 +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 46QvZg20rXz4LwB; Sun, 8 Sep 2019 01:58:03 +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 2898DECAF; Sun, 8 Sep 2019 01:58:03 +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 x881w3MJ068759; Sun, 8 Sep 2019 01:58:03 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x881w3uQ068758; Sun, 8 Sep 2019 01:58:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909080158.x881w3uQ068758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 8 Sep 2019 01:58: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: r352027 - in stable: 11/lib/libc/nameser 12/lib/libc/nameser X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/lib/libc/nameser 12/lib/libc/nameser X-SVN-Commit-Revision: 352027 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, 08 Sep 2019 01:58:03 -0000 Author: cy Date: Sun Sep 8 01:58:02 2019 New Revision: 352027 URL: https://svnweb.freebsd.org/changeset/base/352027 Log: MFC r351889: Bounds check again after advancing cp, otherwise we have a possible heap buffer overflow. This was discovered by a Google fuzzer test. This can lead to remote denial of service. User interaction and execution privileges are not a prerequisite for exploitation. Reported by: enh at Google, to FreeBSD by maya@NetBSD.org Obtained from: enh at Google See also: NetBSD ns_name.c r1.12 Reviewed by: delphij, ume MFC after: 3 days https://android-review.googlesource.com/c/platform/bionic/+/1093130 Differential Revision: https://reviews.freebsd.org/D21523 Modified: stable/12/lib/libc/nameser/ns_name.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/nameser/ns_name.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libc/nameser/ns_name.c ============================================================================== --- stable/12/lib/libc/nameser/ns_name.c Sat Sep 7 23:39:30 2019 (r352026) +++ stable/12/lib/libc/nameser/ns_name.c Sun Sep 8 01:58:02 2019 (r352027) @@ -684,7 +684,7 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) { const u_char *cp; u_int n; - int l; + int l = 0; cp = *ptrptr; while (cp < eom && (n = *cp++) != 0) { @@ -694,7 +694,7 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) cp += n; continue; case NS_TYPE_ELT: /*%< EDNS0 extended label */ - if ((l = labellen(cp - 1)) < 0) { + if (cp < eom && (l = labellen(cp - 1)) < 0) { errno = EMSGSIZE; /*%< XXX */ return (-1); } From owner-svn-src-stable@freebsd.org Sun Sep 8 20: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 B0820E0A06; Sun, 8 Sep 2019 20:28: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 46RNCW49Kyz43S5; Sun, 8 Sep 2019 20:28: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 5461D274A; Sun, 8 Sep 2019 20:28:07 +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 x88KS7NZ028280; Sun, 8 Sep 2019 20:28:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KS7Gv028279; Sun, 8 Sep 2019 20:28:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082028.x88KS7Gv028279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20: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: r352038 - 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: 352038 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, 08 Sep 2019 20:28:07 -0000 Author: markj Date: Sun Sep 8 20:28:06 2019 New Revision: 352038 URL: https://svnweb.freebsd.org/changeset/base/352038 Log: MFC r351547, r351549: Fix several logic issues in domainset_empty_vm(). 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 8 19:54:28 2019 (r352037) +++ stable/12/sys/kern/kern_cpuset.c Sun Sep 8 20:28:06 2019 (r352038) @@ -457,7 +457,7 @@ static struct domainset * _domainset_create(struct domainset *domain, struct domainlist *freelist) { struct domainset *ndomain; - int i, j, max; + int i, j; KASSERT(domain->ds_cnt <= vm_ndomains, ("invalid domain count in domainset %p", domain)); @@ -476,8 +476,7 @@ _domainset_create(struct domainset *domain, struct dom if (ndomain == NULL) { LIST_INSERT_HEAD(&cpuset_domains, domain, ds_link); domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = 0, j = 0; i < max; i++) + for (i = 0, j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++) if (DOMAINSET_ISSET(i, &domain->ds_mask)) domain->ds_order[j++] = i; } @@ -500,25 +499,31 @@ _domainset_create(struct domainset *domain, struct dom static bool domainset_empty_vm(struct domainset *domain) { - int i, j, max; + domainset_t empty; + int i, j; - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = 0; i < max; i++) - if (DOMAINSET_ISSET(i, &domain->ds_mask) && VM_DOMAIN_EMPTY(i)) - DOMAINSET_CLR(i, &domain->ds_mask); + DOMAINSET_ZERO(&empty); + for (i = 0; i < vm_ndomains; i++) + if (VM_DOMAIN_EMPTY(i)) + DOMAINSET_SET(i, &empty); + if (DOMAINSET_SUBSET(&empty, &domain->ds_mask)) + return (true); + + /* Remove empty domains from the set and recompute. */ + DOMAINSET_NAND(&domain->ds_mask, &empty); domain->ds_cnt = DOMAINSET_COUNT(&domain->ds_mask); - max = DOMAINSET_FLS(&domain->ds_mask) + 1; - for (i = j = 0; i < max; i++) { + for (i = j = 0; i < DOMAINSET_FLS(&domain->ds_mask); i++) if (DOMAINSET_ISSET(i, &domain->ds_mask)) domain->ds_order[j++] = i; - else if (domain->ds_policy == DOMAINSET_POLICY_PREFER && - domain->ds_prefer == i && domain->ds_cnt > 1) { - domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN; - domain->ds_prefer = -1; - } + + /* Convert a PREFER policy referencing an empty domain to RR. */ + if (domain->ds_policy == DOMAINSET_POLICY_PREFER && + DOMAINSET_ISSET(domain->ds_prefer, &empty)) { + domain->ds_policy = DOMAINSET_POLICY_ROUNDROBIN; + domain->ds_prefer = -1; } - return (DOMAINSET_EMPTY(&domain->ds_mask)); + return (false); } /* From owner-svn-src-stable@freebsd.org Sun Sep 8 20:37:43 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 DE8F3E0F54; Sun, 8 Sep 2019 20:37:43 +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 46RNQb5YLPz4424; Sun, 8 Sep 2019 20:37:43 +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 9D954293F; Sun, 8 Sep 2019 20:37:43 +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 x88KbhqK034208; Sun, 8 Sep 2019 20:37:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KbgY0034205; Sun, 8 Sep 2019 20:37:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082037.x88KbgY0034205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:37: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: r352039 - in stable/12/sys: kern vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: kern vm X-SVN-Commit-Revision: 352039 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, 08 Sep 2019 20:37:43 -0000 Author: markj Date: Sun Sep 8 20:37:42 2019 New Revision: 352039 URL: https://svnweb.freebsd.org/changeset/base/352039 Log: MFC r350431: Centralize the logic in vfs_vmio_unwire() and sendfile_free_page(). Modified: stable/12/sys/kern/kern_sendfile.c stable/12/sys/kern/vfs_bio.c stable/12/sys/vm/vm_page.c stable/12/sys/vm/vm_page.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sendfile.c ============================================================================== --- stable/12/sys/kern/kern_sendfile.c Sun Sep 8 20:28:06 2019 (r352038) +++ stable/12/sys/kern/kern_sendfile.c Sun Sep 8 20:37:42 2019 (r352039) @@ -119,76 +119,22 @@ sfstat_sysctl(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_kern_ipc, OID_AUTO, sfstat, CTLTYPE_OPAQUE | CTLFLAG_RW, NULL, 0, sfstat_sysctl, "I", "sendfile statistics"); -/* - * Detach mapped page and release resources back to the system. Called - * by mbuf(9) code when last reference to a page is freed. - */ static void -sendfile_free_page(vm_page_t pg, bool nocache) -{ - bool freed; - - vm_page_lock(pg); - /* - * In either case check for the object going away on us. This can - * happen since we don't hold a reference to it. If so, we're - * responsible for freeing the page. In 'noncache' case try to free - * the page, but only if it is cheap to. - */ - if (vm_page_unwire_noq(pg)) { - vm_object_t obj; - - if ((obj = pg->object) == NULL) - vm_page_free(pg); - else { - freed = false; - if (nocache && !vm_page_xbusied(pg) && - VM_OBJECT_TRYWLOCK(obj)) { - /* Only free unmapped pages. */ - if (obj->ref_count == 0 || - !pmap_page_is_mapped(pg)) - /* - * The busy test before the object is - * locked cannot be relied upon. - */ - freed = vm_page_try_to_free(pg); - VM_OBJECT_WUNLOCK(obj); - } - if (!freed) { - /* - * If we were asked to not cache the page, place - * it near the head of the inactive queue so - * that it is reclaimed sooner. Otherwise, - * maintain LRU. - */ - if (nocache) - vm_page_deactivate_noreuse(pg); - else if (vm_page_active(pg)) - vm_page_reference(pg); - else - vm_page_deactivate(pg); - } - } - } - vm_page_unlock(pg); -} - -static void sendfile_free_mext(struct mbuf *m) { struct sf_buf *sf; vm_page_t pg; - bool nocache; + int flags; KASSERT(m->m_flags & M_EXT && m->m_ext.ext_type == EXT_SFBUF, ("%s: m %p !M_EXT or !EXT_SFBUF", __func__, m)); sf = m->m_ext.ext_arg1; pg = sf_buf_page(sf); - nocache = m->m_ext.ext_flags & EXT_FLAG_NOCACHE; + flags = (m->m_ext.ext_flags & EXT_FLAG_NOCACHE) != 0 ? VPR_TRYFREE : 0; sf_buf_free(sf); - sendfile_free_page(pg, nocache); + vm_page_release(pg, flags); if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { struct sendfile_sync *sfs = m->m_ext.ext_arg2; Modified: stable/12/sys/kern/vfs_bio.c ============================================================================== --- stable/12/sys/kern/vfs_bio.c Sun Sep 8 20:28:06 2019 (r352038) +++ stable/12/sys/kern/vfs_bio.c Sun Sep 8 20:37:42 2019 (r352039) @@ -2904,47 +2904,6 @@ vfs_vmio_iodone(struct buf *bp) } /* - * Unwire a page held by a buf and either free it or update the page queues to - * reflect its recent use. - */ -static void -vfs_vmio_unwire(struct buf *bp, vm_page_t m) -{ - bool freed; - - vm_page_lock(m); - if (vm_page_unwire_noq(m)) { - if ((bp->b_flags & B_DIRECT) != 0) - freed = vm_page_try_to_free(m); - else - freed = false; - if (!freed) { - /* - * Use a racy check of the valid bits to determine - * whether we can accelerate reclamation of the page. - * The valid bits will be stable unless the page is - * being mapped or is referenced by multiple buffers, - * and in those cases we expect races to be rare. At - * worst we will either accelerate reclamation of a - * valid page and violate LRU, or unnecessarily defer - * reclamation of an invalid page. - * - * The B_NOREUSE flag marks data that is not expected to - * be reused, so accelerate reclamation in that case - * too. Otherwise, maintain LRU. - */ - if (m->valid == 0 || (bp->b_flags & B_NOREUSE) != 0) - vm_page_deactivate_noreuse(m); - else if (vm_page_active(m)) - vm_page_reference(m); - else - vm_page_deactivate(m); - } - } - vm_page_unlock(m); -} - -/* * Perform page invalidation when a buffer is released. The fully invalid * pages will be reclaimed later in vfs_vmio_truncate(). */ @@ -2953,7 +2912,7 @@ vfs_vmio_invalidate(struct buf *bp) { vm_object_t obj; vm_page_t m; - int i, resid, poffset, presid; + int flags, i, resid, poffset, presid; if (buf_mapped(bp)) { BUF_CHECK_MAPPED(bp); @@ -2972,6 +2931,7 @@ vfs_vmio_invalidate(struct buf *bp) * * See man buf(9) for more information */ + flags = (bp->b_flags & B_NOREUSE) != 0 ? VPR_NOREUSE : 0; obj = bp->b_bufobj->bo_object; resid = bp->b_bufsize; poffset = bp->b_offset & PAGE_MASK; @@ -2993,7 +2953,7 @@ vfs_vmio_invalidate(struct buf *bp) } if (pmap_page_wired_mappings(m) == 0) vm_page_set_invalid(m, poffset, presid); - vfs_vmio_unwire(bp, m); + vm_page_release_locked(m, flags); resid -= presid; poffset = 0; } @@ -3009,7 +2969,7 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages) { vm_object_t obj; vm_page_t m; - int i; + int flags, i; if (bp->b_npages == desiredpages) return; @@ -3024,14 +2984,22 @@ vfs_vmio_truncate(struct buf *bp, int desiredpages) /* * The object lock is needed only if we will attempt to free pages. */ - obj = (bp->b_flags & B_DIRECT) != 0 ? bp->b_bufobj->bo_object : NULL; - if (obj != NULL) + flags = (bp->b_flags & B_NOREUSE) != 0 ? VPR_NOREUSE : 0; + if ((bp->b_flags & B_DIRECT) != 0) { + flags |= VPR_TRYFREE; + obj = bp->b_bufobj->bo_object; VM_OBJECT_WLOCK(obj); + } else { + obj = NULL; + } for (i = desiredpages; i < bp->b_npages; i++) { m = bp->b_pages[i]; KASSERT(m != bogus_page, ("allocbuf: bogus page found")); bp->b_pages[i] = NULL; - vfs_vmio_unwire(bp, m); + if (obj != NULL) + vm_page_release_locked(m, flags); + else + vm_page_release(m, flags); } if (obj != NULL) VM_OBJECT_WUNLOCK(obj); Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Sun Sep 8 20:28:06 2019 (r352038) +++ stable/12/sys/vm/vm_page.c Sun Sep 8 20:37:42 2019 (r352039) @@ -3746,29 +3746,92 @@ vm_page_unswappable(vm_page_t m) vm_page_enqueue(m, PQ_UNSWAPPABLE); } +static void +vm_page_release_toq(vm_page_t m, int flags) +{ + + /* + * Use a check of the valid bits to determine whether we should + * accelerate reclamation of the page. The object lock might not be + * held here, in which case the check is racy. At worst we will either + * accelerate reclamation of a valid page and violate LRU, or + * unnecessarily defer reclamation of an invalid page. + * + * If we were asked to not cache the page, place it near the head of the + * inactive queue so that is reclaimed sooner. + */ + if ((flags & (VPR_TRYFREE | VPR_NOREUSE)) != 0 || m->valid == 0) + vm_page_deactivate_noreuse(m); + else if (vm_page_active(m)) + vm_page_reference(m); + else + vm_page_deactivate(m); +} + /* - * Attempt to free the page. If it cannot be freed, do nothing. Returns true - * if the page is freed and false otherwise. - * - * The page must be managed. The page and its containing object must be - * locked. + * Unwire a page and either attempt to free it or re-add it to the page queues. */ -bool -vm_page_try_to_free(vm_page_t m) +void +vm_page_release(vm_page_t m, int flags) { + vm_object_t object; + bool freed; - vm_page_assert_locked(m); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("vm_page_release: page %p is unmanaged", m)); + + vm_page_lock(m); + if (m->object != NULL) + VM_OBJECT_ASSERT_UNLOCKED(m->object); + if (vm_page_unwire_noq(m)) { + if ((object = m->object) == NULL) { + vm_page_free(m); + } else { + freed = false; + if ((flags & VPR_TRYFREE) != 0 && !vm_page_busied(m) && + /* Depends on type stability. */ + VM_OBJECT_TRYWLOCK(object)) { + /* + * Only free unmapped pages. The busy test from + * before the object was locked cannot be relied + * upon. + */ + if ((object->ref_count == 0 || + !pmap_page_is_mapped(m)) && m->dirty == 0 && + !vm_page_busied(m)) { + vm_page_free(m); + freed = true; + } + VM_OBJECT_WUNLOCK(object); + } + + if (!freed) + vm_page_release_toq(m, flags); + } + } + vm_page_unlock(m); +} + +/* See vm_page_release(). */ +void +vm_page_release_locked(vm_page_t m, int flags) +{ + VM_OBJECT_ASSERT_WLOCKED(m->object); - KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); - if (m->dirty != 0 || vm_page_held(m) || vm_page_busied(m)) - return (false); - if (m->object->ref_count != 0) { - pmap_remove_all(m); - if (m->dirty != 0) - return (false); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("vm_page_release_locked: page %p is unmanaged", m)); + + vm_page_lock(m); + if (vm_page_unwire_noq(m)) { + if ((flags & VPR_TRYFREE) != 0 && + (m->object->ref_count == 0 || !pmap_page_is_mapped(m)) && + m->dirty == 0 && !vm_page_busied(m)) { + vm_page_free(m); + } else { + vm_page_release_toq(m, flags); + } } - vm_page_free(m); - return (true); + vm_page_unlock(m); } /* Modified: stable/12/sys/vm/vm_page.h ============================================================================== --- stable/12/sys/vm/vm_page.h Sun Sep 8 20:28:06 2019 (r352038) +++ stable/12/sys/vm/vm_page.h Sun Sep 8 20:37:42 2019 (r352039) @@ -563,8 +563,12 @@ bool vm_page_reclaim_contig(int req, u_long npages, vm bool vm_page_reclaim_contig_domain(int domain, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); void vm_page_reference(vm_page_t m); +#define VPR_TRYFREE 0x01 +#define VPR_NOREUSE 0x02 +void vm_page_release(vm_page_t m, int flags); +void vm_page_release_locked(vm_page_t m, int flags); bool vm_page_remove(vm_page_t); -int vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t); +int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); vm_page_t vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex); void vm_page_requeue(vm_page_t m); @@ -575,7 +579,6 @@ void vm_page_set_valid_range(vm_page_t m, int base, in int vm_page_sleep_if_busy(vm_page_t m, const char *msg); vm_offset_t vm_page_startup(vm_offset_t vaddr); void vm_page_sunbusy(vm_page_t m); -bool vm_page_try_to_free(vm_page_t m); int vm_page_trysbusy(vm_page_t m); void vm_page_unhold_pages(vm_page_t *ma, int count); void vm_page_unswappable(vm_page_t m); From owner-svn-src-stable@freebsd.org Sun Sep 8 20:38: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 5C307E102C; Sun, 8 Sep 2019 20:38:59 +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 46RNS31rpZz44Dj; Sun, 8 Sep 2019 20:38:59 +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 243CA2943; Sun, 8 Sep 2019 20:38:59 +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 x88KcxRD034426; Sun, 8 Sep 2019 20:38:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88Kcx9D034425; Sun, 8 Sep 2019 20:38:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082038.x88Kcx9D034425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:38: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: r352040 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 352040 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, 08 Sep 2019 20:38:59 -0000 Author: markj Date: Sun Sep 8 20:38:58 2019 New Revision: 352040 URL: https://svnweb.freebsd.org/changeset/base/352040 Log: MFC r351332: Unconditionally enable debug.vm_lowmem. Modified: stable/12/sys/vm/vm_kern.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_kern.c ============================================================================== --- stable/12/sys/vm/vm_kern.c Sun Sep 8 20:37:42 2019 (r352039) +++ stable/12/sys/vm/vm_kern.c Sun Sep 8 20:38:58 2019 (r352040) @@ -839,7 +839,6 @@ kmem_bootstrap_free(vm_offset_t start, vm_size_t size) #endif } -#ifdef DIAGNOSTIC /* * Allow userspace to directly trigger the VM drain routine for testing * purposes. @@ -862,4 +861,3 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); -#endif From owner-svn-src-stable@freebsd.org Sun Sep 8 20:39:56 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 8E6B5E11EE; Sun, 8 Sep 2019 20:39:56 +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 46RNT83BScz44PF; Sun, 8 Sep 2019 20:39:56 +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 519FC2947; Sun, 8 Sep 2019 20:39:56 +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 x88KdupC034516; Sun, 8 Sep 2019 20:39:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KduwJ034515; Sun, 8 Sep 2019 20:39:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082039.x88KduwJ034515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:39: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: r352041 - 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: 352041 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, 08 Sep 2019 20:39:56 -0000 Author: markj Date: Sun Sep 8 20:39:55 2019 New Revision: 352041 URL: https://svnweb.freebsd.org/changeset/base/352041 Log: MFC r351672: Restrict the input domain set in cpuset_setdomain(2) to all_domains. 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 8 20:38:58 2019 (r352040) +++ stable/12/sys/kern/kern_cpuset.c Sun Sep 8 20:39:55 2019 (r352041) @@ -2156,6 +2156,14 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le DOMAINSET_COPY(mask, &domain.ds_mask); domain.ds_policy = policy; + /* + * Sanitize the provided mask. + */ + if (!DOMAINSET_SUBSET(&all_domains, &domain.ds_mask)) { + error = EINVAL; + goto out; + } + /* Translate preferred policy into a mask and fallback. */ if (policy == DOMAINSET_POLICY_PREFER) { /* Only support a single preferred domain. */ @@ -2165,12 +2173,12 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le } domain.ds_prefer = DOMAINSET_FFS(&domain.ds_mask) - 1; /* This will be constrained by domainset_shadow(). */ - DOMAINSET_FILL(&domain.ds_mask); + DOMAINSET_COPY(&all_domains, &domain.ds_mask); } /* - * When given an impossible policy, fall back to interleaving - * across all domains + * When given an impossible policy, fall back to interleaving + * across all domains. */ if (domainset_empty_vm(&domain)) domainset_copy(&domainset2, &domain); From owner-svn-src-stable@freebsd.org Sun Sep 8 20:41:01 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 B86E7E12C1; Sun, 8 Sep 2019 20:41:01 +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 46RNVP49b1z44Xb; Sun, 8 Sep 2019 20:41:01 +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 7267A296E; Sun, 8 Sep 2019 20:41:01 +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 x88Kf1iJ035298; Sun, 8 Sep 2019 20:41:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88Kf0Vs035295; Sun, 8 Sep 2019 20:41:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082041.x88Kf0Vs035295@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:41:00 +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: r352042 - stable/12/lib/libfetch X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/lib/libfetch X-SVN-Commit-Revision: 352042 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, 08 Sep 2019 20:41:01 -0000 Author: markj Date: Sun Sep 8 20:41:00 2019 New Revision: 352042 URL: https://svnweb.freebsd.org/changeset/base/352042 Log: MFC r351573: Document fetchReqHTTP(). Modified: stable/12/lib/libfetch/Makefile stable/12/lib/libfetch/fetch.3 stable/12/lib/libfetch/http.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libfetch/Makefile ============================================================================== --- stable/12/lib/libfetch/Makefile Sun Sep 8 20:39:55 2019 (r352041) +++ stable/12/lib/libfetch/Makefile Sun Sep 8 20:41:00 2019 (r352042) @@ -68,6 +68,7 @@ MLINKS+= fetch.3 fetchPutFTP.3 MLINKS+= fetch.3 fetchPutFile.3 MLINKS+= fetch.3 fetchPutHTTP.3 MLINKS+= fetch.3 fetchPutURL.3 +MLINKS+= fetch.3 fetchReqHTTP.3 MLINKS+= fetch.3 fetchStat.3 MLINKS+= fetch.3 fetchStatFTP.3 MLINKS+= fetch.3 fetchStatFile.3 Modified: stable/12/lib/libfetch/fetch.3 ============================================================================== --- stable/12/lib/libfetch/fetch.3 Sun Sep 8 20:39:55 2019 (r352041) +++ stable/12/lib/libfetch/fetch.3 Sun Sep 8 20:41:00 2019 (r352042) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2016 +.Dd August 28, 2019 .Dt FETCH 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm fetchPutHTTP , .Nm fetchStatHTTP , .Nm fetchListHTTP , +.Nm fetchReqHTTP , .Nm fetchXGetFTP , .Nm fetchGetFTP , .Nm fetchPutFTP , @@ -112,6 +113,8 @@ .Ft struct url_ent * .Fn fetchListHTTP "struct url *u" "const char *flags" .Ft FILE * +.Fn fetchReqHTTP "struct url *u" "const char *method" "const char *flags" "const char *content_type" "const char *body" +.Ft FILE * .Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags" .Ft FILE * .Fn fetchGetFTP "struct url *u" "const char *flags" @@ -355,9 +358,10 @@ and password "anonymous@". .Sh HTTP SCHEME The .Fn fetchXGetHTTP , -.Fn fetchGetHTTP -and +.Fn fetchGetHTTP , .Fn fetchPutHTTP +and +.Fn fetchReqHTTP functions implement the HTTP/1.1 protocol. With a little luck, there is even a chance that they comply with RFC2616 and RFC2617. @@ -386,6 +390,18 @@ will send a conditional .Li If-Modified-Since HTTP header to only fetch the content if it is newer than .Va ims_time . +.Pp +The function +.Fn fetchReqHTTP +can be used to make requests with an arbitrary HTTP verb, +including POST, DELETE, CONNECT, OPTIONS, TRACE or PATCH. +This can be done by setting the argument +.Fa method +to the intended verb, such as +.Ql POST , +and +.Fa body +to the content. .Pp Since there seems to be no good way of implementing the HTTP PUT method in a manner consistent with the rest of the Modified: stable/12/lib/libfetch/http.c ============================================================================== --- stable/12/lib/libfetch/http.c Sun Sep 8 20:39:55 2019 (r352041) +++ stable/12/lib/libfetch/http.c Sun Sep 8 20:41:00 2019 (r352042) @@ -2093,6 +2093,9 @@ fetchListHTTP(struct url *url __unused, const char *fl return (NULL); } +/* + * Arbitrary HTTP verb and content requests + */ FILE * fetchReqHTTP(struct url *URL, const char *method, const char *flags, const char *content_type, const char *body) From owner-svn-src-stable@freebsd.org Sun Sep 8 20:42: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 1BEFEE134E; Sun, 8 Sep 2019 20:42:02 +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 46RNWY6vBxz44ql; Sun, 8 Sep 2019 20:42:01 +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 B5A7F2AD5; Sun, 8 Sep 2019 20:42:01 +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 x88Kg1wn040077; Sun, 8 Sep 2019 20:42:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88Kg18v040076; Sun, 8 Sep 2019 20:42:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082042.x88Kg18v040076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:42: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: r352043 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 352043 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, 08 Sep 2019 20:42:02 -0000 Author: markj Date: Sun Sep 8 20:42:01 2019 New Revision: 352043 URL: https://svnweb.freebsd.org/changeset/base/352043 Log: MFC r351613: Remove unused VM page locking macros. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Sun Sep 8 20:42:28 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 D6124E153C; Sun, 8 Sep 2019 20:42:28 +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 46RNX44Mljz44yY; Sun, 8 Sep 2019 20:42:28 +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 7A3CA2AED; Sun, 8 Sep 2019 20:42:28 +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 x88KgSLj040162; Sun, 8 Sep 2019 20:42:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KgS5F040161; Sun, 8 Sep 2019 20:42:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082042.x88KgS5F040161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:42: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: r352044 - stable/12/sys/dev/sound/midi X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/sound/midi X-SVN-Commit-Revision: 352044 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, 08 Sep 2019 20:42:28 -0000 Author: markj Date: Sun Sep 8 20:42:28 2019 New Revision: 352044 URL: https://svnweb.freebsd.org/changeset/base/352044 Log: MFC r351624: Properly check for an interrupted cv_wait_sig(). Modified: stable/12/sys/dev/sound/midi/sequencer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/midi/sequencer.c ============================================================================== --- stable/12/sys/dev/sound/midi/sequencer.c Sun Sep 8 20:42:01 2019 (r352043) +++ stable/12/sys/dev/sound/midi/sequencer.c Sun Sep 8 20:42:28 2019 (r352044) @@ -912,7 +912,7 @@ mseq_read(struct cdev *i_dev, struct uio *uio, int iof goto err1; retval = cv_wait_sig(&scp->in_cv, &scp->seq_lock); - if (retval == EINTR) + if (retval != 0) goto err1; } @@ -977,7 +977,7 @@ mseq_write(struct cdev *i_dev, struct uio *uio, int io * We slept, maybe things have changed since last * dying check */ - if (retval == EINTR) + if (retval != 0) goto err0; #if 0 /* From owner-svn-src-stable@freebsd.org Sun Sep 8 20:42:56 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 54F0BE15BA; Sun, 8 Sep 2019 20:42:56 +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 46RNXc1dXwz4569; Sun, 8 Sep 2019 20:42:56 +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 1B7552B01; Sun, 8 Sep 2019 20:42:56 +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 x88Kgtsd040227; Sun, 8 Sep 2019 20:42:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KgtQG040226; Sun, 8 Sep 2019 20:42:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082042.x88KgtQG040226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20:42:55 +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: r352045 - stable/12/usr.bin/cpuset X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/cpuset X-SVN-Commit-Revision: 352045 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, 08 Sep 2019 20:42:56 -0000 Author: markj Date: Sun Sep 8 20:42:55 2019 New Revision: 352045 URL: https://svnweb.freebsd.org/changeset/base/352045 Log: MFC r351671: Fix an off-by-one bug in the CPU and domain ID parser. Modified: stable/12/usr.bin/cpuset/cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/cpuset/cpuset.c ============================================================================== --- stable/12/usr.bin/cpuset/cpuset.c Sun Sep 8 20:42:28 2019 (r352044) +++ stable/12/usr.bin/cpuset/cpuset.c Sun Sep 8 20:42:55 2019 (r352045) @@ -100,10 +100,10 @@ parselist(char *list, struct bitset *mask, int size) for (l = list; *l != '\0';) { if (isdigit(*l)) { curnum = atoi(l); - if (curnum > size) + if (curnum >= size) errx(EXIT_FAILURE, "List entry %d exceeds maximum of %d", - curnum, size); + curnum, size - 1); while (isdigit(*l)) l++; switch (state) { From owner-svn-src-stable@freebsd.org Sun Sep 8 20: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 8E394E1E08; Sun, 8 Sep 2019 20:53:30 +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 46RNmp341Kz45mw; Sun, 8 Sep 2019 20:53:30 +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 338C22CD0; Sun, 8 Sep 2019 20:53:30 +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 x88KrUcR046180; Sun, 8 Sep 2019 20:53:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x88KrTtb046176; Sun, 8 Sep 2019 20:53:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909082053.x88KrTtb046176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Sep 2019 20: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: r352046 - in stable/12: cddl/contrib/opensolaris/cmd/lockstat share/man/man4 sys/kern sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/lockstat share/man/man4 sys/kern sys/sys X-SVN-Commit-Revision: 352046 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, 08 Sep 2019 20:53:30 -0000 Author: markj Date: Sun Sep 8 20:53:29 2019 New Revision: 352046 URL: https://svnweb.freebsd.org/changeset/base/352046 Log: MFC r351361, r351363: Add lockmgr(9) probes to the lockstat DTrace provider. Modified: stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c stable/12/share/man/man4/dtrace_lockstat.4 stable/12/sys/kern/kern_lock.c stable/12/sys/kern/kern_lockstat.c stable/12/sys/sys/lockstat.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Sun Sep 8 20:42:55 2019 (r352045) +++ stable/12/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c Sun Sep 8 20:53:29 2019 (r352046) @@ -158,29 +158,33 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'C', "Lock", "R/W writer blocked by readers", "nsec", "lockstat:::rw-block", "arg2 == 0 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W reader blocked by writer", "nsec", - "lockstat:::rw-block", "arg2 != 0 && arg3 == 1" }, + "lockstat:::rw-block", "arg2 == 1 && arg3 == 1" }, { 'C', "Lock", "R/W reader blocked by write wanted", "nsec", - "lockstat:::rw-block", "arg2 != 0 && arg3 == 0 && arg4" }, + "lockstat:::rw-block", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W writer spin on writer", "nsec", "lockstat:::rw-spin", "arg2 == 0 && arg3 == 1" }, { 'C', "Lock", "R/W writer spin on readers", "nsec", "lockstat:::rw-spin", "arg2 == 0 && arg3 == 0 && arg4" }, { 'C', "Lock", "R/W reader spin on writer", "nsec", - "lockstat:::rw-spin", "arg2 != 0 && arg3 == 1" }, + "lockstat:::rw-spin", "arg2 == 1 && arg3 == 1" }, { 'C', "Lock", "R/W reader spin on write wanted", "nsec", - "lockstat:::rw-spin", "arg2 != 0 && arg3 == 0 && arg4" }, + "lockstat:::rw-spin", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "SX exclusive block", "nsec", "lockstat:::sx-block", "arg2 == 0" }, { 'C', "Lock", "SX shared block", "nsec", - "lockstat:::sx-block", "arg2 != 0" }, + "lockstat:::sx-block", "arg2 == 1" }, { 'C', "Lock", "SX exclusive spin", "nsec", "lockstat:::sx-spin", "arg2 == 0" }, { 'C', "Lock", "SX shared spin", "nsec", - "lockstat:::sx-spin", "arg2 != 0" }, - { 'C', "Lock", "Unknown event (type 16)", "units" }, - { 'C', "Lock", "Unknown event (type 17)", "units" }, - { 'C', "Lock", "Unknown event (type 18)", "units" }, - { 'C', "Lock", "Unknown event (type 19)", "units" }, + "lockstat:::sx-spin", "arg2 == 1" }, + { 'C', "Lock", "lockmgr writer blocked by writer", "nsec", + "lockstat:::lockmgr-block", "arg2 == 0 && arg3 == 1" }, + { 'C', "Lock", "lockmgr writer blocked by readers", "nsec", + "lockstat:::lockmgr-block", "arg2 == 0 && arg3 == 0 && arg4" }, + { 'C', "Lock", "lockmgr reader blocked by writer", "nsec", + "lockstat:::lockmgr-block", "arg2 == 1 && arg3 == 1" }, + { 'C', "Lock", "lockmgr reader blocked by write wanted", "nsec", + "lockstat:::lockmgr-block", "arg2 == 1 && arg3 == 0 && arg4" }, { 'C', "Lock", "Unknown event (type 20)", "units" }, { 'C', "Lock", "Unknown event (type 21)", "units" }, { 'C', "Lock", "Unknown event (type 22)", "units" }, @@ -211,8 +215,12 @@ static ls_event_info_t g_event_info[LS_MAX_EVENTS] = { { 'H', "Lock", "SX exclusive hold", "nsec", "lockstat:::sx-release", "arg1 == 0", "lockstat:::sx-acquire" }, - { 'H', "Lock", "Unknown event (type 38)", "units" }, - { 'H', "Lock", "Unknown event (type 39)", "units" }, + { 'H', "Lock", "lockmgr shared hold", "nsec", + "lockstat:::lockmgr-release", "arg1 == 1", + "lockstat:::lockmgr-acquire" }, + { 'H', "Lock", "lockmgr exclusive hold", "nsec", + "lockstat:::lockmgr-release,lockstat:::lockmgr-disown", "arg1 == 0", + "lockstat:::lockmgr-acquire" }, { 'H', "Lock", "Unknown event (type 40)", "units" }, { 'H', "Lock", "Unknown event (type 41)", "units" }, { 'H', "Lock", "Unknown event (type 42)", "units" }, Modified: stable/12/share/man/man4/dtrace_lockstat.4 ============================================================================== --- stable/12/share/man/man4/dtrace_lockstat.4 Sun Sep 8 20:42:55 2019 (r352045) +++ stable/12/share/man/man4/dtrace_lockstat.4 Sun Sep 8 20:53:29 2019 (r352046) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2018 +.Dd August 20, 2019 .Dt DTRACE_LOCKSTAT 4 .Os .Sh NAME @@ -50,6 +50,12 @@ .Fn lockstat:::sx-spin "struct sx *" "uint64_t" .Fn lockstat:::sx-upgrade "struct sx *" .Fn lockstat:::sx-downgrade "struct sx *" +.Fn lockstat:::lockmgr-acquire "struct lock *" "int" +.Fn lockstat:::lockmgr-release "struct lock *" "int" +.Fn lockstat:::lockmgr-disown "struct lock *" "int" +.Fn lockstat:::lockmgr-block "struct lock *" "uint64_t" "int" "int" "int" +.Fn lockstat:::lockmgr-upgrade "struct lock *" +.Fn lockstat:::lockmgr-downgrade "struct lock *" .Fn lockstat:::thread-spin "struct mtx *" "uint64" .Sh DESCRIPTION The DTrace @@ -62,6 +68,7 @@ The provider contains DTrace probes for inspecting kernel lock state transitions. Probes exist for the +.Xr lockmgr 9 , .Xr mutex 9 , .Xr rwlock 9 , and @@ -159,76 +166,50 @@ The second argument is if the lock is being acquired or released as a writer, and .Dv 1 if it is being acquired or released as a reader. -.Pp The -.Fn lockstat:::rw-block -probe fires when a thread removes itself from the CPU while -waiting to acquire a -.Xr rwlock 9 . -The -.Fn lockstat:::rw-spin -probe fires when a thread spins while waiting to acquire a -.Xr rwlock 9 . -Both probes take the same set of arguments. -The first argument is a pointer to the lock structure that describes -the lock. -The second argument is the length of time, in nanoseconds, -that the waiting thread was off the CPU or spinning for the lock. -The third argument is -.Dv 0 -if the thread is attempting to acquire the lock as a writer, and -.Dv 1 -if the thread is attempting to acquire the lock as a reader. -The fourth argument is -.Dv 0 -if the thread is waiting for a writer to release the lock, and -.Dv 1 -if the thread is waiting for a reader to release the lock. -The fifth argument is the number of readers that held the lock when -the thread first attempted to acquire the lock. -This argument will be -.Dv 0 -if the fourth argument is -.Dv 0 . -.Pp -The -.Fn lockstat:::rw-upgrade -probe fires when a thread successfully upgrades a held -.Xr rwlock 9 -read lock to a write lock. -The -.Fn lockstat:::rw-downgrade -probe fires when a thread downgrades a held -.Xr rwlock 9 -write lock to a read lock. -The only argument is a pointer to the structure which describes -the lock being acquired. -.Pp -The .Fn lockstat:::sx-acquire and -.Fn lockstat:::sx-release -probes fire when a +.Fn lockstat:::sx-release , +and +.Fn lockstat:::lockmgr-acquire +and +.Fn lockstat:::lockmgr-release +probes fire upon the corresponding events for .Xr sx 9 -is acquired or released, respectively. +and +.Xr lockmgr 9 +locks, respectively. +The +.Fn lockstat:::lockmgr-disown +probe fires when a +.Xr lockmgr 9 +exclusive lock is disowned. +In this state, the lock remains exclusively held, but may be +released by a different thread. +The +.Fn lockstat:::lockmgr-release +probe does not fire when releasing a disowned lock. The first argument is a pointer to the structure which describes -the lock being acquired. +the lock being disowned. The second argument is -.Dv 0 -if the shared lock is being acquired or released, and -.Dv 1 -if the exclusive lock is being acquired or released. +.Dv 0 , +for compatibility with +.Fn lockstat:::lockmgr-release . .Pp The -.Fn lockstat:::sx-block -probe fires when a thread takes itself off the CPU while -waiting to acquire a -.Xr sx 9 . +.Fn lockstat:::rw-block , +.Fn lockstat:::sx-block , +and +.Fn lockstat:::lockmgr-block +probes fire when a thread removes itself from the CPU while +waiting to acquire a lock of the corresponding type. The +.Fn lockstat:::rw-spin +and .Fn lockstat:::sx-spin -probe fires when a thread spins while waiting to acquire a -.Xr sx 9 . -Both probes take the same set of arguments. +probes fire when a thread spins while waiting to acquire a lock +of the corresponding type. +All probes take the same set of arguments. The first argument is a pointer to the lock structure that describes the lock. The second argument is the length of time, in nanoseconds, @@ -240,28 +221,40 @@ if the thread is attempting to acquire the lock as a w if the thread is attempting to acquire the lock as a reader. The fourth argument is .Dv 0 -if the thread is waiting for a writer to release the lock, and +if the thread is waiting for a reader to release the lock, and .Dv 1 -if the thread is waiting for a reader to release the lock. +if the thread is waiting for a writer to release the lock. The fifth argument is the number of readers that held the lock when the thread first attempted to acquire the lock. This argument will be .Dv 0 if the fourth argument is -.Dv 0 . +.Dv 1 . .Pp The +.Fn lockstat:::lockmgr-upgrade , +.Fn lockstat:::rw-upgrade , +and .Fn lockstat:::sx-upgrade -probe fires when a thread successfully upgrades a held +probes fire when a thread successfully upgrades a held +.Xr lockmgr 9 , +.Xr rwlock 9 , +or .Xr sx 9 -shared lock to an exclusive lock. +shared/reader lock to an exclusive/writer lock. The only argument is a pointer to the structure which describes the lock being acquired. The +.Fn lockstat:::lockmgr-downgrade , +.Fn lockstat:::rw-downgrade , +and .Fn lockstat:::sx-downgrade -probe fires when a thread downgrades a held +probes fire when a thread downgrades a held +.Xr lockmgr 9 , +.Xr rwlock 9 , +or .Xr sx 9 -exclusive lock to a shared lock. +exclusive/writer lock to a shared/reader lock. .Pp The .Fn lockstat:::thread-spin @@ -291,10 +284,11 @@ provider first appeared in .Fx 9 . .Sh AUTHORS This manual page was written by -.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org . +.An George V. Neville-Neil Aq Mt gnn@FreeBSD.org +and +.An -nosplit +.An Mark Johnston Aq Mt markj@FreeBSD.org . .Sh BUGS Probes for -.Xr lockmgr 9 -and .Xr rmlock 9 locks have not yet been added. Modified: stable/12/sys/kern/kern_lock.c ============================================================================== --- stable/12/sys/kern/kern_lock.c Sun Sep 8 20:42:55 2019 (r352045) +++ stable/12/sys/kern/kern_lock.c Sun Sep 8 20:53:29 2019 (r352046) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -201,8 +202,8 @@ lockmgr_note_shared_acquire(struct lock *lk, int conte uint64_t waittime, const char *file, int line, int flags) { - lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime, - file, line); + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(lockmgr__acquire, lk, contested, + waittime, file, line, LOCKSTAT_READER); LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, file, line); WITNESS_LOCK(&lk->lock_object, LK_TRYWIT(flags), file, line); TD_LOCKS_INC(curthread); @@ -214,7 +215,7 @@ static void lockmgr_note_shared_release(struct lock *lk, const char *file, int line) { - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, LOCKSTAT_READER); WITNESS_UNLOCK(&lk->lock_object, 0, file, line); LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, file, line); TD_LOCKS_DEC(curthread); @@ -226,8 +227,8 @@ lockmgr_note_exclusive_acquire(struct lock *lk, int co uint64_t waittime, const char *file, int line, int flags) { - lock_profile_obtain_lock_success(&lk->lock_object, contested, waittime, - file, line); + LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(lockmgr__acquire, lk, contested, + waittime, file, line, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XLOCK", &lk->lock_object, 0, lk->lk_recurse, file, line); WITNESS_LOCK(&lk->lock_object, LOP_EXCLUSIVE | LK_TRYWIT(flags), file, line); @@ -239,7 +240,7 @@ static void lockmgr_note_exclusive_release(struct lock *lk, const char *file, int line) { - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XUNLOCK", &lk->lock_object, 0, lk->lk_recurse, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); @@ -553,6 +554,9 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc const char *iwmesg; int ipri, itimo; +#ifdef KDTRACE_HOOKS + uint64_t sleep_time = 0; +#endif #ifdef LOCK_PROFILING uint64_t waittime = 0; int contested = 0; @@ -643,8 +647,14 @@ retry_sleepq: * shared lock and the shared waiters flag is set, * we will sleep. */ +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(&lk->lock_object); +#endif error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, SQ_SHARED_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(&lk->lock_object); +#endif flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk, @@ -656,6 +666,12 @@ retry_sleepq: __func__, lk); } if (error == 0) { +#ifdef KDTRACE_HOOKS + if (sleep_time != 0) + LOCKSTAT_RECORD4(lockmgr__block, lk, sleep_time, + LOCKSTAT_READER, (x & LK_SHARE) == 0, + (x & LK_SHARE) == 0 ? 0 : LK_SHARERS(x)); +#endif #ifdef LOCK_PROFILING lockmgr_note_shared_acquire(lk, contested, waittime, file, line, flags); @@ -680,6 +696,9 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struc const char *iwmesg; int ipri, itimo; +#ifdef KDTRACE_HOOKS + uint64_t sleep_time = 0; +#endif #ifdef LOCK_PROFILING uint64_t waittime = 0; int contested = 0; @@ -819,8 +838,14 @@ retry_sleepq: * exclusive lock and the exclusive waiters flag * is set, we will sleep. */ +#ifdef KDTRACE_HOOKS + sleep_time -= lockstat_nsecs(&lk->lock_object); +#endif error = sleeplk(lk, flags, ilk, iwmesg, ipri, itimo, SQ_EXCLUSIVE_QUEUE); +#ifdef KDTRACE_HOOKS + sleep_time += lockstat_nsecs(&lk->lock_object); +#endif flags &= ~LK_INTERLOCK; if (error) { LOCK_LOG3(lk, @@ -832,6 +857,12 @@ retry_sleepq: __func__, lk); } if (error == 0) { +#ifdef KDTRACE_HOOKS + if (sleep_time != 0) + LOCKSTAT_RECORD4(lockmgr__block, lk, sleep_time, + LOCKSTAT_WRITER, (x & LK_SHARE) == 0, + (x & LK_SHARE) == 0 ? 0 : LK_SHARERS(x)); +#endif #ifdef LOCK_PROFILING lockmgr_note_exclusive_acquire(lk, contested, waittime, file, line, flags); @@ -875,6 +906,7 @@ lockmgr_upgrade(struct lock *lk, u_int flags, struct l line); WITNESS_UPGRADE(&lk->lock_object, LOP_EXCLUSIVE | LK_TRYWIT(flags), file, line); + LOCKSTAT_RECORD0(lockmgr__upgrade, lk); TD_SLOCKS_DEC(curthread); goto out; } @@ -1022,7 +1054,8 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_i goto out; } if (tid != LK_KERNPROC) - lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_PROFILE_RELEASE_RWLOCK(lockmgr__release, lk, + LOCKSTAT_WRITER); if (x == tid && atomic_cmpset_rel_ptr(&lk->lk_lock, tid, LK_UNLOCKED)) goto out; @@ -1203,7 +1236,6 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo break; case LK_DOWNGRADE: _lockmgr_assert(lk, KA_XLOCKED, file, line); - LOCK_LOG_LOCK("XDOWNGRADE", &lk->lock_object, 0, 0, file, line); WITNESS_DOWNGRADE(&lk->lock_object, 0, file, line); /* @@ -1229,6 +1261,8 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lo break; cpu_spinwait(); } + LOCK_LOG_LOCK("XDOWNGRADE", &lk->lock_object, 0, 0, file, line); + LOCKSTAT_RECORD0(lockmgr__downgrade, lk); break; case LK_RELEASE: _lockmgr_assert(lk, KA_LOCKED, file, line); @@ -1460,6 +1494,7 @@ _lockmgr_disown(struct lock *lk, const char *file, int if (LK_HOLDER(lk->lk_lock) != tid) return; lock_profile_release_lock(&lk->lock_object); + LOCKSTAT_RECORD1(lockmgr__disown, lk, LOCKSTAT_WRITER); LOCK_LOG_LOCK("XDISOWN", &lk->lock_object, 0, 0, file, line); WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_DEC(curthread); Modified: stable/12/sys/kern/kern_lockstat.c ============================================================================== --- stable/12/sys/kern/kern_lockstat.c Sun Sep 8 20:42:55 2019 (r352045) +++ stable/12/sys/kern/kern_lockstat.c Sun Sep 8 20:53:29 2019 (r352046) @@ -62,6 +62,14 @@ SDT_PROBE_DEFINE2(lockstat, , , sx__spin, "struct sx * SDT_PROBE_DEFINE1(lockstat, , , sx__upgrade, "struct sx *"); SDT_PROBE_DEFINE1(lockstat, , , sx__downgrade, "struct sx *"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__acquire, "struct lock *", "int"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__release, "struct lock *", "int"); +SDT_PROBE_DEFINE2(lockstat, , , lockmgr__disown, "struct lock *", "int"); +SDT_PROBE_DEFINE5(lockstat, , , lockmgr__block, "struct lock *", "uint64_t", + "int", "int", "int"); +SDT_PROBE_DEFINE1(lockstat, , , lockmgr__upgrade, "struct lock *"); +SDT_PROBE_DEFINE1(lockstat, , , lockmgr__downgrade, "struct lock *"); + SDT_PROBE_DEFINE2(lockstat, , , thread__spin, "struct mtx *", "uint64_t"); volatile bool __read_frequently lockstat_enabled; Modified: stable/12/sys/sys/lockstat.h ============================================================================== --- stable/12/sys/sys/lockstat.h Sun Sep 8 20:42:55 2019 (r352045) +++ stable/12/sys/sys/lockstat.h Sun Sep 8 20:53:29 2019 (r352046) @@ -65,6 +65,13 @@ SDT_PROBE_DECLARE(lockstat, , , sx__spin); SDT_PROBE_DECLARE(lockstat, , , sx__upgrade); SDT_PROBE_DECLARE(lockstat, , , sx__downgrade); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__acquire); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__release); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__disown); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__block); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__upgrade); +SDT_PROBE_DECLARE(lockstat, , , lockmgr__downgrade); + SDT_PROBE_DECLARE(lockstat, , , thread__spin); #define LOCKSTAT_WRITER 0 From owner-svn-src-stable@freebsd.org Mon Sep 9 10:44: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 1DA25F50FE; Mon, 9 Sep 2019 10:44:59 +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 46RlDB6wvZz3JSy; Mon, 9 Sep 2019 10:44:58 +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 CCDD2C642; Mon, 9 Sep 2019 10:44:58 +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 x89Aiw1M037759; Mon, 9 Sep 2019 10:44:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89AiwQV037758; Mon, 9 Sep 2019 10:44:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909091044.x89AiwQV037758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 9 Sep 2019 10:44:58 +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: r352055 - stable/11/contrib/traceroute X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/contrib/traceroute X-SVN-Commit-Revision: 352055 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, 09 Sep 2019 10:44:59 -0000 Author: tuexen Date: Mon Sep 9 10:44:58 2019 New Revision: 352055 URL: https://svnweb.freebsd.org/changeset/base/352055 Log: The variable names in the description of the port number usage is inconsistent. This patch fixes that and improves the precision of the description. Thanks to Tom Marcoen for reporting the issue and providing an initial patch, on which this change is based. PR: 237723 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D20708 Modified: stable/11/contrib/traceroute/traceroute.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/traceroute/traceroute.8 ============================================================================== --- stable/11/contrib/traceroute/traceroute.8 Mon Sep 9 03:31:46 2019 (r352054) +++ stable/11/contrib/traceroute/traceroute.8 Mon Sep 9 10:44:58 2019 (r352055) @@ -16,7 +16,7 @@ .\" $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $ .\" $FreeBSD$ .\" -.Dd May 31, 2015 +.Dd June 20, 2019 .Dt TRACEROUTE 8 .Os .Sh NAME @@ -32,7 +32,7 @@ .Op Fl m Ar max_ttl .Op Fl P Ar proto .Op Fl p Ar port -.Op Fl q Ar nqueries +.Op Fl q Ar nprobes .Op Fl s Ar src_addr .Op Fl t Ar tos .Op Fl w Ar waittime @@ -125,14 +125,14 @@ Traceroute hopes that nothing is listening on UDP port if used by .Nm and supported by the peer) -.Em base + 1 +.Em port + 1 to -.Em base + nhops * nprobes +.Em port + (max_ttl - first_ttl + 1) * nprobes at the destination host (so an ICMP PORT_UNREACHABLE message will be returned to terminate the route tracing). If something is listening on a port in the default range, this option can be used to pick an unused port range. -.It Fl q Ar nqueries +.It Fl q Ar nprobes Set the number of probes per hop (default is 3, unless .Fl D From owner-svn-src-stable@freebsd.org Mon Sep 9 11:20:17 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 C93BAF5C7E; Mon, 9 Sep 2019 11:20:17 +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 46Rm0x4zVKz3L6S; Mon, 9 Sep 2019 11:20:17 +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 8E32BCBED; Mon, 9 Sep 2019 11:20:17 +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 x89BKHHH056169; Mon, 9 Sep 2019 11:20:17 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89BKGpd056163; Mon, 9 Sep 2019 11:20:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909091120.x89BKGpd056163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 9 Sep 2019 11:20:16 +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: r352057 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/11/sys: netinet netinet6 X-SVN-Commit-Revision: 352057 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, 09 Sep 2019 11:20:17 -0000 Author: tuexen Date: Mon Sep 9 11:20:15 2019 New Revision: 352057 URL: https://svnweb.freebsd.org/changeset/base/352057 Log: MFC r349986: When calling sctp_initialize_auth_params(), the inp must have at least a read lock. To avoid more complex locking dances, just call it in sctp_aloc_assoc() when the write lock is still held. Modified: stable/11/sys/netinet/sctp_input.c stable/11/sys/netinet/sctp_output.c stable/11/sys/netinet/sctp_pcb.c stable/11/sys/netinet/sctp_pcb.h stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_input.c ============================================================================== --- stable/11/sys/netinet/sctp_input.c Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet/sctp_input.c Mon Sep 9 11:20:15 2019 (r352057) @@ -2157,8 +2157,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in ntohl(initack_cp->init.initiate_tag), vrf_id, ntohs(initack_cp->init.num_outbound_streams), port, - (struct thread *)NULL - ); + (struct thread *)NULL, + SCTP_DONT_INITIALIZE_AUTH_PARAMS); if (stcb == NULL) { struct mbuf *op_err; Modified: stable/11/sys/netinet/sctp_output.c ============================================================================== --- stable/11/sys/netinet/sctp_output.c Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet/sctp_output.c Mon Sep 9 11:20:15 2019 (r352057) @@ -12759,7 +12759,8 @@ sctp_lower_sosend(struct socket *so, stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, - p); + p, + SCTP_INITIALIZE_AUTH_PARAMS); if (stcb == NULL) { /* Error is setup for us in the call */ goto out_unlocked; @@ -12787,9 +12788,6 @@ sctp_lower_sosend(struct socket *so, asoc = &stcb->asoc; SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); - - /* initialize authentication params for the assoc */ - sctp_initialize_auth_params(inp, stcb); if (control) { if (sctp_process_cmsgs_for_init(stcb, control, &error)) { Modified: stable/11/sys/netinet/sctp_pcb.c ============================================================================== --- stable/11/sys/netinet/sctp_pcb.c Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet/sctp_pcb.c Mon Sep 9 11:20:15 2019 (r352057) @@ -4189,8 +4189,8 @@ struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, int *error, uint32_t override_tag, uint32_t vrf_id, uint16_t o_streams, uint16_t port, - struct thread *p -) + struct thread *p, + int initialize_auth_params) { /* note the p argument is only valid in unbound sockets */ @@ -4419,6 +4419,9 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockadd head = &inp->sctp_tcbhash[SCTP_PCBHASH_ALLADDR(stcb->rport, inp->sctp_hashmark)]; LIST_INSERT_HEAD(head, stcb, sctp_tcbhash); + } + if (initialize_auth_params == SCTP_INITIALIZE_AUTH_PARAMS) { + sctp_initialize_auth_params(inp, stcb); } SCTP_INP_WUNLOCK(inp); SCTPDBG(SCTP_DEBUG_PCB1, "Association %p now allocated\n", (void *)stcb); Modified: stable/11/sys/netinet/sctp_pcb.h ============================================================================== --- stable/11/sys/netinet/sctp_pcb.h Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet/sctp_pcb.h Mon Sep 9 11:20:15 2019 (r352057) @@ -576,9 +576,13 @@ int sctp_is_address_on_local_host(struct sockaddr *add void sctp_inpcb_free(struct sctp_inpcb *, int, int); +#define SCTP_DONT_INITIALIZE_AUTH_PARAMS 0 +#define SCTP_INITIALIZE_AUTH_PARAMS 1 + struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, - int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *); + int *, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *, + int); int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet/sctp_usrreq.c Mon Sep 9 11:20:15 2019 (r352057) @@ -1443,8 +1443,8 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, - (struct thread *)p - ); + (struct thread *)p, + SCTP_INITIALIZE_AUTH_PARAMS); if (stcb == NULL) { /* Gak! no memory */ goto out_now; @@ -1480,9 +1480,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb a_id = (sctp_assoc_t *)optval; *a_id = sctp_get_associd(stcb); - /* initialize authentication parameters for the assoc */ - sctp_initialize_auth_params(inp, stcb); - if (delay) { /* doing delayed connection */ stcb->asoc.delayed_connection = 1; @@ -7025,7 +7022,8 @@ sctp_connect(struct socket *so, struct sockaddr *addr, /* We are GOOD to go */ stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, - inp->sctp_ep.port, p); + inp->sctp_ep.port, p, + SCTP_INITIALIZE_AUTH_PARAMS); if (stcb == NULL) { /* Gak! no memory */ goto out_now; @@ -7037,9 +7035,6 @@ sctp_connect(struct socket *so, struct sockaddr *addr, } SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); - - /* initialize authentication parameters for the assoc */ - sctp_initialize_auth_params(inp, stcb); sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); SCTP_TCB_UNLOCK(stcb); Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Mon Sep 9 11:15:14 2019 (r352056) +++ stable/11/sys/netinet6/sctp6_usrreq.c Mon Sep 9 11:20:15 2019 (r352057) @@ -913,7 +913,8 @@ sctp6_connect(struct socket *so, struct sockaddr *addr /* We are GOOD to go */ stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, - inp->sctp_ep.port, p); + inp->sctp_ep.port, p, + SCTP_INITIALIZE_AUTH_PARAMS); SCTP_ASOC_CREATE_UNLOCK(inp); if (stcb == NULL) { /* Gak! no memory */ @@ -926,10 +927,6 @@ sctp6_connect(struct socket *so, struct sockaddr *addr } SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); - - /* initialize authentication parameters for the assoc */ - sctp_initialize_auth_params(inp, stcb); - sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); SCTP_TCB_UNLOCK(stcb); return (error); From owner-svn-src-stable@freebsd.org Mon Sep 9 14:16:58 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 67E0FD3A63; Mon, 9 Sep 2019 14:16:58 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Rqwp25Bjz42cG; Mon, 9 Sep 2019 14:16:58 +0000 (UTC) (envelope-from chuck@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 2B57BED73; Mon, 9 Sep 2019 14:16:58 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89EGw3B062669; Mon, 9 Sep 2019 14:16:58 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89EGwM2062668; Mon, 9 Sep 2019 14:16:58 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <201909091416.x89EGwM2062668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 9 Sep 2019 14:16: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: r352061 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 352061 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, 09 Sep 2019 14:16:58 -0000 Author: chuck Date: Mon Sep 9 14:16:57 2019 New Revision: 352061 URL: https://svnweb.freebsd.org/changeset/base/352061 Log: MFC r350077 bhyve: update the NVMe CQ based on the status Approved by: imp (mentor) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_nvme.c Mon Sep 9 12:42:48 2019 (r352060) +++ stable/12/usr.sbin/bhyve/pci_nvme.c Mon Sep 9 14:16:57 2019 (r352061) @@ -99,6 +99,10 @@ static int nvme_debug = 0; #define NVME_PRP2_ITEMS (PAGE_SIZE/sizeof(uint64_t)) #define NVME_MAX_BLOCKIOVS 512 +/* This is a synthetic status code to indicate there is no status */ +#define NVME_NO_STATUS 0xffff +#define NVME_COMPLETION_VALID(c) ((c).status != NVME_NO_STATUS) + /* helpers */ /* Convert a zero-based value into a one-based value */ @@ -1092,14 +1096,16 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u /* XXX dont care, unhandled for now do_intr |= nvme_opc_async_event_req(sc, cmd, &compl); */ + compl.status = NVME_NO_STATUS; break; default: WPRINTF(("0x%x command is not implemented\r\n", cmd->opc)); + pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); + do_intr |= 1; } - /* for now skip async event generation */ - if (cmd->opc != NVME_OPC_ASYNC_EVENT_REQUEST) { + if (NVME_COMPLETION_VALID(compl)) { struct nvme_completion *cp; int phase; From owner-svn-src-stable@freebsd.org Mon Sep 9 14: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 5415BD4119; Mon, 9 Sep 2019 14:41:40 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46RrTJ1cBVz43Wh; Mon, 9 Sep 2019 14:41:40 +0000 (UTC) (envelope-from fabient@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 1B7C9F1CB; Mon, 9 Sep 2019 14:41:40 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89Efdon079157; Mon, 9 Sep 2019 14:41:39 GMT (envelope-from fabient@FreeBSD.org) Received: (from fabient@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89Efd27079156; Mon, 9 Sep 2019 14:41:39 GMT (envelope-from fabient@FreeBSD.org) Message-Id: <201909091441.x89Efd27079156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fabient set sender to fabient@FreeBSD.org using -f From: Fabien Thomas Date: Mon, 9 Sep 2019 14: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: r352062 - stable/12/sys/netipsec X-SVN-Group: stable-12 X-SVN-Commit-Author: fabient X-SVN-Commit-Paths: stable/12/sys/netipsec X-SVN-Commit-Revision: 352062 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, 09 Sep 2019 14:41:40 -0000 Author: fabient Date: Mon Sep 9 14:41:39 2019 New Revision: 352062 URL: https://svnweb.freebsd.org/changeset/base/352062 Log: MFC r351935: Fix broken window replay check that will allow old packet to be accepted. This was introduced in r309144. Submitted by: Jean-Francois HREN Approved by: ae@ Modified: stable/12/sys/netipsec/ipsec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netipsec/ipsec.c ============================================================================== --- stable/12/sys/netipsec/ipsec.c Mon Sep 9 14:16:57 2019 (r352061) +++ stable/12/sys/netipsec/ipsec.c Mon Sep 9 14:41:39 2019 (r352062) @@ -1323,6 +1323,8 @@ ok: __func__, replay->overflow, ipsec_sa2str(sav, buf, sizeof(buf)))); } + + replay->count++; return (0); } From owner-svn-src-stable@freebsd.org Mon Sep 9 14:56: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 79A1FD48E3; Mon, 9 Sep 2019 14:56:07 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Rrnz2bjDz44Vc; Mon, 9 Sep 2019 14:56:07 +0000 (UTC) (envelope-from fabient@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 3CD97F4FE; Mon, 9 Sep 2019 14:56:07 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89Eu7fb086341; Mon, 9 Sep 2019 14:56:07 GMT (envelope-from fabient@FreeBSD.org) Received: (from fabient@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89Eu7Gw086340; Mon, 9 Sep 2019 14:56:07 GMT (envelope-from fabient@FreeBSD.org) Message-Id: <201909091456.x89Eu7Gw086340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fabient set sender to fabient@FreeBSD.org using -f From: Fabien Thomas Date: Mon, 9 Sep 2019 14:56:07 +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: r352064 - stable/11/sys/netipsec X-SVN-Group: stable-11 X-SVN-Commit-Author: fabient X-SVN-Commit-Paths: stable/11/sys/netipsec X-SVN-Commit-Revision: 352064 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, 09 Sep 2019 14:56:07 -0000 Author: fabient Date: Mon Sep 9 14:56:06 2019 New Revision: 352064 URL: https://svnweb.freebsd.org/changeset/base/352064 Log: MFC r351935: Fix broken window replay check that will allow old packet to be accepted. This was introduced in r309144. Submitted by: Jean-Francois HREN Approved by: ae@ Modified: stable/11/sys/netipsec/ipsec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/ipsec.c ============================================================================== --- stable/11/sys/netipsec/ipsec.c Mon Sep 9 14:51:25 2019 (r352063) +++ stable/11/sys/netipsec/ipsec.c Mon Sep 9 14:56:06 2019 (r352064) @@ -1309,6 +1309,8 @@ ok: __func__, replay->overflow, ipsec_sa2str(sav, buf, sizeof(buf)))); } + + replay->count++; return (0); } From owner-svn-src-stable@freebsd.org Mon Sep 9 16:37: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 27BDFD7A8A; Mon, 9 Sep 2019 16:37:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Rv370F70z4ChK; Mon, 9 Sep 2019 16:37:39 +0000 (UTC) (envelope-from johalun@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 DFA1C18731; Mon, 9 Sep 2019 16:37:38 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89GbcQW046833; Mon, 9 Sep 2019 16:37:38 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89GbcWm046830; Mon, 9 Sep 2019 16:37:38 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909091637.x89GbcWm046830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Mon, 9 Sep 2019 16:37:38 +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: r352076 - in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 352076 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, 09 Sep 2019 16:37:39 -0000 Author: johalun Date: Mon Sep 9 16:37:38 2019 New Revision: 352076 URL: https://svnweb.freebsd.org/changeset/base/352076 Log: MFC r351701: LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call. Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Sep 9 16:32:23 2019 (r352075) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Mon Sep 9 16:37:38 2019 (r352076) @@ -152,6 +152,29 @@ sysfs_remove_file(struct kobject *kobj, const struct a sysctl_remove_name(kobj->oidp, attr->name, 1, 1); } +static inline int +sysfs_create_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int error = 0; + int i; + + for (i = 0; attrs[i] && !error; i++) + error = sysfs_create_file(kobj, attrs[i]); + while (error && --i >= 0) + sysfs_remove_file(kobj, attrs[i]); + + return (error); +} + +static inline void +sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attrs) +{ + int i; + + for (i = 0; attrs[i]; i++) + sysfs_remove_file(kobj, attrs[i]); +} + static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Mon Sep 9 16:32:23 2019 (r352075) +++ stable/12/sys/sys/param.h Mon Sep 9 16:37:38 2019 (r352076) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200516 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200517 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Sep 9 17:22:12 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 5F7D3D8E7B; Mon, 9 Sep 2019 17:22:12 +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 46Rw2X1nLsz4GLr; Mon, 9 Sep 2019 17:22:12 +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 2059A18FF2; Mon, 9 Sep 2019 17:22:12 +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 x89HMC5j077008; Mon, 9 Sep 2019 17:22:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HMB2h077006; Mon, 9 Sep 2019 17:22:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091722.x89HMB2h077006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:22: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: r352077 - in stable/12/usr.sbin/makefs: . tests X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12/usr.sbin/makefs: . tests X-SVN-Commit-Revision: 352077 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, 09 Sep 2019 17:22:12 -0000 Author: emaste Date: Mon Sep 9 17:22:11 2019 New Revision: 352077 URL: https://svnweb.freebsd.org/changeset/base/352077 Log: MFC r345281: makefs: Fix "time" mtree attribute handling When processing mtree(5) MANIFEST files, makefs(8) previously threw an error if it encountered an entry whose "time" attribute contained a non-zero subsecond component (e.g. time=1551620152.987220000). Update the handling logic to properly assign the subsecond component if built with nanosecond support, or silently discard it otherwise. Also, re-enable the time attribute for the kyua tests. PR: 194703 Submitted by: mhorne Modified: stable/12/usr.sbin/makefs/mtree.c stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/mtree.c ============================================================================== --- stable/12/usr.sbin/makefs/mtree.c Mon Sep 9 16:37:38 2019 (r352076) +++ stable/12/usr.sbin/makefs/mtree.c Mon Sep 9 17:22:11 2019 (r352077) @@ -644,14 +644,17 @@ read_mtree_keywords(FILE *fp, fsnode *node) st->st_atime = num; st->st_ctime = num; st->st_mtime = num; +#if HAVE_STRUCT_STAT_ST_MTIMENSEC if (p == NULL) break; error = read_number(p, 10, &num, 0, INTMAX_MAX); if (error) break; - if (num != 0) - error = EINVAL; + st->st_atimensec = num; + st->st_ctimensec = num; + st->st_mtimensec = num; +#endif } else if (strcmp(keyword, "type") == 0) { if (value == NULL) { error = ENOATTR; Modified: stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh ============================================================================== --- stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh Mon Sep 9 16:37:38 2019 (r352076) +++ stable/12/usr.sbin/makefs/tests/makefs_tests_common.sh Mon Sep 9 17:22:11 2019 (r352077) @@ -29,13 +29,7 @@ KB=1024 : ${TMPDIR=/tmp} -# TODO: add mtree `time` support; get a lot of errors like this right now when -# passing generating disk images with keyword mtree support, like: -# -# `[...]/mtree.spec:8: error: time: invalid value '1446458503'` -# -#DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time" -DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link" +DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time" TEST_IMAGE="$TMPDIR/test.img" TEST_INPUTS_DIR="$TMPDIR/inputs" TEST_MD_DEVICE_FILE="$TMPDIR/md.output" From owner-svn-src-stable@freebsd.org Mon Sep 9 17:24: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 C90C7D8FD8; Mon, 9 Sep 2019 17:24:24 +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 46Rw544wSMz4GZt; Mon, 9 Sep 2019 17:24:24 +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 8CEC41901D; Mon, 9 Sep 2019 17:24:24 +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 x89HOO4D077187; Mon, 9 Sep 2019 17:24:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HOOwq077186; Mon, 9 Sep 2019 17:24:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091724.x89HOOwq077186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:24:24 +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: r352078 - stable/12/usr.sbin/makefs X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/makefs X-SVN-Commit-Revision: 352078 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, 09 Sep 2019 17:24:24 -0000 Author: emaste Date: Mon Sep 9 17:24:24 2019 New Revision: 352078 URL: https://svnweb.freebsd.org/changeset/base/352078 Log: MFC r351230: makefs.8: style updates from igor Sponsored by: The FreeBSD Foundation Modified: stable/12/usr.sbin/makefs/makefs.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/12/usr.sbin/makefs/makefs.8 Mon Sep 9 17:22:11 2019 (r352077) +++ stable/12/usr.sbin/makefs/makefs.8 Mon Sep 9 17:24:24 2019 (r352078) @@ -119,7 +119,7 @@ XXX: document these .It Fl F Ar mtree-specfile .Em This is almost certainly not the option you are looking for. To create an image from a list of files in an mtree format manifest, -specify it as the last argument on the commandline, not as a the +specify it as the last argument on the command line, not as a the argument to .Fl F . .Pp @@ -160,10 +160,10 @@ and (in the case of symbolic links). If .Sy time -isn't provided, the current time will be used. +is not provided, the current time will be used. If .Sy flags -isn't provided, the current file flags will be used. +is not provided, the current file flags will be used. Missing regular file entries will be created as zero-length files. .It Fl f Ar free-files Ensure that a minimum of @@ -331,9 +331,11 @@ The following keywords are supported: Allow the directory structure to exceed the maximum specified in the spec. .It Sy allow-illegal-chars -Allow illegal characters in filenames. This option is not implemented. +Allow illegal characters in filenames. +This option is not implemented. .It Sy allow-lowercase -Allow lowercase characters in filenames. This option is not implemented. +Allow lowercase characters in filenames. +This option is not implemented. .It Sy allow-max-name Allow 37 instead of 33 characters for filenames by omitting the version id. @@ -348,7 +350,8 @@ extension to encode .Tn RISC OS metadata. .It Sy bootimagedir -Boot image directory. This option is not implemented. +Boot image directory. +This option is not implemented. .It Sy chrp-boot Write an MBR partition table to the image to allow older CHRP hardware to boot. From owner-svn-src-stable@freebsd.org Mon Sep 9 17:32:43 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 625E9D9413; Mon, 9 Sep 2019 17:32:43 +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 46RwGg2cV3z4H6b; Mon, 9 Sep 2019 17:32:43 +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 23634191E6; Mon, 9 Sep 2019 17:32:43 +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 x89HWh6I083289; Mon, 9 Sep 2019 17:32:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HWeTr083276; Mon, 9 Sep 2019 17:32:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091732.x89HWeTr083276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:32: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: r352079 - in stable/12/usr.sbin/makefs: . ffs msdos X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12/usr.sbin/makefs: . ffs msdos X-SVN-Commit-Revision: 352079 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, 09 Sep 2019 17:32:43 -0000 Author: emaste Date: Mon Sep 9 17:32:40 2019 New Revision: 352079 URL: https://svnweb.freebsd.org/changeset/base/352079 Log: makefs: add msdosfs (FAT) support MFC r351232: makefs.8: expand description of image size Submitted by: ryan_freqlabs.com, Siva Mahadevan MFC r351273: makefs: add msdosfs (FAT) support Add FAT support to makefs by copying some files from sys/fs/msdosfs/ and updating others with changes from NetBSD. The six files copied from sys/fs/msdosfs at r348251 and modified are: denode.h direntry.h fat.h msdosfs_fat.c msdosfs_lookup.c msdosfsmount.h I would prefer to avoid the duplication, but reluctance to doing so was expressed in a previous review (D11197); for now copy the files and revisit in the future. Submitted by: Siva Mahadevan MFC r351275: makefs: avoid "dereferencing 'void *' pointer" warnings On GCC 4.2.1 archs MFC r351302: makefs.8: update history - ported to FreeBSD and first appeared in 8.0 - Christos Zoulas added the FAT support that I imported MFC r351319: makefs: use `char *` not `void *` for buf b_data, drop casts in msdos (The kernel uses caddr_t.) Suggested by: cem MFC r351415 (delphij): Properly update FSInfo block after generation. After populating the filesystem, write a FSInfo block with proper information. Sponsored by: The FreeBSD Foundation Added: stable/12/usr.sbin/makefs/msdos/Makefile.inc - copied unchanged from r351273, head/usr.sbin/makefs/msdos/Makefile.inc stable/12/usr.sbin/makefs/msdos/denode.h - copied unchanged from r351273, head/usr.sbin/makefs/msdos/denode.h stable/12/usr.sbin/makefs/msdos/direntry.h - copied unchanged from r351273, head/usr.sbin/makefs/msdos/direntry.h stable/12/usr.sbin/makefs/msdos/fat.h - copied unchanged from r351273, head/usr.sbin/makefs/msdos/fat.h stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c - copied unchanged from r351273, head/usr.sbin/makefs/msdos/msdosfs_conv.c stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c - copied, changed from r351273, head/usr.sbin/makefs/msdos/msdosfs_fat.c stable/12/usr.sbin/makefs/msdos/msdosfs_lookup.c - copied unchanged from r351273, head/usr.sbin/makefs/msdos/msdosfs_lookup.c stable/12/usr.sbin/makefs/msdos/msdosfsmount.h - copied unchanged from r351273, head/usr.sbin/makefs/msdos/msdosfsmount.h Modified: stable/12/usr.sbin/makefs/Makefile stable/12/usr.sbin/makefs/ffs/buf.h stable/12/usr.sbin/makefs/makefs.8 stable/12/usr.sbin/makefs/makefs.c stable/12/usr.sbin/makefs/makefs.h stable/12/usr.sbin/makefs/msdos.c stable/12/usr.sbin/makefs/msdos.h stable/12/usr.sbin/makefs/msdos/msdosfs_denode.c stable/12/usr.sbin/makefs/msdos/msdosfs_vfsops.c stable/12/usr.sbin/makefs/msdos/msdosfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/Makefile ============================================================================== --- stable/12/usr.sbin/makefs/Makefile Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/Makefile Mon Sep 9 17:32:40 2019 (r352079) @@ -8,8 +8,10 @@ PROG= makefs CFLAGS+=-I${SRCDIR} -SRCS= cd9660.c ffs.c \ +SRCS= cd9660.c \ + ffs.c \ makefs.c \ + msdos.c \ mtree.c \ walk.c MAN= makefs.8 @@ -18,6 +20,7 @@ WARNS?= 2 .include "${SRCDIR}/cd9660/Makefile.inc" .include "${SRCDIR}/ffs/Makefile.inc" +.include "${SRCDIR}/msdos/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 Modified: stable/12/usr.sbin/makefs/ffs/buf.h ============================================================================== --- stable/12/usr.sbin/makefs/ffs/buf.h Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/ffs/buf.h Mon Sep 9 17:32:40 2019 (r352079) @@ -54,7 +54,7 @@ struct vnode { }; struct buf { - void * b_data; + char * b_data; long b_bufsize; long b_bcount; daddr_t b_blkno; Modified: stable/12/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/12/usr.sbin/makefs/makefs.8 Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/makefs.8 Mon Sep 9 17:32:40 2019 (r352079) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2018 +.Dd August 20, 2019 .Dt MAKEFS 8 .Os .Sh NAME @@ -198,7 +198,9 @@ and Instead of creating the filesystem at the beginning of the file, start at offset. Valid only for -.Sy ffs . +.Sy ffs +and +.Sy msdos . .It Fl o Ar fs-options Set file system specific options. .Ar fs-options @@ -225,6 +227,21 @@ Defaults to 512. .It Fl s Ar image-size Set the size of the file system image to .Ar image-size . +This is equivalent to setting both the minimum +.Fl ( M ) +and the maximum +.Fl ( m ) +sizes to the same value. +For +.Sy ffs +and +.Sy msdos +the +.Ar image-size +does not include the +.Ar offset . +.Ar offset +is not included in that size. .It Fl T Ar timestamp Specify a timestamp to be set for all filesystem files and directories created so that repeatable builds are possible. @@ -247,6 +264,8 @@ The following file system types are supported: BSD fast file system (default). .It Sy cd9660 ISO 9660 file system. +.It Sy msdos +FAT12, FAT16, or FAT32 file system. .El .It Fl x Exclude file system nodes not explicitly listed in the specfile. @@ -410,6 +429,67 @@ Turns on verbose output. .It Sy volumeid Volume set identifier of the image. .El +.Ss msdos-specific options +.Sy msdos +images have MS-DOS-specific optional parameters that may be +provided. +The arguments consist of a keyword, an equal sign +.Pq Ql = , +and a value. +The following keywords are supported (see +.Xr newfs_msdos 8 +for more details): +.Pp +.Bl -tag -width omit-trailing-period -offset indent -compact +.It Cm backup_sector +Location of the backup boot sector. +.It Cm block_size +Block size. +.It Cm bootstrap +Bootstrap file. +.It Cm bytes_per_sector +Bytes per sector. +.It Cm create_size +Create file size. +.It Cm directory_entries +Directory entries. +.It Cm drive_heads +Drive heads. +.It Cm fat_type +FAT type (12, 16, or 32). +.It Cm floppy +Preset drive parameters for standard format floppy disks +(160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880). +.It Cm hidden_sectors +Hidden sectors. +.It Cm info_sector +Location of the info sector. +.It Cm media_descriptor +Media descriptor. +.It Cm num_FAT +Number of FATs. +.It Cm OEM_string +OEM string. +.It Cm offset +Offset in device. +This option will be ignored if +.Fl O +is set to a positive number. +.It Cm reserved_sectors +Reserved sectors. +.It Cm sectors_per_cluster +Sectors per cluster. +.It Cm sectors_per_fat +Sectors per FAT. +.It Cm sectors_per_track +Sectors per track. +.It Cm size +File System size. +.It Cm volume_id +Volume ID. +.It Cm volume_label +Volume Label. +.El .Sh SEE ALSO .Xr mtree 5 , .Xr mtree 8 , @@ -419,6 +499,10 @@ The .Nm utility appeared in .Nx 1.6 . +It was ported to +.Fx +and first appeared in +.Fx 8.0 . .Sh AUTHORS .An Luke Mewburn .Aq Mt lukem@NetBSD.org @@ -428,4 +512,6 @@ utility appeared in .An Ryan Gabrys , .An Alan Perez-Rathke , .An Ram Vedam -(cd9660 support) +(cd9660 support), +.An Christos Zoulas +(msdos support). Modified: stable/12/usr.sbin/makefs/makefs.c ============================================================================== --- stable/12/usr.sbin/makefs/makefs.c Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/makefs.c Mon Sep 9 17:32:40 2019 (r352079) @@ -74,8 +74,9 @@ static fstype_t fstypes[] = { # name, name ## _prep_opts, name ## _parse_opts, \ name ## _cleanup_opts, name ## _makefs \ } - ENTRY(ffs), ENTRY(cd9660), + ENTRY(ffs), + ENTRY(msdos), { .type = NULL }, }; Modified: stable/12/usr.sbin/makefs/makefs.h ============================================================================== --- stable/12/usr.sbin/makefs/makefs.h Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/makefs.h Mon Sep 9 17:32:40 2019 (r352079) @@ -183,8 +183,9 @@ int fs ## _parse_opts(const char *, fsinfo_t *); \ void fs ## _cleanup_opts(fsinfo_t *); \ void fs ## _makefs(const char *, const char *, fsnode *, fsinfo_t *) -DECLARE_FUN(ffs); DECLARE_FUN(cd9660); +DECLARE_FUN(ffs); +DECLARE_FUN(msdos); extern u_int debug; extern int dupsok; @@ -225,6 +226,7 @@ extern struct stat stampst; #define DEBUG_APPLY_SPECFILE 0x04000000 #define DEBUG_APPLY_SPECENTRY 0x08000000 #define DEBUG_APPLY_SPECONLY 0x10000000 +#define DEBUG_MSDOSFS 0x20000000 #define TIMER_START(x) \ Modified: stable/12/usr.sbin/makefs/msdos.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos.c Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/msdos.c Mon Sep 9 17:32:40 2019 (r352079) @@ -50,24 +50,28 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include -#include -#include -#include #include "makefs.h" #include "msdos.h" -#include "mkfs_msdos.h" +#include +#include + +#include "ffs/buf.h" + +#include "msdos/msdosfsmount.h" +#include "msdos/direntry.h" +#include "msdos/denode.h" + static int msdos_populate_dir(const char *, struct denode *, fsnode *, fsnode *, fsinfo_t *); struct msdos_options_ex { struct msdos_options options; - bool utf8; }; void @@ -85,15 +89,13 @@ msdos_prep_opts(fsinfo_t *fsopts) (sizeof(_type) == 4 ? OPT_INT32 : OPT_INT64)))), \ .value = &msdos_opt->options._name, \ .minimum = _min, \ - .maximum = sizeof(_type) == 1 ? 0xff : \ - (sizeof(_type) == 2 ? 0xffff : \ - (sizeof(_type) == 4 ? 0xffffffff : 0xffffffffffffffffLL)), \ - .desc = _desc, \ + .maximum = sizeof(_type) == 1 ? UINT8_MAX : \ + (sizeof(_type) == 2 ? UINT16_MAX : \ + (sizeof(_type) == 4 ? UINT32_MAX : INT64_MAX)), \ + .desc = _desc, \ }, ALLOPTS #undef AOPT - { 'U', "utf8", &msdos_opt->utf8, OPT_BOOL, - 0, 1, "Use UTF8 names" }, { .name = NULL } }; @@ -113,7 +115,6 @@ msdos_parse_opts(const char *option, fsinfo_t *fsopts) { struct msdos_options *msdos_opt = fsopts->fs_specific; option_t *msdos_options = fsopts->fs_options; - int rv; assert(option != NULL); @@ -148,7 +149,7 @@ msdos_makefs(const char *image, const char *dir, fsnod { struct msdos_options_ex *msdos_opt = fsopts->fs_specific; struct vnode vp, rootvp; - struct timeval start; + struct timeval start; struct msdosfsmount *pmp; uint32_t flags; @@ -160,7 +161,8 @@ msdos_makefs(const char *image, const char *dir, fsnod fsopts->size = fsopts->maxsize; msdos_opt->options.create_size = MAX(msdos_opt->options.create_size, fsopts->offset + fsopts->size); - msdos_opt->options.offset = fsopts->offset; + if (fsopts->offset > 0) + msdos_opt->options.offset = fsopts->offset; if (msdos_opt->options.bytes_per_sector == 0) { if (fsopts->sectorsize == -1) fsopts->sectorsize = 512; @@ -173,7 +175,7 @@ msdos_makefs(const char *image, const char *dir, fsnod fsopts->sectorsize, msdos_opt->options.bytes_per_sector); } - /* create image */ + /* create image */ printf("Creating `%s'\n", image); TIMER_START(start); if (mkfs_msdos(image, NULL, &msdos_opt->options) == -1) @@ -184,10 +186,7 @@ msdos_makefs(const char *image, const char *dir, fsnod vp.fs = fsopts; flags = 0; - if (msdos_opt->utf8) - flags |= MSDOSFSMNT_UTF8; - - if ((pmp = msdosfs_mount(&vp, flags)) == NULL) + if ((pmp = msdosfs_mount(&vp)) == NULL) err(1, "msdosfs_mount"); if (msdosfs_root(pmp, &rootvp) != 0) @@ -197,17 +196,19 @@ msdos_makefs(const char *image, const char *dir, fsnod printf("msdos_makefs: image %s directory %s root %p\n", image, dir, root); - /* populate image */ + /* populate image */ printf("Populating `%s'\n", image); TIMER_START(start); if (msdos_populate_dir(dir, VTODE(&rootvp), root, root, fsopts) == -1) errx(1, "Image file `%s' not created.", image); TIMER_RESULTS(start, "msdos_populate_dir"); + if (msdosfs_fsiflush(pmp) != 0) + errx(1, "Unable to update FSInfo block."); if (debug & DEBUG_FS_MAKEFS) putchar('\n'); - /* ensure no outstanding buffers remain */ + /* ensure no outstanding buffers remain */ if (debug & DEBUG_FS_MAKEFS) bcleanup(); Modified: stable/12/usr.sbin/makefs/msdos.h ============================================================================== --- stable/12/usr.sbin/makefs/msdos.h Mon Sep 9 17:24:24 2019 (r352078) +++ stable/12/usr.sbin/makefs/msdos.h Mon Sep 9 17:32:40 2019 (r352079) @@ -30,11 +30,32 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _MAKEFS_MSDOS_H +#define _MAKEFS_MSDOS_H + +#define NOCRED NULL + +#define MSDOSFS_DPRINTF(args) do { \ + if (debug & DEBUG_MSDOSFS) \ + printf args; \ +} while (0); + + struct vnode; struct denode; +struct fsnode; +struct msdosfsmount; -struct msdosfsmount *msdosfs_mount(struct vnode *, int); +struct componentname { + char *cn_nameptr; + size_t cn_namelen; +}; + +int msdosfs_fsiflush(struct msdosfsmount *); +struct msdosfsmount *msdosfs_mount(struct vnode *); int msdosfs_root(struct msdosfsmount *, struct vnode *); struct denode *msdosfs_mkfile(const char *, struct denode *, fsnode *); struct denode *msdosfs_mkdire(const char *, struct denode *, fsnode *); + +#endif Copied: stable/12/usr.sbin/makefs/msdos/Makefile.inc (from r351273, head/usr.sbin/makefs/msdos/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/makefs/msdos/Makefile.inc Mon Sep 9 17:32:40 2019 (r352079, copy of r351273, head/usr.sbin/makefs/msdos/Makefile.inc) @@ -0,0 +1,13 @@ +# $FreeBSD$ +# + +MSDOS= ${SRCTOP}/sys/fs/msdosfs +MSDOS_NEWFS= ${SRCTOP}/sbin/newfs_msdos + +.PATH: ${SRCDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} + +CFLAGS+= -I${MSDOS} -I${MSDOS_NEWFS} + +SRCS+= mkfs_msdos.c +SRCS+= msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c +SRCS+= msdosfs_vnops.c msdosfs_vfsops.c Copied: stable/12/usr.sbin/makefs/msdos/denode.h (from r351273, head/usr.sbin/makefs/msdos/denode.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/makefs/msdos/denode.h Mon Sep 9 17:32:40 2019 (r352079, copy of r351273, head/usr.sbin/makefs/msdos/denode.h) @@ -0,0 +1,237 @@ +/* $FreeBSD$ */ +/* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */ + +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. + * Copyright (C) 1994, 1995, 1997 TooLs GmbH. + * All rights reserved. + * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*- + * Written by Paul Popelka (paulp@uts.amdahl.com) + * + * You can do anything you want with this software, just don't say you wrote + * it, and don't remove this notice. + * + * This software is provided "as is". + * + * The author supplies this software to be publicly redistributed on the + * understanding that the author is not responsible for the correct + * functioning of this software in any circumstances and is not liable for + * any damages caused by this software. + * + * October 1992 + */ +#ifndef _FS_MSDOSFS_DENODE_H_ +#define _FS_MSDOSFS_DENODE_H_ + +/* + * This is the pc filesystem specific portion of the vnode structure. + * + * To describe a file uniquely the de_dirclust, de_diroffset, and + * de_StartCluster fields are used. + * + * de_dirclust contains the cluster number of the directory cluster + * containing the entry for a file or directory. + * de_diroffset is the index into the cluster for the entry describing + * a file or directory. + * de_StartCluster is the number of the first cluster of the file or directory. + * + * Now to describe the quirks of the pc filesystem. + * - Clusters 0 and 1 are reserved. + * - The first allocatable cluster is 2. + * - The root directory is of fixed size and all blocks that make it up + * are contiguous. + * - Cluster 0 refers to the root directory when it is found in the + * startcluster field of a directory entry that points to another directory. + * - Cluster 0 implies a 0 length file when found in the start cluster field + * of a directory entry that points to a file. + * - You can't use the cluster number 0 to derive the address of the root + * directory. + * - Multiple directory entries can point to a directory. The entry in the + * parent directory points to a child directory. Any directories in the + * child directory contain a ".." entry that points back to the parent. + * The child directory itself contains a "." entry that points to itself. + * - The root directory does not contain a "." or ".." entry. + * - Directory entries for directories are never changed once they are created + * (except when removed). The size stays 0, and the last modification time + * is never changed. This is because so many directory entries can point to + * the physical clusters that make up a directory. It would lead to an + * update nightmare. + * - The length field in a directory entry pointing to a directory contains 0 + * (always). The only way to find the end of a directory is to follow the + * cluster chain until the "last cluster" marker is found. + * + * My extensions to make this house of cards work. These apply only to the in + * memory copy of the directory entry. + * - A reference count for each denode will be kept since dos doesn't keep such + * things. + */ + +/* + * Internal pseudo-offset for (nonexistent) directory entry for the root + * dir in the root dir + */ +#define MSDOSFSROOT_OFS 0x1fffffff + +/* + * The FAT cache structure. fc_fsrcn is the filesystem relative cluster + * number that corresponds to the file relative cluster number in this + * structure (fc_frcn). + */ +struct fatcache { + u_long fc_frcn; /* file relative cluster number */ + u_long fc_fsrcn; /* filesystem relative cluster number */ +}; + +/* + * The FAT entry cache as it stands helps make extending files a "quick" + * operation by avoiding having to scan the FAT to discover the last + * cluster of the file. The cache also helps sequential reads by + * remembering the last cluster read from the file. This also prevents us + * from having to rescan the FAT to find the next cluster to read. This + * cache is probably pretty worthless if a file is opened by multiple + * processes. + */ +#define FC_SIZE 3 /* number of entries in the cache */ +#define FC_LASTMAP 0 /* entry the last call to pcbmap() resolved + * to */ +#define FC_LASTFC 1 /* entry for the last cluster in the file */ +#define FC_NEXTTOLASTFC 2 /* entry for a close to the last cluster in + * the file */ + +#define FCE_EMPTY 0xffffffff /* doesn't represent an actual cluster # */ + +/* + * Set a slot in the FAT cache. + */ +#define fc_setcache(dep, slot, frcn, fsrcn) \ + (dep)->de_fc[(slot)].fc_frcn = (frcn); \ + (dep)->de_fc[(slot)].fc_fsrcn = (fsrcn); + +/* + * This is the in memory variant of a dos directory entry. It is usually + * contained within a vnode. + */ +struct denode { + struct vnode *de_vnode; /* addr of vnode we are part of */ + u_long de_flag; /* flag bits */ + u_long de_dirclust; /* cluster of the directory file containing this entry */ + u_long de_diroffset; /* offset of this entry in the directory cluster */ + u_long de_fndoffset; /* offset of found dir entry */ + int de_fndcnt; /* number of slots before de_fndoffset */ + long de_refcnt; /* reference count */ + struct msdosfsmount *de_pmp; /* addr of our mount struct */ + u_char de_Name[12]; /* name, from DOS directory entry */ + u_char de_Attributes; /* attributes, from directory entry */ + u_char de_LowerCase; /* NT VFAT lower case flags */ + u_char de_CHun; /* Hundredth of second of CTime*/ + u_short de_CTime; /* creation time */ + u_short de_CDate; /* creation date */ + u_short de_ADate; /* access date */ + u_short de_MTime; /* modification time */ + u_short de_MDate; /* modification date */ + u_long de_StartCluster; /* starting cluster of file */ + u_long de_FileSize; /* size of file in bytes */ + struct fatcache de_fc[FC_SIZE]; /* FAT cache */ + uint64_t de_inode; /* Inode number (really byte offset of direntry) */ +}; + +/* + * Values for the de_flag field of the denode. + */ +#define DE_UPDATE 0x0004 /* Modification time update request */ +#define DE_CREATE 0x0008 /* Creation time update */ +#define DE_ACCESS 0x0010 /* Access time update */ +#define DE_MODIFIED 0x0020 /* Denode has been modified */ +#define DE_RENAME 0x0040 /* Denode is in the process of being renamed */ + +/* Maximum size of a file on a FAT filesystem */ +#define MSDOSFS_FILESIZE_MAX 0xFFFFFFFFLL + +/* + * Transfer directory entries between internal and external form. + * dep is a struct denode * (internal form), + * dp is a struct direntry * (external form). + */ +#define DE_INTERNALIZE32(dep, dp) \ + ((dep)->de_StartCluster |= getushort((dp)->deHighClust) << 16) +#define DE_INTERNALIZE(dep, dp) \ + (memcpy((dep)->de_Name, (dp)->deName, 11), \ + (dep)->de_Attributes = (dp)->deAttributes, \ + (dep)->de_LowerCase = (dp)->deLowerCase, \ + (dep)->de_CHun = (dp)->deCHundredth, \ + (dep)->de_CTime = getushort((dp)->deCTime), \ + (dep)->de_CDate = getushort((dp)->deCDate), \ + (dep)->de_ADate = getushort((dp)->deADate), \ + (dep)->de_MTime = getushort((dp)->deMTime), \ + (dep)->de_MDate = getushort((dp)->deMDate), \ + (dep)->de_StartCluster = getushort((dp)->deStartCluster), \ + (dep)->de_FileSize = getulong((dp)->deFileSize), \ + (FAT32((dep)->de_pmp) ? DE_INTERNALIZE32((dep), (dp)) : 0)) + +#define DE_EXTERNALIZE(dp, dep) \ + (memcpy((dp)->deName, (dep)->de_Name, 11), \ + (dp)->deAttributes = (dep)->de_Attributes, \ + (dp)->deLowerCase = (dep)->de_LowerCase, \ + (dp)->deCHundredth = (dep)->de_CHun, \ + putushort((dp)->deCTime, (dep)->de_CTime), \ + putushort((dp)->deCDate, (dep)->de_CDate), \ + putushort((dp)->deADate, (dep)->de_ADate), \ + putushort((dp)->deMTime, (dep)->de_MTime), \ + putushort((dp)->deMDate, (dep)->de_MDate), \ + putushort((dp)->deStartCluster, (dep)->de_StartCluster), \ + putulong((dp)->deFileSize, \ + ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ + putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) + +#define VTODE(vp) ((struct denode *)(vp)->v_data) +#define DETOV(de) ((de)->de_vnode) + +struct buf; +struct msdosfsmount; +struct direntry; +struct componentname; +struct denode; + +/* + * Internal service routine prototypes. + */ +int deget(struct msdosfsmount *, u_long, u_long, struct denode **); +int uniqdosname(struct denode *, struct componentname *, u_char *); + +int readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs, struct buf **bpp, struct direntry **epp); +int readde(struct denode *dep, struct buf **bpp, struct direntry **epp); +int deextend(struct denode *dep, u_long length); +int fillinusemap(struct msdosfsmount *pmp); +int createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct componentname *cnp); +int removede(struct denode *pdep, struct denode *dep); +int detrunc(struct denode *dep, u_long length, int flags); +#endif /* !_FS_MSDOSFS_DENODE_H_ */ Copied: stable/12/usr.sbin/makefs/msdos/direntry.h (from r351273, head/usr.sbin/makefs/msdos/direntry.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/makefs/msdos/direntry.h Mon Sep 9 17:32:40 2019 (r352079, copy of r351273, head/usr.sbin/makefs/msdos/direntry.h) @@ -0,0 +1,146 @@ +/* $FreeBSD$ */ +/* $NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $ */ + +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. + * Copyright (C) 1994, 1995, 1997 TooLs GmbH. + * All rights reserved. + * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*- + * Written by Paul Popelka (paulp@uts.amdahl.com) + * + * You can do anything you want with this software, just don't say you wrote + * it, and don't remove this notice. + * + * This software is provided "as is". + * + * The author supplies this software to be publicly redistributed on the + * understanding that the author is not responsible for the correct + * functioning of this software in any circumstances and is not liable for + * any damages caused by this software. + * + * October 1992 + */ +#ifndef _FS_MSDOSFS_DIRENTRY_H_ +#define _FS_MSDOSFS_DIRENTRY_H_ + +/* + * Structure of a dos directory entry. + */ +struct direntry { + uint8_t deName[11]; /* filename, blank filled */ +#define SLOT_EMPTY 0x00 /* slot has never been used */ +#define SLOT_E5 0x05 /* the real value is 0xe5 */ +#define SLOT_DELETED 0xe5 /* file in this slot deleted */ + uint8_t deAttributes; /* file attributes */ +#define ATTR_NORMAL 0x00 /* normal file */ +#define ATTR_READONLY 0x01 /* file is readonly */ +#define ATTR_HIDDEN 0x02 /* file is hidden */ +#define ATTR_SYSTEM 0x04 /* file is a system file */ +#define ATTR_VOLUME 0x08 /* entry is a volume label */ +#define ATTR_DIRECTORY 0x10 /* entry is a directory name */ +#define ATTR_ARCHIVE 0x20 /* file is new or modified */ + uint8_t deLowerCase; /* NT VFAT lower case flags */ +#define LCASE_BASE 0x08 /* filename base in lower case */ +#define LCASE_EXT 0x10 /* filename extension in lower case */ + uint8_t deCHundredth; /* hundredth of seconds in CTime */ + uint8_t deCTime[2]; /* create time */ + uint8_t deCDate[2]; /* create date */ + uint8_t deADate[2]; /* access date */ + uint8_t deHighClust[2]; /* high bytes of cluster number */ + uint8_t deMTime[2]; /* last update time */ + uint8_t deMDate[2]; /* last update date */ + uint8_t deStartCluster[2]; /* starting cluster of file */ + uint8_t deFileSize[4]; /* size of file in bytes */ +}; + +/* + * Structure of a Win95 long name directory entry + */ +struct winentry { + uint8_t weCnt; +#define WIN_LAST 0x40 +#define WIN_CNT 0x3f + uint8_t wePart1[10]; + uint8_t weAttributes; +#define ATTR_WIN95 0x0f + uint8_t weReserved1; + uint8_t weChksum; + uint8_t wePart2[12]; + uint16_t weReserved2; + uint8_t wePart3[4]; +}; +#define WIN_CHARS 13 /* Number of chars per winentry */ + +/* + * Maximum number of winentries for a filename. + */ +#define WIN_MAXSUBENTRIES 20 + +/* + * Maximum filename length in Win95 + * Note: Must be < sizeof(dirent.d_name) + */ +#define WIN_MAXLEN 255 + +/* + * This is the format of the contents of the deTime field in the direntry + * structure. + * We don't use bitfields because we don't know how compilers for + * arbitrary machines will lay them out. + */ +#define DT_2SECONDS_MASK 0x1F /* seconds divided by 2 */ +#define DT_2SECONDS_SHIFT 0 +#define DT_MINUTES_MASK 0x7E0 /* minutes */ +#define DT_MINUTES_SHIFT 5 +#define DT_HOURS_MASK 0xF800 /* hours */ +#define DT_HOURS_SHIFT 11 + +/* + * This is the format of the contents of the deDate field in the direntry + * structure. + */ +#define DD_DAY_MASK 0x1F /* day of month */ +#define DD_DAY_SHIFT 0 +#define DD_MONTH_MASK 0x1E0 /* month */ +#define DD_MONTH_SHIFT 5 +#define DD_YEAR_MASK 0xFE00 /* year - 1980 */ +#define DD_YEAR_SHIFT 9 + +uint8_t winChksum(uint8_t *name); +int winSlotCnt(const u_char *un, size_t unlen); +int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); +int winChkName(const u_char *un, size_t unlen, struct winentry *wep, + int chksum); +int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, + int chksum); + +#endif /* !_FS_MSDOSFS_DIRENTRY_H_ */ Copied: stable/12/usr.sbin/makefs/msdos/fat.h (from r351273, head/usr.sbin/makefs/msdos/fat.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/makefs/msdos/fat.h Mon Sep 9 17:32:40 2019 (r352079, copy of r351273, head/usr.sbin/makefs/msdos/fat.h) @@ -0,0 +1,110 @@ +/* $FreeBSD$ */ +/* $NetBSD: fat.h,v 1.12 1997/11/17 15:36:36 ws Exp $ */ + +/*- + * SPDX-License-Identifier: BSD-4-Clause + * + * Copyright (C) 1994, 1997 Wolfgang Solfrank. + * Copyright (C) 1994, 1997 TooLs GmbH. + * All rights reserved. + * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*- + * Written by Paul Popelka (paulp@uts.amdahl.com) + * + * You can do anything you want with this software, just don't say you wrote + * it, and don't remove this notice. + * + * This software is provided "as is". + * + * The author supplies this software to be publicly redistributed on the + * understanding that the author is not responsible for the correct + * functioning of this software in any circumstances and is not liable for + * any damages caused by this software. + * + * October 1992 + */ + +#ifndef _FS_MSDOSFS_FAT_H_ +#define _FS_MSDOSFS_FAT_H_ +/* + * Some useful cluster numbers. + */ +#define MSDOSFSROOT 0 /* cluster 0 means the root dir */ +#define CLUST_FREE 0 /* cluster 0 also means a free cluster */ +#define MSDOSFSFREE CLUST_FREE +#define CLUST_FIRST 2 /* first legal cluster number */ +#define CLUST_RSRVD 0xfffffff6 /* reserved cluster range */ +#define CLUST_BAD 0xfffffff7 /* a cluster with a defect */ +#define CLUST_EOFS 0xfffffff8 /* start of eof cluster range */ +#define CLUST_EOFE 0xffffffff /* end of eof cluster range */ + +#define FAT12_MASK 0x00000fff /* mask for 12 bit cluster numbers */ +#define FAT16_MASK 0x0000ffff /* mask for 16 bit cluster numbers */ +#define FAT32_MASK 0x0fffffff /* mask for FAT32 cluster numbers */ + +/* + * MSDOSFS: + * Return true if filesystem uses 12 bit FATs. Microsoft Programmer's + * Reference says if the maximum cluster number in a filesystem is greater + * than 4084 ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK) then we've got a + * 16 bit FAT filesystem. While mounting, the result of this test is stored + * in pm_fatentrysize. + */ +#define FAT12(pmp) (pmp->pm_fatmask == FAT12_MASK) +#define FAT16(pmp) (pmp->pm_fatmask == FAT16_MASK) +#define FAT32(pmp) (pmp->pm_fatmask == FAT32_MASK) + +#define MSDOSFSEOF(pmp, cn) ((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) + +/* + * These are the values for the function argument to the function + * fatentry(). + */ +#define FAT_GET 0x0001 /* get a FAT entry */ +#define FAT_SET 0x0002 /* set a FAT entry */ +#define FAT_GET_AND_SET (FAT_GET | FAT_SET) + +/* + * Flags to extendfile: + */ +#define DE_CLEAR 1 /* Zero out the blocks allocated */ + +struct buf; +struct denode; +struct msdosfsmount; + +int pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp); +int clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp); +int clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got); +int fatentry(int function, struct msdosfsmount *pmp, u_long cluster, u_long *oldcontents, u_long newcontents); +int freeclusterchain(struct msdosfsmount *pmp, u_long startchain); +int extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags); +void fc_purge(struct denode *dep, u_int frcn); + +#endif /* !_FS_MSDOSFS_FAT_H_ */ Copied: stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c (from r351273, head/usr.sbin/makefs/msdos/msdosfs_conv.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c Mon Sep 9 17:32:40 2019 (r352079, copy of r351273, head/usr.sbin/makefs/msdos/msdosfs_conv.c) @@ -0,0 +1,508 @@ +/*- + * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. + * Copyright (C) 1994, 1995, 1997 TooLs GmbH. + * All rights reserved. + * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by TooLs GmbH. + * 4. The name of TooLs GmbH may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Written by Paul Popelka (paulp@uts.amdahl.com) + * + * You can do anything you want with this software, just don't say you wrote + * it, and don't remove this notice. + * + * This software is provided "as is". + * + * The author supplies this software to be publicly redistributed on the + * understanding that the author is not responsible for the correct + * functioning of this software in any circumstances and is not liable for + * any damages caused by this software. + * + * October 1992 + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include + +#include + +#include "makefs.h" +#include "msdos.h" + +#include "msdos/denode.h" +#include "msdos/direntry.h" +#include "msdos/fat.h" +#include "msdos/msdosfsmount.h" + +static int char8ucs2str(const uint8_t *in, int n, uint16_t *out, int m); +static void ucs2pad(uint16_t *buf, int len, int size); +static int char8match(uint16_t *w1, uint16_t *w2, int n); + +static const u_char unix2dos[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, /* 00-07 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 08-0f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 10-17 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 18-1f */ + 0, '!', 0, '#', '$', '%', '&', '\'', /* 20-27 */ + '(', ')', 0, '+', 0, '-', 0, 0, /* 28-2f */ + '0', '1', '2', '3', '4', '5', '6', '7', /* 30-37 */ + '8', '9', 0, 0, 0, 0, 0, 0, /* 38-3f */ + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 40-47 */ + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 48-4f */ + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 50-57 */ + 'X', 'Y', 'Z', 0, 0, 0, '^', '_', /* 58-5f */ + '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', /* 60-67 */ + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 68-6f */ + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', /* 70-77 */ + 'X', 'Y', 'Z', '{', 0, '}', '~', 0, /* 78-7f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 80-87 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 88-8f */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 90-97 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 98-9f */ + 0, 0xad, 0xbd, 0x9c, 0xcf, 0xbe, 0xdd, 0xf5, /* a0-a7 */ + 0xf9, 0xb8, 0xa6, 0xae, 0xaa, 0xf0, 0xa9, 0xee, /* a8-af */ + 0xf8, 0xf1, 0xfd, 0xfc, 0xef, 0xe6, 0xf4, 0xfa, /* b0-b7 */ + 0xf7, 0xfb, 0xa7, 0xaf, 0xac, 0xab, 0xf3, 0xa8, /* b8-bf */ + 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* c0-c7 */ + 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* c8-cf */ + 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0x9e, /* d0-d7 */ + 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0xe1, /* d8-df */ + 0xb7, 0xb5, 0xb6, 0xc7, 0x8e, 0x8f, 0x92, 0x80, /* e0-e7 */ + 0xd4, 0x90, 0xd2, 0xd3, 0xde, 0xd6, 0xd7, 0xd8, /* e8-ef */ + 0xd1, 0xa5, 0xe3, 0xe0, 0xe2, 0xe5, 0x99, 0xf6, /* f0-f7 */ + 0x9d, 0xeb, 0xe9, 0xea, 0x9a, 0xed, 0xe8, 0x98, /* f8-ff */ +}; + +static const u_char u2l[256] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 00-07 */ + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 08-0f */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Mon Sep 9 17:33: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 6132DD94AB; Mon, 9 Sep 2019 17:33:32 +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 46RwHc1tpdz4HF6; Mon, 9 Sep 2019 17:33:32 +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 2425F191EA; Mon, 9 Sep 2019 17:33:32 +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 x89HXWvt083411; Mon, 9 Sep 2019 17:33:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HXW7F083410; Mon, 9 Sep 2019 17:33:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091733.x89HXW7F083410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:33: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: r352080 - stable/12/usr.sbin/makefs/msdos X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/makefs/msdos X-SVN-Commit-Revision: 352080 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, 09 Sep 2019 17:33:32 -0000 Author: emaste Date: Mon Sep 9 17:33:31 2019 New Revision: 352080 URL: https://svnweb.freebsd.org/changeset/base/352080 Log: MFC r351347: makefs: Verify that the BPB media descriptor and FAT ID match From r322982 in sys/fs/msdosfs. Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c Mon Sep 9 17:32:40 2019 (r352079) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c Mon Sep 9 17:33:31 2019 (r352080) @@ -888,19 +888,17 @@ fillinusemap(struct msdosfsmount *pmp) * zero. These represent free clusters. */ pmp->pm_freeclustercount = 0; - for (cn = CLUST_FIRST; cn <= pmp->pm_maxcluster; cn++) { + for (cn = 0; cn <= pmp->pm_maxcluster; cn++) { byteoffset = FATOFS(pmp, cn); bo = byteoffset % pmp->pm_fatblocksize; - if (bo == 0 || bp == NULL) { + if (bo == 0) { /* Read new FAT block */ if (bp != NULL) brelse(bp); fatblock(pmp, byteoffset, &bn, &bsize, NULL); error = bread(pmp->pm_devvp, bn, bsize, NOCRED, &bp); - if (error != 0) { - brelse(bp); + if (error != 0) return (error); - } } if (FAT32(pmp)) readcn = getulong(bp->b_data + bo); @@ -910,7 +908,19 @@ fillinusemap(struct msdosfsmount *pmp) readcn >>= 4; readcn &= pmp->pm_fatmask; - if (readcn == CLUST_FREE) + /* + * Check if the FAT ID matches the BPB's media descriptor and + * all other bits are set to 1. + */ + if (cn == 0 && readcn != ((pmp->pm_fatmask & 0xffffff00) | + pmp->pm_bpb.bpbMedia)) { +#ifdef MSDOSFS_DEBUG + printf("mountmsdosfs(): Media descriptor in BPB" + "does not match FAT ID\n"); +#endif + brelse(bp); + return (EINVAL); + } else if (readcn == CLUST_FREE) usemap_free(pmp, cn); } if (bp != NULL) From owner-svn-src-stable@freebsd.org Mon Sep 9 17:34: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 07451D9533; Mon, 9 Sep 2019 17:34: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 46RwJX6QH4z4HMY; Mon, 9 Sep 2019 17:34: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 C058F191EB; Mon, 9 Sep 2019 17:34: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 x89HYKn7083508; Mon, 9 Sep 2019 17:34:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HYJl0083500; Mon, 9 Sep 2019 17:34:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091734.x89HYJl0083500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:34: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: r352081 - stable/12/usr.sbin/makefs/msdos X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/makefs/msdos X-SVN-Commit-Revision: 352081 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, 09 Sep 2019 17:34:21 -0000 Author: emaste Date: Mon Sep 9 17:34:18 2019 New Revision: 352081 URL: https://svnweb.freebsd.org/changeset/base/352081 Log: MFC r351396: makefs: diff reduction to sys/fs/msdosfs No functional change. Modified: stable/12/usr.sbin/makefs/msdos/direntry.h stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c stable/12/usr.sbin/makefs/msdos/msdosfs_denode.c stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c stable/12/usr.sbin/makefs/msdos/msdosfs_lookup.c stable/12/usr.sbin/makefs/msdos/msdosfs_vfsops.c stable/12/usr.sbin/makefs/msdos/msdosfs_vnops.c stable/12/usr.sbin/makefs/msdos/msdosfsmount.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/msdos/direntry.h ============================================================================== --- stable/12/usr.sbin/makefs/msdos/direntry.h Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/direntry.h Mon Sep 9 17:34:18 2019 (r352081) @@ -135,12 +135,12 @@ struct winentry { #define DD_YEAR_MASK 0xFE00 /* year - 1980 */ #define DD_YEAR_SHIFT 9 -uint8_t winChksum(uint8_t *name); -int winSlotCnt(const u_char *un, size_t unlen); -int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); -int winChkName(const u_char *un, size_t unlen, struct winentry *wep, - int chksum); -int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, - int chksum); +int unix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen); +int unix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt, + int chksum); +int winChkName(const u_char *un, size_t unlen, struct winentry *wep, + int chksum); +uint8_t winChksum(uint8_t *name); +int winSlotCnt(const u_char *un, size_t unlen); #endif /* !_FS_MSDOSFS_DIRENTRY_H_ */ Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_conv.c Mon Sep 9 17:34:18 2019 (r352081) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -29,7 +31,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_denode.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_denode.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_denode.c Mon Sep 9 17:34:18 2019 (r352081) @@ -1,6 +1,8 @@ /* $NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -31,7 +33,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote @@ -261,7 +263,7 @@ detrunc(struct denode *dep, u_long length, int flags) if (error) { MSDOSFS_DPRINTF(("detrunc(): pcbmap fails %d\n", error)); - return error; + return (error); } } @@ -282,10 +284,9 @@ detrunc(struct denode *dep, u_long length, int flags) MSDOSFS_DPRINTF(("detrunc(): bread fails %d\n", error)); - return error; + return (error); } - memset((char *)bp->b_data + boff, 0, - pmp->pm_bpcluster - boff); + memset(bp->b_data + boff, 0, pmp->pm_bpcluster - boff); if (flags & IO_SYNC) bwrite(bp); else @@ -326,7 +327,7 @@ detrunc(struct denode *dep, u_long length, int flags) if (chaintofree != 0 && !MSDOSFSEOF(pmp, chaintofree)) freeclusterchain(pmp, chaintofree); - return allerror; + return (allerror); } /* @@ -343,16 +344,16 @@ deextend(struct denode *dep, u_long length) * The root of a DOS filesystem cannot be extended. */ if (dep->de_vnode != NULL && !FAT32(pmp)) - return EINVAL; + return (EINVAL); /* * Directories cannot be extended. */ if (dep->de_Attributes & ATTR_DIRECTORY) - return EISDIR; + return (EISDIR); if (length <= dep->de_FileSize) - return E2BIG; + return (E2BIG); /* * Compute the number of clusters to allocate. Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_fat.c Mon Sep 9 17:34:18 2019 (r352081) @@ -871,9 +871,11 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus int fillinusemap(struct msdosfsmount *pmp) { - struct buf *bp = NULL; + struct buf *bp; u_long bn, bo, bsize, byteoffset, cn, readcn; int error; + + bp = NULL; /* * Mark all clusters in use, we mark the free ones in the FAT scan Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_lookup.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_lookup.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_lookup.c Mon Sep 9 17:34:18 2019 (r352081) @@ -278,7 +278,7 @@ uniqdosname(struct denode *dep, struct componentname * return error; } for (dentp = (struct direntry *)bp->b_data; - (char *)dentp < (char *)bp->b_data + blsize; + (char *)dentp < bp->b_data + blsize; dentp++) { if (dentp->deName[0] == SLOT_EMPTY) { /* Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_vfsops.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_vfsops.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_vfsops.c Mon Sep 9 17:34:18 2019 (r352081) @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -29,7 +31,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote Modified: stable/12/usr.sbin/makefs/msdos/msdosfs_vnops.c ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfs_vnops.c Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfs_vnops.c Mon Sep 9 17:34:18 2019 (r352081) @@ -1,6 +1,8 @@ /* $NetBSD: msdosfs_vnops.c,v 1.19 2017/04/13 17:10:12 christos Exp $ */ /*- + * SPDX-License-Identifier: BSD-4-Clause + * * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. * Copyright (C) 1994, 1995, 1997 TooLs GmbH. * All rights reserved. @@ -31,7 +33,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Written by Paul Popelka (paulp@uts.amdahl.com) * * You can do anything you want with this software, just don't say you wrote @@ -219,7 +221,7 @@ msdosfs_findslot(struct denode *dp, struct componentna for (blkoff = 0; blkoff < blsize; blkoff += sizeof(struct direntry), diroff += sizeof(struct direntry)) { - dep = (struct direntry *)((char *)bp->b_data + blkoff); + dep = (struct direntry *)(bp->b_data + blkoff); /* * If the slot is empty and we are still looking * for an empty then remember this one. If the @@ -495,7 +497,7 @@ msdosfs_wfile(const char *path, struct denode *dep, fs goto out; } cpsize = MIN((nsize - offs), blsize - on); - memcpy((char *)bp->b_data + on, dat + offs, cpsize); + memcpy(bp->b_data + on, dat + offs, cpsize); bwrite(bp); offs += cpsize; } Modified: stable/12/usr.sbin/makefs/msdos/msdosfsmount.h ============================================================================== --- stable/12/usr.sbin/makefs/msdos/msdosfsmount.h Mon Sep 9 17:33:31 2019 (r352080) +++ stable/12/usr.sbin/makefs/msdos/msdosfsmount.h Mon Sep 9 17:34:18 2019 (r352081) @@ -51,7 +51,7 @@ */ #ifndef _MSDOSFS_MSDOSFSMOUNT_H_ -#define _MSDOSFS_MSDOSFSMOUNT_H_ +#define _MSDOSFS_MSDOSFSMOUNT_H_ #include From owner-svn-src-stable@freebsd.org Mon Sep 9 17:37: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 5570DD97B0; Mon, 9 Sep 2019 17:37:53 +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 46RwNd1Vl3z4HkK; Mon, 9 Sep 2019 17:37:53 +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 17E31191EE; Mon, 9 Sep 2019 17:37:53 +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 x89Hbq6s083788; Mon, 9 Sep 2019 17:37:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89Hbqq5083786; Mon, 9 Sep 2019 17:37:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091737.x89Hbqq5083786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:37:52 +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: r352083 - in stable: 11/lib/libc/mips 11/sys/mips/include 12/lib/libc/mips 12/sys/mips/include X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libc/mips 11/sys/mips/include 12/lib/libc/mips 12/sys/mips/include X-SVN-Commit-Revision: 352083 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, 09 Sep 2019 17:37:53 -0000 Author: kevans Date: Mon Sep 9 17:37:52 2019 New Revision: 352083 URL: https://svnweb.freebsd.org/changeset/base/352083 Log: MFC r351681: mips: fix some mcount nits The symbol version for _mcount was removed 12 years ago in r169525 from gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked in this, so _mcount has no symver. Add it back to where it should have been, rather than where it would go if it were added today, since we're correcting a historical mistake. Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90 world as it's not getting explicitly thrown into .text, so do this now. This fixes the libc build that was previously failing due to relocations in .mdebug.abi32. This is specifically due to the way clang's integrated AS works and that they emit the .mdebug.abiNN section early in the process. An LLVM bug has been submitted (and since committed) and an agreement has been made that the mips backend should switch to .text following .mdebug.abiNN for compatibility. Modified: stable/11/lib/libc/mips/Symbol.map stable/11/sys/mips/include/profile.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libc/mips/Symbol.map stable/12/sys/mips/include/profile.h Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libc/mips/Symbol.map ============================================================================== --- stable/11/lib/libc/mips/Symbol.map Mon Sep 9 17:36:29 2019 (r352082) +++ stable/11/lib/libc/mips/Symbol.map Mon Sep 9 17:37:52 2019 (r352083) @@ -11,6 +11,7 @@ FBSD_1.0 { /* PSEUDO syscalls */ _exit; + _mcount; _setjmp; _longjmp; alloca; Modified: stable/11/sys/mips/include/profile.h ============================================================================== --- stable/11/sys/mips/include/profile.h Mon Sep 9 17:36:29 2019 (r352082) +++ stable/11/sys/mips/include/profile.h Mon Sep 9 17:37:52 2019 (r352083) @@ -44,7 +44,8 @@ /*XXX This is not MIPS64 safe. */ #define MCOUNT \ - __asm(".globl _mcount;" \ + __asm(".text;" \ + ".globl _mcount;" \ ".type _mcount,@function;" \ "_mcount:;" \ ".set noreorder;" \ From owner-svn-src-stable@freebsd.org Mon Sep 9 17:37: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 E8CD1D97B4; Mon, 9 Sep 2019 17:37:53 +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 46RwNd5dhsz4HkL; Mon, 9 Sep 2019 17:37:53 +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 A494B191EF; Mon, 9 Sep 2019 17:37:53 +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 x89HbraB083795; Mon, 9 Sep 2019 17:37:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HbreC083793; Mon, 9 Sep 2019 17:37:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091737.x89HbreC083793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:37: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: r352083 - in stable: 11/lib/libc/mips 11/sys/mips/include 12/lib/libc/mips 12/sys/mips/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libc/mips 11/sys/mips/include 12/lib/libc/mips 12/sys/mips/include X-SVN-Commit-Revision: 352083 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, 09 Sep 2019 17:37:54 -0000 Author: kevans Date: Mon Sep 9 17:37:52 2019 New Revision: 352083 URL: https://svnweb.freebsd.org/changeset/base/352083 Log: MFC r351681: mips: fix some mcount nits The symbol version for _mcount was removed 12 years ago in r169525 from gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked in this, so _mcount has no symver. Add it back to where it should have been, rather than where it would go if it were added today, since we're correcting a historical mistake. Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90 world as it's not getting explicitly thrown into .text, so do this now. This fixes the libc build that was previously failing due to relocations in .mdebug.abi32. This is specifically due to the way clang's integrated AS works and that they emit the .mdebug.abiNN section early in the process. An LLVM bug has been submitted (and since committed) and an agreement has been made that the mips backend should switch to .text following .mdebug.abiNN for compatibility. Modified: stable/12/lib/libc/mips/Symbol.map stable/12/sys/mips/include/profile.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/mips/Symbol.map stable/11/sys/mips/include/profile.h Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libc/mips/Symbol.map ============================================================================== --- stable/12/lib/libc/mips/Symbol.map Mon Sep 9 17:36:29 2019 (r352082) +++ stable/12/lib/libc/mips/Symbol.map Mon Sep 9 17:37:52 2019 (r352083) @@ -11,6 +11,7 @@ FBSD_1.0 { /* PSEUDO syscalls */ _exit; + _mcount; _setjmp; _longjmp; alloca; Modified: stable/12/sys/mips/include/profile.h ============================================================================== --- stable/12/sys/mips/include/profile.h Mon Sep 9 17:36:29 2019 (r352082) +++ stable/12/sys/mips/include/profile.h Mon Sep 9 17:37:52 2019 (r352083) @@ -46,7 +46,8 @@ /*XXX This is not MIPS64 safe. */ #define MCOUNT \ - __asm(".globl _mcount;" \ + __asm(".text;" \ + ".globl _mcount;" \ ".type _mcount,@function;" \ "_mcount:;" \ ".set noreorder;" \ From owner-svn-src-stable@freebsd.org Mon Sep 9 17:43: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 7688DD9B87; Mon, 9 Sep 2019 17:43:45 +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 46RwWP2KgKz4JJc; Mon, 9 Sep 2019 17:43:45 +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 33292193BB; Mon, 9 Sep 2019 17:43:45 +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 x89HhjTF089338; Mon, 9 Sep 2019 17:43:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89Hhixv089335; Mon, 9 Sep 2019 17:43:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091743.x89Hhixv089335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:43:44 +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: r352084 - in stable/12: lib/geom/part sys/geom/part X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: lib/geom/part sys/geom/part X-SVN-Commit-Revision: 352084 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, 09 Sep 2019 17:43:45 -0000 Author: kevans Date: Mon Sep 9 17:43:44 2019 New Revision: 352084 URL: https://svnweb.freebsd.org/changeset/base/352084 Log: MFC r351797: (Optional) Allow more nesting of GEOM partitioning schemes GEOM is supposed to be topology-agnostic, but the GPT and BSD partition code has arbitrary restrictions on nesting that are annoying in cases such as running VMs on raw partitions (since the VM's partitioning scheme is not visible to the host). This patch adds sysctls to disable the restrictions except in the case of BSD label (and similar) partitions with offset 0 (where we need to avoid recursively recognizing the label). Modified: stable/12/lib/geom/part/gpart.8 stable/12/sys/geom/part/g_part.c stable/12/sys/geom/part/g_part_gpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/geom/part/gpart.8 ============================================================================== --- stable/12/lib/geom/part/gpart.8 Mon Sep 9 17:37:52 2019 (r352083) +++ stable/12/lib/geom/part/gpart.8 Mon Sep 9 17:43:44 2019 (r352084) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 17, 2018 +.Dd September 3, 2019 .Dt GPART 8 .Os .Sh NAME @@ -1198,7 +1198,13 @@ variables can be used to control the behavior of the GEOM class. The default value is shown next to each variable. .Bl -tag -width indent -.It Va kern.geom.part.auto_resize: No 1 +.It Va kern.geom.part.allow_nesting : No 0 +By default, some schemes (currently BSD, BSD64 and VTOC8) do not permit +further nested partitioning. +This variable overrides this restriction and allows arbitrary nesting (except +within partitions created at offset 0). +Some schemes have their own separate checks, for which see below. +.It Va kern.geom.part.auto_resize : No 1 This variable controls automatic resize behavior of .Nm GEOM class. @@ -1219,6 +1225,9 @@ disk metadata. If some inconsistency is detected, the partition table will be rejected with a diagnostic message: .Sy "GEOM_PART: Integrity check failed (provider, scheme)" . +.It Va kern.geom.part.gpt.allow_nesting : No 0 +By default the GPT scheme is allowed only at the outermost nesting level. +This variable allows this restriction to be removed. .It Va kern.geom.part.ldm.debug : No 0 Debug level of the Logical Disk Manager (LDM) module. This can be set to a number between 0 and 2 inclusive. Modified: stable/12/sys/geom/part/g_part.c ============================================================================== --- stable/12/sys/geom/part/g_part.c Mon Sep 9 17:37:52 2019 (r352083) +++ stable/12/sys/geom/part/g_part.c Mon Sep 9 17:43:44 2019 (r352084) @@ -143,6 +143,10 @@ static u_int auto_resize = 1; SYSCTL_UINT(_kern_geom_part, OID_AUTO, auto_resize, CTLFLAG_RWTUN, &auto_resize, 1, "Enable auto resize"); +static u_int allow_nesting = 0; +SYSCTL_UINT(_kern_geom_part, OID_AUTO, allow_nesting, + CTLFLAG_RWTUN, &allow_nesting, 0, + "Allow additional levels of nesting"); /* * The GEOM partitioning class. @@ -2264,7 +2268,13 @@ g_part_start(struct bio *bp) return; if (g_handleattr_int(bp, "GEOM::fwsectors", table->gpt_sectors)) return; - if (g_handleattr_int(bp, "PART::isleaf", table->gpt_isleaf)) + /* + * allow_nesting overrides "isleaf" to false _unless_ the + * provider offset is zero, since otherwise we would recurse. + */ + if (g_handleattr_int(bp, "PART::isleaf", + table->gpt_isleaf && + (allow_nesting == 0 || entry->gpe_offset == 0))) return; if (g_handleattr_int(bp, "PART::depth", table->gpt_depth)) return; Modified: stable/12/sys/geom/part/g_part_gpt.c ============================================================================== --- stable/12/sys/geom/part/g_part_gpt.c Mon Sep 9 17:37:52 2019 (r352083) +++ stable/12/sys/geom/part/g_part_gpt.c Mon Sep 9 17:43:44 2019 (r352084) @@ -53,6 +53,14 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_part_gpt, "GEOM partitioning class for GPT partitions support"); +SYSCTL_DECL(_kern_geom_part); +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, gpt, CTLFLAG_RW, 0, + "GEOM_PART_GPT GUID Partition Table"); + +static u_int allow_nesting = 0; +SYSCTL_UINT(_kern_geom_part_gpt, OID_AUTO, allow_nesting, + CTLFLAG_RWTUN, &allow_nesting, 0, "Allow GPT to be nested inside other schemes"); + CTASSERT(offsetof(struct gpt_hdr, padding) == 92); CTASSERT(sizeof(struct gpt_ent) == 128); @@ -651,8 +659,8 @@ g_part_gpt_create(struct g_part_table *basetable, stru struct g_part_gpt_table *table; size_t tblsz; - /* We don't nest, which means that our depth should be 0. */ - if (basetable->gpt_depth != 0) + /* Our depth should be 0 unless nesting was explicitly enabled. */ + if (!allow_nesting && basetable->gpt_depth != 0) return (ENXIO); table = (struct g_part_gpt_table *)basetable; @@ -814,8 +822,8 @@ g_part_gpt_probe(struct g_part_table *table, struct g_ u_char *buf; int error, index, pri, res; - /* We don't nest, which means that our depth should be 0. */ - if (table->gpt_depth != 0) + /* Our depth should be 0 unless nesting was explicitly enabled. */ + if (!allow_nesting && table->gpt_depth != 0) return (ENXIO); pp = cp->provider; From owner-svn-src-stable@freebsd.org Mon Sep 9 17:44:15 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 79972D9BFB; Mon, 9 Sep 2019 17:44:15 +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 46RwWz2fwjz4JQh; Mon, 9 Sep 2019 17:44:15 +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 3EDA9193BC; Mon, 9 Sep 2019 17:44:15 +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 x89HiF9o089439; Mon, 9 Sep 2019 17:44:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HiF6Z089438; Mon, 9 Sep 2019 17:44:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909091744.x89HiF6Z089438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 17:44:15 +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: r352085 - stable/12/usr.sbin/makefs X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.sbin/makefs X-SVN-Commit-Revision: 352085 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, 09 Sep 2019 17:44:15 -0000 Author: emaste Date: Mon Sep 9 17:44:14 2019 New Revision: 352085 URL: https://svnweb.freebsd.org/changeset/base/352085 Log: MFC r344555 (sobomax): makefs: Improve error handling Bail out if one of the files scheduled to go to the FS image we are making cannot be read (e.g. EPERM). Previous behaviour of issuing a warning but still proceeeding and returning success was definitely not correct: masking out error condition as well as making a slighly inconsistent FS where attempt to access the file in question ends up in EBADF. (More details in review D18584.) Modified: stable/12/usr.sbin/makefs/ffs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/makefs/ffs.c ============================================================================== --- stable/12/usr.sbin/makefs/ffs.c Mon Sep 9 17:43:44 2019 (r352084) +++ stable/12/usr.sbin/makefs/ffs.c Mon Sep 9 17:44:14 2019 (r352085) @@ -932,8 +932,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void * if (isfile) { fbuf = emalloc(ffs_opts->bsize); if ((ffd = open((char *)buf, O_RDONLY, 0444)) == -1) { - warn("Can't open `%s' for reading", (char *)buf); - goto leave_ffs_write_file; + err(EXIT_FAILURE, "Can't open `%s' for reading", (char *)buf); } } else { p = buf; @@ -987,8 +986,6 @@ ffs_write_file(union dinode *din, uint32_t ino, void * write_inode_and_leave: ffs_write_inode(&in.i_din, in.i_number, fsopts); - - leave_ffs_write_file: if (fbuf) free(fbuf); if (ffd != -1) From owner-svn-src-stable@freebsd.org Mon Sep 9 17:53:16 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 48DE6D9EFE; Mon, 9 Sep 2019 17:53:16 +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 46RwkN11KCz4Jrs; Mon, 9 Sep 2019 17:53:16 +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 05ED619576; Mon, 9 Sep 2019 17:53:16 +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 x89HrFtl095267; Mon, 9 Sep 2019 17:53:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HrFCH095266; Mon, 9 Sep 2019 17:53:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091753.x89HrFCH095266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:53:15 +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: r352086 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 352086 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, 09 Sep 2019 17:53:16 -0000 Author: kevans Date: Mon Sep 9 17:53:15 2019 New Revision: 352086 URL: https://svnweb.freebsd.org/changeset/base/352086 Log: MFC r345845-r345846: bectl(8) manpage clarity r345845: bectl.8: Clean up & clarify the create subcommand - Improve formatting - Use consistent variable names - Improve the description of the create subcommand (1) PR: 235850 r345846: bectl.8: Bump date after r345845 Modified: stable/12/sbin/bectl/bectl.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Mon Sep 9 17:44:14 2019 (r352085) +++ stable/12/sbin/bectl/bectl.8 Mon Sep 9 17:53:15 2019 (r352086) @@ -18,12 +18,12 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2019 +.Dd September 9, 2019 .Dt BECTL 8 .Os .Sh NAME .Nm bectl -.Nd Utility to manage Boot Environments on ZFS +.Nd Utility to manage boot environments on ZFS .Sh SYNOPSIS .Nm .Cm activate @@ -32,16 +32,12 @@ .Nm .Cm create .Op Fl r -.Op Fl e Brq Ar nonActiveBe | beName@snapshot -.Ar beName +.Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot +.Ar newBeName .Nm -.Cm create -.Op Fl r -.Ar beName@snapshot -.Nm .Cm destroy .Op Fl \&Fo -.Brq Ar beName | beName@snapshot +.Ar beName Ns Op Cm @ Ns Ar snapshot .Nm .Cm export .Ar sourceBe @@ -50,39 +46,42 @@ .Ar targetBe .Nm .Cm jail -.Brq Fl b | Fl U -.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... -.Ar bootenv +.Op Fl bU +.Oo Bro Fl o Ar key Ns Cm = Ns Ar value | Fl u Ar key Brc Oc Ns ... +.Ar beName .Op Ar utility Op Ar argument ... .Nm .Cm list -.Op Fl DHas +.Op Fl aDHs .Nm .Cm mount .Ar beName -.Op mountpoint +.Op Ar mountpoint .Nm .Cm rename .Ar origBeName .Ar newBeName .Nm .Brq Cm ujail | unjail -.Brq Ar jailID | jailName -.Ar bootenv +.Brq Ar jailId | jailName +.Ar beName .Nm .Brq Cm umount | unmount .Op Fl f .Ar beName +.Pp +.Nm +.Op Fl h\&? .Sh DESCRIPTION The .Nm command is used to setup and interact with ZFS boot environments, which are bootable clones of datasets. .Pp -.Em Boot Environments -allows the system to be upgraded, while preserving the old system environment in +Boot environments +allow the system to be upgraded, while preserving the old system environment in a separate ZFS dataset. -.Sh COMMANDS +.Pp The following commands are supported by .Nm : .Bl -tag -width activate @@ -100,28 +99,27 @@ flag is given, this takes effect only for the next boo .It Xo .Cm create .Op Fl r -.Op Fl e Brq Ar nonActiveBe | beName@snapshot -.Ar beName +.Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot +.Ar newBeName .Xc -Creates a new boot environment named -.Ar beName . +Create a new boot environment named +.Ar newBeName . +.Pp If the -.Fl e -argument is specified, the new environment will be cloned from the given -.Brq Ar nonActiveBe | Ar beName@snapshot . -If the .Fl r flag is given, a recursive boot environment will be made. -.It Xo -.Cm create -.Op Fl r -.Ar beName@snapshot -.Xc -Creates a snapshot of the existing boot environment named -.Ar beName . +.Pp If the -.Fl r -flag is given, a recursive boot environment will be made. +.Fl e +flag is specified, the new environment will be cloned from the given +.Ar nonActiveBe +or +.Ar beName Ns Cm @ Ns Ar snapshot . +Otherwise, the new environment will be created from the currently booted environment. +.Pp +If +.Nm +is creating from another boot environment, a snapshot of that boot environment will be created to clone from. .It Xo .Cm create .Op Fl r @@ -139,14 +137,14 @@ No new boot environment is created with this command. .It Xo .Cm destroy .Op Fl \&Fo -.Brq Ar beName | beName@snapshot +.Ar beName Ns Op Cm @ Ns Ar snapshot .Xc -Destroys the given +Destroy the given .Ar beName boot environment or -.Ar beName@snapshot +.Ar beName Ns Cm @ Ns Ar snapshot snapshot without confirmation, unlike in -.Nm beadm . +.Xr beadm 1 . Specifying .Fl F will automatically unmount without confirmation. @@ -162,22 +160,22 @@ flag may be specified to destroy the origin as well. Export .Ar sourceBe to -.Dv stdout . -.Dv stdout +.Xr stdout 4 . +.Xr stdout 4 must be piped or redirected to a file. .It Cm import Ar targetBe Import .Ar targetBe from -.Dv stdin . +.Xr stdin 4 . .It Xo .Cm jail -.Brq Fl b | Fl U -.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... -.Ao Ar bootenv Ac +.Op Fl bU +.Oo Bro Fl o Ar key Ns Cm = Ns Ar value | Fl u Ar key Brc Oc Ns ... +.Ar beName .Op Ar utility Op Ar argument ... .Xc -Creates a jail of the given boot environment. +Create a jail of the given boot environment. Multiple .Fl o and @@ -216,7 +214,7 @@ and must be set, the default values are specified below. .Pp All -.Ar key Ns = Ns Ar value +.Ar key Ns Cm = Ns Ar value pairs are interpreted as jail parameters as described in .Xr jail 8 . The following default parameters are provided: @@ -224,17 +222,24 @@ The following default parameters are provided: .It Va allow.mount Ta Cm true .It Va allow.mount.devfs Ta Cm true .It Va enforce_statfs Ta Cm 1 -.It Va name Ta jail id +.It Va name Ta Set to jail ID. .It Va host.hostname Ta Va bootenv -.It Va path Ta Set to a path in /tmp generated by +.It Va path Ta Set to a path in Pa /tmp +generated by .Xr libbe 3 . .El .Pp All default parameters may be overwritten. -.It Cm list Op Fl DHas -Displays all boot environments. -The Active field indicates whether the boot environment is active now (N); -active on reboot (R); or both (NR). +.It Cm list Op Fl aDHs +Display all boot environments. +The +.Em Active +field indicates whether the boot environment is active now +.Pq Em \&N ; +active on reboot +.Pq Em \&R ; +or both +.Pq Em \&NR . .Pp If .Fl a @@ -257,14 +262,20 @@ Mount at the specified .Ar mountpoint if provided. .It Cm rename Ar origBeName newBeName -Renames the given +Rename the given .Ar origBeName to the given .Ar newBeName . The boot environment will not be unmounted in order for this rename to occur. -.It Cm unjail Brq Ar jailID | jailName | beName -Destroys the jail created from the given boot environment. +.It Cm ujail Bro Ar jailId | jailName Brc Ar beName +.It Cm unjail Bro Ar jailId | jailName Brc Ar beName +Destroy the jail created from the given boot environment. .It Xo +.Cm umount +.Op Fl f +.Ar beName +.Xc +.It Xo .Cm unmount .Op Fl f .Ar beName @@ -274,12 +285,20 @@ Specifying .Fl f will force the unmount if busy. .El +.Pp +.Nm +prints usage information if +.Fl h +or +.Fl \&? +is specified. .Sh EXAMPLES .Bl -bullet .It To fill in with jail upgrade example when behavior is firm. .El .Sh SEE ALSO +.Xr beinstall.sh 1 , .Xr libbe 3 , .Xr jail 8 , .Xr zfs 8 , @@ -287,7 +306,7 @@ To fill in with jail upgrade example when behavior is .Sh HISTORY .Nm is based on -.Nm beadm +.Xr beadm 1 and was implemented as a project for the 2017 Summer of Code, along with .Xr libbe 3 . .Sh AUTHORS @@ -295,11 +314,11 @@ and was implemented as a project for the 2017 Summer o was written by .An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in . .Pp -.Nm beadm +.Xr beadm 1 was written and is maintained by .An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl . .Pp .An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net wrote the original -.Nm beadm +.Xr beadm 1 manual page that this one is derived from. From owner-svn-src-stable@freebsd.org Mon Sep 9 17:56:15 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 40D99DA068; Mon, 9 Sep 2019 17:56:15 +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 46Rwnq113zz4K7Q; Mon, 9 Sep 2019 17:56:15 +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 010811957D; Mon, 9 Sep 2019 17:56:14 +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 x89HuElx095662; Mon, 9 Sep 2019 17:56:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HuEYJ095660; Mon, 9 Sep 2019 17:56:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091756.x89HuEYJ095660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:56:14 +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: r352087 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 352087 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, 09 Sep 2019 17:56:15 -0000 Author: kevans Date: Mon Sep 9 17:56:14 2019 New Revision: 352087 URL: https://svnweb.freebsd.org/changeset/base/352087 Log: MFC r351813: bectl(8): implement sorting for 'bectl list' output Allow 'bectl list' to sort output by a given property name. The property name is passed in using a command-line flag, '-c' for ascending order and '-C' for descending order. The properties allowed to sort by are: - name (the default output, even if '-c' or '-C' are not used) - creation - origin - used - usedds - usedsnap - usedrefreserv The default output for 'bectl list' is now ascending alphabetical order of BE name. To sort by creation time from earliest to latest, the command would be 'bectl list -c creation' Modified: stable/12/sbin/bectl/bectl.8 stable/12/sbin/bectl/bectl.c stable/12/sbin/bectl/bectl_list.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Mon Sep 9 17:53:15 2019 (r352086) +++ stable/12/sbin/bectl/bectl.8 Mon Sep 9 17:56:14 2019 (r352087) @@ -53,6 +53,9 @@ .Nm .Cm list .Op Fl aDHs +.Op Fl c Ar property +.Op Fl C Ar property +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Nm .Cm mount .Ar beName @@ -230,7 +233,12 @@ generated by .El .Pp All default parameters may be overwritten. -.It Cm list Op Fl aDHs +.It Xo +.Cm list +.Op Fl DHas +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc +.Xc +.Pp Display all boot environments. The .Em Active @@ -241,21 +249,44 @@ active on reboot or both .Pq Em \&NR . .Pp -If -.Fl a -is used, display all datasets. -If -.Fl D -is used, display the full space usage for each boot environment, assuming all +.Bl -tag -width indent +.It Fl a +Display all datasets. +.It Fl D +Display the full space usage for each boot environment, assuming all other boot environments were destroyed. -The -.Fl H -option is used for scripting. -It does not print headers and separate fields by a single tab instead of +.It Fl H +Used for scripting. +Do not print headers and separate fields by a single tab instead of arbitrary white space. -If +.It Fl s +Display all snapshots as well. +.It Fl c Ar property +Sort boot environments by given property name. +The following properties are supported: +.Pp +.Bl -tag -width 4n -offset indent -compact +.It name (default output) +.It creation +.It origin +.It used +.It usedds +.It usedsnap +.It usedrefreserv +.El +.It Fl C Ar property +Same as the +.Fl c +option, but displays in descending order. +.El +.Pp +The +.Fl D +option is ignored when either the .Fl s -is used, display all snapshots as well. +or +.Fl a +option is used. .It Cm mount Ar beName Op Ar mountpoint Temporarily mount the boot environment. Mount at the specified Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Mon Sep 9 17:53:15 2019 (r352086) +++ stable/12/sbin/bectl/bectl.c Mon Sep 9 17:56:14 2019 (r352087) @@ -80,7 +80,7 @@ usage(bool explicit) "\tbectl jail {-b | -U} [{-o key=value | -u key}]... " "{jailID | jailName}\n" "\t bootenv [utility [argument ...]]\n" - "\tbectl list [-DHas]\n" + "\tbectl list [-DHas] [{-c property | -C property}]\n" "\tbectl mount beName [mountpoint]\n" "\tbectl rename origBeName newBeName\n" "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n" Modified: stable/12/sbin/bectl/bectl_list.c ============================================================================== --- stable/12/sbin/bectl/bectl_list.c Mon Sep 9 17:53:15 2019 (r352086) +++ stable/12/sbin/bectl/bectl_list.c Mon Sep 9 17:56:14 2019 (r352087) @@ -38,6 +38,12 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" +struct sort_column { + char *name; + char *val; + nvlist_t *nvl; +}; + struct printc { int active_colsz_def; int be_colsz; @@ -324,6 +330,74 @@ print_headers(nvlist_t *props, struct printc *pc) printf("\n"); } +/* + * Sort the given nvlist of boot environments by property. + */ +static int +prop_list_sort(nvlist_t *props, char *property, bool reverse) +{ + nvpair_t *nvp; + nvlist_t *nvl; + int i, nvp_count; + uint64_t lval, rval; + struct sort_column sc_prev, sc_next; + + /* a temporary list to work with */ + nvlist_dup(props, &nvl, 0); + + nvp_count = fnvlist_num_pairs(nvl); + for (i = 0; i < nvp_count; i++) { + + nvp = nvlist_next_nvpair(nvl, NULL); + nvpair_value_nvlist(nvp, &sc_prev.nvl); + nvlist_lookup_string(sc_prev.nvl, "name", &sc_prev.name); + nvlist_lookup_string(sc_prev.nvl, property, &sc_prev.val); + + while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { + + nvpair_value_nvlist(nvp, &sc_next.nvl); + nvlist_lookup_string(sc_next.nvl, "name", &sc_next.name); + nvlist_lookup_string(sc_next.nvl, property, &sc_next.val); + + /* properties that use numerical comparison */ + if (strcmp(property, "creation") == 0 || + strcmp(property, "used") == 0 || + strcmp(property, "usedds") == 0 || + strcmp(property, "usedsnap") == 0 || + strcmp(property, "usedrefreserv") == 0) { + + lval = strtoull(sc_prev.val, NULL, 10); + rval = strtoull(sc_next.val, NULL, 10); + + if ((lval < rval && reverse) || + (lval > rval && !reverse)) + sc_prev = sc_next; + } + + /* properties that use string comparison */ + else if (strcmp(property, "name") == 0 || + strcmp(property, "origin") == 0) { + if ((strcmp(sc_prev.val, sc_next.val) < 0 && reverse) || + (strcmp(sc_prev.val, sc_next.val) > 0 && !reverse)) + sc_prev = sc_next; + } + } + + /* + * The 'props' nvlist has been created to only have unique names. + * When a name is added, any existing nvlist's with the same name + * will be removed. Eventually, all existing nvlist's are replaced + * in sorted order. + */ + nvlist_add_nvlist(props, sc_prev.name, sc_prev.nvl); + nvlist_remove_all(nvl, sc_prev.name); + } + + be_prop_list_free(nvl); + + return 0; +} + int bectl_cmd_list(int argc, char *argv[]) { @@ -331,12 +405,14 @@ bectl_cmd_list(int argc, char *argv[]) nvpair_t *cur; nvlist_t *dsprops, *props; int opt, printed; - boolean_t active_now, active_reboot; + char *column; + bool reverse; + column = NULL; props = NULL; printed = 0; bzero(&pc, sizeof(pc)); - while ((opt = getopt(argc, argv, "aDHs")) != -1) { + while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) { switch (opt) { case 'a': pc.show_all_datasets = true; @@ -350,6 +426,18 @@ bectl_cmd_list(int argc, char *argv[]) case 's': pc.show_snaps = true; break; + case 'c': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = false; + break; + case 'C': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = true; + break; default: fprintf(stderr, "bectl list: unknown option '-%c'\n", optopt); @@ -374,44 +462,33 @@ bectl_cmd_list(int argc, char *argv[]) return (1); } + /* List boot environments in alphabetical order by default */ + if (column == NULL) { + column = strdup("name"); + reverse = false; + } + + prop_list_sort(props, column, reverse); + /* Force -D off if either -a or -s are specified */ if (pc.show_all_datasets || pc.show_snaps) pc.show_space = false; if (!pc.script_fmt) print_headers(props, &pc); - /* Do a first pass to print active and next active first */ - for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; - cur = nvlist_next_nvpair(props, cur)) { - nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (!active_now && !active_reboot) - continue; - if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) - printf("\n"); - print_info(nvpair_name(cur), dsprops, &pc); - printed++; - } - - /* Now pull everything else */ + /* Print boot environments */ for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; cur = nvlist_next_nvpair(props, cur)) { nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (active_now || active_reboot) - continue; if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) printf("\n"); + print_info(nvpair_name(cur), dsprops, &pc); printed++; } + + free(column); be_prop_list_free(props); return (0); From owner-svn-src-stable@freebsd.org Mon Sep 9 17:56:38 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 6EB62DA0F8; Mon, 9 Sep 2019 17:56:38 +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 46RwpG2LH2z4KFl; Mon, 9 Sep 2019 17:56:38 +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 3481419581; Mon, 9 Sep 2019 17:56:38 +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 x89HuccW095726; Mon, 9 Sep 2019 17:56:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HubEv095723; Mon, 9 Sep 2019 17:56:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091756.x89HubEv095723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 17:56:37 +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: r352088 - stable/11/sbin/bectl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sbin/bectl X-SVN-Commit-Revision: 352088 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, 09 Sep 2019 17:56:38 -0000 Author: kevans Date: Mon Sep 9 17:56:37 2019 New Revision: 352088 URL: https://svnweb.freebsd.org/changeset/base/352088 Log: MFC r351813: bectl(8): implement sorting for 'bectl list' output Allow 'bectl list' to sort output by a given property name. The property name is passed in using a command-line flag, '-c' for ascending order and '-C' for descending order. The properties allowed to sort by are: - name (the default output, even if '-c' or '-C' are not used) - creation - origin - used - usedds - usedsnap - usedrefreserv The default output for 'bectl list' is now ascending alphabetical order of BE name. To sort by creation time from earliest to latest, the command would be 'bectl list -c creation' Modified: stable/11/sbin/bectl/bectl.8 stable/11/sbin/bectl/bectl.c stable/11/sbin/bectl/bectl_list.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/bectl/bectl.8 ============================================================================== --- stable/11/sbin/bectl/bectl.8 Mon Sep 9 17:56:14 2019 (r352087) +++ stable/11/sbin/bectl/bectl.8 Mon Sep 9 17:56:37 2019 (r352088) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 12, 2019 +.Dd September 4, 2019 .Dt BECTL 8 .Os .Sh NAME @@ -57,6 +57,9 @@ .Nm .Cm list .Op Fl aDHs +.Op Fl c Ar property +.Op Fl C Ar property +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Nm .Cm mount .Ar beName @@ -234,7 +237,12 @@ generated by .El .Pp All default parameters may be overwritten. -.It Cm list Op Fl aDHs +.It Xo +.Cm list +.Op Fl DHas +.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc +.Xc +.Pp Display all boot environments. The .Em Active @@ -245,21 +253,44 @@ active on reboot or both .Pq Em \&NR . .Pp -If -.Fl a -is used, display all datasets. -If -.Fl D -is used, display the full space usage for each boot environment, assuming all +.Bl -tag -width indent +.It Fl a +Display all datasets. +.It Fl D +Display the full space usage for each boot environment, assuming all other boot environments were destroyed. -The -.Fl H -option is used for scripting. -It does not print headers and separate fields by a single tab instead of +.It Fl H +Used for scripting. +Do not print headers and separate fields by a single tab instead of arbitrary white space. -If +.It Fl s +Display all snapshots as well. +.It Fl c Ar property +Sort boot environments by given property name. +The following properties are supported: +.Pp +.Bl -tag -width 4n -offset indent -compact +.It name (default output) +.It creation +.It origin +.It used +.It usedds +.It usedsnap +.It usedrefreserv +.El +.It Fl C Ar property +Same as the +.Fl c +option, but displays in descending order. +.El +.Pp +The +.Fl D +option is ignored when either the .Fl s -is used, display all snapshots as well. +or +.Fl a +option is used. .It Cm mount Ar beName Op Ar mountpoint Temporarily mount the boot environment. Mount at the specified Modified: stable/11/sbin/bectl/bectl.c ============================================================================== --- stable/11/sbin/bectl/bectl.c Mon Sep 9 17:56:14 2019 (r352087) +++ stable/11/sbin/bectl/bectl.c Mon Sep 9 17:56:37 2019 (r352088) @@ -80,7 +80,7 @@ usage(bool explicit) "\tbectl jail {-b | -U} [{-o key=value | -u key}]... " "{jailID | jailName}\n" "\t bootenv [utility [argument ...]]\n" - "\tbectl list [-DHas]\n" + "\tbectl list [-DHas] [{-c property | -C property}]\n" "\tbectl mount beName [mountpoint]\n" "\tbectl rename origBeName newBeName\n" "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n" Modified: stable/11/sbin/bectl/bectl_list.c ============================================================================== --- stable/11/sbin/bectl/bectl_list.c Mon Sep 9 17:56:14 2019 (r352087) +++ stable/11/sbin/bectl/bectl_list.c Mon Sep 9 17:56:37 2019 (r352088) @@ -38,6 +38,12 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" +struct sort_column { + char *name; + char *val; + nvlist_t *nvl; +}; + struct printc { int active_colsz_def; int be_colsz; @@ -324,6 +330,74 @@ print_headers(nvlist_t *props, struct printc *pc) printf("\n"); } +/* + * Sort the given nvlist of boot environments by property. + */ +static int +prop_list_sort(nvlist_t *props, char *property, bool reverse) +{ + nvpair_t *nvp; + nvlist_t *nvl; + int i, nvp_count; + uint64_t lval, rval; + struct sort_column sc_prev, sc_next; + + /* a temporary list to work with */ + nvlist_dup(props, &nvl, 0); + + nvp_count = fnvlist_num_pairs(nvl); + for (i = 0; i < nvp_count; i++) { + + nvp = nvlist_next_nvpair(nvl, NULL); + nvpair_value_nvlist(nvp, &sc_prev.nvl); + nvlist_lookup_string(sc_prev.nvl, "name", &sc_prev.name); + nvlist_lookup_string(sc_prev.nvl, property, &sc_prev.val); + + while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { + + nvpair_value_nvlist(nvp, &sc_next.nvl); + nvlist_lookup_string(sc_next.nvl, "name", &sc_next.name); + nvlist_lookup_string(sc_next.nvl, property, &sc_next.val); + + /* properties that use numerical comparison */ + if (strcmp(property, "creation") == 0 || + strcmp(property, "used") == 0 || + strcmp(property, "usedds") == 0 || + strcmp(property, "usedsnap") == 0 || + strcmp(property, "usedrefreserv") == 0) { + + lval = strtoull(sc_prev.val, NULL, 10); + rval = strtoull(sc_next.val, NULL, 10); + + if ((lval < rval && reverse) || + (lval > rval && !reverse)) + sc_prev = sc_next; + } + + /* properties that use string comparison */ + else if (strcmp(property, "name") == 0 || + strcmp(property, "origin") == 0) { + if ((strcmp(sc_prev.val, sc_next.val) < 0 && reverse) || + (strcmp(sc_prev.val, sc_next.val) > 0 && !reverse)) + sc_prev = sc_next; + } + } + + /* + * The 'props' nvlist has been created to only have unique names. + * When a name is added, any existing nvlist's with the same name + * will be removed. Eventually, all existing nvlist's are replaced + * in sorted order. + */ + nvlist_add_nvlist(props, sc_prev.name, sc_prev.nvl); + nvlist_remove_all(nvl, sc_prev.name); + } + + be_prop_list_free(nvl); + + return 0; +} + int bectl_cmd_list(int argc, char *argv[]) { @@ -331,12 +405,14 @@ bectl_cmd_list(int argc, char *argv[]) nvpair_t *cur; nvlist_t *dsprops, *props; int opt, printed; - boolean_t active_now, active_reboot; + char *column; + bool reverse; + column = NULL; props = NULL; printed = 0; bzero(&pc, sizeof(pc)); - while ((opt = getopt(argc, argv, "aDHs")) != -1) { + while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) { switch (opt) { case 'a': pc.show_all_datasets = true; @@ -350,6 +426,18 @@ bectl_cmd_list(int argc, char *argv[]) case 's': pc.show_snaps = true; break; + case 'c': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = false; + break; + case 'C': + if (column != NULL) + free(column); + column = strdup(optarg); + reverse = true; + break; default: fprintf(stderr, "bectl list: unknown option '-%c'\n", optopt); @@ -374,44 +462,33 @@ bectl_cmd_list(int argc, char *argv[]) return (1); } + /* List boot environments in alphabetical order by default */ + if (column == NULL) { + column = strdup("name"); + reverse = false; + } + + prop_list_sort(props, column, reverse); + /* Force -D off if either -a or -s are specified */ if (pc.show_all_datasets || pc.show_snaps) pc.show_space = false; if (!pc.script_fmt) print_headers(props, &pc); - /* Do a first pass to print active and next active first */ - for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; - cur = nvlist_next_nvpair(props, cur)) { - nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (!active_now && !active_reboot) - continue; - if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) - printf("\n"); - print_info(nvpair_name(cur), dsprops, &pc); - printed++; - } - - /* Now pull everything else */ + /* Print boot environments */ for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; cur = nvlist_next_nvpair(props, cur)) { nvpair_value_nvlist(cur, &dsprops); - active_now = active_reboot = false; - nvlist_lookup_boolean_value(dsprops, "active", &active_now); - nvlist_lookup_boolean_value(dsprops, "nextboot", - &active_reboot); - if (active_now || active_reboot) - continue; if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) printf("\n"); + print_info(nvpair_name(cur), dsprops, &pc); printed++; } + + free(column); be_prop_list_free(props); return (0); From owner-svn-src-stable@freebsd.org Mon Sep 9 17:58:27 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 6865ADA186; Mon, 9 Sep 2019 17:58:27 +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 46RwrM21mXz4KNZ; Mon, 9 Sep 2019 17:58:27 +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 23AE519582; Mon, 9 Sep 2019 17:58:27 +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 x89HwQIs095862; Mon, 9 Sep 2019 17:58:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HwQ2C095861; Mon, 9 Sep 2019 17:58:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909091758.x89HwQ2C095861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 9 Sep 2019 17:58:26 +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: r352089 - in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Commit-Revision: 352089 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, 09 Sep 2019 17:58:27 -0000 Author: dim Date: Mon Sep 9 17:58:26 2019 New Revision: 352089 URL: https://svnweb.freebsd.org/changeset/base/352089 Log: MFC r351938: Pull in r371111 from upstream llvm trunk (by Eli Friedman): [IfConversion] Fix diamond conversion with unanalyzable branches. The code was incorrectly counting the number of identical instructions, and therefore tried to predicate an instruction which should not have been predicated. This could have various effects: a compiler crash, an assembler failure, a miscompile, or just generating an extra, unnecessary instruction. Instead of depending on TargetInstrInfo::removeBranch, which only works on analyzable branches, just remove all branch instructions. Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and https://bugs.llvm.org/show_bug.cgi?id=41121 . Differential Revision: https://reviews.llvm.org/D67203 This should fix "Unable to predicate BX killed renamable $r0" errors when building the lang/spidermonkey170 and lang/spidermonkey38 ports for armv7 and armv6. PR: 236567 Modified: stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp ============================================================================== --- stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp Mon Sep 9 17:56:37 2019 (r352088) +++ stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp Mon Sep 9 17:58:26 2019 (r352089) @@ -1759,9 +1759,15 @@ bool IfConverter::IfConvertDiamondCommon( if (!BBI1->IsBrAnalyzable) verifySameBranchInstructions(&MBB1, &MBB2); #endif - BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB); - // Remove duplicated instructions. + // Remove duplicated instructions from the tail of MBB1: any branch + // instructions, and the common instructions counted by NumDups2. DI1 = MBB1.end(); + while (DI1 != MBB1.begin()) { + MachineBasicBlock::iterator Prev = std::prev(DI1); + if (!Prev->isBranch() && !Prev->isDebugInstr()) + break; + DI1 = Prev; + } for (unsigned i = 0; i != NumDups2; ) { // NumDups2 only counted non-dbg_value instructions, so this won't // run off the head of the list. From owner-svn-src-stable@freebsd.org Mon Sep 9 17:58:27 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 A9451DA18A; Mon, 9 Sep 2019 17:58:27 +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 46RwrM41m7z4KNb; Mon, 9 Sep 2019 17:58:27 +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 6D49119583; Mon, 9 Sep 2019 17:58:27 +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 x89HwRsj095868; Mon, 9 Sep 2019 17:58:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89HwRdK095867; Mon, 9 Sep 2019 17:58:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909091758.x89HwRdK095867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 9 Sep 2019 17:58:27 +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: r352089 - in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/CodeGen 12/contrib/llvm/lib/CodeGen X-SVN-Commit-Revision: 352089 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, 09 Sep 2019 17:58:27 -0000 Author: dim Date: Mon Sep 9 17:58:26 2019 New Revision: 352089 URL: https://svnweb.freebsd.org/changeset/base/352089 Log: MFC r351938: Pull in r371111 from upstream llvm trunk (by Eli Friedman): [IfConversion] Fix diamond conversion with unanalyzable branches. The code was incorrectly counting the number of identical instructions, and therefore tried to predicate an instruction which should not have been predicated. This could have various effects: a compiler crash, an assembler failure, a miscompile, or just generating an extra, unnecessary instruction. Instead of depending on TargetInstrInfo::removeBranch, which only works on analyzable branches, just remove all branch instructions. Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and https://bugs.llvm.org/show_bug.cgi?id=41121 . Differential Revision: https://reviews.llvm.org/D67203 This should fix "Unable to predicate BX killed renamable $r0" errors when building the lang/spidermonkey170 and lang/spidermonkey38 ports for armv7 and armv6. PR: 236567 Modified: stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/llvm/lib/CodeGen/IfConversion.cpp Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp Mon Sep 9 17:56:37 2019 (r352088) +++ stable/11/contrib/llvm/lib/CodeGen/IfConversion.cpp Mon Sep 9 17:58:26 2019 (r352089) @@ -1759,9 +1759,15 @@ bool IfConverter::IfConvertDiamondCommon( if (!BBI1->IsBrAnalyzable) verifySameBranchInstructions(&MBB1, &MBB2); #endif - BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB); - // Remove duplicated instructions. + // Remove duplicated instructions from the tail of MBB1: any branch + // instructions, and the common instructions counted by NumDups2. DI1 = MBB1.end(); + while (DI1 != MBB1.begin()) { + MachineBasicBlock::iterator Prev = std::prev(DI1); + if (!Prev->isBranch() && !Prev->isDebugInstr()) + break; + DI1 = Prev; + } for (unsigned i = 0; i != NumDups2; ) { // NumDups2 only counted non-dbg_value instructions, so this won't // run off the head of the list. From owner-svn-src-stable@freebsd.org Mon Sep 9 18:01: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 5F7EEDA348; Mon, 9 Sep 2019 18:01:08 +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 46RwvS1wX0z4KkC; Mon, 9 Sep 2019 18:01:08 +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 25C5D195C5; Mon, 9 Sep 2019 18:01:08 +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 x89I17Ul097557; Mon, 9 Sep 2019 18:01:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89I171p097556; Mon, 9 Sep 2019 18:01:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091801.x89I171p097556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 18:01: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: r352090 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 352090 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, 09 Sep 2019 18:01:08 -0000 Author: kevans Date: Mon Sep 9 18:01:07 2019 New Revision: 352090 URL: https://svnweb.freebsd.org/changeset/base/352090 Log: bectl(8): fix mis-merge r348296 ("add description for create subcommand") apparently failed to merge in the SYNOPSIS addition somehow... correct this mistake now. This is a direct commit to stable/12 for a misfire on previous MFC. Modified: stable/12/sbin/bectl/bectl.8 Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Mon Sep 9 17:58:26 2019 (r352089) +++ stable/12/sbin/bectl/bectl.8 Mon Sep 9 18:01:07 2019 (r352090) @@ -35,6 +35,10 @@ .Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot .Ar newBeName .Nm +.Cm create +.Op Fl r +.Ar beName@snapshot +.Nm .Cm destroy .Op Fl \&Fo .Ar beName Ns Op Cm @ Ns Ar snapshot From owner-svn-src-stable@freebsd.org Mon Sep 9 18:07: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 85F97DA67E; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Rx2r301jz4LD4; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@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 49CF219774; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89I7Ws0002059; Mon, 9 Sep 2019 18:07:32 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89I7W5l002058; Mon, 9 Sep 2019 18:07:32 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201909091807.x89I7W5l002058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 9 Sep 2019 18:07: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: r352091 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 352091 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, 09 Sep 2019 18:07:32 -0000 Author: erj Date: Mon Sep 9 18:07:31 2019 New Revision: 352091 URL: https://svnweb.freebsd.org/changeset/base/352091 Log: iflib: initialize the STATE_LOCK in iflib_register From Jake: r347197 contained an MFC for r332389, adding the STATE_LOCK to the iflib core driver. Unfortunately, the commit accidentally missed adding the STATE_LOCK_INIT. Without this, if you build a STABLE-11 kernel with INVARIANTS enabled, any mtx_lock of the state lock will result in a panic: panic: mtx_lock() of spin mutex (null) @ /usr/src/sys/net/iflib.c:5522 It actually ends up looking like a panic due to taking a spin mutex when we could be interrupted. However, the real cause is because the lock class was never initialized. Initialize the STATE_LOCK properly during iflib_register to fix this. Submitted by: Jacob Keller Reviewed by: erj@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21540 Modified: stable/11/sys/net/iflib.c Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Mon Sep 9 18:01:07 2019 (r352090) +++ stable/11/sys/net/iflib.c Mon Sep 9 18:07:31 2019 (r352091) @@ -4758,6 +4758,7 @@ iflib_register(if_ctx_t ctx) _iflib_assert(sctx); CTX_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); + STATE_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); ifp = ctx->ifc_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { From owner-svn-src-stable@freebsd.org Mon Sep 9 18:20:56 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 78245DAF80; Mon, 9 Sep 2019 18:20:56 +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 46RxLJ2YSmz4MDJ; Mon, 9 Sep 2019 18:20:56 +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 3ADAE19A7D; Mon, 9 Sep 2019 18:20:56 +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 x89IKucI009894; Mon, 9 Sep 2019 18:20:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89IKtv6009891; Mon, 9 Sep 2019 18:20:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909091820.x89IKtv6009891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Sep 2019 18:20:55 +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: r352093 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 352093 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, 09 Sep 2019 18:20:56 -0000 Author: kevans Date: Mon Sep 9 18:20:55 2019 New Revision: 352093 URL: https://svnweb.freebsd.org/changeset/base/352093 Log: Back out r352087 for now The ancient-gcc -Wno-error series hasn't been MFC'd yet to this branch and some GCC builds seem to have raised a false-positive that wasn't caught due to -Wno-error on head. Back it out for now, will reapply when r352092 becomes eligible for MFC... Modified: stable/12/sbin/bectl/bectl.8 stable/12/sbin/bectl/bectl.c stable/12/sbin/bectl/bectl_list.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Mon Sep 9 18:17:30 2019 (r352092) +++ stable/12/sbin/bectl/bectl.8 Mon Sep 9 18:20:55 2019 (r352093) @@ -57,9 +57,6 @@ .Nm .Cm list .Op Fl aDHs -.Op Fl c Ar property -.Op Fl C Ar property -.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Nm .Cm mount .Ar beName @@ -237,12 +234,7 @@ generated by .El .Pp All default parameters may be overwritten. -.It Xo -.Cm list -.Op Fl DHas -.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc -.Xc -.Pp +.It Cm list Op Fl aDHs Display all boot environments. The .Em Active @@ -253,44 +245,21 @@ active on reboot or both .Pq Em \&NR . .Pp -.Bl -tag -width indent -.It Fl a -Display all datasets. -.It Fl D -Display the full space usage for each boot environment, assuming all +If +.Fl a +is used, display all datasets. +If +.Fl D +is used, display the full space usage for each boot environment, assuming all other boot environments were destroyed. -.It Fl H -Used for scripting. -Do not print headers and separate fields by a single tab instead of -arbitrary white space. -.It Fl s -Display all snapshots as well. -.It Fl c Ar property -Sort boot environments by given property name. -The following properties are supported: -.Pp -.Bl -tag -width 4n -offset indent -compact -.It name (default output) -.It creation -.It origin -.It used -.It usedds -.It usedsnap -.It usedrefreserv -.El -.It Fl C Ar property -Same as the -.Fl c -option, but displays in descending order. -.El -.Pp The -.Fl D -option is ignored when either the +.Fl H +option is used for scripting. +It does not print headers and separate fields by a single tab instead of +arbitrary white space. +If .Fl s -or -.Fl a -option is used. +is used, display all snapshots as well. .It Cm mount Ar beName Op Ar mountpoint Temporarily mount the boot environment. Mount at the specified Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Mon Sep 9 18:17:30 2019 (r352092) +++ stable/12/sbin/bectl/bectl.c Mon Sep 9 18:20:55 2019 (r352093) @@ -80,7 +80,7 @@ usage(bool explicit) "\tbectl jail {-b | -U} [{-o key=value | -u key}]... " "{jailID | jailName}\n" "\t bootenv [utility [argument ...]]\n" - "\tbectl list [-DHas] [{-c property | -C property}]\n" + "\tbectl list [-DHas]\n" "\tbectl mount beName [mountpoint]\n" "\tbectl rename origBeName newBeName\n" "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n" Modified: stable/12/sbin/bectl/bectl_list.c ============================================================================== --- stable/12/sbin/bectl/bectl_list.c Mon Sep 9 18:17:30 2019 (r352092) +++ stable/12/sbin/bectl/bectl_list.c Mon Sep 9 18:20:55 2019 (r352093) @@ -38,12 +38,6 @@ __FBSDID("$FreeBSD$"); #include "bectl.h" -struct sort_column { - char *name; - char *val; - nvlist_t *nvl; -}; - struct printc { int active_colsz_def; int be_colsz; @@ -330,74 +324,6 @@ print_headers(nvlist_t *props, struct printc *pc) printf("\n"); } -/* - * Sort the given nvlist of boot environments by property. - */ -static int -prop_list_sort(nvlist_t *props, char *property, bool reverse) -{ - nvpair_t *nvp; - nvlist_t *nvl; - int i, nvp_count; - uint64_t lval, rval; - struct sort_column sc_prev, sc_next; - - /* a temporary list to work with */ - nvlist_dup(props, &nvl, 0); - - nvp_count = fnvlist_num_pairs(nvl); - for (i = 0; i < nvp_count; i++) { - - nvp = nvlist_next_nvpair(nvl, NULL); - nvpair_value_nvlist(nvp, &sc_prev.nvl); - nvlist_lookup_string(sc_prev.nvl, "name", &sc_prev.name); - nvlist_lookup_string(sc_prev.nvl, property, &sc_prev.val); - - while ((nvp = nvlist_next_nvpair(nvl, nvp)) != NULL) { - - nvpair_value_nvlist(nvp, &sc_next.nvl); - nvlist_lookup_string(sc_next.nvl, "name", &sc_next.name); - nvlist_lookup_string(sc_next.nvl, property, &sc_next.val); - - /* properties that use numerical comparison */ - if (strcmp(property, "creation") == 0 || - strcmp(property, "used") == 0 || - strcmp(property, "usedds") == 0 || - strcmp(property, "usedsnap") == 0 || - strcmp(property, "usedrefreserv") == 0) { - - lval = strtoull(sc_prev.val, NULL, 10); - rval = strtoull(sc_next.val, NULL, 10); - - if ((lval < rval && reverse) || - (lval > rval && !reverse)) - sc_prev = sc_next; - } - - /* properties that use string comparison */ - else if (strcmp(property, "name") == 0 || - strcmp(property, "origin") == 0) { - if ((strcmp(sc_prev.val, sc_next.val) < 0 && reverse) || - (strcmp(sc_prev.val, sc_next.val) > 0 && !reverse)) - sc_prev = sc_next; - } - } - - /* - * The 'props' nvlist has been created to only have unique names. - * When a name is added, any existing nvlist's with the same name - * will be removed. Eventually, all existing nvlist's are replaced - * in sorted order. - */ - nvlist_add_nvlist(props, sc_prev.name, sc_prev.nvl); - nvlist_remove_all(nvl, sc_prev.name); - } - - be_prop_list_free(nvl); - - return 0; -} - int bectl_cmd_list(int argc, char *argv[]) { @@ -405,14 +331,12 @@ bectl_cmd_list(int argc, char *argv[]) nvpair_t *cur; nvlist_t *dsprops, *props; int opt, printed; - char *column; - bool reverse; + boolean_t active_now, active_reboot; - column = NULL; props = NULL; printed = 0; bzero(&pc, sizeof(pc)); - while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) { + while ((opt = getopt(argc, argv, "aDHs")) != -1) { switch (opt) { case 'a': pc.show_all_datasets = true; @@ -426,18 +350,6 @@ bectl_cmd_list(int argc, char *argv[]) case 's': pc.show_snaps = true; break; - case 'c': - if (column != NULL) - free(column); - column = strdup(optarg); - reverse = false; - break; - case 'C': - if (column != NULL) - free(column); - column = strdup(optarg); - reverse = true; - break; default: fprintf(stderr, "bectl list: unknown option '-%c'\n", optopt); @@ -462,33 +374,44 @@ bectl_cmd_list(int argc, char *argv[]) return (1); } - /* List boot environments in alphabetical order by default */ - if (column == NULL) { - column = strdup("name"); - reverse = false; - } - - prop_list_sort(props, column, reverse); - /* Force -D off if either -a or -s are specified */ if (pc.show_all_datasets || pc.show_snaps) pc.show_space = false; if (!pc.script_fmt) print_headers(props, &pc); - - /* Print boot environments */ + /* Do a first pass to print active and next active first */ for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; cur = nvlist_next_nvpair(props, cur)) { nvpair_value_nvlist(cur, &dsprops); + active_now = active_reboot = false; + nvlist_lookup_boolean_value(dsprops, "active", &active_now); + nvlist_lookup_boolean_value(dsprops, "nextboot", + &active_reboot); + if (!active_now && !active_reboot) + continue; if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) printf("\n"); - print_info(nvpair_name(cur), dsprops, &pc); printed++; } - free(column); + /* Now pull everything else */ + for (cur = nvlist_next_nvpair(props, NULL); cur != NULL; + cur = nvlist_next_nvpair(props, cur)) { + nvpair_value_nvlist(cur, &dsprops); + active_now = active_reboot = false; + + nvlist_lookup_boolean_value(dsprops, "active", &active_now); + nvlist_lookup_boolean_value(dsprops, "nextboot", + &active_reboot); + if (active_now || active_reboot) + continue; + if (printed > 0 && (pc.show_all_datasets || pc.show_snaps)) + printf("\n"); + print_info(nvpair_name(cur), dsprops, &pc); + printed++; + } be_prop_list_free(props); return (0); From owner-svn-src-stable@freebsd.org Mon Sep 9 18:27:58 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 1B83ADB491; Mon, 9 Sep 2019 18:27:58 +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 46RxVQ0f2Wz4Mqp; Mon, 9 Sep 2019 18:27:58 +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 EE4B719B1F; Mon, 9 Sep 2019 18:27:57 +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 x89IRvw6014056; Mon, 9 Sep 2019 18:27:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89IRqg6014032; Mon, 9 Sep 2019 18:27:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201909091827.x89IRqg6014032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 9 Sep 2019 18:27: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: r352094 - in stable/12: share/mk sys/arm/conf sys/conf sys/modules/linux sys/modules/linux64 sys/powerpc/conf sys/powerpc/conf/dpaa usr.sbin/pmcstudy X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/12: share/mk sys/arm/conf sys/conf sys/modules/linux sys/modules/linux64 sys/powerpc/conf sys/powerpc/conf/dpaa usr.sbin/pmcstudy X-SVN-Commit-Revision: 352094 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, 09 Sep 2019 18:27:58 -0000 Author: imp Date: Mon Sep 9 18:27:52 2019 New Revision: 352094 URL: https://svnweb.freebsd.org/changeset/base/352094 Log: MFC: r351429,351430,351485,351497,351498 Merge changes to turn off -Werror for gcc 4.2.1 by default as part of the plan to deorbit gcc 4.2.1 from -head before 13.0. Relnotes: Yes Modified: stable/12/share/mk/bsd.sys.mk stable/12/sys/arm/conf/ALPINE stable/12/sys/arm/conf/ARMADA38X stable/12/sys/arm/conf/ARMADAXP stable/12/sys/arm/conf/DB-78XXX stable/12/sys/arm/conf/DB-88F5XXX stable/12/sys/arm/conf/DB-88F6XXX stable/12/sys/arm/conf/RT1310 stable/12/sys/arm/conf/SHEEVAPLUG stable/12/sys/arm/conf/SOCFPGA stable/12/sys/arm/conf/TS7800 stable/12/sys/arm/conf/VYBRID stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/conf/kern.pre.mk stable/12/sys/conf/kmod.mk stable/12/sys/modules/linux/Makefile stable/12/sys/modules/linux64/Makefile stable/12/sys/powerpc/conf/MPC85XX stable/12/sys/powerpc/conf/MPC85XXSPE stable/12/sys/powerpc/conf/QORIQ64 stable/12/sys/powerpc/conf/dpaa/DPAA stable/12/usr.sbin/pmcstudy/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.sys.mk ============================================================================== --- stable/12/share/mk/bsd.sys.mk Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/share/mk/bsd.sys.mk Mon Sep 9 18:27:52 2019 (r352094) @@ -29,6 +29,15 @@ CFLAGS+= -std=${CSTD} CXXFLAGS+= -std=${CXXSTD} .endif +# +# Turn off -Werror for gcc 4.2.1. The compiler is on the glide path out of the +# system, and any warnings specific to it are no longer relevant as there are +# too many false positives. +# +.if ${COMPILER_VERSION} < 50000 +NO_WERROR.gcc= yes +.endif + # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS+= -pedantic .if defined(WARNS) Modified: stable/12/sys/arm/conf/ALPINE ============================================================================== --- stable/12/sys/arm/conf/ALPINE Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/ALPINE Mon Sep 9 18:27:52 2019 (r352094) @@ -23,7 +23,6 @@ include "std.armv7" include "../annapurna/alpine/std.alpine" makeoptions MODULES_OVERRIDE="" -makeoptions WERROR="-Werror" options SCHED_4BSD # 4BSD scheduler options SMP # Enable multiple cores Modified: stable/12/sys/arm/conf/ARMADA38X ============================================================================== --- stable/12/sys/arm/conf/ARMADA38X Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/ARMADA38X Mon Sep 9 18:27:52 2019 (r352094) @@ -11,7 +11,6 @@ ident ARMADA38X options SOC_MV_ARMADA38X -makeoptions WERROR="-Werror" makeoptions MODULES_EXTRA="dtb/mv" options MD_ROOT Modified: stable/12/sys/arm/conf/ARMADAXP ============================================================================== --- stable/12/sys/arm/conf/ARMADAXP Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/ARMADAXP Mon Sep 9 18:27:52 2019 (r352094) @@ -27,8 +27,6 @@ include "../mv/armadaxp/std.mv78x60" options SOC_MV_ARMADAXP -makeoptions WERROR="-Werror" - options SCHED_ULE # ULE scheduler options SMP # Enable multiple cores Modified: stable/12/sys/arm/conf/DB-78XXX ============================================================================== --- stable/12/sys/arm/conf/DB-78XXX Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/DB-78XXX Mon Sep 9 18:27:52 2019 (r352094) @@ -10,8 +10,6 @@ include "../mv/discovery/std.db78xxx" options SOC_MV_DISCOVERY -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: stable/12/sys/arm/conf/DB-88F5XXX ============================================================================== --- stable/12/sys/arm/conf/DB-88F5XXX Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/DB-88F5XXX Mon Sep 9 18:27:52 2019 (r352094) @@ -10,8 +10,6 @@ include "../mv/orion/std.db88f5xxx" options SOC_MV_ORION -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: stable/12/sys/arm/conf/DB-88F6XXX ============================================================================== --- stable/12/sys/arm/conf/DB-88F6XXX Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/DB-88F6XXX Mon Sep 9 18:27:52 2019 (r352094) @@ -10,8 +10,6 @@ include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: stable/12/sys/arm/conf/RT1310 ============================================================================== --- stable/12/sys/arm/conf/RT1310 Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/RT1310 Mon Sep 9 18:27:52 2019 (r352094) @@ -16,7 +16,6 @@ makeoptions FDT_DTS_FILE=wzr2-g300n.dts makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror" options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking Modified: stable/12/sys/arm/conf/SHEEVAPLUG ============================================================================== --- stable/12/sys/arm/conf/SHEEVAPLUG Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/SHEEVAPLUG Mon Sep 9 18:27:52 2019 (r352094) @@ -11,8 +11,6 @@ include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions WERROR="-Werror" - options HZ=1000 options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking Modified: stable/12/sys/arm/conf/SOCFPGA ============================================================================== --- stable/12/sys/arm/conf/SOCFPGA Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/SOCFPGA Mon Sep 9 18:27:52 2019 (r352094) @@ -24,8 +24,6 @@ include "../altera/socfpga/std.socfpga" makeoptions MODULES_OVERRIDE="" -makeoptions WERROR="-Werror" - options SCHED_ULE # ULE scheduler options PLATFORM # Platform based SoC options SMP # Enable multiple cores Modified: stable/12/sys/arm/conf/TS7800 ============================================================================== --- stable/12/sys/arm/conf/TS7800 Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/TS7800 Mon Sep 9 18:27:52 2019 (r352094) @@ -10,8 +10,6 @@ include "../mv/orion/std.ts7800" options SOC_MV_ORION -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options INET # InterNETworking options INET6 # IPv6 communications protocols Modified: stable/12/sys/arm/conf/VYBRID ============================================================================== --- stable/12/sys/arm/conf/VYBRID Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/arm/conf/VYBRID Mon Sep 9 18:27:52 2019 (r352094) @@ -22,8 +22,6 @@ ident VYBRID include "std.armv7" include "../freescale/vybrid/std.vybrid" -makeoptions WERROR="-Werror" - options SCHED_4BSD # 4BSD scheduler options PLATFORM # Platform based SoC #options NANDFS # NAND Filesystem Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/conf/files.amd64 Mon Sep 9 18:27:52 2019 (r352094) @@ -46,7 +46,7 @@ linux32_assym.h optional compat_linux32 \ # linux32_locore.o optional compat_linux32 \ dependency "linux32_assym.h $S/amd64/linux32/linux32_locore.s" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux32_locore.o" # Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/conf/files.i386 Mon Sep 9 18:27:52 2019 (r352094) @@ -33,7 +33,7 @@ linux_assym.h optional compat_linux \ # linux_locore.o optional compat_linux \ dependency "linux_assym.h $S/i386/linux/linux_locore.s" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ + compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S ${WERROR} -Wall -fPIC -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-warn-common ${.IMPSRC} -o ${.TARGET}" \ no-obj no-implicit-rule \ clean "linux_locore.o" # Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/conf/kern.pre.mk Mon Sep 9 18:27:52 2019 (r352094) @@ -93,7 +93,11 @@ CFLAGS.gcc+= -fms-extensions .if defined(CFLAGS_ARCH_PARAMS) CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS} .endif -WERROR?= -Werror +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000 +WERROR?= -Wno-error +.else +WERROR?= -Werror +.endif # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} Modified: stable/12/sys/conf/kmod.mk ============================================================================== --- stable/12/sys/conf/kmod.mk Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/conf/kmod.mk Mon Sep 9 18:27:52 2019 (r352094) @@ -107,7 +107,12 @@ __KLD_SHARED=no .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) CFLAGS+= -fno-strict-aliasing .endif +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000 +WERROR?= -Wno-error +.else WERROR?= -Werror +.endif + CFLAGS+= ${WERROR} CFLAGS+= -D_KERNEL CFLAGS+= -DKLD_MODULE Modified: stable/12/sys/modules/linux/Makefile ============================================================================== --- stable/12/sys/modules/linux/Makefile Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/modules/linux/Makefile Mon Sep 9 18:27:52 2019 (r352094) @@ -55,7 +55,7 @@ linux${SFX}_assym.h: linux${SFX}_genassym.o linux${SFX}_locore.o: linux${SFX}_assym.h assym.inc ${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s \ - -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib \ + -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -nostdinc -nostdlib \ -fno-omit-frame-pointer -fPIC \ -Wl,-T${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX}/${VDSO}.lds.s \ -Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-warn-common \ Modified: stable/12/sys/modules/linux64/Makefile ============================================================================== --- stable/12/sys/modules/linux64/Makefile Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/modules/linux64/Makefile Mon Sep 9 18:27:52 2019 (r352094) @@ -31,7 +31,7 @@ linux_assym.h: linux_genassym.o linux_locore.o: linux_locore.s linux_assym.h ${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small \ - -pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -fPIC -nostdinc \ + -pipe -I. -I${SYSDIR} ${WERROR} -Wall -fno-common -fPIC -nostdinc \ -Wl,-T${SRCTOP}/sys/${MACHINE}/linux/${VDSO}.lds.s \ -Wl,-soname=${VDSO}.so.1,-warn-common -nostdlib \ ${.IMPSRC} -o ${.TARGET} Modified: stable/12/sys/powerpc/conf/MPC85XX ============================================================================== --- stable/12/sys/powerpc/conf/MPC85XX Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/powerpc/conf/MPC85XX Mon Sep 9 18:27:52 2019 (r352094) @@ -13,7 +13,6 @@ machine powerpc powerpc include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU Modified: stable/12/sys/powerpc/conf/MPC85XXSPE ============================================================================== --- stable/12/sys/powerpc/conf/MPC85XXSPE Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/powerpc/conf/MPC85XXSPE Mon Sep 9 18:27:52 2019 (r352094) @@ -13,7 +13,6 @@ machine powerpc powerpcspe include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU Modified: stable/12/sys/powerpc/conf/QORIQ64 ============================================================================== --- stable/12/sys/powerpc/conf/QORIQ64 Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/powerpc/conf/QORIQ64 Mon Sep 9 18:27:52 2019 (r352094) @@ -14,7 +14,7 @@ machine powerpc powerpc64 include "dpaa/config.dpaa" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions WITH_CTF=1 -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" +#makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" options FPU_EMU Modified: stable/12/sys/powerpc/conf/dpaa/DPAA ============================================================================== --- stable/12/sys/powerpc/conf/dpaa/DPAA Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/sys/powerpc/conf/dpaa/DPAA Mon Sep 9 18:27:52 2019 (r352094) @@ -12,7 +12,7 @@ cpu BOOKE_E500 machine powerpc powerpc #makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" +#makeoptions WERROR="-Werror -Wno-format -Wno-redundant-decls" makeoptions NO_MODULES=yes # Platform support Modified: stable/12/usr.sbin/pmcstudy/Makefile ============================================================================== --- stable/12/usr.sbin/pmcstudy/Makefile Mon Sep 9 18:20:55 2019 (r352093) +++ stable/12/usr.sbin/pmcstudy/Makefile Mon Sep 9 18:27:52 2019 (r352094) @@ -4,7 +4,7 @@ PROG= pmcstudy MAN= pmcstudy.8 SRCS= pmcstudy.c eval_expr.c -CFLAGS+= -Wall -Werror +CFLAGS+= -Wall ${WERROR} BINDIR= /usr/bin From owner-svn-src-stable@freebsd.org Mon Sep 9 18:50: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 7D0D8DBFC6; Mon, 9 Sep 2019 18:50:39 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Ry0b3Qhzz4Pqh; Mon, 9 Sep 2019 18:50:39 +0000 (UTC) (envelope-from wulf@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 59DEE19EAE; Mon, 9 Sep 2019 18:50:39 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89IodBN027180; Mon, 9 Sep 2019 18:50:39 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89IocFv027176; Mon, 9 Sep 2019 18:50:38 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201909091850.x89IocFv027176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 9 Sep 2019 18:50:38 +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: r352101 - in stable/12/sys: conf modules/netgraph/bluetooth/ubt netgraph/bluetooth/drivers/ubt X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in stable/12/sys: conf modules/netgraph/bluetooth/ubt netgraph/bluetooth/drivers/ubt X-SVN-Commit-Revision: 352101 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, 09 Sep 2019 18:50:39 -0000 Author: wulf Date: Mon Sep 9 18:50:38 2019 New Revision: 352101 URL: https://svnweb.freebsd.org/changeset/base/352101 Log: MFC r351196, r351324, r351326: ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode. Add helper function for synchronous execution of HCI commands at probe stage and use this function to check firmware state of Intel Wireless 8260/8265 bluetooth devices found in many post 2016 year laptops. Attempt to initialize FreeBSD bluetooth stack while such a device is in bootloader mode locks the adapter hardly so it requires power on/off cycle to restore. This change blocks ng_ubt attachment unless operational firmware is loaded thus preventing the lock up. PR: 237083 Reviewed by: hps, emax MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D21071 Added: stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c - copied unchanged from r351196, head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c Modified: stable/12/sys/conf/files stable/12/sys/modules/netgraph/bluetooth/ubt/Makefile stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Sep 9 18:46:28 2019 (r352100) +++ stable/12/sys/conf/files Mon Sep 9 18:50:38 2019 (r352101) @@ -4235,6 +4235,7 @@ netgraph/bluetooth/common/ng_bluetooth.c optional netg netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb +netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci Modified: stable/12/sys/modules/netgraph/bluetooth/ubt/Makefile ============================================================================== --- stable/12/sys/modules/netgraph/bluetooth/ubt/Makefile Mon Sep 9 18:46:28 2019 (r352100) +++ stable/12/sys/modules/netgraph/bluetooth/ubt/Makefile Mon Sep 9 18:50:38 2019 (r352101) @@ -7,7 +7,7 @@ CFLAGS+= -I${SRCTOP}/sys/netgraph/bluetooth/include \ -I${SRCTOP}/sys/netgraph/bluetooth/drivers/ubt KMOD= ng_ubt -SRCS= ng_ubt.c opt_bus.h opt_usb.h device_if.h bus_if.h \ - usb_if.h usbdevs.h +SRCS= ng_ubt.c ng_ubt_intel.c opt_bus.h opt_usb.h device_if.h \ + bus_if.h usb_if.h usbdevs.h .include Modified: stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Mon Sep 9 18:46:28 2019 (r352100) +++ stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Mon Sep 9 18:50:38 2019 (r352101) @@ -252,6 +252,7 @@ static struct ng_type typestruct = ****************************************************************************/ /* USB methods */ +static usb_callback_t ubt_probe_intr_callback; static usb_callback_t ubt_ctrl_write_callback; static usb_callback_t ubt_intr_read_callback; static usb_callback_t ubt_bulk_read_callback; @@ -421,6 +422,13 @@ static const STRUCT_USB_HOST_ID ubt_ignore_devs[] = /* Atheros AR5BBU12 with sflash firmware */ { USB_VPI(0x0489, 0xe03c, 0), USB_DEV_BCD_LTEQ(1) }, { USB_VPI(0x0489, 0xe036, 0), USB_DEV_BCD_LTEQ(1) }, + + /* Intel Wireless 8260 and successors are handled in ng_ubt_intel.c */ + { USB_VPI(USB_VENDOR_INTEL2, 0x0a2b, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0aaa, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0025, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0026, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0029, 0) }, }; /* List of supported bluetooth devices */ @@ -503,6 +511,79 @@ static const STRUCT_USB_HOST_ID ubt_devs[] = }; /* + * Does a synchronous (waits for completion event) execution of HCI command. + * Size of both command and response buffers are passed in length field of + * corresponding structures in "Parameter Total Length" format i.e. + * not including HCI packet headers. + * + * Must not be used after USB transfers have been configured in attach routine. + */ + +usb_error_t +ubt_do_hci_request(struct usb_device *udev, struct ubt_hci_cmd *cmd, + void *evt, usb_timeout_t timeout) +{ + static const struct usb_config ubt_probe_config = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, + .bufsize = UBT_INTR_BUFFER_SIZE, + .callback = &ubt_probe_intr_callback, + }; + struct usb_device_request req; + struct usb_xfer *xfer[1]; + struct mtx mtx; + usb_error_t error = USB_ERR_NORMAL_COMPLETION; + uint8_t iface_index = 0; + + /* Initialize a USB control request and then do it */ + bzero(&req, sizeof(req)); + req.bmRequestType = UBT_HCI_REQUEST; + req.wIndex[0] = iface_index; + USETW(req.wLength, UBT_HCI_CMD_SIZE(cmd)); + + error = usbd_do_request(udev, NULL, &req, cmd); + if (error != USB_ERR_NORMAL_COMPLETION) { + printf("ng_ubt: usbd_do_request error=%s\n", + usbd_errstr(error)); + return (error); + } + + if (evt == NULL) + return (USB_ERR_NORMAL_COMPLETION); + + /* Initialize INTR endpoint xfer and wait for response */ + mtx_init(&mtx, "ubt pb", NULL, MTX_DEF | MTX_NEW); + + error = usbd_transfer_setup(udev, &iface_index, xfer, + &ubt_probe_config, 1, evt, &mtx); + if (error == USB_ERR_NORMAL_COMPLETION) { + + mtx_lock(&mtx); + usbd_transfer_start(*xfer); + + if (msleep_sbt(evt, &mtx, 0, "ubt pb", SBT_1MS * timeout, + 0, C_HARDCLOCK) == EWOULDBLOCK) { + printf("ng_ubt: HCI command 0x%04x timed out\n", + le16toh(cmd->opcode)); + error = USB_ERR_TIMEOUT; + } + + usbd_transfer_stop(*xfer); + mtx_unlock(&mtx); + + usbd_transfer_unsetup(xfer, 1); + } else + printf("ng_ubt: usbd_transfer_setup error=%s\n", + usbd_errstr(error)); + + mtx_destroy(&mtx); + + return (error); +} + +/* * Probe for a USB Bluetooth device. * USB context. */ @@ -717,6 +798,49 @@ ubt_detach(device_t dev) return (0); } /* ubt_detach */ +/* + * Called when incoming interrupt transfer (HCI event) has completed, i.e. + * HCI event was received from the device during device probe stage. + * USB context. + */ + +static void +ubt_probe_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct ubt_hci_event *evt = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + if (actlen > UBT_HCI_EVENT_SIZE(evt)) + actlen = UBT_HCI_EVENT_SIZE(evt); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, evt, actlen); + /* OneShot mode */ + wakeup(evt); + break; + + case USB_ST_SETUP: +submit_next: + /* Try clear stall first */ + usbd_xfer_set_stall(xfer); + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + break; + + default: + if (error != USB_ERR_CANCELLED) { + printf("ng_ubt: interrupt transfer failed: %s\n", + usbd_errstr(error)); + goto submit_next; + } + break; + } +} /* ubt_probe_intr_callback */ + /* * Called when outgoing control request (HCI command) has completed, i.e. * HCI command was sent to the device. @@ -1852,7 +1976,7 @@ ubt_modevent(module_t mod, int event, void *data) return (error); } /* ubt_modevent */ -static devclass_t ubt_devclass; +devclass_t ubt_devclass; static device_method_t ubt_methods[] = { @@ -1862,7 +1986,7 @@ static device_method_t ubt_methods[] = DEVMETHOD_END }; -static driver_t ubt_driver = +driver_t ubt_driver = { .name = "ubt", .methods = ubt_methods, Copied: stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c (from r351196, head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c Mon Sep 9 18:50:38 2019 (r352101, copy of r351196, head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c) @@ -0,0 +1,161 @@ +/* + * ng_ubt_intel.c + */ + +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * Attempt to initialize FreeBSD bluetooth stack while Intel Wireless 8260/8265 + * device is in bootloader mode locks the adapter hardly so it requires power + * on/off cycle to restore. This driver blocks ng_ubt attachment until + * operational firmware is loaded by iwmbtfw utility thus avoiding the lock up. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "usbdevs.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static device_probe_t ubt_intel_probe; + +/* + * List of supported bluetooth devices. If you add a new device PID here ensure + * that it is blacklisted in ng_ubt.c and is supported by iwmbtfw utility. + */ + +static const STRUCT_USB_HOST_ID ubt_intel_devs[] = +{ + /* Intel Wireless 8260/8265 and successors */ + { USB_VPI(USB_VENDOR_INTEL2, 0x0a2b, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0aaa, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0025, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0026, 0) }, + { USB_VPI(USB_VENDOR_INTEL2, 0x0029, 0) }, +}; + +/* + * Find if the Intel Wireless 8260/8265 device is in bootloader mode or is + * running operational firmware with checking of 4-th byte "Intel version" + * HCI command response. The value 0x23 identifies the operational firmware. + */ + +static bool +ubt_intel_check_firmware_state(struct usb_device *udev) +{ +#define UBT_INTEL_VER_LEN 13 +#define UBT_INTEL_HCICMD_TIMEOUT 2000 /* ms */ + struct ubt_hci_event_command_compl *evt; + uint8_t buf[offsetof(struct ubt_hci_event, data) + UBT_INTEL_VER_LEN]; + static struct ubt_hci_cmd cmd = { + .opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_VENDOR, 0x05)), + .length = 0, + }; + usb_error_t error; + + bzero(buf, sizeof(buf)); + evt = (struct ubt_hci_event_command_compl *)buf; + evt->header.length = UBT_INTEL_VER_LEN; + + error = ubt_do_hci_request(udev, &cmd, evt, UBT_INTEL_HCICMD_TIMEOUT); + if (error != USB_ERR_NORMAL_COMPLETION) + return false; + + return (evt->header.event == NG_HCI_EVENT_COMMAND_COMPL && + evt->header.length == UBT_INTEL_VER_LEN && + evt->data[4] == 0x23); +} + +/* + * Probe for a Intel Wireless Bluetooth device. + */ + +static int +ubt_intel_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + int error; + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + + if (uaa->info.bIfaceIndex != 0) + return (ENXIO); + + error = usbd_lookup_id_by_uaa(ubt_intel_devs, sizeof(ubt_intel_devs), + uaa); + if (error != 0) + return (error); + + if (!ubt_intel_check_firmware_state(uaa->device)) + return (ENXIO); + + return (BUS_PROBE_DEFAULT); +} + +/* + * Module interface. Attach and detach methods, netgraph node type + * registration and PNP string are inherited from ng_ubt.c driver. + */ + +static device_method_t ubt_intel_methods[] = +{ + DEVMETHOD(device_probe, ubt_intel_probe), + DEVMETHOD_END +}; + +static kobj_class_t ubt_baseclasses[] = { &ubt_driver, NULL }; +static driver_t ubt_intel_driver = +{ + .name = "ubt", + .methods = ubt_intel_methods, + .size = sizeof(struct ubt_softc), + .baseclasses = ubt_baseclasses, +}; + +DRIVER_MODULE(ng_ubt_intel, uhub, ubt_intel_driver, ubt_devclass, 0, 0); +MODULE_VERSION(ng_ubt_intel, NG_BLUETOOTH_VERSION); +MODULE_DEPEND(ng_ubt_intel, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); +MODULE_DEPEND(ng_ubt_intel, ng_hci, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); +MODULE_DEPEND(ng_ubt_intel, usb, 1, 1, 1); Modified: stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h ============================================================================== --- stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Mon Sep 9 18:46:28 2019 (r352100) +++ stable/12/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h Mon Sep 9 18:50:38 2019 (r352101) @@ -74,6 +74,35 @@ enum { UBT_N_TRANSFER, /* total number of transfers */ }; +/* USB control request (HCI command) structure */ +struct ubt_hci_cmd { + uint16_t opcode; + uint8_t length; + uint8_t data[]; +} __attribute__ ((packed)); +#define UBT_HCI_CMD_SIZE(cmd) \ + ((cmd)->length + offsetof(struct ubt_hci_cmd, data)) + +/* USB interrupt transfer HCI event header structure */ +struct ubt_hci_evhdr { + uint8_t event; + uint8_t length; +} __attribute__ ((packed)); +/* USB interrupt transfer (generic HCI event) structure */ +struct ubt_hci_event { + struct ubt_hci_evhdr header; + uint8_t data[]; +} __attribute__ ((packed)); +/* USB interrupt transfer (HCI command completion event) structure */ +struct ubt_hci_event_command_compl { + struct ubt_hci_evhdr header; + uint8_t numpkt; + uint16_t opcode; + uint8_t data[]; +} __attribute__ ((packed)); +#define UBT_HCI_EVENT_SIZE(evt) \ + ((evt)->header.length + offsetof(struct ubt_hci_event, data)) + /* USB device softc structure */ struct ubt_softc { device_t sc_dev; /* for debug printf */ @@ -128,6 +157,12 @@ struct ubt_softc { }; typedef struct ubt_softc ubt_softc_t; typedef struct ubt_softc * ubt_softc_p; + +usb_error_t ubt_do_hci_request(struct usb_device *, struct ubt_hci_cmd *, + void *, usb_timeout_t); + +extern devclass_t ubt_devclass; +extern driver_t ubt_driver; #endif /* ndef _NG_UBT_VAR_H_ */ From owner-svn-src-stable@freebsd.org Mon Sep 9 18:57: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 B81FDDC205; Mon, 9 Sep 2019 18:57:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Ry8G4Rqqz4QDQ; Mon, 9 Sep 2019 18:57:18 +0000 (UTC) (envelope-from wulf@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 7BB091A081; Mon, 9 Sep 2019 18:57:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89IvIqY032211; Mon, 9 Sep 2019 18:57:18 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89IvHoV032206; Mon, 9 Sep 2019 18:57:17 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201909091857.x89IvHoV032206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Mon, 9 Sep 2019 18:57:17 +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: r352102 - in stable/12: targets/pseudo/userland tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/iwmbtfw X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: in stable/12: targets/pseudo/userland tools/build/mk usr.sbin/bluetooth usr.sbin/bluetooth/iwmbtfw X-SVN-Commit-Revision: 352102 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, 09 Sep 2019 18:57:18 -0000 Author: wulf Date: Mon Sep 9 18:57:17 2019 New Revision: 352102 URL: https://svnweb.freebsd.org/changeset/base/352102 Log: MFC r351197, r351199: iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices Currently supported models are: 8260, 8265, 9560, 9260 and 22161. Firmware files can be installed with comms/iwmbt-firmware port. PR: 237083 Reviewed by: hps, emax Differential Revision: https://reviews.freebsd.org/D21071 Added: stable/12/usr.sbin/bluetooth/iwmbtfw/ - copied from r351197, head/usr.sbin/bluetooth/iwmbtfw/ Modified: stable/12/targets/pseudo/userland/Makefile.depend stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.sbin/bluetooth/Makefile stable/12/usr.sbin/bluetooth/iwmbtfw/Makefile stable/12/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Directory Properties: stable/12/ (props changed) Modified: stable/12/targets/pseudo/userland/Makefile.depend ============================================================================== --- stable/12/targets/pseudo/userland/Makefile.depend Mon Sep 9 18:50:38 2019 (r352101) +++ stable/12/targets/pseudo/userland/Makefile.depend Mon Sep 9 18:57:17 2019 (r352102) @@ -443,6 +443,7 @@ DIRDEPS+= \ usr.sbin/bluetooth/hccontrol \ usr.sbin/bluetooth/hcsecd \ usr.sbin/bluetooth/hcseriald \ + usr.sbin/bluetooth/iwmbtfw \ usr.sbin/bluetooth/l2control \ usr.sbin/bluetooth/l2ping \ usr.sbin/bluetooth/rfcomm_pppd \ Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 9 18:50:38 2019 (r352101) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Mon Sep 9 18:57:17 2019 (r352102) @@ -459,6 +459,7 @@ OLD_FILES+=etc/bluetooth/hcsecd.conf OLD_FILES+=etc/bluetooth/hosts OLD_FILES+=etc/bluetooth/protocols OLD_FILES+=etc/defaults/bluetooth.device.conf +OLD_FILES+=etc/devd/iwmbtfw.conf OLD_DIRS+=etc/bluetooth OLD_FILES+=etc/rc.d/bluetooth OLD_FILES+=etc/rc.d/bthidd @@ -512,6 +513,7 @@ OLD_FILES+=usr/sbin/btpand OLD_FILES+=usr/sbin/hccontrol OLD_FILES+=usr/sbin/hcsecd OLD_FILES+=usr/sbin/hcseriald +OLD_FILES+=usr/sbin/iwmbtfw OLD_FILES+=usr/sbin/l2control OLD_FILES+=usr/sbin/l2ping OLD_FILES+=usr/sbin/rfcomm_pppd @@ -589,6 +591,7 @@ OLD_FILES+=usr/share/man/man8/btpand.8.gz OLD_FILES+=usr/share/man/man8/hccontrol.8.gz OLD_FILES+=usr/share/man/man8/hcsecd.8.gz OLD_FILES+=usr/share/man/man8/hcseriald.8.gz +OLD_FILES+=usr/share/man/man8/iwmbtfw.8.gz OLD_FILES+=usr/share/man/man8/l2control.8.gz OLD_FILES+=usr/share/man/man8/l2ping.8.gz OLD_FILES+=usr/share/man/man8/rfcomm_pppd.8.gz Modified: stable/12/usr.sbin/bluetooth/Makefile ============================================================================== --- stable/12/usr.sbin/bluetooth/Makefile Mon Sep 9 18:50:38 2019 (r352101) +++ stable/12/usr.sbin/bluetooth/Makefile Mon Sep 9 18:57:17 2019 (r352102) @@ -21,6 +21,7 @@ SUBDIR+= ath3kfw SUBDIR+= bcmfw SUBDIR+= bthidcontrol SUBDIR+= bthidd +SUBDIR+= iwmbtfw .endif .include Modified: stable/12/usr.sbin/bluetooth/iwmbtfw/Makefile ============================================================================== --- head/usr.sbin/bluetooth/iwmbtfw/Makefile Sun Aug 18 22:20:28 2019 (r351197) +++ stable/12/usr.sbin/bluetooth/iwmbtfw/Makefile Mon Sep 9 18:57:17 2019 (r352102) @@ -1,6 +1,5 @@ # $FreeBSD$ -PACKAGE= bluetooth CONFS= iwmbtfw.conf CONFSDIR= /etc/devd PROG= iwmbtfw Modified: stable/12/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c ============================================================================== --- head/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Sun Aug 18 22:20:28 2019 (r351197) +++ stable/12/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c Mon Sep 9 18:57:17 2019 (r352102) @@ -68,7 +68,7 @@ iwmbt_send_fragment(struct libusb_device_handle *hdl, &transferred, timeout); - if (ret < 0 || transferred != IWMBT_HCI_CMD_SIZE(cmd)) { + if (ret < 0 || transferred != (int)IWMBT_HCI_CMD_SIZE(cmd)) { iwmbt_err("libusb_bulk_transfer() failed: err=%s, size=%zu", libusb_strerror(ret), IWMBT_HCI_CMD_SIZE(cmd)); From owner-svn-src-stable@freebsd.org Mon Sep 9 20:04:46 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 65F97DEBCF; Mon, 9 Sep 2019 20:04:46 +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 46Rzf61v6bz4YWh; Mon, 9 Sep 2019 20:04:46 +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 2572F1AD5D; Mon, 9 Sep 2019 20:04:46 +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 x89K4kwr078790; Mon, 9 Sep 2019 20:04:46 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89K4kvA078789; Mon, 9 Sep 2019 20:04:46 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909092004.x89K4kvA078789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Sep 2019 20:04:46 +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: r352106 - stable/12/usr.bin/ar X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/usr.bin/ar X-SVN-Commit-Revision: 352106 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, 09 Sep 2019 20:04:46 -0000 Author: emaste Date: Mon Sep 9 20:04:45 2019 New Revision: 352106 URL: https://svnweb.freebsd.org/changeset/base/352106 Log: MFC r351663: ar: use more correct size_t type for loop index Submitted by: cem Modified: stable/12/usr.bin/ar/write.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/ar/write.c ============================================================================== --- stable/12/usr.bin/ar/write.c Mon Sep 9 19:58:46 2019 (r352105) +++ stable/12/usr.bin/ar/write.c Mon Sep 9 20:04:45 2019 (r352106) @@ -615,9 +615,9 @@ write_objs(struct bsdar *bsdar) size_t s_sz; /* size of archive symbol table. */ size_t pm_sz; /* size of pseudo members */ size_t w_sz; /* size of words in symbol table */ + size_t i; uint64_t nr; uint32_t nr32; - int i; if (elf_version(EV_CURRENT) == EV_NONE) bsdar_errc(bsdar, EX_SOFTWARE, 0, @@ -671,7 +671,7 @@ write_objs(struct bsdar *bsdar) bsdar->s_sn_sz; pm_sz += s_sz; /* Convert to big-endian. */ - for (i = 0; (size_t)i < bsdar->s_cnt; i++) + for (i = 0; i < bsdar->s_cnt; i++) bsdar->s_so[i] = htobe64(bsdar->s_so[i] + pm_sz); } else { @@ -679,7 +679,7 @@ write_objs(struct bsdar *bsdar) * Convert to big-endian and shuffle in-place to * the front of the allocation. XXX UB */ - for (i = 0; (size_t)i < bsdar->s_cnt; i++) + for (i = 0; i < bsdar->s_cnt; i++) ((uint32_t *)(bsdar->s_so))[i] = htobe32(bsdar->s_so[i] + pm_sz); } From owner-svn-src-stable@freebsd.org Mon Sep 9 20:49:38 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 7AAA3E0E90; Mon, 9 Sep 2019 20:49:38 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46S0dt2f35z4d8c; Mon, 9 Sep 2019 20:49:38 +0000 (UTC) (envelope-from scottph@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 3E5021B4E4; Mon, 9 Sep 2019 20:49:38 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89KncsN003634; Mon, 9 Sep 2019 20:49:38 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89Knb5L003633; Mon, 9 Sep 2019 20:49:37 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201909092049.x89Knb5L003633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Mon, 9 Sep 2019 20:49: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: r352108 - in stable/12/sys/dev: acpica nvdimm X-SVN-Group: stable-12 X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: in stable/12/sys/dev: acpica nvdimm X-SVN-Commit-Revision: 352108 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, 09 Sep 2019 20:49:38 -0000 Author: scottph Date: Mon Sep 9 20:49:37 2019 New Revision: 352108 URL: https://svnweb.freebsd.org/changeset/base/352108 Log: MFC 348757,351225: acpi and nvdimm location_str updates 348757: nvdimm: Provide nvdimm location information Provide the acpi handle path as the location string for the nvdimm children of the nvdimm_root device. 351225: Don't set the string "unknown" as a device's location_str Return an empty string when the location is unknown instead of the string "unknown". This ensures that all location entries are of the form key=val. Approved by: scottl (mentor) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D20644 Modified: stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/nvdimm/nvdimm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi.c Mon Sep 9 20:48:12 2019 (r352107) +++ stable/12/sys/dev/acpica/acpi.c Mon Sep 9 20:49:37 2019 (r352108) @@ -869,7 +869,7 @@ acpi_child_location_str_method(device_t cbdev, device_ strlcat(buf, buf2, buflen); } } else { - snprintf(buf, buflen, "unknown"); + snprintf(buf, buflen, ""); } return (0); } Modified: stable/12/sys/dev/nvdimm/nvdimm.c ============================================================================== --- stable/12/sys/dev/nvdimm/nvdimm.c Mon Sep 9 20:48:12 2019 (r352107) +++ stable/12/sys/dev/nvdimm/nvdimm.c Mon Sep 9 20:49:37 2019 (r352108) @@ -560,6 +560,24 @@ nvdimm_root_write_ivar(device_t dev, device_t child, i return (0); } +static int +nvdimm_root_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + ACPI_HANDLE handle; + int res; + + handle = nvdimm_root_get_acpi_handle(child); + if (handle != NULL) + res = snprintf(buf, buflen, "handle=%s", acpi_name(handle)); + else + res = snprintf(buf, buflen, ""); + + if (res >= buflen) + return (EOVERFLOW); + return (0); +} + static device_method_t nvdimm_methods[] = { DEVMETHOD(device_probe, nvdimm_probe), DEVMETHOD(device_attach, nvdimm_attach), @@ -582,6 +600,7 @@ static device_method_t nvdimm_root_methods[] = { DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar), DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar), + DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str), DEVMETHOD_END }; From owner-svn-src-stable@freebsd.org Mon Sep 9 21:03: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 F1A3FE1361; Mon, 9 Sep 2019 21:03:08 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46S0xS60xDz4dqZ; Mon, 9 Sep 2019 21:03:08 +0000 (UTC) (envelope-from scottph@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 B19C91B868; Mon, 9 Sep 2019 21:03:08 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89L38gT015278; Mon, 9 Sep 2019 21:03:08 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89L38h1015277; Mon, 9 Sep 2019 21:03:08 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <201909092103.x89L38h1015277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Mon, 9 Sep 2019 21:03: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: r352109 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 352109 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, 09 Sep 2019 21:03:09 -0000 Author: scottph Date: Mon Sep 9 21:03:08 2019 New Revision: 352109 URL: https://svnweb.freebsd.org/changeset/base/352109 Log: MFC 351897: nvdimm(4): Add description of NVDIMM Namespace support Approved by: scottl (mentor) Sponsored by: Intel Corporation Modified: stable/12/share/man/man4/nvdimm.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/nvdimm.4 ============================================================================== --- stable/12/share/man/man4/nvdimm.4 Mon Sep 9 20:49:37 2019 (r352108) +++ stable/12/share/man/man4/nvdimm.4 Mon Sep 9 21:03:08 2019 (r352109) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 23, 2019 +.Dd September 5, 2019 .Dt NVDIMM 4 .Os .Sh NAME @@ -75,7 +75,7 @@ the device. .Pp Also, for each SPA, the geom provider .Pa spaNNN -is created, which can be used to create a conventional filesystem (e.g. +is created, which can be used to create a conventional filesystem (e.g., by .Xr newfs 8 ) and @@ -86,6 +86,18 @@ Content accessible by and .Pa /dev/spaNNN is coherent. +.Pp +The +.Nm +driver has support for reading NVDIMM namespaces (if supported by your +hardware and already configured by some other mechanism, e.g., a BIOS +configuration screen). +The driver will provide a +.Pa /dev/nvdimm_spaNNNnsMMM +device node and +.Pa spaNNNnsMMM +geom provider for each namespace in a SPA, which behave analogously to their +full-SPA cousins described above. .Sh SEE ALSO .Xr ACPI 4 , .Xr GEOM 4 , From owner-svn-src-stable@freebsd.org Tue Sep 10 02:21: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 D4983EAD5C; Tue, 10 Sep 2019 02:21:18 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46S80Z51sLz3Dyj; Tue, 10 Sep 2019 02:21:18 +0000 (UTC) (envelope-from johalun@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 8FCD01F1AD; Tue, 10 Sep 2019 02:21:18 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8A2LI9f000740; Tue, 10 Sep 2019 02:21:18 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8A2LHD4000737; Tue, 10 Sep 2019 02:21:17 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909100221.x8A2LHD4000737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Tue, 10 Sep 2019 02:21:17 +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: r352114 - in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 352114 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, 10 Sep 2019 02:21:18 -0000 Author: johalun Date: Tue Sep 10 02:21:17 2019 New Revision: 352114 URL: https://svnweb.freebsd.org/changeset/base/352114 Log: MFC r351937: LinuxKPI: Improve sysfs support. - Add functions for creating and merging sysfs groups. - Add sysfs_streq function to compare strings ignoring newline from the sysctl userland call. - Add a call to sysfs_create_groups in device_add. - Remove duplicate header include. - Bump __FreeBSD_version. Reviewed by: hselasky Approved by: imp (mentor), hselasky Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/device.h Tue Sep 10 01:56:47 2019 (r352113) +++ stable/12/sys/compat/linuxkpi/common/include/linux/device.h Tue Sep 10 02:21:17 2019 (r352114) @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -316,6 +315,10 @@ device_add(struct device *dev) dev->devt = makedev(0, device_get_unit(dev->bsddev)); } kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); + + if (dev->groups) + return (sysfs_create_groups(&dev->kobj, dev->groups)); + return (0); } Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Tue Sep 10 01:56:47 2019 (r352113) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sysfs.h Tue Sep 10 02:21:17 2019 (r352114) @@ -175,6 +175,27 @@ sysfs_remove_files(struct kobject *kobj, const struct sysfs_remove_file(kobj, attrs[i]); } +static inline int +sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) +{ + struct attribute **attr; + struct sysctl_oid *oidp; + + /* Don't create the group node if grp->name is undefined. */ + if (grp->name) + oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp), + OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name); + else + oidp = kobj->oidp; + for (attr = grp->attrs; *attr != NULL; attr++) { + SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, + (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, + kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", ""); + } + + return (0); +} + static inline void sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp) { @@ -184,20 +205,40 @@ sysfs_remove_group(struct kobject *kobj, const struct } static inline int -sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) +sysfs_create_groups(struct kobject *kobj, const struct attribute_group **grps) { + int error = 0; + int i; + + for (i = 0; grps[i] && !error; i++) + error = sysfs_create_group(kobj, grps[i]); + while (error && --i >= 0) + sysfs_remove_group(kobj, grps[i]); + + return (error); +} + +static inline int +sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp) +{ + + /* Really expected behavior is to return failure if group exists. */ + return (sysfs_create_group(kobj, grp)); +} + +static inline void +sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp) +{ struct attribute **attr; struct sysctl_oid *oidp; - oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp), - OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name); - for (attr = grp->attrs; *attr != NULL; attr++) { - SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO, - (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE, - kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", ""); + SLIST_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp), oid_link) { + if (strcmp(oidp->oid_name, grp->name) != 0) + continue; + for (attr = grp->attrs; *attr != NULL; attr++) { + sysctl_remove_name(oidp, (*attr)->name, 1, 1); + } } - - return (0); } static inline int @@ -222,6 +263,22 @@ sysfs_remove_dir(struct kobject *kobj) if (kobj->oidp == NULL) return; sysctl_remove_oid(kobj->oidp, 1, 1); +} + +static inline bool +sysfs_streq(const char *s1, const char *s2) +{ + int l1, l2; + + l1 = strlen(s1); + l2 = strlen(s2); + + if (l1 != 0 && s1[l1-1] == '\n') + l1--; + if (l2 != 0 && s2[l2-1] == '\n') + l2--; + + return (l1 == l2 && strncmp(s1, s2, l1) == 0); } #define sysfs_attr_init(attr) do {} while(0) Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Tue Sep 10 01:56:47 2019 (r352113) +++ stable/12/sys/sys/param.h Tue Sep 10 02:21:17 2019 (r352114) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200517 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200518 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Tue Sep 10 06:45:46 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 D20B1F350E; Tue, 10 Sep 2019 06:45:46 +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 46SFsk56cjz40mn; Tue, 10 Sep 2019 06:45:46 +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 8F2DB2237E; Tue, 10 Sep 2019 06:45:46 +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 x8A6jklL060875; Tue, 10 Sep 2019 06:45:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8A6jilL060867; Tue, 10 Sep 2019 06:45:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909100645.x8A6jilL060867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Sep 2019 06:45:44 +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: r352117 - in stable/12: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm X-SVN-Commit-Revision: 352117 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, 10 Sep 2019 06:45:46 -0000 Author: kib Date: Tue Sep 10 06:45:44 2019 New Revision: 352117 URL: https://svnweb.freebsd.org/changeset/base/352117 Log: MFC r351773: Add procctl(PROC_STACKGAP_CTL). PR: 239894 Modified: stable/12/lib/libc/sys/procctl.2 stable/12/sys/compat/freebsd32/freebsd32_misc.c stable/12/sys/kern/kern_exec.c stable/12/sys/kern/kern_fork.c stable/12/sys/kern/kern_procctl.c stable/12/sys/sys/proc.h stable/12/sys/sys/procctl.h stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/procctl.2 ============================================================================== --- stable/12/lib/libc/sys/procctl.2 Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/lib/libc/sys/procctl.2 Tue Sep 10 06:45:44 2019 (r352117) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2019 +.Dd August 31, 2019 .Dt PROCCTL 2 .Os .Sh NAME @@ -462,6 +462,67 @@ must point to a memory location that can hold a value .Vt int . If signal delivery has not been requested, it will contain zero on return. +.It Dv PROC_STACKGAP_CTL +Controls the stack gaps in the specified process. +A stack gap is the part of the growth area for a +.Dv MAP_STACK +mapped region that is reserved and never filled by memory. +Instead, the process is guaranteed to receive a +.Dv SIGSEGV +signal on accessing pages in the gap. +Gaps protect against stack overflow corrupting memory adjacent +to the stack. +.Pp +The +.Fa data +argument must point to an integer variable containing flags. +The following flags are allowed: +.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC +.It Dv PROC_STACKGAP_ENABLE +This flag is only accepted for consistency with +.Dv PROC_STACKGAP_STATUS . +If stack gaps are enabled, the flag is ignored. +If disabled, the flag causes an +.Ev EINVAL +error to be returned. +After gaps are disabled in a process, they can only be re-enabled when an +.Xr execve 2 +is performed. +.It Dv PROC_STACKGAP_DISABLE +Disable stack gaps for the process. +For existing stacks, the gap is no longer a reserved part of the growth +area and can be filled by memory on access. +.It Dv PROC_STACKGAP_ENABLE_EXEC +Enable stack gaps for programs started after an +.Xr execve 2 +by the specified process. +.It Dv PROC_STACKGAP_DISABLE_EXEC +Inherit disabled stack gaps state after +.Xr execve 2 . +In other words, if the currently executing program has stack gaps disabled, +they are kept disabled on exec. +If gaps were enabled, they are kept enabled after exec. +.El +.Pp +The stack gap state is inherited from the parent on +.Xr fork 2 . +.It Dv PROC_STACKGAP_STATUS +Returns the current stack gap state for the specified process. +.Fa data +must point to an integer variable, which is used to return a bitmask +consisting of the following flags: +.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC +.It Dv PROC_STACKGAP_ENABLE +Stack gaps are enabled. +.It Dv PROC_STACKGAP_DISABLE +Stack gaps are disabled. +.It Dv PROC_STACKGAP_ENABLE_EXEC +Stack gaps are enabled in the process after +.Xr execve 2 . +.It Dv PROC_STACKGAP_DISABLE_EXEC +Stack gaps are disabled in the process after +.Xr execve 2 . +.El .El .Sh NOTES Disabling tracing on a process should not be considered a security Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_misc.c Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/compat/freebsd32/freebsd32_misc.c Tue Sep 10 06:45:44 2019 (r352117) @@ -3360,6 +3360,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ switch (uap->com) { case PROC_ASLR_CTL: case PROC_SPROTECT: + case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: error = copyin(PTRIN(uap->data), &flags, sizeof(flags)); @@ -3391,6 +3392,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ data = &x.rk; break; case PROC_ASLR_STATUS: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: data = &flags; @@ -3420,6 +3422,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ error = error1; break; case PROC_ASLR_STATUS: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: if (error == 0) Modified: stable/12/sys/kern/kern_exec.c ============================================================================== --- stable/12/sys/kern/kern_exec.c Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/kern/kern_exec.c Tue Sep 10 06:45:44 2019 (r352117) @@ -756,6 +756,8 @@ interpret: p->p_flag |= P_EXEC; if ((p->p_flag2 & P2_NOTRACE_EXEC) == 0) p->p_flag2 &= ~P2_NOTRACE; + if ((p->p_flag2 & P2_STKGAP_DISABLE_EXEC) == 0) + p->p_flag2 &= ~P2_STKGAP_DISABLE; if (p->p_flag & P_PPWAIT) { p->p_flag &= ~(P_PPWAIT | P_PPTRACE); cv_broadcast(&p->p_pwait); Modified: stable/12/sys/kern/kern_fork.c ============================================================================== --- stable/12/sys/kern/kern_fork.c Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/kern/kern_fork.c Tue Sep 10 06:45:44 2019 (r352117) @@ -508,7 +508,9 @@ do_fork(struct thread *td, struct fork_req *fr, struct */ p2->p_flag = P_INMEM; p2->p_flag2 = p1->p_flag2 & (P2_ASLR_DISABLE | P2_ASLR_ENABLE | - P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | P2_TRAPCAP); + P2_ASLR_IGNSTART | P2_NOTRACE | P2_NOTRACE_EXEC | + P2_TRAPCAP | + P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); Modified: stable/12/sys/kern/kern_procctl.c ============================================================================== --- stable/12/sys/kern/kern_procctl.c Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/kern/kern_procctl.c Tue Sep 10 06:45:44 2019 (r352117) @@ -474,6 +474,55 @@ aslr_status(struct thread *td, struct proc *p, int *da return (0); } +static int +stackgap_ctl(struct thread *td, struct proc *p, int state) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + if ((state & ~(PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE | + PROC_STACKGAP_ENABLE_EXEC | PROC_STACKGAP_DISABLE_EXEC)) != 0) + return (EINVAL); + switch (state & (PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE)) { + case PROC_STACKGAP_ENABLE: + if ((p->p_flag2 & P2_STKGAP_DISABLE) != 0) + return (EINVAL); + break; + case PROC_STACKGAP_DISABLE: + p->p_flag2 |= P2_STKGAP_DISABLE; + break; + case 0: + break; + default: + return (EINVAL); + } + switch (state & (PROC_STACKGAP_ENABLE_EXEC | + PROC_STACKGAP_DISABLE_EXEC)) { + case PROC_STACKGAP_ENABLE_EXEC: + p->p_flag2 &= ~P2_STKGAP_DISABLE_EXEC; + break; + case PROC_STACKGAP_DISABLE_EXEC: + p->p_flag2 |= P2_STKGAP_DISABLE_EXEC; + break; + case 0: + break; + default: + return (EINVAL); + } + return (0); +} + +static int +stackgap_status(struct thread *td, struct proc *p, int *data) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + *data = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : + PROC_STACKGAP_ENABLE; + *data |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? + PROC_STACKGAP_DISABLE_EXEC : PROC_STACKGAP_ENABLE_EXEC; + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct procctl_args { idtype_t idtype; @@ -501,6 +550,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua switch (uap->com) { case PROC_ASLR_CTL: case PROC_SPROTECT: + case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: error = copyin(uap->data, &flags, sizeof(flags)); @@ -530,6 +580,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua data = &x.rk; break; case PROC_ASLR_STATUS: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: data = &flags; @@ -558,6 +609,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua error = error1; break; case PROC_ASLR_STATUS: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: if (error == 0) @@ -583,6 +635,10 @@ kern_procctl_single(struct thread *td, struct proc *p, return (aslr_status(td, p, data)); case PROC_SPROTECT: return (protect_set(td, p, *(int *)data)); + case PROC_STACKGAP_CTL: + return (stackgap_ctl(td, p, *(int *)data)); + case PROC_STACKGAP_STATUS: + return (stackgap_status(td, p, data)); case PROC_REAP_ACQUIRE: return (reap_acquire(td, p)); case PROC_REAP_RELEASE: @@ -623,6 +679,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t case PROC_REAP_STATUS: case PROC_REAP_GETPIDS: case PROC_REAP_KILL: + case PROC_STACKGAP_CTL: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_PDEATHSIG_CTL: @@ -669,6 +727,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t break; case PROC_ASLR_CTL: case PROC_ASLR_STATUS: + case PROC_STACKGAP_CTL: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: tree_locked = false; Modified: stable/12/sys/sys/proc.h ============================================================================== --- stable/12/sys/sys/proc.h Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/sys/proc.h Tue Sep 10 06:45:44 2019 (r352117) @@ -763,6 +763,8 @@ struct proc { #define P2_ASLR_ENABLE 0x00000040 /* Force enable ASLR. */ #define P2_ASLR_DISABLE 0x00000080 /* Force disable ASLR. */ #define P2_ASLR_IGNSTART 0x00000100 /* Enable ASLR to consume sbrk area. */ +#define P2_STKGAP_DISABLE 0x00000800 /* Disable stack gap for MAP_STACK */ +#define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ Modified: stable/12/sys/sys/procctl.h ============================================================================== --- stable/12/sys/sys/procctl.h Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/sys/procctl.h Tue Sep 10 06:45:44 2019 (r352117) @@ -59,6 +59,8 @@ #define PROC_PDEATHSIG_STATUS 12 /* get parent death signal */ #define PROC_ASLR_CTL 13 /* en/dis ASLR */ #define PROC_ASLR_STATUS 14 /* query ASLR status */ +#define PROC_STACKGAP_CTL 17 /* en/dis stack gap on MAP_STACK */ +#define PROC_STACKGAP_STATUS 18 /* query stack gap */ /* Operations for PROC_SPROTECT (passed in integer arg). */ #define PPROT_OP(x) ((x) & 0xf) @@ -126,6 +128,11 @@ struct procctl_reaper_kill { #define PROC_ASLR_FORCE_DISABLE 2 #define PROC_ASLR_NOFORCE 3 #define PROC_ASLR_ACTIVE 0x80000000 + +#define PROC_STACKGAP_ENABLE 0x0001 +#define PROC_STACKGAP_DISABLE 0x0002 +#define PROC_STACKGAP_ENABLE_EXEC 0x0004 +#define PROC_STACKGAP_DISABLE_EXEC 0x0008 #ifndef _KERNEL __BEGIN_DECLS Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Tue Sep 10 04:21:48 2019 (r352116) +++ stable/12/sys/vm/vm_map.c Tue Sep 10 06:45:44 2019 (r352117) @@ -4102,7 +4102,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, addrbos + max_ssize > vm_map_max(map) || addrbos + max_ssize <= addrbos) return (KERN_INVALID_ADDRESS); - sgp = (vm_size_t)stack_guard_page * PAGE_SIZE; + sgp = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + (vm_size_t)stack_guard_page * PAGE_SIZE; if (sgp >= max_ssize) return (KERN_INVALID_ARGUMENT); @@ -4153,6 +4154,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, ("new entry lacks MAP_ENTRY_GROWS_UP")); + if (gap_bot == gap_top) + return (KERN_SUCCESS); rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); @@ -4236,7 +4239,8 @@ retry: } else { return (KERN_FAILURE); } - guard = gap_entry->next_read; + guard = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); From owner-svn-src-stable@freebsd.org Tue Sep 10 06:47: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 F288CF3673; Tue, 10 Sep 2019 06:47:40 +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 46SFvw68Yfz40yx; Tue, 10 Sep 2019 06:47:40 +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 9C6D02238D; Tue, 10 Sep 2019 06:47:40 +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 x8A6leC3061036; Tue, 10 Sep 2019 06:47:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8A6leDt061035; Tue, 10 Sep 2019 06:47:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909100647.x8A6leDt061035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Sep 2019 06:47: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: r352118 - stable/12/usr.bin/proccontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/usr.bin/proccontrol X-SVN-Commit-Revision: 352118 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, 10 Sep 2019 06:47:41 -0000 Author: kib Date: Tue Sep 10 06:47:40 2019 New Revision: 352118 URL: https://svnweb.freebsd.org/changeset/base/352118 Log: MFC r351774: Add stackgap control mode to proccontrol(1). PR: 239894 Modified: stable/12/usr.bin/proccontrol/proccontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/proccontrol/proccontrol.c ============================================================================== --- stable/12/usr.bin/proccontrol/proccontrol.c Tue Sep 10 06:45:44 2019 (r352117) +++ stable/12/usr.bin/proccontrol/proccontrol.c Tue Sep 10 06:47:40 2019 (r352118) @@ -43,6 +43,7 @@ enum { MODE_INVALID, MODE_TRACE, MODE_TRAPCAP, + MODE_STACKGAP, #ifdef PROC_KPTI_CTL MODE_KPTI, #endif @@ -72,8 +73,8 @@ static void __dead2 usage(void) { - fprintf(stderr, "Usage: proccontrol -m (aslr|trace|trapcap" - KPTI_USAGE") [-q] " + fprintf(stderr, "Usage: proccontrol -m (aslr|trace|trapcap|" + "stackgap"KPTI_USAGE") [-q] " "[-s (enable|disable)] [-p pid | command]\n"); exit(1); } @@ -98,6 +99,8 @@ main(int argc, char *argv[]) mode = MODE_TRACE; else if (strcmp(optarg, "trapcap") == 0) mode = MODE_TRAPCAP; + else if (strcmp(optarg, "stackgap") == 0) + mode = MODE_STACKGAP; #ifdef PROC_KPTI_CTL else if (strcmp(optarg, "kpti") == 0) mode = MODE_KPTI; @@ -147,6 +150,9 @@ main(int argc, char *argv[]) case MODE_TRAPCAP: error = procctl(P_PID, pid, PROC_TRAPCAP_STATUS, &arg); break; + case MODE_STACKGAP: + error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, &arg); + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: error = procctl(P_PID, pid, PROC_KPTI_STATUS, &arg); @@ -194,6 +200,26 @@ main(int argc, char *argv[]) break; } break; + case MODE_STACKGAP: + switch (arg & (PROC_STACKGAP_ENABLE | + PROC_STACKGAP_DISABLE)) { + case PROC_STACKGAP_ENABLE: + printf("enabled\n"); + break; + case PROC_STACKGAP_DISABLE: + printf("disabled\n"); + break; + } + switch (arg & (PROC_STACKGAP_ENABLE_EXEC | + PROC_STACKGAP_DISABLE_EXEC)) { + case PROC_STACKGAP_ENABLE_EXEC: + printf("enabled after exec\n"); + break; + case PROC_STACKGAP_DISABLE_EXEC: + printf("disabled after exec\n"); + break; + } + break; #ifdef PROC_KPTI_CTL case MODE_KPTI: switch (arg & ~PROC_KPTI_STATUS_ACTIVE) { @@ -227,6 +253,12 @@ main(int argc, char *argv[]) arg = enable ? PROC_TRAPCAP_CTL_ENABLE : PROC_TRAPCAP_CTL_DISABLE; error = procctl(P_PID, pid, PROC_TRAPCAP_CTL, &arg); + break; + case MODE_STACKGAP: + arg = enable ? PROC_STACKGAP_ENABLE_EXEC : + (PROC_STACKGAP_DISABLE | + PROC_STACKGAP_DISABLE_EXEC); + error = procctl(P_PID, pid, PROC_STACKGAP_CTL, &arg); break; #ifdef PROC_KPTI_CTL case MODE_KPTI: From owner-svn-src-stable@freebsd.org Tue Sep 10 07:29: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 ED97EF4C20; Tue, 10 Sep 2019 07:29:23 +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 46SGr362G9z44Gs; Tue, 10 Sep 2019 07:29:23 +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 B267D22B3D; Tue, 10 Sep 2019 07:29:23 +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 x8A7TNOB085578; Tue, 10 Sep 2019 07:29:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8A7TMlL085569; Tue, 10 Sep 2019 07:29:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909100729.x8A7TMlL085569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Sep 2019 07:29:22 +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: r352125 - in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm X-SVN-Commit-Revision: 352125 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, 10 Sep 2019 07:29:24 -0000 Author: kib Date: Tue Sep 10 07:29:21 2019 New Revision: 352125 URL: https://svnweb.freebsd.org/changeset/base/352125 Log: MFC r351773: Add procctl(PROC_STACKGAP_CTL). PR: 239894 Modified: stable/11/lib/libc/sys/procctl.2 stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/kern/kern_exec.c stable/11/sys/kern/kern_fork.c stable/11/sys/kern/kern_procctl.c stable/11/sys/sys/proc.h stable/11/sys/sys/procctl.h stable/11/sys/vm/vm_map.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/procctl.2 ============================================================================== --- stable/11/lib/libc/sys/procctl.2 Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/lib/libc/sys/procctl.2 Tue Sep 10 07:29:21 2019 (r352125) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2019 +.Dd August 31, 2019 .Dt PROCCTL 2 .Os .Sh NAME @@ -422,6 +422,67 @@ must point to a memory location that can hold a value .Vt int . If signal delivery has not been requested, it will contain zero on return. +.It Dv PROC_STACKGAP_CTL +Controls the stack gaps in the specified process. +A stack gap is the part of the growth area for a +.Dv MAP_STACK +mapped region that is reserved and never filled by memory. +Instead, the process is guaranteed to receive a +.Dv SIGSEGV +signal on accessing pages in the gap. +Gaps protect against stack overflow corrupting memory adjacent +to the stack. +.Pp +The +.Fa data +argument must point to an integer variable containing flags. +The following flags are allowed: +.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC +.It Dv PROC_STACKGAP_ENABLE +This flag is only accepted for consistency with +.Dv PROC_STACKGAP_STATUS . +If stack gaps are enabled, the flag is ignored. +If disabled, the flag causes an +.Ev EINVAL +error to be returned. +After gaps are disabled in a process, they can only be re-enabled when an +.Xr execve 2 +is performed. +.It Dv PROC_STACKGAP_DISABLE +Disable stack gaps for the process. +For existing stacks, the gap is no longer a reserved part of the growth +area and can be filled by memory on access. +.It Dv PROC_STACKGAP_ENABLE_EXEC +Enable stack gaps for programs started after an +.Xr execve 2 +by the specified process. +.It Dv PROC_STACKGAP_DISABLE_EXEC +Inherit disabled stack gaps state after +.Xr execve 2 . +In other words, if the currently executing program has stack gaps disabled, +they are kept disabled on exec. +If gaps were enabled, they are kept enabled after exec. +.El +.Pp +The stack gap state is inherited from the parent on +.Xr fork 2 . +.It Dv PROC_STACKGAP_STATUS +Returns the current stack gap state for the specified process. +.Fa data +must point to an integer variable, which is used to return a bitmask +consisting of the following flags: +.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC +.It Dv PROC_STACKGAP_ENABLE +Stack gaps are enabled. +.It Dv PROC_STACKGAP_DISABLE +Stack gaps are disabled. +.It Dv PROC_STACKGAP_ENABLE_EXEC +Stack gaps are enabled in the process after +.Xr execve 2 . +.It Dv PROC_STACKGAP_DISABLE_EXEC +Stack gaps are disabled in the process after +.Xr execve 2 . +.El .El .Sh NOTES Disabling tracing on a process should not be considered a security Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Tue Sep 10 07:29:21 2019 (r352125) @@ -3107,6 +3107,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ switch (uap->com) { case PROC_SPROTECT: + case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: error = copyin(PTRIN(uap->data), &flags, sizeof(flags)); @@ -3137,6 +3138,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ return (error); data = &x.rk; break; + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: data = &flags; @@ -3165,6 +3167,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_ if (error == 0) error = error1; break; + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: if (error == 0) Modified: stable/11/sys/kern/kern_exec.c ============================================================================== --- stable/11/sys/kern/kern_exec.c Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/kern/kern_exec.c Tue Sep 10 07:29:21 2019 (r352125) @@ -762,6 +762,8 @@ interpret: p->p_flag |= P_EXEC; if ((p->p_flag2 & P2_NOTRACE_EXEC) == 0) p->p_flag2 &= ~P2_NOTRACE; + if ((p->p_flag2 & P2_STKGAP_DISABLE_EXEC) == 0) + p->p_flag2 &= ~P2_STKGAP_DISABLE; if (p->p_flag & P_PPWAIT) { p->p_flag &= ~(P_PPWAIT | P_PPTRACE); cv_broadcast(&p->p_pwait); Modified: stable/11/sys/kern/kern_fork.c ============================================================================== --- stable/11/sys/kern/kern_fork.c Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/kern/kern_fork.c Tue Sep 10 07:29:21 2019 (r352125) @@ -513,7 +513,8 @@ do_fork(struct thread *td, struct fork_req *fr, struct * Increase reference counts on shared objects. */ p2->p_flag = P_INMEM; - p2->p_flag2 = p1->p_flag2 & (P2_NOTRACE | P2_NOTRACE_EXEC | P2_TRAPCAP); + p2->p_flag2 = p1->p_flag2 & (P2_NOTRACE | P2_NOTRACE_EXEC | P2_TRAPCAP | + P2_STKGAP_DISABLE | P2_STKGAP_DISABLE_EXEC); p2->p_swtick = ticks; if (p1->p_flag & P_PROFIL) startprofclock(p2); Modified: stable/11/sys/kern/kern_procctl.c ============================================================================== --- stable/11/sys/kern/kern_procctl.c Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/kern/kern_procctl.c Tue Sep 10 07:29:21 2019 (r352125) @@ -413,6 +413,55 @@ trapcap_status(struct thread *td, struct proc *p, int return (0); } +static int +stackgap_ctl(struct thread *td, struct proc *p, int state) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + if ((state & ~(PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE | + PROC_STACKGAP_ENABLE_EXEC | PROC_STACKGAP_DISABLE_EXEC)) != 0) + return (EINVAL); + switch (state & (PROC_STACKGAP_ENABLE | PROC_STACKGAP_DISABLE)) { + case PROC_STACKGAP_ENABLE: + if ((p->p_flag2 & P2_STKGAP_DISABLE) != 0) + return (EINVAL); + break; + case PROC_STACKGAP_DISABLE: + p->p_flag2 |= P2_STKGAP_DISABLE; + break; + case 0: + break; + default: + return (EINVAL); + } + switch (state & (PROC_STACKGAP_ENABLE_EXEC | + PROC_STACKGAP_DISABLE_EXEC)) { + case PROC_STACKGAP_ENABLE_EXEC: + p->p_flag2 &= ~P2_STKGAP_DISABLE_EXEC; + break; + case PROC_STACKGAP_DISABLE_EXEC: + p->p_flag2 |= P2_STKGAP_DISABLE_EXEC; + break; + case 0: + break; + default: + return (EINVAL); + } + return (0); +} + +static int +stackgap_status(struct thread *td, struct proc *p, int *data) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + + *data = (p->p_flag2 & P2_STKGAP_DISABLE) != 0 ? PROC_STACKGAP_DISABLE : + PROC_STACKGAP_ENABLE; + *data |= (p->p_flag2 & P2_STKGAP_DISABLE_EXEC) != 0 ? + PROC_STACKGAP_DISABLE_EXEC : PROC_STACKGAP_ENABLE_EXEC; + return (0); +} + #ifndef _SYS_SYSPROTO_H_ struct procctl_args { idtype_t idtype; @@ -435,6 +484,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua switch (uap->com) { case PROC_SPROTECT: + case PROC_STACKGAP_CTL: case PROC_TRACE_CTL: case PROC_TRAPCAP_CTL: error = copyin(uap->data, &flags, sizeof(flags)); @@ -463,6 +513,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua return (error); data = &x.rk; break; + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: data = &flags; @@ -490,6 +541,7 @@ sys_procctl(struct thread *td, struct procctl_args *ua if (error == 0) error = error1; break; + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: if (error == 0) @@ -511,6 +563,10 @@ kern_procctl_single(struct thread *td, struct proc *p, switch (com) { case PROC_SPROTECT: return (protect_set(td, p, *(int *)data)); + case PROC_STACKGAP_CTL: + return (stackgap_ctl(td, p, *(int *)data)); + case PROC_STACKGAP_STATUS: + return (stackgap_status(td, p, data)); case PROC_REAP_ACQUIRE: return (reap_acquire(td, p)); case PROC_REAP_RELEASE: @@ -549,6 +605,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t case PROC_REAP_STATUS: case PROC_REAP_GETPIDS: case PROC_REAP_KILL: + case PROC_STACKGAP_CTL: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: case PROC_PDEATHSIG_CTL: @@ -593,6 +651,8 @@ kern_procctl(struct thread *td, idtype_t idtype, id_t sx_xlock(&proctree_lock); tree_locked = true; break; + case PROC_STACKGAP_CTL: + case PROC_STACKGAP_STATUS: case PROC_TRACE_STATUS: case PROC_TRAPCAP_STATUS: tree_locked = false; Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/sys/proc.h Tue Sep 10 07:29:21 2019 (r352125) @@ -745,6 +745,8 @@ struct proc { #define P2_AST_SU 0x00000008 /* Handles SU ast for kthreads. */ #define P2_PTRACE_FSTP 0x00000010 /* SIGSTOP from PT_ATTACH not yet handled. */ #define P2_TRAPCAP 0x00000020 /* SIGTRAP on ENOTCAPABLE */ +#define P2_STKGAP_DISABLE 0x00000800 /* Disable stack gap for MAP_STACK */ +#define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */ /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ Modified: stable/11/sys/sys/procctl.h ============================================================================== --- stable/11/sys/sys/procctl.h Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/sys/procctl.h Tue Sep 10 07:29:21 2019 (r352125) @@ -51,6 +51,8 @@ #define PROC_TRAPCAP_STATUS 10 /* query trap capability status */ #define PROC_PDEATHSIG_CTL 11 /* set parent death signal */ #define PROC_PDEATHSIG_STATUS 12 /* get parent death signal */ +#define PROC_STACKGAP_CTL 17 /* en/dis stack gap on MAP_STACK */ +#define PROC_STACKGAP_STATUS 18 /* query stack gap */ /* Operations for PROC_SPROTECT (passed in integer arg). */ #define PPROT_OP(x) ((x) & 0xf) @@ -113,6 +115,11 @@ struct procctl_reaper_kill { #define PROC_TRAPCAP_CTL_ENABLE 1 #define PROC_TRAPCAP_CTL_DISABLE 2 + +#define PROC_STACKGAP_ENABLE 0x0001 +#define PROC_STACKGAP_DISABLE 0x0002 +#define PROC_STACKGAP_ENABLE_EXEC 0x0004 +#define PROC_STACKGAP_DISABLE_EXEC 0x0008 #ifndef _KERNEL __BEGIN_DECLS Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Tue Sep 10 07:28:27 2019 (r352124) +++ stable/11/sys/vm/vm_map.c Tue Sep 10 07:29:21 2019 (r352125) @@ -3632,7 +3632,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, addrbos + max_ssize > vm_map_max(map) || addrbos + max_ssize <= addrbos) return (KERN_INVALID_ADDRESS); - sgp = (vm_size_t)stack_guard_page * PAGE_SIZE; + sgp = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + (vm_size_t)stack_guard_page * PAGE_SIZE; if (sgp >= max_ssize) return (KERN_INVALID_ARGUMENT); @@ -3683,6 +3684,8 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, ("new entry lacks MAP_ENTRY_GROWS_UP")); + if (gap_bot == gap_top) + return (KERN_SUCCESS); rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); @@ -3766,7 +3769,8 @@ retry: } else { return (KERN_FAILURE); } - guard = gap_entry->next_read; + guard = (curproc->p_flag2 & P2_STKGAP_DISABLE) != 0 ? 0 : + gap_entry->next_read; max_grow = gap_entry->end - gap_entry->start; if (guard > max_grow) return (KERN_NO_SPACE); From owner-svn-src-stable@freebsd.org Tue Sep 10 09:57:25 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 6E8CCD1AD8; Tue, 10 Sep 2019 09:57:25 +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 46SL6s2LPbz4Fy4; Tue, 10 Sep 2019 09:57:25 +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 2F5CB2466D; Tue, 10 Sep 2019 09:57:25 +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 x8A9vPMT075159; Tue, 10 Sep 2019 09:57:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8A9vPXn075158; Tue, 10 Sep 2019 09:57:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909100957.x8A9vPXn075158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 10 Sep 2019 09:57: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: r352133 - stable/11/usr.bin/proccontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/usr.bin/proccontrol X-SVN-Commit-Revision: 352133 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, 10 Sep 2019 09:57:25 -0000 Author: kib Date: Tue Sep 10 09:57:24 2019 New Revision: 352133 URL: https://svnweb.freebsd.org/changeset/base/352133 Log: MFC r351774: Add stackgap control mode to proccontrol(1). PR: 239894 Modified: stable/11/usr.bin/proccontrol/proccontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/proccontrol/proccontrol.c ============================================================================== --- stable/11/usr.bin/proccontrol/proccontrol.c Tue Sep 10 08:51:11 2019 (r352132) +++ stable/11/usr.bin/proccontrol/proccontrol.c Tue Sep 10 09:57:24 2019 (r352133) @@ -42,6 +42,7 @@ enum { MODE_INVALID, MODE_TRACE, MODE_TRAPCAP, + MODE_STACKGAP, }; static pid_t @@ -62,7 +63,7 @@ static void __dead2 usage(void) { - fprintf(stderr, "Usage: proccontrol -m (trace|trapcap) [-q] " + fprintf(stderr, "Usage: proccontrol -m (trace|trapcap|stackgap) [-q] " "[-s (enable|disable)] [-p pid | command]\n"); exit(1); } @@ -85,6 +86,8 @@ main(int argc, char *argv[]) mode = MODE_TRACE; else if (strcmp(optarg, "trapcap") == 0) mode = MODE_TRAPCAP; + else if (strcmp(optarg, "stackgap") == 0) + mode = MODE_STACKGAP; else usage(); break; @@ -127,6 +130,9 @@ main(int argc, char *argv[]) case MODE_TRAPCAP: error = procctl(P_PID, pid, PROC_TRAPCAP_STATUS, &arg); break; + case MODE_STACKGAP: + error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, &arg); + break; default: usage(); break; @@ -152,6 +158,26 @@ main(int argc, char *argv[]) break; } break; + case MODE_STACKGAP: + switch (arg & (PROC_STACKGAP_ENABLE | + PROC_STACKGAP_DISABLE)) { + case PROC_STACKGAP_ENABLE: + printf("enabled\n"); + break; + case PROC_STACKGAP_DISABLE: + printf("disabled\n"); + break; + } + switch (arg & (PROC_STACKGAP_ENABLE_EXEC | + PROC_STACKGAP_DISABLE_EXEC)) { + case PROC_STACKGAP_ENABLE_EXEC: + printf("enabled after exec\n"); + break; + case PROC_STACKGAP_DISABLE_EXEC: + printf("disabled after exec\n"); + break; + } + break; } } else { switch (mode) { @@ -164,6 +190,12 @@ main(int argc, char *argv[]) arg = enable ? PROC_TRAPCAP_CTL_ENABLE : PROC_TRAPCAP_CTL_DISABLE; error = procctl(P_PID, pid, PROC_TRAPCAP_CTL, &arg); + break; + case MODE_STACKGAP: + arg = enable ? PROC_STACKGAP_ENABLE_EXEC : + (PROC_STACKGAP_DISABLE | + PROC_STACKGAP_DISABLE_EXEC); + error = procctl(P_PID, pid, PROC_STACKGAP_CTL, &arg); break; default: usage(); From owner-svn-src-stable@freebsd.org Tue Sep 10 20:14:52 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 AE3CDE317E; Tue, 10 Sep 2019 20:14:52 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46SbqJ48fcz3y16; Tue, 10 Sep 2019 20:14:52 +0000 (UTC) (envelope-from oshogbo@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 70ABA2B68C; Tue, 10 Sep 2019 20:14:52 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKEqGR051577; Tue, 10 Sep 2019 20:14:52 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKEqDo051576; Tue, 10 Sep 2019 20:14:52 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102014.x8AKEqDo051576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:14: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: r352179 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352179 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, 10 Sep 2019 20:14:52 -0000 Author: oshogbo Date: Tue Sep 10 20:14:52 2019 New Revision: 352179 URL: https://svnweb.freebsd.org/changeset/base/352179 Log: MFCr350610: exit1: postpone clearing P_TRACED flag until the proctree lock is acquired In case of the process being debugged. The P_TRACED is cleared very early, which would make procdesc_close() not calling proc_clear_orphan(). That would result in the debugged process can not be able to collect status of the process with process descriptor. Reviewed by: markj, kib Tested by: pho Modified: stable/12/sys/kern/kern_exit.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exit.c ============================================================================== --- stable/12/sys/kern/kern_exit.c Tue Sep 10 20:11:00 2019 (r352178) +++ stable/12/sys/kern/kern_exit.c Tue Sep 10 20:14:52 2019 (r352179) @@ -335,7 +335,6 @@ exit1(struct thread *td, int rval, int signo) */ PROC_LOCK(p); stopprofclock(p); - p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); p->p_ptevents = 0; /* @@ -437,6 +436,11 @@ exit1(struct thread *td, int rval, int signo) LIST_INSERT_HEAD(&zombproc, p, p_list); LIST_REMOVE(p, p_hash); sx_xunlock(&allproc_lock); + + sx_xlock(&proctree_lock); + PROC_LOCK(p); + p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); + PROC_UNLOCK(p); /* * Reparent all children processes: From owner-svn-src-stable@freebsd.org Tue Sep 10 20:15: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 21DDBE325A; Tue, 10 Sep 2019 20:15:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46SbrT06hrz3yCY; Tue, 10 Sep 2019 20:15:53 +0000 (UTC) (envelope-from oshogbo@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 C311E2B696; Tue, 10 Sep 2019 20:15:52 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKFqFJ051858; Tue, 10 Sep 2019 20:15:52 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKFqgJ051856; Tue, 10 Sep 2019 20:15:52 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102015.x8AKFqgJ051856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:15: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: r352180 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 352180 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, 10 Sep 2019 20:15:53 -0000 Author: oshogbo Date: Tue Sep 10 20:15:52 2019 New Revision: 352180 URL: https://svnweb.freebsd.org/changeset/base/352180 Log: MFCr350611: proc: introduce the proc_add_orphan function This API allows adding the process to its parent orphan list. Reviewed by: kib, markj Modified: stable/12/sys/kern/kern_exit.c stable/12/sys/sys/proc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exit.c ============================================================================== --- stable/12/sys/kern/kern_exit.c Tue Sep 10 20:14:52 2019 (r352179) +++ stable/12/sys/kern/kern_exit.c Tue Sep 10 20:15:52 2019 (r352180) @@ -1330,6 +1330,24 @@ loop_locked: goto loop; } +void +proc_add_orphan(struct proc *child, struct proc *parent) +{ + + sx_assert(&proctree_lock, SX_XLOCKED); + KASSERT((child->p_flag & P_TRACED) != 0, + ("proc_add_orphan: not traced")); + + if (LIST_EMPTY(&parent->p_orphans)) { + child->p_treeflag |= P_TREE_FIRST_ORPHAN; + LIST_INSERT_HEAD(&parent->p_orphans, child, p_orphan); + } else { + LIST_INSERT_AFTER(LIST_FIRST(&parent->p_orphans), + child, p_orphan); + } + child->p_treeflag |= P_TREE_ORPHANED; +} + /* * Make process 'parent' the new parent of process 'child'. * Must be called with an exclusive hold of proctree lock. @@ -1350,16 +1368,8 @@ proc_reparent(struct proc *child, struct proc *parent, LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); clear_orphan(child); - if (child->p_flag & P_TRACED) { - if (LIST_EMPTY(&child->p_pptr->p_orphans)) { - child->p_treeflag |= P_TREE_FIRST_ORPHAN; - LIST_INSERT_HEAD(&child->p_pptr->p_orphans, child, - p_orphan); - } else { - LIST_INSERT_AFTER(LIST_FIRST(&child->p_pptr->p_orphans), - child, p_orphan); - } - child->p_treeflag |= P_TREE_ORPHANED; + if ((child->p_flag & P_TRACED) != 0) { + proc_add_orphan(child, child->p_pptr); } child->p_pptr = parent; Modified: stable/12/sys/sys/proc.h ============================================================================== --- stable/12/sys/sys/proc.h Tue Sep 10 20:14:52 2019 (r352179) +++ stable/12/sys/sys/proc.h Tue Sep 10 20:15:52 2019 (r352180) @@ -1063,6 +1063,7 @@ void proc_linkup(struct proc *p, struct thread *td); struct proc *proc_realparent(struct proc *child); void proc_reap(struct thread *td, struct proc *p, int *status, int options); void proc_reparent(struct proc *child, struct proc *newparent, bool set_oppid); +void proc_add_orphan(struct proc *child, struct proc *parent); void proc_set_traced(struct proc *p, bool stop); void proc_wkilled(struct proc *p); struct pstats *pstats_alloc(void); From owner-svn-src-stable@freebsd.org Tue Sep 10 20:18: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 D80DBE3338; Tue, 10 Sep 2019 20:18:07 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Sbv35PNjz3yL9; Tue, 10 Sep 2019 20:18:07 +0000 (UTC) (envelope-from oshogbo@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 9C8222B698; Tue, 10 Sep 2019 20:18:07 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKI7s0052015; Tue, 10 Sep 2019 20:18:07 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKI7RR052013; Tue, 10 Sep 2019 20:18:07 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102018.x8AKI7RR052013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:18: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: r352181 - in stable/12: sys/kern tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/12: sys/kern tests/sys/kern X-SVN-Commit-Revision: 352181 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, 10 Sep 2019 20:18:07 -0000 Author: oshogbo Date: Tue Sep 10 20:18:06 2019 New Revision: 352181 URL: https://svnweb.freebsd.org/changeset/base/352181 Log: MFCr350612 procdesc: fix reparenting when the debugger is attached The process is reparented to the debugger while it is attached. B B / ----> | A A D Every time when the process is reparented, it is added to the orphan list of the previous parent: A->orphan = B D->orphan = NULL When the A process will close the process descriptor to the B process, the B process will be reparented to the init process. B B - init | ----> A D A D A->orphan = B D->orphan = B In this scenario, the B process is in the orphan list of A and D. When the last process descriptor is closed instead of reparenting it to the reaper let it stay with the debugger process and set our previews parent to the reaper. Add test case for this situation. Notice that without this patch the kernel will crash with this test case: panic: orphan 0xfffff8000e990530 of 0xfffff8000e990000 has unexpected oppid 1 Reviewed by: markj, kib Differential Revision: https://reviews.freebsd.org/D20361 Modified: stable/12/sys/kern/sys_procdesc.c stable/12/tests/sys/kern/ptrace_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_procdesc.c ============================================================================== --- stable/12/sys/kern/sys_procdesc.c Tue Sep 10 20:15:52 2019 (r352180) +++ stable/12/sys/kern/sys_procdesc.c Tue Sep 10 20:18:06 2019 (r352181) @@ -416,7 +416,13 @@ procdesc_close(struct file *fp, struct thread *td) * terminate with prejudice. */ p->p_sigparent = SIGCHLD; - proc_reparent(p, p->p_reaper, true); + if ((p->p_flag & P_TRACED) == 0) { + proc_reparent(p, p->p_reaper, true); + } else { + clear_orphan(p); + p->p_oppid = p->p_reaper->p_pid; + proc_add_orphan(p, p->p_reaper); + } if ((pd->pd_flags & PDF_DAEMON) == 0) kern_psignal(p, SIGKILL); PROC_UNLOCK(p); Modified: stable/12/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/12/tests/sys/kern/ptrace_test.c Tue Sep 10 20:15:52 2019 (r352180) +++ stable/12/tests/sys/kern/ptrace_test.c Tue Sep 10 20:18:06 2019 (r352181) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #define _WANT_MIPS_REGNUM +#include #include #include #include @@ -3906,6 +3907,60 @@ ATF_TC_BODY(ptrace__PT_LWPINFO_stale_siginfo, tc) ATF_REQUIRE(errno == ECHILD); } +/* + * Verify that when the process is traced that it isn't reparent + * to the init process when we close all process descriptors. + */ +ATF_TC(ptrace__proc_reparent); +ATF_TC_HEAD(ptrace__proc_reparent, tc) +{ + + atf_tc_set_md_var(tc, "timeout", "2"); +} +ATF_TC_BODY(ptrace__proc_reparent, tc) +{ + pid_t traced, debuger, wpid; + int pd, status; + + traced = pdfork(&pd, 0); + ATF_REQUIRE(traced >= 0); + if (traced == 0) { + raise(SIGSTOP); + exit(0); + } + ATF_REQUIRE(pd >= 0); + + debuger = fork(); + ATF_REQUIRE(debuger >= 0); + if (debuger == 0) { + /* The traced process is reparented to debuger. */ + ATF_REQUIRE(ptrace(PT_ATTACH, traced, 0, 0) == 0); + wpid = waitpid(traced, &status, 0); + ATF_REQUIRE(wpid == traced); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + ATF_REQUIRE(close(pd) == 0); + ATF_REQUIRE(ptrace(PT_DETACH, traced, (caddr_t)1, 0) == 0); + + /* We closed pd so we should not have any child. */ + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); + + exit(0); + } + + ATF_REQUIRE(close(pd) == 0); + wpid = waitpid(debuger, &status, 0); + ATF_REQUIRE(wpid == debuger); + ATF_REQUIRE(WEXITSTATUS(status) == 0); + + /* Check if we still have any child. */ + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -3967,6 +4022,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); #endif ATF_TP_ADD_TC(tp, ptrace__PT_LWPINFO_stale_siginfo); + ATF_TP_ADD_TC(tp, ptrace__proc_reparent); return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Tue Sep 10 20:19: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 ED581E33F6; Tue, 10 Sep 2019 20:19:02 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Sbw65zDWz3yTl; Tue, 10 Sep 2019 20:19:02 +0000 (UTC) (envelope-from oshogbo@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 B19C12B69B; Tue, 10 Sep 2019 20:19:02 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKJ2e9052125; Tue, 10 Sep 2019 20:19:02 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKJ2lL052124; Tue, 10 Sep 2019 20:19:02 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102019.x8AKJ2lL052124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:19:02 +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: r352182 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352182 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, 10 Sep 2019 20:19:03 -0000 Author: oshogbo Date: Tue Sep 10 20:19:02 2019 New Revision: 352182 URL: https://svnweb.freebsd.org/changeset/base/352182 Log: MFCr350614: exit1: fix style nits Modified: stable/12/sys/kern/kern_exit.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exit.c ============================================================================== --- stable/12/sys/kern/kern_exit.c Tue Sep 10 20:18:06 2019 (r352181) +++ stable/12/sys/kern/kern_exit.c Tue Sep 10 20:19:02 2019 (r352182) @@ -456,7 +456,7 @@ exit1(struct thread *td, int rval, int signo) PROC_LOCK(q); q->p_sigparent = SIGCHLD; - if (!(q->p_flag & P_TRACED)) { + if ((q->p_flag & P_TRACED) == 0) { proc_reparent(q, q->p_reaper, true); if (q->p_state == PRS_ZOMBIE) { /* From owner-svn-src-stable@freebsd.org Tue Sep 10 20:20:46 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 41105E357A; Tue, 10 Sep 2019 20:20:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Sby611nnz3ylh; Tue, 10 Sep 2019 20:20:46 +0000 (UTC) (envelope-from oshogbo@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 0683D2B6B3; Tue, 10 Sep 2019 20:20:46 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKKjf4052341; Tue, 10 Sep 2019 20:20:45 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKKjb0052340; Tue, 10 Sep 2019 20:20:45 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102020.x8AKKjb0052340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:20: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: r352184 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352184 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, 10 Sep 2019 20:20:46 -0000 Author: oshogbo Date: Tue Sep 10 20:20:45 2019 New Revision: 352184 URL: https://svnweb.freebsd.org/changeset/base/352184 Log: MFCr350616: process: style We don't need to check if the parent is already set. This is done already in the proc_reparent. No functional behaviour changes intended. MFC after: 1 month Modified: stable/12/sys/kern/sys_process.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_process.c ============================================================================== --- stable/12/sys/kern/sys_process.c Tue Sep 10 20:19:29 2019 (r352183) +++ stable/12/sys/kern/sys_process.c Tue Sep 10 20:20:45 2019 (r352184) @@ -929,9 +929,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi * on a "detach". */ proc_set_traced(p, true); - if (p->p_pptr != td->td_proc) { - proc_reparent(p, td->td_proc, false); - } + proc_reparent(p, td->td_proc, false); CTR2(KTR_PTRACE, "PT_ATTACH: pid %d, oppid %d", p->p_pid, p->p_oppid); @@ -1048,7 +1046,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi bcopy(td2->td_sa.args, addr, td2->td_sa.narg * sizeof(register_t)); break; - + case PT_STEP: case PT_CONTINUE: case PT_TO_SCE: @@ -1158,8 +1156,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi sendsig: MPASS(proctree_locked == 0); - - /* + + /* * Clear the pending event for the thread that just * reported its event (p_xthread). This may not be * the thread passed to PT_CONTINUE, PT_STEP, etc. if From owner-svn-src-stable@freebsd.org Tue Sep 10 20:21: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 85C51E3611; Tue, 10 Sep 2019 20:21:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46SbzJ2yjtz3ywL; Tue, 10 Sep 2019 20:21:48 +0000 (UTC) (envelope-from oshogbo@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 492B52B816; Tue, 10 Sep 2019 20:21:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKLmr2056202; Tue, 10 Sep 2019 20:21:48 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKLmWZ056201; Tue, 10 Sep 2019 20:21:48 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102021.x8AKLmWZ056201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:21:48 +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: r352185 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352185 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, 10 Sep 2019 20:21:48 -0000 Author: oshogbo Date: Tue Sep 10 20:21:47 2019 New Revision: 352185 URL: https://svnweb.freebsd.org/changeset/base/352185 Log: MFCr350617: procdesc: fix the function name I changed name of the function r350429 and forgot to update the r350612 patch. Reported by: jenkins Modified: stable/12/sys/kern/sys_procdesc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_procdesc.c ============================================================================== --- stable/12/sys/kern/sys_procdesc.c Tue Sep 10 20:20:45 2019 (r352184) +++ stable/12/sys/kern/sys_procdesc.c Tue Sep 10 20:21:47 2019 (r352185) @@ -419,7 +419,7 @@ procdesc_close(struct file *fp, struct thread *td) if ((p->p_flag & P_TRACED) == 0) { proc_reparent(p, p->p_reaper, true); } else { - clear_orphan(p); + proc_clear_orphan(p); p->p_oppid = p->p_reaper->p_pid; proc_add_orphan(p, p->p_reaper); } From owner-svn-src-stable@freebsd.org Tue Sep 10 20:41:43 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 2EA61E4021; Tue, 10 Sep 2019 20:41:43 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ScQH0Td1z416P; Tue, 10 Sep 2019 20:41:43 +0000 (UTC) (envelope-from oshogbo@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 E7BB02BBBC; Tue, 10 Sep 2019 20:41:42 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKfgRE068984; Tue, 10 Sep 2019 20:41:42 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKfgA8068981; Tue, 10 Sep 2019 20:41:42 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102041.x8AKfgA8068981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:41: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: r352187 - in stable/12/lib/libcasper/services/cap_dns: . tests X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/12/lib/libcasper/services/cap_dns: . tests X-SVN-Commit-Revision: 352187 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, 10 Sep 2019 20:41:43 -0000 Author: oshogbo Date: Tue Sep 10 20:41:42 2019 New Revision: 352187 URL: https://svnweb.freebsd.org/changeset/base/352187 Log: MFCr340141: libcasper: fix limitations in dns service The getaddrinfo(3) and gethostbyname(3) are used to return the address for a given hostname. The getnameinfo(3) and gethostbyaddr(3) are used to return hostname for a given address. Right now in casper, we have two limitations: - NAME which allows resolving DNS names. - ADDR which allows to do revert DNS lookups. Before this change the rights was mixed up: NAME - getnameinfo(3) and gethostbyname(3) ADDR - gethostbyaddr(3) and getaddrinfo(3) Which no matters on limitation allowed us to resolve DNS names and do DNS lookups basically by using a different set of functions. Now the NAME type allows getaddrinfo(3) and gethostbyname (3)functions, and the ADDR names allow to use gethostbyaddr(3) and getnameinfo(3) functions. Reviewed by: pjd, bcr Discussed with: hrs Differential Revision: https://reviews.freebsd.org/D16930 Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.3 stable/12/lib/libcasper/services/cap_dns/cap_dns.c stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Tue Sep 10 20:27:44 2019 (r352186) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Tue Sep 10 20:41:42 2019 (r352187) @@ -118,19 +118,21 @@ or .Dv NAME . The .Dv ADDR -means that functions -.Fn cap_gethostbyname , -.Fn cap_gethostbyname2 +means that reverse DNS lookups are allowed with +.Fn cap_getnameinfo and .Fn cap_gethostbyaddr -are allowed. +functions. In case when .Va type is set to .Dv NAME -the -.Fn cap_getnameinfo -function is allowed. +the name resolution is allowed with +.Fn cap_getaddrinfo , +.Fn cap_gethostbyname , +and +.Fn cap_gethostbyname2 +functions. .It family ( NV_TYPE_NUMBER ) The .Va family Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.c ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:27:44 2019 (r352186) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:41:42 2019 (r352187) @@ -524,7 +524,7 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t socklen_t salen; int error, flags; - if (!dns_allowed_type(limits, "NAME")) + if (!dns_allowed_type(limits, "ADDR")) return (NO_RECOVERY); error = 0; @@ -617,7 +617,7 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t unsigned int ii; int error, family, n; - if (!dns_allowed_type(limits, "ADDR")) + if (!dns_allowed_type(limits, "NAME")) return (NO_RECOVERY); hostname = dnvlist_get_string(nvlin, "hostname", NULL); Modified: stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c Tue Sep 10 20:27:44 2019 (r352186) +++ stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c Tue Sep 10 20:41:42 2019 (r352187) @@ -393,7 +393,8 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 2) == 0); CHECK(runtest(capdns) == - (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6)); + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETHOSTBYNAME2_AF_INET6 | + GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6)); cap_close(capdns); @@ -419,9 +420,7 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 2) == 0); CHECK(runtest(capdns) == - (GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6 | - GETADDRINFO_AF_INET | GETADDRINFO_AF_INET6)); - + (GETHOSTBYADDR_AF_INET | GETHOSTBYADDR_AF_INET6)); cap_close(capdns); /* @@ -512,7 +511,8 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && errno == ENOTCAPABLE); - CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET)); + CHECK(runtest(capdns) == + (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | GETADDRINFO_AF_INET)); cap_close(capdns); @@ -548,7 +548,8 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && errno == ENOTCAPABLE); - CHECK(runtest(capdns) == GETHOSTBYNAME2_AF_INET6); + CHECK(runtest(capdns) == + (GETHOSTBYNAME2_AF_INET6 | GETADDRINFO_AF_INET6)); cap_close(capdns); @@ -584,7 +585,7 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && errno == ENOTCAPABLE); - CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET | GETADDRINFO_AF_INET)); + CHECK(runtest(capdns) == GETHOSTBYADDR_AF_INET); cap_close(capdns); @@ -620,8 +621,7 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 1) == -1 && errno == ENOTCAPABLE); - CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET6 | - GETADDRINFO_AF_INET6)); + CHECK(runtest(capdns) == GETHOSTBYADDR_AF_INET6); cap_close(capdns); @@ -657,7 +657,8 @@ main(void) errno == ENOTCAPABLE); /* Do the limits still hold? */ - CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET)); + CHECK(runtest(capdns) == (GETHOSTBYNAME | GETHOSTBYNAME2_AF_INET | + GETADDRINFO_AF_INET)); cap_close(capdns); @@ -691,8 +692,7 @@ main(void) errno == ENOTCAPABLE); /* Do the limits still hold? */ - CHECK(runtest(capdns) == (GETHOSTBYADDR_AF_INET6 | - GETADDRINFO_AF_INET6)); + CHECK(runtest(capdns) == GETHOSTBYADDR_AF_INET6); cap_close(capdns); From owner-svn-src-stable@freebsd.org Tue Sep 10 20:45: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 9D85FE40F0; Tue, 10 Sep 2019 20:45:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46ScW53hXzz41Hs; Tue, 10 Sep 2019 20:45:53 +0000 (UTC) (envelope-from oshogbo@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 440982BC10; Tue, 10 Sep 2019 20:45:53 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKjr2l070095; Tue, 10 Sep 2019 20:45:53 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKjppA070087; Tue, 10 Sep 2019 20:45:51 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102045.x8AKjppA070087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:45:51 +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: r352188 - in stable/12: . contrib/tcpdump contrib/traceroute lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests sbin/ping X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/12: . contrib/tcpdump contrib/traceroute lib/libcasper/services/cap_dns lib/libcasper/services/cap_dns/tests sbin/ping X-SVN-Commit-Revision: 352188 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, 10 Sep 2019 20:45:53 -0000 Author: oshogbo Date: Tue Sep 10 20:45:51 2019 New Revision: 352188 URL: https://svnweb.freebsd.org/changeset/base/352188 Log: MFCr340363: libcasper: Change the name of limits in cap_dns so the intentions are obvious. Reported by: pjd Modified: stable/12/ObsoleteFiles.inc stable/12/contrib/tcpdump/tcpdump.c stable/12/contrib/traceroute/traceroute.c stable/12/lib/libcasper/services/cap_dns/Makefile stable/12/lib/libcasper/services/cap_dns/cap_dns.3 stable/12/lib/libcasper/services/cap_dns/cap_dns.c stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c stable/12/sbin/ping/ping.c Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/ObsoleteFiles.inc Tue Sep 10 20:45:51 2019 (r352188) @@ -483,6 +483,9 @@ OLD_DIRS+=usr/lib/clang/6.0.1/lib OLD_DIRS+=usr/lib/clang/6.0.1 # 20181116: Rename test file. OLD_FILES+=usr/tests/sys/netinet/reuseport_lb +# 20181112: Cleanup old libcap_dns. +OLD_LIBS+=lib/casper/libcap_dns.so.1 +OLD_LIBS+=usr/lib32/libcap_dns.so.1 # 20181030: malloc_domain(9) KPI change OLD_FILES+=usr/share/man/man9/malloc_domain.9.gz # 20181025: OpenSSL libraries version bump to avoid conflict with ports Modified: stable/12/contrib/tcpdump/tcpdump.c ============================================================================== --- stable/12/contrib/tcpdump/tcpdump.c Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/contrib/tcpdump/tcpdump.c Tue Sep 10 20:45:51 2019 (r352188) @@ -741,7 +741,7 @@ capdns_setup(void) if (capdnsloc == NULL) error("unable to open system.dns service"); /* Limit system.dns to reverse DNS lookups. */ - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; if (cap_dns_type_limit(capdnsloc, types, 1) < 0) error("unable to limit access to system.dns service"); families[0] = AF_INET; Modified: stable/12/contrib/traceroute/traceroute.c ============================================================================== --- stable/12/contrib/traceroute/traceroute.c Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/contrib/traceroute/traceroute.c Tue Sep 10 20:45:51 2019 (r352188) @@ -523,7 +523,7 @@ main(int argc, char **argv) int sump = 0; int sockerrno; #ifdef WITH_CASPER - const char *types[] = { "NAME", "ADDR" }; + const char *types[] = { "NAME2ADDR", "ADDR2NAME" }; int families[1]; cap_channel_t *casper; #endif Modified: stable/12/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/Makefile Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/lib/libcasper/services/cap_dns/Makefile Tue Sep 10 20:45:51 2019 (r352188) @@ -6,7 +6,7 @@ SHLIBDIR?= /lib/casper PACKAGE=libcasper -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 INCSDIR?= ${INCLUDEDIR}/casper .if ${MK_CASPER} != "no" Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Tue Sep 10 20:45:51 2019 (r352188) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2018 +.Dd November 12, 2018 .Dt CAP_DNS 3 .Os .Sh NAME @@ -76,9 +76,9 @@ function limits the functions allowed in the service. The .Fa types variable can be set to -.Dv ADDR +.Dv ADDR2NAME or -.Dv NAME . +.Dv NAME2ADDR . See the .Sx LIMITS section for more details. @@ -113,9 +113,9 @@ for that function can contain the following values and The .Va type can have two values: -.Dv ADDR +.Dv ADDR2NAME or -.Dv NAME . +.Dv NAME2ADDR . The .Dv ADDR means that reverse DNS lookups are allowed with Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.c ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:45:51 2019 (r352188) @@ -474,7 +474,7 @@ dns_gethostbyname(const nvlist_t *limits, const nvlist struct hostent *hp; int family; - if (!dns_allowed_type(limits, "NAME")) + if (!dns_allowed_type(limits, "NAME2ADDR")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -498,7 +498,7 @@ dns_gethostbyaddr(const nvlist_t *limits, const nvlist size_t addrsize; int family; - if (!dns_allowed_type(limits, "ADDR")) + if (!dns_allowed_type(limits, "ADDR2NAME")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -524,7 +524,7 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t socklen_t salen; int error, flags; - if (!dns_allowed_type(limits, "ADDR")) + if (!dns_allowed_type(limits, "ADDR2NAME")) return (NO_RECOVERY); error = 0; @@ -617,7 +617,7 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t unsigned int ii; int error, family, n; - if (!dns_allowed_type(limits, "NAME")) + if (!dns_allowed_type(limits, "NAME2ADDR")) return (NO_RECOVERY); hostname = dnvlist_get_string(nvlin, "hostname", NULL); @@ -702,8 +702,8 @@ dns_limit(const nvlist_t *oldlimits, const nvlist_t *n if (strncmp(name, "type", sizeof("type") - 1) != 0) return (EINVAL); type = nvlist_get_string(newlimits, name); - if (strcmp(type, "ADDR") != 0 && - strcmp(type, "NAME") != 0) { + if (strcmp(type, "ADDR2NAME") != 0 && + strcmp(type, "NAME2ADDR") != 0) { return (EINVAL); } if (!dns_allowed_type(oldlimits, type)) Modified: stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/lib/libcasper/services/cap_dns/tests/dns_test.c Tue Sep 10 20:45:51 2019 (r352188) @@ -357,8 +357,8 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; families[1] = AF_INET6; @@ -380,12 +380,12 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -407,12 +407,12 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "NAME"; + types[1] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -432,8 +432,8 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; CHECK(cap_dns_family_limit(capdns, families, 1) == 0); @@ -459,8 +459,8 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 1) == 0); @@ -488,18 +488,18 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; families[1] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 2) == 0); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -525,18 +525,18 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; families[1] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 2) == 0); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET6; @@ -562,18 +562,18 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; families[1] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 2) == 0); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "NAME"; + types[1] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -598,18 +598,18 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == 0); families[0] = AF_INET; families[1] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 2) == 0); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); - types[1] = "NAME"; + types[1] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET6; @@ -630,13 +630,13 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); families[0] = AF_INET; CHECK(cap_dns_family_limit(capdns, families, 1) == 0); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -644,7 +644,7 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET6; @@ -665,13 +665,13 @@ main(void) capdns = cap_clone(origcapdns); CHECK(capdns != NULL); - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 1) == 0); families[0] = AF_INET6; CHECK(cap_dns_family_limit(capdns, families, 1) == 0); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; CHECK(cap_dns_type_limit(capdns, types, 2) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; @@ -679,7 +679,7 @@ main(void) CHECK(cap_dns_family_limit(capdns, families, 2) == -1 && errno == ENOTCAPABLE); - types[0] = "NAME"; + types[0] = "NAME2ADDR"; CHECK(cap_dns_type_limit(capdns, types, 1) == -1 && errno == ENOTCAPABLE); families[0] = AF_INET; Modified: stable/12/sbin/ping/ping.c ============================================================================== --- stable/12/sbin/ping/ping.c Tue Sep 10 20:41:42 2019 (r352187) +++ stable/12/sbin/ping/ping.c Tue Sep 10 20:45:51 2019 (r352188) @@ -619,7 +619,7 @@ main(int argc, char *const *argv) if (capdns != NULL) { const char *types[1]; - types[0] = "ADDR"; + types[0] = "ADDR2NAME"; if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } @@ -1791,8 +1791,8 @@ capdns_setup(void) cap_close(capcas); if (capdnsloc == NULL) err(1, "unable to open system.dns service"); - types[0] = "NAME"; - types[1] = "ADDR"; + types[0] = "NAME2ADDR"; + types[1] = "ADDR2NAME"; if (cap_dns_type_limit(capdnsloc, types, 2) < 0) err(1, "unable to limit access to system.dns service"); families[0] = AF_INET; From owner-svn-src-stable@freebsd.org Tue Sep 10 20: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 481FEE41C6; Tue, 10 Sep 2019 20:49:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Scbc1HdJz41QQ; Tue, 10 Sep 2019 20:49:48 +0000 (UTC) (envelope-from oshogbo@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 0B0642BC11; Tue, 10 Sep 2019 20:49:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKnlH9070320; Tue, 10 Sep 2019 20:49:47 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKnlws070319; Tue, 10 Sep 2019 20:49:47 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102049.x8AKnlws070319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:49:47 +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: r352189 - stable/12/lib/libcasper/services/cap_dns X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/lib/libcasper/services/cap_dns X-SVN-Commit-Revision: 352189 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, 10 Sep 2019 20:49:48 -0000 Author: oshogbo Date: Tue Sep 10 20:49:47 2019 New Revision: 352189 URL: https://svnweb.freebsd.org/changeset/base/352189 Log: MFCr340638: libcasper: provide compatibility with the old version of service Some external tools like tcpdump(1) have upstream the changes with old limits name. Because of that provide compatibility with the old names. Reported by: emaste Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.c ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:45:51 2019 (r352188) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.c Tue Sep 10 20:49:47 2019 (r352189) @@ -474,7 +474,8 @@ dns_gethostbyname(const nvlist_t *limits, const nvlist struct hostent *hp; int family; - if (!dns_allowed_type(limits, "NAME2ADDR")) + if (!dns_allowed_type(limits, "NAME2ADDR") && + !dns_allowed_type(limits, "NAME")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -498,7 +499,8 @@ dns_gethostbyaddr(const nvlist_t *limits, const nvlist size_t addrsize; int family; - if (!dns_allowed_type(limits, "ADDR2NAME")) + if (!dns_allowed_type(limits, "ADDR2NAME") && + !dns_allowed_type(limits, "ADDR")) return (NO_RECOVERY); family = (int)nvlist_get_number(nvlin, "family"); @@ -524,7 +526,8 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t socklen_t salen; int error, flags; - if (!dns_allowed_type(limits, "ADDR2NAME")) + if (!dns_allowed_type(limits, "ADDR2NAME") && + !dns_allowed_type(limits, "ADDR")) return (NO_RECOVERY); error = 0; @@ -617,7 +620,8 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t unsigned int ii; int error, family, n; - if (!dns_allowed_type(limits, "NAME2ADDR")) + if (!dns_allowed_type(limits, "NAME2ADDR") && + !dns_allowed_type(limits, "NAME")) return (NO_RECOVERY); hostname = dnvlist_get_string(nvlin, "hostname", NULL); @@ -703,7 +707,9 @@ dns_limit(const nvlist_t *oldlimits, const nvlist_t *n return (EINVAL); type = nvlist_get_string(newlimits, name); if (strcmp(type, "ADDR2NAME") != 0 && - strcmp(type, "NAME2ADDR") != 0) { + strcmp(type, "NAME2ADDR") != 0 && + strcmp(type, "ADDR") != 0 && + strcmp(type, "NAME") != 0) { return (EINVAL); } if (!dns_allowed_type(oldlimits, type)) From owner-svn-src-stable@freebsd.org Tue Sep 10 20:55: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 61DDBE447D; Tue, 10 Sep 2019 20:55:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46SckX1yDmz41t4; Tue, 10 Sep 2019 20:55:48 +0000 (UTC) (envelope-from oshogbo@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 267452BDE1; Tue, 10 Sep 2019 20:55:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AKtmIK075829; Tue, 10 Sep 2019 20:55:48 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AKtlZ6075827; Tue, 10 Sep 2019 20:55:47 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909102055.x8AKtlZ6075827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Sep 2019 20:55:47 +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: r352190 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 352190 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, 10 Sep 2019 20:55:48 -0000 Author: oshogbo Date: Tue Sep 10 20:55:47 2019 New Revision: 352190 URL: https://svnweb.freebsd.org/changeset/base/352190 Log: MFCr350429: proc: make clear_orphan an public API This will be useful for other patches with process descriptors. Change its name as well. Reviewed by: markj, kib Modified: stable/12/sys/kern/kern_exit.c stable/12/sys/sys/proc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exit.c ============================================================================== --- stable/12/sys/kern/kern_exit.c Tue Sep 10 20:49:47 2019 (r352189) +++ stable/12/sys/kern/kern_exit.c Tue Sep 10 20:55:47 2019 (r352190) @@ -147,8 +147,8 @@ reaper_abandon_children(struct proc *p, bool exiting) p->p_treeflag &= ~P_TREE_REAPER; } -static void -clear_orphan(struct proc *p) +void +proc_clear_orphan(struct proc *p) { struct proc *p1; @@ -505,7 +505,7 @@ exit1(struct thread *td, int rval, int signo) * list due to present P_TRACED flag. Clear * orphan link for q now while q is locked. */ - clear_orphan(q); + proc_clear_orphan(q); q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE); q->p_flag2 &= ~P2_PTRACE_FSTP; q->p_ptevents = 0; @@ -539,7 +539,7 @@ exit1(struct thread *td, int rval, int signo) kern_psignal(q, q->p_pdeathsig); CTR2(KTR_PTRACE, "exit: pid %d, clearing orphan %d", p->p_pid, q->p_pid); - clear_orphan(q); + proc_clear_orphan(q); PROC_UNLOCK(q); } @@ -889,7 +889,7 @@ proc_reap(struct thread *td, struct proc *p, int *stat reaper_abandon_children(p, true); LIST_REMOVE(p, p_reapsibling); PROC_LOCK(p); - clear_orphan(p); + proc_clear_orphan(p); PROC_UNLOCK(p); leavepgrp(p); if (p->p_procdesc != NULL) @@ -1367,7 +1367,7 @@ proc_reparent(struct proc *child, struct proc *parent, LIST_REMOVE(child, p_sibling); LIST_INSERT_HEAD(&parent->p_children, child, p_sibling); - clear_orphan(child); + proc_clear_orphan(child); if ((child->p_flag & P_TRACED) != 0) { proc_add_orphan(child, child->p_pptr); } Modified: stable/12/sys/sys/proc.h ============================================================================== --- stable/12/sys/sys/proc.h Tue Sep 10 20:49:47 2019 (r352189) +++ stable/12/sys/sys/proc.h Tue Sep 10 20:55:47 2019 (r352190) @@ -1069,6 +1069,7 @@ void proc_wkilled(struct proc *p); struct pstats *pstats_alloc(void); void pstats_fork(struct pstats *src, struct pstats *dst); void pstats_free(struct pstats *ps); +void proc_clear_orphan(struct proc *p); void reaper_abandon_children(struct proc *p, bool exiting); int securelevel_ge(struct ucred *cr, int level); int securelevel_gt(struct ucred *cr, int level); From owner-svn-src-stable@freebsd.org Tue Sep 10 21:13: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 57A33E4ADC; Tue, 10 Sep 2019 21:13:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Sd7D2MBzz42t4; Tue, 10 Sep 2019 21:13:44 +0000 (UTC) (envelope-from jkim@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 194AE2C17F; Tue, 10 Sep 2019 21:13:44 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8ALDijN088314; Tue, 10 Sep 2019 21:13:44 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8ALDceq088282; Tue, 10 Sep 2019 21:13:38 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201909102113.x8ALDceq088282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 10 Sep 2019 21:13:38 +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: r352192 - in stable/12: . crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bio crypto/openssl/cryp... X-SVN-Group: stable-12 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/12: . crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/aes/asm crypto/openssl/crypto/asn1 crypto/openssl/crypto/bio crypto/openssl/crypto/bn crypto/openssl/cryp... X-SVN-Commit-Revision: 352192 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, 10 Sep 2019 21:13:44 -0000 Author: jkim Date: Tue Sep 10 21:13:37 2019 New Revision: 352192 URL: https://svnweb.freebsd.org/changeset/base/352192 Log: MFC: r352191 Merge OpenSSL 1.1.1d. Added: stable/12/crypto/openssl/doc/man3/CRYPTO_memcmp.pod - copied unchanged from r352191, head/crypto/openssl/doc/man3/CRYPTO_memcmp.pod stable/12/crypto/openssl/doc/man3/X509_cmp.pod - copied unchanged from r352191, head/crypto/openssl/doc/man3/X509_cmp.pod stable/12/secure/lib/libcrypto/man/CRYPTO_memcmp.3 - copied unchanged from r352191, head/secure/lib/libcrypto/man/CRYPTO_memcmp.3 stable/12/secure/lib/libcrypto/man/X509_cmp.3 - copied unchanged from r352191, head/secure/lib/libcrypto/man/X509_cmp.3 Deleted: stable/12/crypto/openssl/crypto/aes/asm/aes-586.pl stable/12/crypto/openssl/crypto/aes/asm/aes-x86_64.pl stable/12/crypto/openssl/crypto/aes/asm/bsaes-x86_64.pl stable/12/secure/lib/libcrypto/amd64/aes-x86_64.S stable/12/secure/lib/libcrypto/amd64/bsaes-x86_64.S stable/12/secure/lib/libcrypto/i386/aes-586.S Modified: stable/12/ObsoleteFiles.inc stable/12/crypto/openssl/CHANGES stable/12/crypto/openssl/Configure stable/12/crypto/openssl/INSTALL stable/12/crypto/openssl/NEWS stable/12/crypto/openssl/README stable/12/crypto/openssl/apps/apps.c stable/12/crypto/openssl/apps/apps.h stable/12/crypto/openssl/apps/ca.c stable/12/crypto/openssl/apps/dgst.c stable/12/crypto/openssl/apps/enc.c stable/12/crypto/openssl/apps/ocsp.c stable/12/crypto/openssl/apps/openssl.c stable/12/crypto/openssl/apps/pkcs12.c stable/12/crypto/openssl/apps/req.c stable/12/crypto/openssl/apps/s_apps.h stable/12/crypto/openssl/apps/s_cb.c stable/12/crypto/openssl/apps/s_client.c stable/12/crypto/openssl/apps/speed.c stable/12/crypto/openssl/apps/storeutl.c stable/12/crypto/openssl/config stable/12/crypto/openssl/crypto/aes/asm/aes-s390x.pl stable/12/crypto/openssl/crypto/asn1/a_time.c stable/12/crypto/openssl/crypto/asn1/a_type.c stable/12/crypto/openssl/crypto/asn1/x_bignum.c stable/12/crypto/openssl/crypto/bio/b_addr.c stable/12/crypto/openssl/crypto/bio/bss_dgram.c stable/12/crypto/openssl/crypto/bio/bss_file.c stable/12/crypto/openssl/crypto/bio/bss_mem.c stable/12/crypto/openssl/crypto/bn/asm/mips.pl stable/12/crypto/openssl/crypto/bn/bn_div.c stable/12/crypto/openssl/crypto/bn/bn_lcl.h stable/12/crypto/openssl/crypto/bn/bn_lib.c stable/12/crypto/openssl/crypto/bn/bn_prime.c stable/12/crypto/openssl/crypto/bn/bn_rand.c stable/12/crypto/openssl/crypto/bn/bn_sqrt.c stable/12/crypto/openssl/crypto/cms/cms_att.c stable/12/crypto/openssl/crypto/cms/cms_env.c stable/12/crypto/openssl/crypto/cms/cms_err.c stable/12/crypto/openssl/crypto/cms/cms_lcl.h stable/12/crypto/openssl/crypto/cms/cms_sd.c stable/12/crypto/openssl/crypto/cms/cms_smime.c stable/12/crypto/openssl/crypto/conf/conf_sap.c stable/12/crypto/openssl/crypto/ctype.c stable/12/crypto/openssl/crypto/dh/dh_check.c stable/12/crypto/openssl/crypto/dh/dh_gen.c stable/12/crypto/openssl/crypto/dh/dh_key.c stable/12/crypto/openssl/crypto/dh/dh_lib.c stable/12/crypto/openssl/crypto/dsa/dsa_ameth.c stable/12/crypto/openssl/crypto/dsa/dsa_err.c stable/12/crypto/openssl/crypto/dsa/dsa_ossl.c stable/12/crypto/openssl/crypto/dso/dso_dlfcn.c stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-sparcv9.pl stable/12/crypto/openssl/crypto/ec/asm/ecp_nistz256-x86_64.pl stable/12/crypto/openssl/crypto/ec/asm/x25519-ppc64.pl stable/12/crypto/openssl/crypto/ec/ec_asn1.c stable/12/crypto/openssl/crypto/ec/ec_curve.c stable/12/crypto/openssl/crypto/ec/ec_lcl.h stable/12/crypto/openssl/crypto/ec/ec_lib.c stable/12/crypto/openssl/crypto/ec/ecdh_ossl.c stable/12/crypto/openssl/crypto/ec/ecdsa_ossl.c stable/12/crypto/openssl/crypto/ec/ecp_nistp224.c stable/12/crypto/openssl/crypto/ec/ecp_nistp256.c stable/12/crypto/openssl/crypto/ec/ecp_nistp521.c stable/12/crypto/openssl/crypto/ec/ecp_nistputil.c stable/12/crypto/openssl/crypto/ec/ecx_meth.c stable/12/crypto/openssl/crypto/engine/eng_devcrypto.c stable/12/crypto/openssl/crypto/engine/eng_openssl.c stable/12/crypto/openssl/crypto/err/err.c stable/12/crypto/openssl/crypto/err/openssl.txt stable/12/crypto/openssl/crypto/evp/bio_ok.c stable/12/crypto/openssl/crypto/evp/e_aes.c stable/12/crypto/openssl/crypto/evp/e_aria.c stable/12/crypto/openssl/crypto/evp/e_chacha20_poly1305.c stable/12/crypto/openssl/crypto/evp/e_rc5.c stable/12/crypto/openssl/crypto/evp/evp_err.c stable/12/crypto/openssl/crypto/evp/evp_lib.c stable/12/crypto/openssl/crypto/evp/m_sha3.c stable/12/crypto/openssl/crypto/include/internal/ctype.h stable/12/crypto/openssl/crypto/include/internal/rand_int.h stable/12/crypto/openssl/crypto/include/internal/sm2err.h stable/12/crypto/openssl/crypto/init.c stable/12/crypto/openssl/crypto/lhash/lhash.c stable/12/crypto/openssl/crypto/o_str.c stable/12/crypto/openssl/crypto/pem/pvkfmt.c stable/12/crypto/openssl/crypto/pkcs7/pk7_doit.c stable/12/crypto/openssl/crypto/rand/drbg_lib.c stable/12/crypto/openssl/crypto/rand/rand_err.c stable/12/crypto/openssl/crypto/rand/rand_lcl.h stable/12/crypto/openssl/crypto/rand/rand_lib.c stable/12/crypto/openssl/crypto/rand/rand_unix.c stable/12/crypto/openssl/crypto/rsa/rsa_ameth.c stable/12/crypto/openssl/crypto/rsa/rsa_err.c stable/12/crypto/openssl/crypto/rsa/rsa_gen.c stable/12/crypto/openssl/crypto/rsa/rsa_lib.c stable/12/crypto/openssl/crypto/rsa/rsa_ossl.c stable/12/crypto/openssl/crypto/s390xcap.c stable/12/crypto/openssl/crypto/sha/asm/keccak1600-armv4.pl stable/12/crypto/openssl/crypto/sha/asm/keccak1600-armv8.pl stable/12/crypto/openssl/crypto/sha/asm/sha512-sparcv9.pl stable/12/crypto/openssl/crypto/sm2/sm2_sign.c stable/12/crypto/openssl/crypto/store/loader_file.c stable/12/crypto/openssl/crypto/store/store_lib.c stable/12/crypto/openssl/crypto/threads_none.c stable/12/crypto/openssl/crypto/threads_pthread.c stable/12/crypto/openssl/crypto/ui/ui_lib.c stable/12/crypto/openssl/crypto/ui/ui_openssl.c stable/12/crypto/openssl/crypto/uid.c stable/12/crypto/openssl/crypto/whrlpool/wp_block.c stable/12/crypto/openssl/crypto/x509/by_dir.c stable/12/crypto/openssl/crypto/x509/t_req.c stable/12/crypto/openssl/crypto/x509/x509_att.c stable/12/crypto/openssl/crypto/x509/x509_cmp.c stable/12/crypto/openssl/crypto/x509/x509_err.c stable/12/crypto/openssl/crypto/x509/x509_lu.c stable/12/crypto/openssl/crypto/x509/x509_vfy.c stable/12/crypto/openssl/crypto/x509v3/v3_alt.c stable/12/crypto/openssl/crypto/x509v3/v3_purp.c stable/12/crypto/openssl/doc/HOWTO/proxy_certificates.txt stable/12/crypto/openssl/doc/man1/engine.pod stable/12/crypto/openssl/doc/man1/errstr.pod stable/12/crypto/openssl/doc/man1/pkcs12.pod stable/12/crypto/openssl/doc/man1/pkeyparam.pod stable/12/crypto/openssl/doc/man1/s_client.pod stable/12/crypto/openssl/doc/man1/s_server.pod stable/12/crypto/openssl/doc/man3/ADMISSIONS.pod stable/12/crypto/openssl/doc/man3/ASYNC_start_job.pod stable/12/crypto/openssl/doc/man3/BIO_connect.pod stable/12/crypto/openssl/doc/man3/BIO_f_ssl.pod stable/12/crypto/openssl/doc/man3/BIO_find_type.pod stable/12/crypto/openssl/doc/man3/BIO_new.pod stable/12/crypto/openssl/doc/man3/BIO_s_accept.pod stable/12/crypto/openssl/doc/man3/BIO_s_bio.pod stable/12/crypto/openssl/doc/man3/BIO_s_connect.pod stable/12/crypto/openssl/doc/man3/BIO_s_fd.pod stable/12/crypto/openssl/doc/man3/BIO_s_mem.pod stable/12/crypto/openssl/doc/man3/BIO_set_callback.pod stable/12/crypto/openssl/doc/man3/BN_generate_prime.pod stable/12/crypto/openssl/doc/man3/BN_mod_mul_montgomery.pod stable/12/crypto/openssl/doc/man3/BN_new.pod stable/12/crypto/openssl/doc/man3/CMS_final.pod stable/12/crypto/openssl/doc/man3/CRYPTO_THREAD_run_once.pod stable/12/crypto/openssl/doc/man3/DES_random_key.pod stable/12/crypto/openssl/doc/man3/DSA_generate_key.pod stable/12/crypto/openssl/doc/man3/DSA_sign.pod stable/12/crypto/openssl/doc/man3/ECDSA_SIG_new.pod stable/12/crypto/openssl/doc/man3/EVP_DigestInit.pod stable/12/crypto/openssl/doc/man3/EVP_DigestSignInit.pod stable/12/crypto/openssl/doc/man3/EVP_DigestVerifyInit.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_decrypt.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_derive.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_encrypt.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_sign.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_verify.pod stable/12/crypto/openssl/doc/man3/EVP_PKEY_verify_recover.pod stable/12/crypto/openssl/doc/man3/EVP_SealInit.pod stable/12/crypto/openssl/doc/man3/EVP_SignInit.pod stable/12/crypto/openssl/doc/man3/EVP_VerifyInit.pod stable/12/crypto/openssl/doc/man3/EVP_aria.pod stable/12/crypto/openssl/doc/man3/EVP_md5.pod stable/12/crypto/openssl/doc/man3/EVP_rc5_32_12_16_cbc.pod stable/12/crypto/openssl/doc/man3/OCSP_REQUEST_new.pod stable/12/crypto/openssl/doc/man3/OPENSSL_fork_prepare.pod stable/12/crypto/openssl/doc/man3/OSSL_STORE_LOADER.pod stable/12/crypto/openssl/doc/man3/OSSL_STORE_expect.pod stable/12/crypto/openssl/doc/man3/PKCS12_newpass.pod stable/12/crypto/openssl/doc/man3/RAND_DRBG_set_callbacks.pod stable/12/crypto/openssl/doc/man3/RAND_set_rand_method.pod stable/12/crypto/openssl/doc/man3/RSA_blinding_on.pod stable/12/crypto/openssl/doc/man3/RSA_generate_key.pod stable/12/crypto/openssl/doc/man3/RSA_padding_add_PKCS1_type_1.pod stable/12/crypto/openssl/doc/man3/RSA_public_encrypt.pod stable/12/crypto/openssl/doc/man3/RSA_sign_ASN1_OCTET_STRING.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_config.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_dane_enable.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_get0_param.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_new.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_set_cipher_list.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_set_generate_session_id.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_set_session_id_context.pod stable/12/crypto/openssl/doc/man3/SSL_CTX_set_verify.pod stable/12/crypto/openssl/doc/man3/SSL_SESSION_get0_hostname.pod stable/12/crypto/openssl/doc/man3/SSL_get_error.pod stable/12/crypto/openssl/doc/man3/SSL_library_init.pod stable/12/crypto/openssl/doc/man3/SSL_set1_host.pod stable/12/crypto/openssl/doc/man3/SSL_write.pod stable/12/crypto/openssl/doc/man3/X509_STORE_CTX_get_error.pod stable/12/crypto/openssl/doc/man3/X509_STORE_CTX_set_verify_cb.pod stable/12/crypto/openssl/doc/man3/X509_STORE_add_cert.pod stable/12/crypto/openssl/doc/man3/X509_STORE_new.pod stable/12/crypto/openssl/doc/man3/X509_VERIFY_PARAM_set_flags.pod stable/12/crypto/openssl/doc/man3/X509_get_extension_flags.pod stable/12/crypto/openssl/doc/man3/d2i_X509.pod stable/12/crypto/openssl/doc/man5/x509v3_config.pod stable/12/crypto/openssl/doc/man7/Ed25519.pod stable/12/crypto/openssl/doc/man7/RAND.pod stable/12/crypto/openssl/doc/man7/SM2.pod stable/12/crypto/openssl/doc/man7/X25519.pod stable/12/crypto/openssl/doc/man7/bio.pod stable/12/crypto/openssl/doc/man7/scrypt.pod stable/12/crypto/openssl/e_os.h stable/12/crypto/openssl/engines/build.info stable/12/crypto/openssl/engines/e_afalg.c stable/12/crypto/openssl/include/internal/constant_time_locl.h stable/12/crypto/openssl/include/internal/cryptlib.h stable/12/crypto/openssl/include/internal/dsoerr.h stable/12/crypto/openssl/include/internal/refcount.h stable/12/crypto/openssl/include/internal/thread_once.h stable/12/crypto/openssl/include/internal/tsan_assist.h stable/12/crypto/openssl/include/openssl/asn1err.h stable/12/crypto/openssl/include/openssl/asyncerr.h stable/12/crypto/openssl/include/openssl/bio.h stable/12/crypto/openssl/include/openssl/bioerr.h stable/12/crypto/openssl/include/openssl/bnerr.h stable/12/crypto/openssl/include/openssl/buffererr.h stable/12/crypto/openssl/include/openssl/cms.h stable/12/crypto/openssl/include/openssl/cmserr.h stable/12/crypto/openssl/include/openssl/comperr.h stable/12/crypto/openssl/include/openssl/conferr.h stable/12/crypto/openssl/include/openssl/cryptoerr.h stable/12/crypto/openssl/include/openssl/cterr.h stable/12/crypto/openssl/include/openssl/dherr.h stable/12/crypto/openssl/include/openssl/dsaerr.h stable/12/crypto/openssl/include/openssl/ec.h stable/12/crypto/openssl/include/openssl/ecerr.h stable/12/crypto/openssl/include/openssl/engineerr.h stable/12/crypto/openssl/include/openssl/evp.h stable/12/crypto/openssl/include/openssl/evperr.h stable/12/crypto/openssl/include/openssl/kdferr.h stable/12/crypto/openssl/include/openssl/objectserr.h stable/12/crypto/openssl/include/openssl/ocsperr.h stable/12/crypto/openssl/include/openssl/opensslv.h stable/12/crypto/openssl/include/openssl/pemerr.h stable/12/crypto/openssl/include/openssl/pkcs12err.h stable/12/crypto/openssl/include/openssl/pkcs7err.h stable/12/crypto/openssl/include/openssl/randerr.h stable/12/crypto/openssl/include/openssl/rsaerr.h stable/12/crypto/openssl/include/openssl/ssl.h stable/12/crypto/openssl/include/openssl/sslerr.h stable/12/crypto/openssl/include/openssl/store.h stable/12/crypto/openssl/include/openssl/storeerr.h stable/12/crypto/openssl/include/openssl/tls1.h stable/12/crypto/openssl/include/openssl/tserr.h stable/12/crypto/openssl/include/openssl/uierr.h stable/12/crypto/openssl/include/openssl/x509err.h stable/12/crypto/openssl/include/openssl/x509v3.h stable/12/crypto/openssl/include/openssl/x509v3err.h stable/12/crypto/openssl/ssl/d1_msg.c stable/12/crypto/openssl/ssl/record/rec_layer_s3.c stable/12/crypto/openssl/ssl/s3_lib.c stable/12/crypto/openssl/ssl/ssl_cert.c stable/12/crypto/openssl/ssl/ssl_ciph.c stable/12/crypto/openssl/ssl/ssl_lib.c stable/12/crypto/openssl/ssl/ssl_locl.h stable/12/crypto/openssl/ssl/ssl_sess.c stable/12/crypto/openssl/ssl/statem/extensions.c stable/12/crypto/openssl/ssl/statem/extensions_clnt.c stable/12/crypto/openssl/ssl/statem/extensions_srvr.c stable/12/crypto/openssl/ssl/statem/statem_clnt.c stable/12/crypto/openssl/ssl/statem/statem_lib.c stable/12/crypto/openssl/ssl/statem/statem_srvr.c stable/12/crypto/openssl/ssl/t1_lib.c stable/12/crypto/openssl/ssl/tls13_enc.c stable/12/secure/lib/libcrypto/Makefile stable/12/secure/lib/libcrypto/Makefile.asm stable/12/secure/lib/libcrypto/Makefile.inc stable/12/secure/lib/libcrypto/Makefile.man stable/12/secure/lib/libcrypto/Version.map stable/12/secure/lib/libcrypto/aarch64/keccak1600-armv8.S stable/12/secure/lib/libcrypto/arm/keccak1600-armv4.S stable/12/secure/lib/libcrypto/man/ADMISSIONS.3 stable/12/secure/lib/libcrypto/man/ASN1_INTEGER_get_int64.3 stable/12/secure/lib/libcrypto/man/ASN1_ITEM_lookup.3 stable/12/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 stable/12/secure/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 stable/12/secure/lib/libcrypto/man/ASN1_STRING_length.3 stable/12/secure/lib/libcrypto/man/ASN1_STRING_new.3 stable/12/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 stable/12/secure/lib/libcrypto/man/ASN1_TIME_set.3 stable/12/secure/lib/libcrypto/man/ASN1_TYPE_get.3 stable/12/secure/lib/libcrypto/man/ASN1_generate_nconf.3 stable/12/secure/lib/libcrypto/man/ASYNC_WAIT_CTX_new.3 stable/12/secure/lib/libcrypto/man/ASYNC_start_job.3 stable/12/secure/lib/libcrypto/man/BF_encrypt.3 stable/12/secure/lib/libcrypto/man/BIO_ADDR.3 stable/12/secure/lib/libcrypto/man/BIO_ADDRINFO.3 stable/12/secure/lib/libcrypto/man/BIO_connect.3 stable/12/secure/lib/libcrypto/man/BIO_ctrl.3 stable/12/secure/lib/libcrypto/man/BIO_f_base64.3 stable/12/secure/lib/libcrypto/man/BIO_f_buffer.3 stable/12/secure/lib/libcrypto/man/BIO_f_cipher.3 stable/12/secure/lib/libcrypto/man/BIO_f_md.3 stable/12/secure/lib/libcrypto/man/BIO_f_null.3 stable/12/secure/lib/libcrypto/man/BIO_f_ssl.3 stable/12/secure/lib/libcrypto/man/BIO_find_type.3 stable/12/secure/lib/libcrypto/man/BIO_get_data.3 stable/12/secure/lib/libcrypto/man/BIO_get_ex_new_index.3 stable/12/secure/lib/libcrypto/man/BIO_meth_new.3 stable/12/secure/lib/libcrypto/man/BIO_new.3 stable/12/secure/lib/libcrypto/man/BIO_new_CMS.3 stable/12/secure/lib/libcrypto/man/BIO_parse_hostserv.3 stable/12/secure/lib/libcrypto/man/BIO_printf.3 stable/12/secure/lib/libcrypto/man/BIO_push.3 stable/12/secure/lib/libcrypto/man/BIO_read.3 stable/12/secure/lib/libcrypto/man/BIO_s_accept.3 stable/12/secure/lib/libcrypto/man/BIO_s_bio.3 stable/12/secure/lib/libcrypto/man/BIO_s_connect.3 stable/12/secure/lib/libcrypto/man/BIO_s_fd.3 stable/12/secure/lib/libcrypto/man/BIO_s_file.3 stable/12/secure/lib/libcrypto/man/BIO_s_mem.3 stable/12/secure/lib/libcrypto/man/BIO_s_null.3 stable/12/secure/lib/libcrypto/man/BIO_s_socket.3 stable/12/secure/lib/libcrypto/man/BIO_set_callback.3 stable/12/secure/lib/libcrypto/man/BIO_should_retry.3 stable/12/secure/lib/libcrypto/man/BN_BLINDING_new.3 stable/12/secure/lib/libcrypto/man/BN_CTX_new.3 stable/12/secure/lib/libcrypto/man/BN_CTX_start.3 stable/12/secure/lib/libcrypto/man/BN_add.3 stable/12/secure/lib/libcrypto/man/BN_add_word.3 stable/12/secure/lib/libcrypto/man/BN_bn2bin.3 stable/12/secure/lib/libcrypto/man/BN_cmp.3 stable/12/secure/lib/libcrypto/man/BN_copy.3 stable/12/secure/lib/libcrypto/man/BN_generate_prime.3 stable/12/secure/lib/libcrypto/man/BN_mod_inverse.3 stable/12/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 stable/12/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 stable/12/secure/lib/libcrypto/man/BN_new.3 stable/12/secure/lib/libcrypto/man/BN_num_bytes.3 stable/12/secure/lib/libcrypto/man/BN_rand.3 stable/12/secure/lib/libcrypto/man/BN_security_bits.3 stable/12/secure/lib/libcrypto/man/BN_set_bit.3 stable/12/secure/lib/libcrypto/man/BN_swap.3 stable/12/secure/lib/libcrypto/man/BN_zero.3 stable/12/secure/lib/libcrypto/man/BUF_MEM_new.3 stable/12/secure/lib/libcrypto/man/CMS_add0_cert.3 stable/12/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 stable/12/secure/lib/libcrypto/man/CMS_add1_signer.3 stable/12/secure/lib/libcrypto/man/CMS_compress.3 stable/12/secure/lib/libcrypto/man/CMS_decrypt.3 stable/12/secure/lib/libcrypto/man/CMS_encrypt.3 stable/12/secure/lib/libcrypto/man/CMS_final.3 stable/12/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 stable/12/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 stable/12/secure/lib/libcrypto/man/CMS_get0_type.3 stable/12/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 stable/12/secure/lib/libcrypto/man/CMS_sign.3 stable/12/secure/lib/libcrypto/man/CMS_sign_receipt.3 stable/12/secure/lib/libcrypto/man/CMS_uncompress.3 stable/12/secure/lib/libcrypto/man/CMS_verify.3 stable/12/secure/lib/libcrypto/man/CMS_verify_receipt.3 stable/12/secure/lib/libcrypto/man/CONF_modules_free.3 stable/12/secure/lib/libcrypto/man/CONF_modules_load_file.3 stable/12/secure/lib/libcrypto/man/CRYPTO_THREAD_run_once.3 stable/12/secure/lib/libcrypto/man/CRYPTO_get_ex_new_index.3 stable/12/secure/lib/libcrypto/man/CTLOG_STORE_get0_log_by_id.3 stable/12/secure/lib/libcrypto/man/CTLOG_STORE_new.3 stable/12/secure/lib/libcrypto/man/CTLOG_new.3 stable/12/secure/lib/libcrypto/man/CT_POLICY_EVAL_CTX_new.3 stable/12/secure/lib/libcrypto/man/DEFINE_STACK_OF.3 stable/12/secure/lib/libcrypto/man/DES_random_key.3 stable/12/secure/lib/libcrypto/man/DH_generate_key.3 stable/12/secure/lib/libcrypto/man/DH_generate_parameters.3 stable/12/secure/lib/libcrypto/man/DH_get0_pqg.3 stable/12/secure/lib/libcrypto/man/DH_get_1024_160.3 stable/12/secure/lib/libcrypto/man/DH_meth_new.3 stable/12/secure/lib/libcrypto/man/DH_new.3 stable/12/secure/lib/libcrypto/man/DH_new_by_nid.3 stable/12/secure/lib/libcrypto/man/DH_set_method.3 stable/12/secure/lib/libcrypto/man/DH_size.3 stable/12/secure/lib/libcrypto/man/DSA_SIG_new.3 stable/12/secure/lib/libcrypto/man/DSA_do_sign.3 stable/12/secure/lib/libcrypto/man/DSA_dup_DH.3 stable/12/secure/lib/libcrypto/man/DSA_generate_key.3 stable/12/secure/lib/libcrypto/man/DSA_generate_parameters.3 stable/12/secure/lib/libcrypto/man/DSA_get0_pqg.3 stable/12/secure/lib/libcrypto/man/DSA_meth_new.3 stable/12/secure/lib/libcrypto/man/DSA_new.3 stable/12/secure/lib/libcrypto/man/DSA_set_method.3 stable/12/secure/lib/libcrypto/man/DSA_sign.3 stable/12/secure/lib/libcrypto/man/DSA_size.3 stable/12/secure/lib/libcrypto/man/DTLS_get_data_mtu.3 stable/12/secure/lib/libcrypto/man/DTLS_set_timer_cb.3 stable/12/secure/lib/libcrypto/man/DTLSv1_listen.3 stable/12/secure/lib/libcrypto/man/ECDSA_SIG_new.3 stable/12/secure/lib/libcrypto/man/ECPKParameters_print.3 stable/12/secure/lib/libcrypto/man/EC_GFp_simple_method.3 stable/12/secure/lib/libcrypto/man/EC_GROUP_copy.3 stable/12/secure/lib/libcrypto/man/EC_GROUP_new.3 stable/12/secure/lib/libcrypto/man/EC_KEY_get_enc_flags.3 stable/12/secure/lib/libcrypto/man/EC_KEY_new.3 stable/12/secure/lib/libcrypto/man/EC_POINT_add.3 stable/12/secure/lib/libcrypto/man/EC_POINT_new.3 stable/12/secure/lib/libcrypto/man/ENGINE_add.3 stable/12/secure/lib/libcrypto/man/ERR_GET_LIB.3 stable/12/secure/lib/libcrypto/man/ERR_clear_error.3 stable/12/secure/lib/libcrypto/man/ERR_error_string.3 stable/12/secure/lib/libcrypto/man/ERR_get_error.3 stable/12/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 stable/12/secure/lib/libcrypto/man/ERR_load_strings.3 stable/12/secure/lib/libcrypto/man/ERR_print_errors.3 stable/12/secure/lib/libcrypto/man/ERR_put_error.3 stable/12/secure/lib/libcrypto/man/ERR_remove_state.3 stable/12/secure/lib/libcrypto/man/ERR_set_mark.3 stable/12/secure/lib/libcrypto/man/EVP_BytesToKey.3 stable/12/secure/lib/libcrypto/man/EVP_CIPHER_CTX_get_cipher_data.3 stable/12/secure/lib/libcrypto/man/EVP_CIPHER_meth_new.3 stable/12/secure/lib/libcrypto/man/EVP_DigestInit.3 stable/12/secure/lib/libcrypto/man/EVP_DigestSignInit.3 stable/12/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 stable/12/secure/lib/libcrypto/man/EVP_EncodeInit.3 stable/12/secure/lib/libcrypto/man/EVP_EncryptInit.3 stable/12/secure/lib/libcrypto/man/EVP_MD_meth_new.3 stable/12/secure/lib/libcrypto/man/EVP_OpenInit.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_ASN1_METHOD.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_set1_pbe_pass.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_set_hkdf_md.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_set_rsa_pss_keygen_md.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_set_scrypt_N.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_CTX_set_tls1_prf_md.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_asn1_get_count.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_derive.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest_nid.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_meth_get_count.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_meth_new.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_new.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_sign.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_verify.3 stable/12/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 stable/12/secure/lib/libcrypto/man/EVP_SealInit.3 stable/12/secure/lib/libcrypto/man/EVP_SignInit.3 stable/12/secure/lib/libcrypto/man/EVP_VerifyInit.3 stable/12/secure/lib/libcrypto/man/EVP_aes.3 stable/12/secure/lib/libcrypto/man/EVP_aria.3 stable/12/secure/lib/libcrypto/man/EVP_bf_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_blake2b512.3 stable/12/secure/lib/libcrypto/man/EVP_camellia.3 stable/12/secure/lib/libcrypto/man/EVP_cast5_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_chacha20.3 stable/12/secure/lib/libcrypto/man/EVP_des.3 stable/12/secure/lib/libcrypto/man/EVP_desx_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_idea_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_md2.3 stable/12/secure/lib/libcrypto/man/EVP_md4.3 stable/12/secure/lib/libcrypto/man/EVP_md5.3 stable/12/secure/lib/libcrypto/man/EVP_mdc2.3 stable/12/secure/lib/libcrypto/man/EVP_rc2_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_rc4.3 stable/12/secure/lib/libcrypto/man/EVP_rc5_32_12_16_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_ripemd160.3 stable/12/secure/lib/libcrypto/man/EVP_seed_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_sha1.3 stable/12/secure/lib/libcrypto/man/EVP_sha224.3 stable/12/secure/lib/libcrypto/man/EVP_sha3_224.3 stable/12/secure/lib/libcrypto/man/EVP_sm3.3 stable/12/secure/lib/libcrypto/man/EVP_sm4_cbc.3 stable/12/secure/lib/libcrypto/man/EVP_whirlpool.3 stable/12/secure/lib/libcrypto/man/HMAC.3 stable/12/secure/lib/libcrypto/man/MD5.3 stable/12/secure/lib/libcrypto/man/MDC2_Init.3 stable/12/secure/lib/libcrypto/man/OBJ_nid2obj.3 stable/12/secure/lib/libcrypto/man/OCSP_REQUEST_new.3 stable/12/secure/lib/libcrypto/man/OCSP_cert_to_id.3 stable/12/secure/lib/libcrypto/man/OCSP_request_add1_nonce.3 stable/12/secure/lib/libcrypto/man/OCSP_resp_find_status.3 stable/12/secure/lib/libcrypto/man/OCSP_response_status.3 stable/12/secure/lib/libcrypto/man/OCSP_sendreq_new.3 stable/12/secure/lib/libcrypto/man/OPENSSL_Applink.3 stable/12/secure/lib/libcrypto/man/OPENSSL_LH_COMPFUNC.3 stable/12/secure/lib/libcrypto/man/OPENSSL_LH_stats.3 stable/12/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 stable/12/secure/lib/libcrypto/man/OPENSSL_config.3 stable/12/secure/lib/libcrypto/man/OPENSSL_fork_prepare.3 stable/12/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 stable/12/secure/lib/libcrypto/man/OPENSSL_init_crypto.3 stable/12/secure/lib/libcrypto/man/OPENSSL_init_ssl.3 stable/12/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 stable/12/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 stable/12/secure/lib/libcrypto/man/OPENSSL_malloc.3 stable/12/secure/lib/libcrypto/man/OPENSSL_secure_malloc.3 stable/12/secure/lib/libcrypto/man/OSSL_STORE_INFO.3 stable/12/secure/lib/libcrypto/man/OSSL_STORE_LOADER.3 stable/12/secure/lib/libcrypto/man/OSSL_STORE_SEARCH.3 stable/12/secure/lib/libcrypto/man/OSSL_STORE_expect.3 stable/12/secure/lib/libcrypto/man/OSSL_STORE_open.3 stable/12/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 stable/12/secure/lib/libcrypto/man/PEM_bytes_read_bio.3 stable/12/secure/lib/libcrypto/man/PEM_read.3 stable/12/secure/lib/libcrypto/man/PEM_read_CMS.3 stable/12/secure/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 stable/12/secure/lib/libcrypto/man/PEM_read_bio_ex.3 stable/12/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 stable/12/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 stable/12/secure/lib/libcrypto/man/PKCS12_create.3 stable/12/secure/lib/libcrypto/man/PKCS12_newpass.3 stable/12/secure/lib/libcrypto/man/PKCS12_parse.3 stable/12/secure/lib/libcrypto/man/PKCS5_PBKDF2_HMAC.3 stable/12/secure/lib/libcrypto/man/PKCS7_decrypt.3 stable/12/secure/lib/libcrypto/man/PKCS7_encrypt.3 stable/12/secure/lib/libcrypto/man/PKCS7_sign.3 stable/12/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 stable/12/secure/lib/libcrypto/man/PKCS7_verify.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_generate.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_get0_master.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_new.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_reseed.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_set_callbacks.3 stable/12/secure/lib/libcrypto/man/RAND_DRBG_set_ex_data.3 stable/12/secure/lib/libcrypto/man/RAND_add.3 stable/12/secure/lib/libcrypto/man/RAND_bytes.3 stable/12/secure/lib/libcrypto/man/RAND_cleanup.3 stable/12/secure/lib/libcrypto/man/RAND_egd.3 stable/12/secure/lib/libcrypto/man/RAND_load_file.3 stable/12/secure/lib/libcrypto/man/RAND_set_rand_method.3 stable/12/secure/lib/libcrypto/man/RC4_set_key.3 stable/12/secure/lib/libcrypto/man/RIPEMD160_Init.3 stable/12/secure/lib/libcrypto/man/RSA_blinding_on.3 stable/12/secure/lib/libcrypto/man/RSA_check_key.3 stable/12/secure/lib/libcrypto/man/RSA_generate_key.3 stable/12/secure/lib/libcrypto/man/RSA_get0_key.3 stable/12/secure/lib/libcrypto/man/RSA_meth_new.3 stable/12/secure/lib/libcrypto/man/RSA_new.3 stable/12/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 stable/12/secure/lib/libcrypto/man/RSA_print.3 stable/12/secure/lib/libcrypto/man/RSA_private_encrypt.3 stable/12/secure/lib/libcrypto/man/RSA_public_encrypt.3 stable/12/secure/lib/libcrypto/man/RSA_set_method.3 stable/12/secure/lib/libcrypto/man/RSA_sign.3 stable/12/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 stable/12/secure/lib/libcrypto/man/RSA_size.3 stable/12/secure/lib/libcrypto/man/SCT_new.3 stable/12/secure/lib/libcrypto/man/SCT_print.3 stable/12/secure/lib/libcrypto/man/SCT_validate.3 stable/12/secure/lib/libcrypto/man/SHA256_Init.3 stable/12/secure/lib/libcrypto/man/SMIME_read_CMS.3 stable/12/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 stable/12/secure/lib/libcrypto/man/SMIME_write_CMS.3 stable/12/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 stable/12/secure/lib/libcrypto/man/SSL_CIPHER_get_name.3 stable/12/secure/lib/libcrypto/man/SSL_COMP_add_compression_method.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_CTX_new.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_CTX_set1_prefix.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_CTX_set_flags.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_CTX_set_ssl_ctx.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_cmd.3 stable/12/secure/lib/libcrypto/man/SSL_CONF_cmd_argv.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_add1_chain_cert.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_add_extra_chain_cert.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_add_session.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_config.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_ctrl.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_dane_enable.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_flush_sessions.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_free.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_get0_param.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_get_verify_mode.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_has_client_custom_ext.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_load_verify_locations.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_new.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_sess_number.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_sess_set_cache_size.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_sess_set_get_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_sessions.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set0_CA_list.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set1_curves.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set1_sigalgs.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set1_verify_cert_store.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_alpn_select_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_cert_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_cert_store.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_cert_verify_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_cipher_list.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_client_cert_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_client_hello_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_ct_validation_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_ctlog_list_file.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_default_passwd_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_ex_data.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_generate_session_id.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_info_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_keylog_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_max_cert_list.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_min_proto_version.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_mode.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_msg_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_num_tickets.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_options.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_psk_client_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_quiet_shutdown.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_read_ahead.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_record_padding_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_security_level.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_session_cache_mode.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_session_id_context.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_session_ticket_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_split_send_fragment.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_ssl_version.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_stateless_cookie_generate_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_timeout.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_tlsext_servername_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_tlsext_status_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_tlsext_ticket_key_cb.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_tlsext_use_srtp.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_tmp_dh_callback.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_set_verify.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_use_certificate.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_use_psk_identity_hint.3 stable/12/secure/lib/libcrypto/man/SSL_CTX_use_serverinfo.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_free.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get0_cipher.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get0_hostname.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get0_id_context.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get0_peer.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get_compress_id.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get_ex_data.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get_protocol_version.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_get_time.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_has_ticket.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_is_resumable.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_print.3 stable/12/secure/lib/libcrypto/man/SSL_SESSION_set1_id.3 stable/12/secure/lib/libcrypto/man/SSL_accept.3 stable/12/secure/lib/libcrypto/man/SSL_alert_type_string.3 stable/12/secure/lib/libcrypto/man/SSL_alloc_buffers.3 stable/12/secure/lib/libcrypto/man/SSL_check_chain.3 stable/12/secure/lib/libcrypto/man/SSL_clear.3 stable/12/secure/lib/libcrypto/man/SSL_connect.3 stable/12/secure/lib/libcrypto/man/SSL_do_handshake.3 stable/12/secure/lib/libcrypto/man/SSL_export_keying_material.3 stable/12/secure/lib/libcrypto/man/SSL_extension_supported.3 stable/12/secure/lib/libcrypto/man/SSL_free.3 stable/12/secure/lib/libcrypto/man/SSL_get0_peer_scts.3 stable/12/secure/lib/libcrypto/man/SSL_get_SSL_CTX.3 stable/12/secure/lib/libcrypto/man/SSL_get_all_async_fds.3 stable/12/secure/lib/libcrypto/man/SSL_get_ciphers.3 stable/12/secure/lib/libcrypto/man/SSL_get_client_random.3 stable/12/secure/lib/libcrypto/man/SSL_get_current_cipher.3 stable/12/secure/lib/libcrypto/man/SSL_get_default_timeout.3 stable/12/secure/lib/libcrypto/man/SSL_get_error.3 stable/12/secure/lib/libcrypto/man/SSL_get_extms_support.3 stable/12/secure/lib/libcrypto/man/SSL_get_fd.3 stable/12/secure/lib/libcrypto/man/SSL_get_peer_cert_chain.3 stable/12/secure/lib/libcrypto/man/SSL_get_peer_certificate.3 stable/12/secure/lib/libcrypto/man/SSL_get_peer_signature_nid.3 stable/12/secure/lib/libcrypto/man/SSL_get_peer_tmp_key.3 stable/12/secure/lib/libcrypto/man/SSL_get_psk_identity.3 stable/12/secure/lib/libcrypto/man/SSL_get_rbio.3 stable/12/secure/lib/libcrypto/man/SSL_get_session.3 stable/12/secure/lib/libcrypto/man/SSL_get_shared_sigalgs.3 stable/12/secure/lib/libcrypto/man/SSL_get_verify_result.3 stable/12/secure/lib/libcrypto/man/SSL_get_version.3 stable/12/secure/lib/libcrypto/man/SSL_in_init.3 stable/12/secure/lib/libcrypto/man/SSL_key_update.3 stable/12/secure/lib/libcrypto/man/SSL_library_init.3 stable/12/secure/lib/libcrypto/man/SSL_load_client_CA_file.3 stable/12/secure/lib/libcrypto/man/SSL_new.3 stable/12/secure/lib/libcrypto/man/SSL_pending.3 stable/12/secure/lib/libcrypto/man/SSL_read.3 stable/12/secure/lib/libcrypto/man/SSL_read_early_data.3 stable/12/secure/lib/libcrypto/man/SSL_rstate_string.3 stable/12/secure/lib/libcrypto/man/SSL_session_reused.3 stable/12/secure/lib/libcrypto/man/SSL_set1_host.3 stable/12/secure/lib/libcrypto/man/SSL_set_bio.3 stable/12/secure/lib/libcrypto/man/SSL_set_connect_state.3 stable/12/secure/lib/libcrypto/man/SSL_set_fd.3 stable/12/secure/lib/libcrypto/man/SSL_set_session.3 stable/12/secure/lib/libcrypto/man/SSL_set_shutdown.3 stable/12/secure/lib/libcrypto/man/SSL_set_verify_result.3 stable/12/secure/lib/libcrypto/man/SSL_shutdown.3 stable/12/secure/lib/libcrypto/man/SSL_state_string.3 stable/12/secure/lib/libcrypto/man/SSL_want.3 stable/12/secure/lib/libcrypto/man/SSL_write.3 stable/12/secure/lib/libcrypto/man/UI_STRING.3 stable/12/secure/lib/libcrypto/man/UI_UTIL_read_pw.3 stable/12/secure/lib/libcrypto/man/UI_create_method.3 stable/12/secure/lib/libcrypto/man/UI_new.3 stable/12/secure/lib/libcrypto/man/X509V3_get_d2i.3 stable/12/secure/lib/libcrypto/man/X509_ALGOR_dup.3 stable/12/secure/lib/libcrypto/man/X509_CRL_get0_by_serial.3 stable/12/secure/lib/libcrypto/man/X509_EXTENSION_set_object.3 stable/12/secure/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 stable/12/secure/lib/libcrypto/man/X509_LOOKUP_meth_new.3 stable/12/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 stable/12/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 stable/12/secure/lib/libcrypto/man/X509_NAME_get0_der.3 stable/12/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 stable/12/secure/lib/libcrypto/man/X509_NAME_print_ex.3 stable/12/secure/lib/libcrypto/man/X509_PUBKEY_new.3 stable/12/secure/lib/libcrypto/man/X509_SIG_get0.3 stable/12/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 stable/12/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 stable/12/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 stable/12/secure/lib/libcrypto/man/X509_STORE_add_cert.3 stable/12/secure/lib/libcrypto/man/X509_STORE_get0_param.3 stable/12/secure/lib/libcrypto/man/X509_STORE_new.3 stable/12/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 stable/12/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 stable/12/secure/lib/libcrypto/man/X509_check_ca.3 stable/12/secure/lib/libcrypto/man/X509_check_host.3 stable/12/secure/lib/libcrypto/man/X509_check_issued.3 stable/12/secure/lib/libcrypto/man/X509_check_private_key.3 stable/12/secure/lib/libcrypto/man/X509_cmp_time.3 stable/12/secure/lib/libcrypto/man/X509_digest.3 stable/12/secure/lib/libcrypto/man/X509_dup.3 stable/12/secure/lib/libcrypto/man/X509_get0_notBefore.3 stable/12/secure/lib/libcrypto/man/X509_get0_signature.3 stable/12/secure/lib/libcrypto/man/X509_get0_uids.3 stable/12/secure/lib/libcrypto/man/X509_get_extension_flags.3 stable/12/secure/lib/libcrypto/man/X509_get_pubkey.3 stable/12/secure/lib/libcrypto/man/X509_get_serialNumber.3 stable/12/secure/lib/libcrypto/man/X509_get_subject_name.3 stable/12/secure/lib/libcrypto/man/X509_get_version.3 stable/12/secure/lib/libcrypto/man/X509_new.3 stable/12/secure/lib/libcrypto/man/X509_sign.3 stable/12/secure/lib/libcrypto/man/X509_verify_cert.3 stable/12/secure/lib/libcrypto/man/X509v3_get_ext_by_NID.3 stable/12/secure/lib/libcrypto/man/d2i_DHparams.3 stable/12/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey_bio.3 stable/12/secure/lib/libcrypto/man/d2i_PrivateKey.3 stable/12/secure/lib/libcrypto/man/d2i_SSL_SESSION.3 stable/12/secure/lib/libcrypto/man/d2i_X509.3 stable/12/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 stable/12/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 stable/12/secure/lib/libcrypto/man/i2d_re_X509_tbs.3 stable/12/secure/lib/libcrypto/man/o2i_SCT_LIST.3 stable/12/secure/usr.bin/openssl/man/CA.pl.1 stable/12/secure/usr.bin/openssl/man/asn1parse.1 stable/12/secure/usr.bin/openssl/man/ca.1 stable/12/secure/usr.bin/openssl/man/ciphers.1 stable/12/secure/usr.bin/openssl/man/cms.1 stable/12/secure/usr.bin/openssl/man/crl.1 stable/12/secure/usr.bin/openssl/man/crl2pkcs7.1 stable/12/secure/usr.bin/openssl/man/dgst.1 stable/12/secure/usr.bin/openssl/man/dhparam.1 stable/12/secure/usr.bin/openssl/man/dsa.1 stable/12/secure/usr.bin/openssl/man/dsaparam.1 stable/12/secure/usr.bin/openssl/man/ec.1 stable/12/secure/usr.bin/openssl/man/ecparam.1 stable/12/secure/usr.bin/openssl/man/enc.1 stable/12/secure/usr.bin/openssl/man/engine.1 stable/12/secure/usr.bin/openssl/man/errstr.1 stable/12/secure/usr.bin/openssl/man/gendsa.1 stable/12/secure/usr.bin/openssl/man/genpkey.1 stable/12/secure/usr.bin/openssl/man/genrsa.1 stable/12/secure/usr.bin/openssl/man/list.1 stable/12/secure/usr.bin/openssl/man/nseq.1 stable/12/secure/usr.bin/openssl/man/ocsp.1 stable/12/secure/usr.bin/openssl/man/openssl.1 stable/12/secure/usr.bin/openssl/man/passwd.1 stable/12/secure/usr.bin/openssl/man/pkcs12.1 stable/12/secure/usr.bin/openssl/man/pkcs7.1 stable/12/secure/usr.bin/openssl/man/pkcs8.1 stable/12/secure/usr.bin/openssl/man/pkey.1 stable/12/secure/usr.bin/openssl/man/pkeyparam.1 stable/12/secure/usr.bin/openssl/man/pkeyutl.1 stable/12/secure/usr.bin/openssl/man/prime.1 stable/12/secure/usr.bin/openssl/man/rand.1 stable/12/secure/usr.bin/openssl/man/req.1 stable/12/secure/usr.bin/openssl/man/rsa.1 stable/12/secure/usr.bin/openssl/man/rsautl.1 stable/12/secure/usr.bin/openssl/man/s_client.1 stable/12/secure/usr.bin/openssl/man/s_server.1 stable/12/secure/usr.bin/openssl/man/s_time.1 stable/12/secure/usr.bin/openssl/man/sess_id.1 stable/12/secure/usr.bin/openssl/man/smime.1 stable/12/secure/usr.bin/openssl/man/speed.1 stable/12/secure/usr.bin/openssl/man/spkac.1 stable/12/secure/usr.bin/openssl/man/srp.1 stable/12/secure/usr.bin/openssl/man/storeutl.1 stable/12/secure/usr.bin/openssl/man/ts.1 stable/12/secure/usr.bin/openssl/man/tsget.1 stable/12/secure/usr.bin/openssl/man/verify.1 stable/12/secure/usr.bin/openssl/man/version.1 stable/12/secure/usr.bin/openssl/man/x509.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/ObsoleteFiles.inc Tue Sep 10 21:13:37 2019 (r352192) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190910: OpenSSL 1.1.1d +OLD_FILES+=usr/share/openssl/man/man3/d2i_ECDSA_SIG.3.gz +OLD_FILES+=usr/share/openssl/man/man3/i2d_ECDSA_SIG.3.gz # 20190811: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 # 20190723: new clang import which bumps version from 8.0.0 to 8.0.1. Modified: stable/12/crypto/openssl/CHANGES ============================================================================== --- stable/12/crypto/openssl/CHANGES Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/CHANGES Tue Sep 10 21:13:37 2019 (r352192) @@ -7,6 +7,101 @@ https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + Changes between 1.1.1c and 1.1.1d [10 Sep 2019] + + *) Fixed a fork protection issue. OpenSSL 1.1.1 introduced a rewritten random + number generator (RNG). This was intended to include protection in the + event of a fork() system call in order to ensure that the parent and child + processes did not share the same RNG state. However this protection was not + being used in the default case. + + A partial mitigation for this issue is that the output from a high + precision timer is mixed into the RNG state so the likelihood of a parent + and child process sharing state is significantly reduced. + + If an application already calls OPENSSL_init_crypto() explicitly using + OPENSSL_INIT_ATFORK then this problem does not occur at all. + (CVE-2019-1549) + [Matthias St. Pierre] + + *) For built-in EC curves, ensure an EC_GROUP built from the curve name is + used even when parsing explicit parameters, when loading a serialized key + or calling `EC_GROUP_new_from_ecpkparameters()`/ + `EC_GROUP_new_from_ecparameters()`. + This prevents bypass of security hardening and performance gains, + especially for curves with specialized EC_METHODs. + By default, if a key encoded with explicit parameters is loaded and later + serialized, the output is still encoded with explicit parameters, even if + internally a "named" EC_GROUP is used for computation. + [Nicola Tuveri] + + *) Compute ECC cofactors if not provided during EC_GROUP construction. Before + this change, EC_GROUP_set_generator would accept order and/or cofactor as + NULL. After this change, only the cofactor parameter can be NULL. It also + does some minimal sanity checks on the passed order. + (CVE-2019-1547) + [Billy Bob Brumley] + + *) Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey. + An attack is simple, if the first CMS_recipientInfo is valid but the + second CMS_recipientInfo is chosen ciphertext. If the second + recipientInfo decodes to PKCS #1 v1.5 form plaintext, the correct + encryption key will be replaced by garbage, and the message cannot be + decoded, but if the RSA decryption fails, the correct encryption key is + used and the recipient will not notice the attack. + As a work around for this potential attack the length of the decrypted + key must be equal to the cipher default key length, in case the + certifiate is not given and all recipientInfo are tried out. + The old behaviour can be re-enabled in the CMS code by setting the + CMS_DEBUG_DECRYPT flag. + (CVE-2019-1563) + [Bernd Edlinger] + + *) Early start up entropy quality from the DEVRANDOM seed source has been + improved for older Linux systems. The RAND subsystem will wait for + /dev/random to be producing output before seeding from /dev/urandom. + The seeded state is stored for future library initialisations using + a system global shared memory segment. The shared memory identifier + can be configured by defining OPENSSL_RAND_SEED_DEVRANDOM_SHM_ID to + the desired value. The default identifier is 114. + [Paul Dale] + + *) Correct the extended master secret constant on EBCDIC systems. Without this + fix TLS connections between an EBCDIC system and a non-EBCDIC system that + negotiate EMS will fail. Unfortunately this also means that TLS connections + between EBCDIC systems with this fix, and EBCDIC systems without this + fix will fail if they negotiate EMS. + [Matt Caswell] + + *) Use Windows installation paths in the mingw builds + + Mingw isn't a POSIX environment per se, which means that Windows + paths should be used for installation. + (CVE-2019-1552) + [Richard Levitte] + + *) Changed DH_check to accept parameters with order q and 2q subgroups. + With order 2q subgroups the bit 0 of the private key is not secret + but DH_generate_key works around that by clearing bit 0 of the + private key for those. This avoids leaking bit 0 of the private key. + [Bernd Edlinger] + + *) Significantly reduce secure memory usage by the randomness pools. + [Paul Dale] + + *) Revert the DEVRANDOM_WAIT feature for Linux systems + + The DEVRANDOM_WAIT feature added a select() call to wait for the + /dev/random device to become readable before reading from the + /dev/urandom device. + + It turned out that this change had negative side effects on + performance which were not acceptable. After some discussion it + was decided to revert this feature and leave it up to the OS + resp. the platform maintainer to ensure a proper initialization + during early boot time. + [Matthias St. Pierre] + Changes between 1.1.1b and 1.1.1c [28 May 2019] *) Add build tests for C++. These are generated files that only do one @@ -75,6 +170,16 @@ (CVE-2019-1543) [Matt Caswell] + *) Add DEVRANDOM_WAIT feature for Linux systems + + On older Linux systems where the getrandom() system call is not available, + OpenSSL normally uses the /dev/urandom device for seeding its CSPRNG. + Contrary to getrandom(), the /dev/urandom device will not block during + early boot when the kernel CSPRNG has not been seeded yet. + + To mitigate this known weakness, use select() to wait for /dev/random to + become readable before reading from /dev/urandom. + *) Ensure that SM2 only uses SM3 as digest algorithm [Paul Yang] @@ -322,7 +427,7 @@ SSL_set_ciphersuites() [Matt Caswell] - *) Memory allocation failures consistenly add an error to the error + *) Memory allocation failures consistently add an error to the error stack. [Rich Salz] @@ -6860,7 +6965,7 @@ reason texts, thereby removing some of the footprint that may not be interesting if those errors aren't displayed anyway. - NOTE: it's still possible for any application or module to have it's + NOTE: it's still possible for any application or module to have its own set of error texts inserted. The routines are there, just not used by default when no-err is given. [Richard Levitte] @@ -8826,7 +8931,7 @@ des-cbc 3624.96k 5258.21k 5530.91k Changes between 0.9.6g and 0.9.6h [5 Dec 2002] *) New function OPENSSL_cleanse(), which is used to cleanse a section of - memory from it's contents. This is done with a counter that will + memory from its contents. This is done with a counter that will place alternating values in each byte. This can be used to solve two issues: 1) the removal of calls to memset() by highly optimizing compilers, and 2) cleansing with other values than 0, since those can Modified: stable/12/crypto/openssl/Configure ============================================================================== --- stable/12/crypto/openssl/Configure Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/Configure Tue Sep 10 21:13:37 2019 (r352192) @@ -87,9 +87,6 @@ my $usage="Usage: Configure [no- ...] [enable- # linked openssl executable has rather debugging value than # production quality. # -# DEBUG_SAFESTACK use type-safe stacks to enforce type-safety on stack items -# provided to stack calls. Generates unique stack functions for -# each possible stack type. # BN_LLONG use the type 'long long' in crypto/bn/bn.h # RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h # Following are set automatically by this script @@ -145,13 +142,13 @@ my @gcc_devteam_warn = qw( # -Wunused-macros -- no, too tricky for BN and _XOPEN_SOURCE etc # -Wextended-offsetof -- no, needed in CMS ASN1 code my @clang_devteam_warn = qw( + -Wno-unknown-warning-option -Wswitch-default -Wno-parentheses-equality -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Wincompatible-pointer-types-discards-qualifiers - -Wno-unknown-warning-option -Wmissing-variable-declarations ); Modified: stable/12/crypto/openssl/INSTALL ============================================================================== --- stable/12/crypto/openssl/INSTALL Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/INSTALL Tue Sep 10 21:13:37 2019 (r352192) @@ -98,6 +98,9 @@ $ nmake test $ nmake install + Note that in order to perform the install step above you need to have + appropriate permissions to write to the installation directory. + If any of these steps fails, see section Installation in Detail below. This will build and install OpenSSL in the default location, which is: @@ -107,6 +110,12 @@ OpenSSL version number with underscores instead of periods. Windows: C:\Program Files\OpenSSL or C:\Program Files (x86)\OpenSSL + The installation directory should be appropriately protected to ensure + unprivileged users cannot make changes to OpenSSL binaries or files, or install + engines. If you already have a pre-installed version of OpenSSL as part of + your Operating System it is recommended that you do not overwrite the system + version and instead install to somewhere else. + If you want to install it anywhere else, run config like this: On Unix: @@ -135,7 +144,10 @@ Don't build with support for deprecated APIs below the specified version number. For example "--api=1.1.0" will remove support for all APIS that were deprecated in OpenSSL - version 1.1.0 or below. + version 1.1.0 or below. This is a rather specialized option + for developers. If you just intend to remove all deprecated + APIs entirely (up to the current version), it is easier + to add the 'no-deprecated' option instead (see below). --cross-compile-prefix=PREFIX The PREFIX to include in front of commands for your @@ -229,7 +241,7 @@ source exists. getrandom: Use the L or equivalent system call. - devrandom: Use the the first device from the DEVRANDOM list + devrandom: Use the first device from the DEVRANDOM list which can be opened to read random bytes. The DEVRANDOM preprocessor constant expands to "/dev/urandom","/dev/random","/dev/srandom" on @@ -908,8 +920,11 @@ $ mms install ! OpenVMS $ nmake install # Windows - This will install all the software components in this directory - tree under PREFIX (the directory given with --prefix or its + Note that in order to perform the install step above you need to have + appropriate permissions to write to the installation directory. + + The above commands will install all the software components in this + directory tree under PREFIX (the directory given with --prefix or its default): Unix: @@ -964,6 +979,12 @@ private Initially empty, this is the default location for private key files. misc Various scripts. + + The installation directory should be appropriately protected to ensure + unprivileged users cannot make changes to OpenSSL binaries or files, or + install engines. If you already have a pre-installed version of OpenSSL as + part of your Operating System it is recommended that you do not overwrite + the system version and instead install to somewhere else. Package builders who want to configure the library for standard locations, but have the package installed somewhere else so that Modified: stable/12/crypto/openssl/NEWS ============================================================================== --- stable/12/crypto/openssl/NEWS Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/NEWS Tue Sep 10 21:13:37 2019 (r352192) @@ -5,6 +5,23 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.1.1c and OpenSSL 1.1.1d [10 Sep 2019] + + o Fixed a fork protection issue (CVE-2019-1549) + o Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey + (CVE-2019-1563) + o For built-in EC curves, ensure an EC_GROUP built from the curve name is + used even when parsing explicit parameters + o Compute ECC cofactors if not provided during EC_GROUP construction + (CVE-2019-1547) + o Early start up entropy quality from the DEVRANDOM seed source has been + improved for older Linux systems + o Correct the extended master secret constant on EBCDIC systems + o Use Windows installation paths in the mingw builds (CVE-2019-1552) + o Changed DH_check to accept parameters with order q and 2q subgroups + o Significantly reduce secure memory usage by the randomness pools + o Revert the DEVRANDOM_WAIT feature for Linux systems + Major changes between OpenSSL 1.1.1b and OpenSSL 1.1.1c [28 May 2019] o Prevent over long nonces in ChaCha20-Poly1305 (CVE-2019-1543) @@ -601,7 +618,7 @@ Major changes between OpenSSL 0.9.7h and OpenSSL 0.9.7i [14 Oct 2005]: - o Give EVP_MAX_MD_SIZE it's old value, except for a FIPS build. + o Give EVP_MAX_MD_SIZE its old value, except for a FIPS build. Major changes between OpenSSL 0.9.7g and OpenSSL 0.9.7h [11 Oct 2005]: Modified: stable/12/crypto/openssl/README ============================================================================== --- stable/12/crypto/openssl/README Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/README Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ - OpenSSL 1.1.1c 28 May 2019 + OpenSSL 1.1.1d 10 Sep 2019 Copyright (c) 1998-2019 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Modified: stable/12/crypto/openssl/apps/apps.c ============================================================================== --- stable/12/crypto/openssl/apps/apps.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/apps.c Tue Sep 10 21:13:37 2019 (r352192) @@ -40,12 +40,19 @@ #endif #include #include -#include "s_apps.h" #include "apps.h" #ifdef _WIN32 static int WIN32_rename(const char *from, const char *to); # define rename(from,to) WIN32_rename((from),(to)) +#endif + +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) +# include +#endif + +#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32) +# define _kbhit kbhit #endif typedef struct { Modified: stable/12/crypto/openssl/apps/apps.h ============================================================================== --- stable/12/crypto/openssl/apps/apps.h Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/apps.h Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -444,11 +444,9 @@ void destroy_ui_method(void); const UI_METHOD *get_ui_method(void); int chopup_args(ARGS *arg, char *buf); -# ifdef HEADER_X509_H int dump_cert_text(BIO *out, X509 *x); void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags); -# endif void print_bignum_var(BIO *, const BIGNUM *, const char*, int, unsigned char *); void print_array(BIO *, const char *, int, const unsigned char *); Modified: stable/12/crypto/openssl/apps/ca.c ============================================================================== --- stable/12/crypto/openssl/apps/ca.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/ca.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -722,7 +722,7 @@ end_of_options: /*****************************************************************/ if (req || gencrl) { - if (spkac_file != NULL) { + if (spkac_file != NULL && outfile != NULL) { output_der = 1; batch = 1; } Modified: stable/12/crypto/openssl/apps/dgst.c ============================================================================== --- stable/12/crypto/openssl/apps/dgst.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/dgst.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -421,7 +421,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int s size_t len; int i; - for (;;) { + while (BIO_pending(bp) || !BIO_eof(bp)) { i = BIO_read(bp, (char *)buf, BUFSIZE); if (i < 0) { BIO_printf(bio_err, "Read Error in %s\n", file); Modified: stable/12/crypto/openssl/apps/enc.c ============================================================================== --- stable/12/crypto/openssl/apps/enc.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/enc.c Tue Sep 10 21:13:37 2019 (r352192) @@ -586,7 +586,7 @@ int enc_main(int argc, char **argv) if (benc != NULL) wbio = BIO_push(benc, wbio); - for (;;) { + while (BIO_pending(rbio) || !BIO_eof(rbio)) { inl = BIO_read(rbio, (char *)buff, bsize); if (inl <= 0) break; Modified: stable/12/crypto/openssl/apps/ocsp.c ============================================================================== --- stable/12/crypto/openssl/apps/ocsp.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/ocsp.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1416,9 +1416,11 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcb *q = '\0'; /* - * Skip "GET / HTTP..." requests often used by load-balancers + * Skip "GET / HTTP..." requests often used by load-balancers. Note: + * 'p' was incremented above to point to the first byte *after* the + * leading slash, so with 'GET / ' it is now an empty string. */ - if (p[1] == '\0') + if (p[0] == '\0') goto out; len = urldecode(p); Modified: stable/12/crypto/openssl/apps/openssl.c ============================================================================== --- stable/12/crypto/openssl/apps/openssl.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/openssl.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -22,7 +22,6 @@ # include #endif #include -#include "s_apps.h" /* Needed to get the other O_xxx flags. */ #ifdef OPENSSL_SYS_VMS # include Modified: stable/12/crypto/openssl/apps/pkcs12.c ============================================================================== --- stable/12/crypto/openssl/apps/pkcs12.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/pkcs12.c Tue Sep 10 21:13:37 2019 (r352192) @@ -838,7 +838,7 @@ static int alg_print(const X509_ALGOR *alg) goto done; } BIO_printf(bio_err, ", Salt length: %d, Cost(N): %ld, " - "Block size(r): %ld, Paralelizm(p): %ld", + "Block size(r): %ld, Parallelism(p): %ld", ASN1_STRING_length(kdf->salt), ASN1_INTEGER_get(kdf->costParameter), ASN1_INTEGER_get(kdf->blockSize), Modified: stable/12/crypto/openssl/apps/req.c ============================================================================== --- stable/12/crypto/openssl/apps/req.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/req.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -881,9 +881,19 @@ int req_main(int argc, char **argv) if (text) { if (x509) - X509_print_ex(out, x509ss, get_nameopt(), reqflag); + ret = X509_print_ex(out, x509ss, get_nameopt(), reqflag); else - X509_REQ_print_ex(out, req, get_nameopt(), reqflag); + ret = X509_REQ_print_ex(out, req, get_nameopt(), reqflag); + + if (ret == 0) { + if (x509) + BIO_printf(bio_err, "Error printing certificate\n"); + else + BIO_printf(bio_err, "Error printing certificate request\n"); + + ERR_print_errors(bio_err); + goto end; + } } if (subject) { Modified: stable/12/crypto/openssl/apps/s_apps.h ============================================================================== --- stable/12/crypto/openssl/apps/s_apps.h Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/s_apps.h Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -9,14 +9,8 @@ #include -#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) -# include -#endif +#include -#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32) -# define _kbhit kbhit -#endif - #define PORT "4433" #define PROTOCOL "tcp" @@ -24,17 +18,15 @@ typedef int (*do_server_cb)(int s, int stype, int prot int do_server(int *accept_sock, const char *host, const char *port, int family, int type, int protocol, do_server_cb cb, unsigned char *context, int naccept, BIO *bio_s_out); -#ifdef HEADER_X509_H + int verify_callback(int ok, X509_STORE_CTX *ctx); -#endif -#ifdef HEADER_SSL_H + int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file); int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key, STACK_OF(X509) *chain, int build_chain); int ssl_print_sigalgs(BIO *out, SSL *s); int ssl_print_point_formats(BIO *out, SSL *s); int ssl_print_groups(BIO *out, SSL *s, int noshared); -#endif int ssl_print_tmp_key(BIO *out, SSL *s); int init_client(int *sock, const char *host, const char *port, const char *bindhost, const char *bindport, @@ -44,13 +36,11 @@ int should_retry(int i); long bio_dump_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); -#ifdef HEADER_SSL_H void apps_ssl_info_callback(const SSL *s, int where, int ret); void msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void tlsext_cb(SSL *s, int client_server, int type, const unsigned char *data, int len, void *arg); -#endif int generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len); @@ -75,7 +65,6 @@ int args_excert(int option, SSL_EXCERT **pexc); int load_excert(SSL_EXCERT **pexc); void print_verify_detail(SSL *s, BIO *bio); void print_ssl_summary(SSL *s); -#ifdef HEADER_SSL_H int config_ctx(SSL_CONF_CTX *cctx, STACK_OF(OPENSSL_STRING) *str, SSL_CTX *ctx); int ssl_ctx_add_crls(SSL_CTX *ctx, STACK_OF(X509_CRL) *crls, int crl_download); @@ -86,4 +75,3 @@ int ssl_load_stores(SSL_CTX *ctx, const char *vfyCApat void ssl_ctx_security_debug(SSL_CTX *ctx, int verbose); int set_keylog_file(SSL_CTX *ctx, const char *keylog_file); void print_ca_names(BIO *bio, SSL *s); -#endif Modified: stable/12/crypto/openssl/apps/s_cb.c ============================================================================== --- stable/12/crypto/openssl/apps/s_cb.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/s_cb.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1525,7 +1525,8 @@ void print_ca_names(BIO *bio, SSL *s) int i; if (sk == NULL || sk_X509_NAME_num(sk) == 0) { - BIO_printf(bio, "---\nNo %s certificate CA names sent\n", cs); + if (!SSL_is_server(s)) + BIO_printf(bio, "---\nNo %s certificate CA names sent\n", cs); return; } Modified: stable/12/crypto/openssl/apps/s_client.c ============================================================================== --- stable/12/crypto/openssl/apps/s_client.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/s_client.c Tue Sep 10 21:13:37 2019 (r352192) @@ -2345,7 +2345,7 @@ int s_client_main(int argc, char **argv) (void)BIO_flush(fbio); /* * The first line is the HTTP response. According to RFC 7230, - * it's formated exactly like this: + * it's formatted exactly like this: * * HTTP/d.d ddd Reason text\r\n */ Modified: stable/12/crypto/openssl/apps/speed.c ============================================================================== --- stable/12/crypto/openssl/apps/speed.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/speed.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1790,7 +1790,7 @@ int speed_main(int argc, char **argv) } buflen = lengths[size_num - 1]; - if (buflen < 36) /* size of random vector in RSA bencmark */ + if (buflen < 36) /* size of random vector in RSA benchmark */ buflen = 36; buflen += MAX_MISALIGNMENT + 1; loopargs[i].buf_malloc = app_malloc(buflen, "input buffer"); Modified: stable/12/crypto/openssl/apps/storeutl.c ============================================================================== --- stable/12/crypto/openssl/apps/storeutl.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/apps/storeutl.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -125,7 +125,7 @@ int storeutl_main(int argc, char *argv[]) } /* * If expected wasn't set at this point, it means the map - * isn't syncronised with the possible options leading here. + * isn't synchronised with the possible options leading here. */ OPENSSL_assert(expected != 0); } Modified: stable/12/crypto/openssl/config ============================================================================== --- stable/12/crypto/openssl/config Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/config Tue Sep 10 21:13:37 2019 (r352192) @@ -498,12 +498,12 @@ case "$GUESSOS" in OUT="darwin64-x86_64-cc" fi ;; armv6+7-*-iphoneos) - __CNF_CFLAGS="$__CNF_CFLAGS -arch%20armv6 -arch%20armv7" - __CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch%20armv6 -arch%20armv7" + __CNF_CFLAGS="$__CNF_CFLAGS -arch armv6 -arch armv7" + __CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch armv6 -arch armv7" OUT="iphoneos-cross" ;; *-*-iphoneos) - __CNF_CFLAGS="$__CNF_CFLAGS -arch%20${MACHINE}" - __CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch%20${MACHINE}" + __CNF_CFLAGS="$__CNF_CFLAGS -arch ${MACHINE}" + __CNF_CXXFLAGS="$__CNF_CXXFLAGS -arch ${MACHINE}" OUT="iphoneos-cross" ;; arm64-*-iphoneos|*-*-ios64) OUT="ios64-cross" ;; Modified: stable/12/crypto/openssl/crypto/aes/asm/aes-s390x.pl ============================================================================== --- stable/12/crypto/openssl/crypto/aes/asm/aes-s390x.pl Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/aes/asm/aes-s390x.pl Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2007-2018 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the OpenSSL license (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -38,14 +38,14 @@ # Implement AES_set_[en|de]crypt_key. Key schedule setup is avoided # for 128-bit keys, if hardware support is detected. -# Januray 2009. +# January 2009. # # Add support for hardware AES192/256 and reschedule instructions to # minimize/avoid Address Generation Interlock hazard and to favour # dual-issue z10 pipeline. This gave ~25% improvement on z10 and # almost 50% on z9. The gain is smaller on z10, because being dual- # issue z10 makes it impossible to eliminate the interlock condition: -# critial path is not long enough. Yet it spends ~24 cycles per byte +# critical path is not long enough. Yet it spends ~24 cycles per byte # processed with 128-bit key. # # Unlike previous version hardware support detection takes place only Modified: stable/12/crypto/openssl/crypto/asn1/a_time.c ============================================================================== --- stable/12/crypto/openssl/crypto/asn1/a_time.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/asn1/a_time.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -67,7 +67,7 @@ static void determine_days(struct tm *tm) } c = y / 100; y %= 100; - /* Zeller's congruance */ + /* Zeller's congruence */ tm->tm_wday = (d + (13 * m) / 5 + y + y / 4 + c / 4 + 5 * c + 6) % 7; } @@ -79,7 +79,11 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) char *a; int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; struct tm tmp; - +#if defined(CHARSET_EBCDIC) + const char upper_z = 0x5A, num_zero = 0x30, period = 0x2E, minus = 0x2D, plus = 0x2B; +#else + const char upper_z = 'Z', num_zero = '0', period = '.', minus = '-', plus = '+'; +#endif /* * ASN1_STRING_FLAG_X509_TIME is used to enforce RFC 5280 * time string format, in which: @@ -120,20 +124,20 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) if (l < min_l) goto err; for (i = 0; i < end; i++) { - if (!strict && (i == btz) && ((a[o] == 'Z') || (a[o] == '+') || (a[o] == '-'))) { + if (!strict && (i == btz) && ((a[o] == upper_z) || (a[o] == plus) || (a[o] == minus))) { i++; break; } - if (!ossl_isdigit(a[o])) + if (!ascii_isdigit(a[o])) goto err; - n = a[o] - '0'; + n = a[o] - num_zero; /* incomplete 2-digital number */ if (++o == l) goto err; - if (!ossl_isdigit(a[o])) + if (!ascii_isdigit(a[o])) goto err; - n = (n * 10) + a[o] - '0'; + n = (n * 10) + a[o] - num_zero; /* no more bytes to read, but we haven't seen time-zone yet */ if (++o == l) goto err; @@ -185,14 +189,14 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) * Optional fractional seconds: decimal point followed by one or more * digits. */ - if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == '.') { + if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == period) { if (strict) /* RFC 5280 forbids fractional seconds */ goto err; if (++o == l) goto err; i = o; - while ((o < l) && ossl_isdigit(a[o])) + while ((o < l) && ascii_isdigit(a[o])) o++; /* Must have at least one digit after decimal point */ if (i == o) @@ -207,10 +211,10 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) * 'o' can point to '\0' is either the subsequent if or the first * else if is true. */ - if (a[o] == 'Z') { + if (a[o] == upper_z) { o++; - } else if (!strict && ((a[o] == '+') || (a[o] == '-'))) { - int offsign = a[o] == '-' ? 1 : -1; + } else if (!strict && ((a[o] == plus) || (a[o] == minus))) { + int offsign = a[o] == minus ? 1 : -1; int offset = 0; o++; @@ -223,13 +227,13 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) if (o + 4 != l) goto err; for (i = end; i < end + 2; i++) { - if (!ossl_isdigit(a[o])) + if (!ascii_isdigit(a[o])) goto err; - n = a[o] - '0'; + n = a[o] - num_zero; o++; - if (!ossl_isdigit(a[o])) + if (!ascii_isdigit(a[o])) goto err; - n = (n * 10) + a[o] - '0'; + n = (n * 10) + a[o] - num_zero; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; @@ -300,7 +304,7 @@ ASN1_TIME *asn1_time_from_tm(ASN1_TIME *s, struct tm * ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec); -#ifdef CHARSET_EBCDIC_not +#ifdef CHARSET_EBCDIC ebcdic2ascii(tmps->data, tmps->data, tmps->length); #endif return tmps; @@ -467,6 +471,7 @@ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) char *v; int gmt = 0, l; struct tm stm; + const char upper_z = 0x5A, period = 0x2E; if (!asn1_time_to_tm(&stm, tm)) { /* asn1_time_to_tm will check the time type */ @@ -475,7 +480,7 @@ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) l = tm->length; v = (char *)tm->data; - if (v[l - 1] == 'Z') + if (v[l - 1] == upper_z) gmt = 1; if (tm->type == V_ASN1_GENERALIZEDTIME) { @@ -486,10 +491,10 @@ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) * Try to parse fractional seconds. '14' is the place of * 'fraction point' in a GeneralizedTime string. */ - if (tm->length > 15 && v[14] == '.') { + if (tm->length > 15 && v[14] == period) { f = &v[14]; f_len = 1; - while (14 + f_len < l && ossl_isdigit(f[f_len])) + while (14 + f_len < l && ascii_isdigit(f[f_len])) ++f_len; } Modified: stable/12/crypto/openssl/crypto/asn1/a_type.c ============================================================================== --- stable/12/crypto/openssl/crypto/asn1/a_type.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/asn1/a_type.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -15,7 +15,9 @@ int ASN1_TYPE_get(const ASN1_TYPE *a) { - if ((a->value.ptr != NULL) || (a->type == V_ASN1_NULL)) + if (a->type == V_ASN1_BOOLEAN + || a->type == V_ASN1_NULL + || a->value.ptr != NULL) return a->type; else return 0; @@ -23,7 +25,9 @@ int ASN1_TYPE_get(const ASN1_TYPE *a) void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) { - if (a->value.ptr != NULL) { + if (a->type != V_ASN1_BOOLEAN + && a->type != V_ASN1_NULL + && a->value.ptr != NULL) { ASN1_TYPE **tmp_a = &a; asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0); } Modified: stable/12/crypto/openssl/crypto/asn1/x_bignum.c ============================================================================== --- stable/12/crypto/openssl/crypto/asn1/x_bignum.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/asn1/x_bignum.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -130,9 +130,20 @@ static int bn_c2i(ASN1_VALUE **pval, const unsigned ch static int bn_secure_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it) { - if (!*pval) - bn_secure_new(pval, it); - return bn_c2i(pval, cont, len, utype, free_cont, it); + int ret; + BIGNUM *bn; + + if (!*pval && !bn_secure_new(pval, it)) + return 0; + + ret = bn_c2i(pval, cont, len, utype, free_cont, it); + if (!ret) + return 0; + + /* Set constant-time flag for all secure BIGNUMS */ + bn = (BIGNUM *)*pval; + BN_set_flags(bn, BN_FLG_CONSTTIME); + return ret; } static int bn_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, Modified: stable/12/crypto/openssl/crypto/bio/b_addr.c ============================================================================== --- stable/12/crypto/openssl/crypto/bio/b_addr.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/bio/b_addr.c Tue Sep 10 21:13:37 2019 (r352192) @@ -675,7 +675,7 @@ int BIO_lookup_ex(const char *host, const char *servic if (1) { #ifdef AI_PASSIVE - int gai_ret = 0; + int gai_ret = 0, old_ret = 0; struct addrinfo hints; memset(&hints, 0, sizeof(hints)); @@ -683,12 +683,12 @@ int BIO_lookup_ex(const char *host, const char *servic hints.ai_family = family; hints.ai_socktype = socktype; hints.ai_protocol = protocol; -#ifdef AI_ADDRCONFIG -#ifdef AF_UNSPEC +# ifdef AI_ADDRCONFIG +# ifdef AF_UNSPEC if (family == AF_UNSPEC) -#endif +# endif hints.ai_flags |= AI_ADDRCONFIG; -#endif +# endif if (lookup_type == BIO_LOOKUP_SERVER) hints.ai_flags |= AI_PASSIVE; @@ -696,6 +696,7 @@ int BIO_lookup_ex(const char *host, const char *servic /* Note that |res| SHOULD be a 'struct addrinfo **' thanks to * macro magic in bio_lcl.h */ + retry: switch ((gai_ret = getaddrinfo(host, service, &hints, res))) { # ifdef EAI_SYSTEM case EAI_SYSTEM: @@ -703,12 +704,25 @@ int BIO_lookup_ex(const char *host, const char *servic BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_SYS_LIB); break; # endif +# ifdef EAI_MEMORY + case EAI_MEMORY: + BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_MALLOC_FAILURE); + break; +# endif case 0: ret = 1; /* Success */ break; default: +# if defined(AI_ADDRCONFIG) && defined(AI_NUMERICHOST) + if (hints.ai_flags & AI_ADDRCONFIG) { + hints.ai_flags &= ~AI_ADDRCONFIG; + hints.ai_flags |= AI_NUMERICHOST; + old_ret = gai_ret; + goto retry; + } +# endif BIOerr(BIO_F_BIO_LOOKUP_EX, ERR_R_SYS_LIB); - ERR_add_error_data(1, gai_strerror(gai_ret)); + ERR_add_error_data(1, gai_strerror(old_ret ? old_ret : gai_ret)); break; } } else { Modified: stable/12/crypto/openssl/crypto/bio/bss_dgram.c ============================================================================== --- stable/12/crypto/openssl/crypto/bio/bss_dgram.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/bio/bss_dgram.c Tue Sep 10 21:13:37 2019 (r352192) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2005-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -784,7 +784,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void * reasons. When BIO_CTRL_DGRAM_SET_PEEK_MODE was first defined its value * was incorrectly clashing with BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE. The * value has been updated to a non-clashing value. However to preserve - * binary compatiblity we now respond to both the old value and the new one + * binary compatibility we now respond to both the old value and the new one */ case BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE: case BIO_CTRL_DGRAM_SET_PEEK_MODE: Modified: stable/12/crypto/openssl/crypto/bio/bss_file.c ============================================================================== --- stable/12/crypto/openssl/crypto/bio/bss_file.c Tue Sep 10 21:08:17 2019 (r352191) +++ stable/12/crypto/openssl/crypto/bio/bss_file.c Tue Sep 10 21:13:37 2019 (r352192) @@ -7,10 +7,7 @@ * https://www.openssl.org/source/license.html */ -#ifndef HEADER_BSS_FILE_C -# define HEADER_BSS_FILE_C - -# if defined(__linux) || defined(__sun) || defined(__hpux) +#if defined(__linux) || defined(__sun) || defined(__hpux) /* * Following definition aliases fopen to fopen64 on above mentioned * platforms. This makes it possible to open and sequentially access files @@ -23,17 +20,17 @@ * of 32-bit platforms which allow for sequential access of large files * without extra "magic" comprise *BSD, Darwin, IRIX... */ -# ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -# endif +# ifndef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 64 # endif +#endif -# include -# include -# include "bio_lcl.h" -# include +#include +#include +#include "bio_lcl.h" +#include -# if !defined(OPENSSL_NO_STDIO) +#if !defined(OPENSSL_NO_STDIO) static int file_write(BIO *h, const char *buf, int num); static int file_read(BIO *h, char *buf, int size); @@ -72,9 +69,9 @@ BIO *BIO_new_file(const char *filename, const char *mo SYSerr(SYS_F_FOPEN, get_last_sys_error()); ERR_add_error_data(5, "fopen('", filename, "','", mode, "')"); if (errno == ENOENT -# ifdef ENXIO +#ifdef ENXIO || errno == ENXIO -# endif +#endif ) BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE); else @@ -212,33 +209,33 @@ static long file_ctrl(BIO *b, int cmd, long num, void b->shutdown = (int)num & BIO_CLOSE; b->ptr = ptr; b->init = 1; -# if BIO_FLAGS_UPLINK!=0 -# if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) -# define _IOB_ENTRIES 20 -# endif +# if BIO_FLAGS_UPLINK!=0 +# if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) +# define _IOB_ENTRIES 20 +# endif /* Safety net to catch purely internal BIO_set_fp calls */ -# if defined(_MSC_VER) && _MSC_VER>=1900 +# if defined(_MSC_VER) && _MSC_VER>=1900 if (ptr == stdin || ptr == stdout || ptr == stderr) BIO_clear_flags(b, BIO_FLAGS_UPLINK); -# elif defined(_IOB_ENTRIES) +# elif defined(_IOB_ENTRIES) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Sep 10 21:15:01 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 7E0A1E4BD3; Tue, 10 Sep 2019 21:15:01 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Sd8j3YPNz432g; Tue, 10 Sep 2019 21:15:01 +0000 (UTC) (envelope-from jkim@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 5D7EA2C183; Tue, 10 Sep 2019 21:15:01 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8ALF10s088461; Tue, 10 Sep 2019 21:15:01 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8ALEuML088421; Tue, 10 Sep 2019 21:14:56 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201909102114.x8ALEuML088421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 10 Sep 2019 21:14:56 +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: r352193 - in stable/11: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/bn crypto/openssl/crypto/cms crypto/openssl/crypto/ec crypto/openssl/crypto/pem cr... X-SVN-Group: stable-11 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in stable/11: crypto/openssl crypto/openssl/apps crypto/openssl/crypto crypto/openssl/crypto/bn crypto/openssl/crypto/cms crypto/openssl/crypto/ec crypto/openssl/crypto/pem crypto/openssl/crypto/pkcs7... X-SVN-Commit-Revision: 352193 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, 10 Sep 2019 21:15:01 -0000 Author: jkim Date: Tue Sep 10 21:14:56 2019 New Revision: 352193 URL: https://svnweb.freebsd.org/changeset/base/352193 Log: Merge OpenSSL 1.0.2t. Modified: stable/11/crypto/openssl/CHANGES stable/11/crypto/openssl/Configure stable/11/crypto/openssl/Makefile stable/11/crypto/openssl/NEWS stable/11/crypto/openssl/README stable/11/crypto/openssl/apps/CA.pl stable/11/crypto/openssl/crypto/arm_arch.h stable/11/crypto/openssl/crypto/armcap.c stable/11/crypto/openssl/crypto/bn/Makefile stable/11/crypto/openssl/crypto/bn/bn_lib.c stable/11/crypto/openssl/crypto/bn_int.h stable/11/crypto/openssl/crypto/cms/cms_env.c stable/11/crypto/openssl/crypto/cms/cms_lcl.h stable/11/crypto/openssl/crypto/cms/cms_smime.c stable/11/crypto/openssl/crypto/constant_time_locl.h stable/11/crypto/openssl/crypto/cryptlib.h stable/11/crypto/openssl/crypto/ec/Makefile stable/11/crypto/openssl/crypto/ec/ec.h stable/11/crypto/openssl/crypto/ec/ec_asn1.c stable/11/crypto/openssl/crypto/ec/ec_curve.c stable/11/crypto/openssl/crypto/ec/ec_err.c stable/11/crypto/openssl/crypto/ec/ec_lcl.h stable/11/crypto/openssl/crypto/ec/ec_lib.c stable/11/crypto/openssl/crypto/ec/ecp_nistp224.c stable/11/crypto/openssl/crypto/ec/ecp_nistp256.c stable/11/crypto/openssl/crypto/ec/ecp_nistp521.c stable/11/crypto/openssl/crypto/opensslv.h stable/11/crypto/openssl/crypto/pem/pvkfmt.c stable/11/crypto/openssl/crypto/pkcs7/pk7_doit.c stable/11/crypto/openssl/crypto/rsa/rsa_chk.c stable/11/crypto/openssl/crypto/x509/x509_cmp.c stable/11/crypto/openssl/crypto/x509v3/v3_alt.c stable/11/crypto/openssl/util/libeay.num stable/11/secure/lib/libcrypto/Makefile.inc stable/11/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_length.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_new.3 stable/11/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 stable/11/secure/lib/libcrypto/man/ASN1_TIME_set.3 stable/11/secure/lib/libcrypto/man/ASN1_generate_nconf.3 stable/11/secure/lib/libcrypto/man/BIO_ctrl.3 stable/11/secure/lib/libcrypto/man/BIO_f_base64.3 stable/11/secure/lib/libcrypto/man/BIO_f_buffer.3 stable/11/secure/lib/libcrypto/man/BIO_f_cipher.3 stable/11/secure/lib/libcrypto/man/BIO_f_md.3 stable/11/secure/lib/libcrypto/man/BIO_f_null.3 stable/11/secure/lib/libcrypto/man/BIO_f_ssl.3 stable/11/secure/lib/libcrypto/man/BIO_find_type.3 stable/11/secure/lib/libcrypto/man/BIO_new.3 stable/11/secure/lib/libcrypto/man/BIO_new_CMS.3 stable/11/secure/lib/libcrypto/man/BIO_push.3 stable/11/secure/lib/libcrypto/man/BIO_read.3 stable/11/secure/lib/libcrypto/man/BIO_s_accept.3 stable/11/secure/lib/libcrypto/man/BIO_s_bio.3 stable/11/secure/lib/libcrypto/man/BIO_s_connect.3 stable/11/secure/lib/libcrypto/man/BIO_s_fd.3 stable/11/secure/lib/libcrypto/man/BIO_s_file.3 stable/11/secure/lib/libcrypto/man/BIO_s_mem.3 stable/11/secure/lib/libcrypto/man/BIO_s_null.3 stable/11/secure/lib/libcrypto/man/BIO_s_socket.3 stable/11/secure/lib/libcrypto/man/BIO_set_callback.3 stable/11/secure/lib/libcrypto/man/BIO_should_retry.3 stable/11/secure/lib/libcrypto/man/BN_BLINDING_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_new.3 stable/11/secure/lib/libcrypto/man/BN_CTX_start.3 stable/11/secure/lib/libcrypto/man/BN_add.3 stable/11/secure/lib/libcrypto/man/BN_add_word.3 stable/11/secure/lib/libcrypto/man/BN_bn2bin.3 stable/11/secure/lib/libcrypto/man/BN_cmp.3 stable/11/secure/lib/libcrypto/man/BN_copy.3 stable/11/secure/lib/libcrypto/man/BN_generate_prime.3 stable/11/secure/lib/libcrypto/man/BN_mod_inverse.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 stable/11/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 stable/11/secure/lib/libcrypto/man/BN_new.3 stable/11/secure/lib/libcrypto/man/BN_num_bytes.3 stable/11/secure/lib/libcrypto/man/BN_rand.3 stable/11/secure/lib/libcrypto/man/BN_set_bit.3 stable/11/secure/lib/libcrypto/man/BN_swap.3 stable/11/secure/lib/libcrypto/man/BN_zero.3 stable/11/secure/lib/libcrypto/man/CMS_add0_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_recipient_cert.3 stable/11/secure/lib/libcrypto/man/CMS_add1_signer.3 stable/11/secure/lib/libcrypto/man/CMS_compress.3 stable/11/secure/lib/libcrypto/man/CMS_decrypt.3 stable/11/secure/lib/libcrypto/man/CMS_encrypt.3 stable/11/secure/lib/libcrypto/man/CMS_final.3 stable/11/secure/lib/libcrypto/man/CMS_get0_RecipientInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_SignerInfos.3 stable/11/secure/lib/libcrypto/man/CMS_get0_type.3 stable/11/secure/lib/libcrypto/man/CMS_get1_ReceiptRequest.3 stable/11/secure/lib/libcrypto/man/CMS_sign.3 stable/11/secure/lib/libcrypto/man/CMS_sign_receipt.3 stable/11/secure/lib/libcrypto/man/CMS_uncompress.3 stable/11/secure/lib/libcrypto/man/CMS_verify.3 stable/11/secure/lib/libcrypto/man/CMS_verify_receipt.3 stable/11/secure/lib/libcrypto/man/CONF_modules_free.3 stable/11/secure/lib/libcrypto/man/CONF_modules_load_file.3 stable/11/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 stable/11/secure/lib/libcrypto/man/DH_generate_key.3 stable/11/secure/lib/libcrypto/man/DH_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DH_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DH_new.3 stable/11/secure/lib/libcrypto/man/DH_set_method.3 stable/11/secure/lib/libcrypto/man/DH_size.3 stable/11/secure/lib/libcrypto/man/DSA_SIG_new.3 stable/11/secure/lib/libcrypto/man/DSA_do_sign.3 stable/11/secure/lib/libcrypto/man/DSA_dup_DH.3 stable/11/secure/lib/libcrypto/man/DSA_generate_key.3 stable/11/secure/lib/libcrypto/man/DSA_generate_parameters.3 stable/11/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/DSA_new.3 stable/11/secure/lib/libcrypto/man/DSA_set_method.3 stable/11/secure/lib/libcrypto/man/DSA_sign.3 stable/11/secure/lib/libcrypto/man/DSA_size.3 stable/11/secure/lib/libcrypto/man/EC_GFp_simple_method.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_copy.3 stable/11/secure/lib/libcrypto/man/EC_GROUP_new.3 stable/11/secure/lib/libcrypto/man/EC_KEY_new.3 stable/11/secure/lib/libcrypto/man/EC_POINT_add.3 stable/11/secure/lib/libcrypto/man/EC_POINT_new.3 stable/11/secure/lib/libcrypto/man/ERR_GET_LIB.3 stable/11/secure/lib/libcrypto/man/ERR_clear_error.3 stable/11/secure/lib/libcrypto/man/ERR_error_string.3 stable/11/secure/lib/libcrypto/man/ERR_get_error.3 stable/11/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 stable/11/secure/lib/libcrypto/man/ERR_load_strings.3 stable/11/secure/lib/libcrypto/man/ERR_print_errors.3 stable/11/secure/lib/libcrypto/man/ERR_put_error.3 stable/11/secure/lib/libcrypto/man/ERR_remove_state.3 stable/11/secure/lib/libcrypto/man/ERR_set_mark.3 stable/11/secure/lib/libcrypto/man/EVP_BytesToKey.3 stable/11/secure/lib/libcrypto/man/EVP_DigestInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestSignInit.3 stable/11/secure/lib/libcrypto/man/EVP_DigestVerifyInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncodeInit.3 stable/11/secure/lib/libcrypto/man/EVP_EncryptInit.3 stable/11/secure/lib/libcrypto/man/EVP_OpenInit.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_CTX_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_cmp.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_decrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_derive.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_encrypt.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_get_default_digest.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_keygen.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_meth_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_new.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_print_private.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_sign.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify.3 stable/11/secure/lib/libcrypto/man/EVP_PKEY_verify_recover.3 stable/11/secure/lib/libcrypto/man/EVP_SealInit.3 stable/11/secure/lib/libcrypto/man/EVP_SignInit.3 stable/11/secure/lib/libcrypto/man/EVP_VerifyInit.3 stable/11/secure/lib/libcrypto/man/OBJ_nid2obj.3 stable/11/secure/lib/libcrypto/man/OPENSSL_Applink.3 stable/11/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 stable/11/secure/lib/libcrypto/man/OPENSSL_config.3 stable/11/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 stable/11/secure/lib/libcrypto/man/OPENSSL_instrument_bus.3 stable/11/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 stable/11/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_CMS_stream.3 stable/11/secure/lib/libcrypto/man/PEM_write_bio_PKCS7_stream.3 stable/11/secure/lib/libcrypto/man/PKCS12_create.3 stable/11/secure/lib/libcrypto/man/PKCS12_parse.3 stable/11/secure/lib/libcrypto/man/PKCS7_decrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_encrypt.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign.3 stable/11/secure/lib/libcrypto/man/PKCS7_sign_add_signer.3 stable/11/secure/lib/libcrypto/man/PKCS7_verify.3 stable/11/secure/lib/libcrypto/man/RAND_add.3 stable/11/secure/lib/libcrypto/man/RAND_bytes.3 stable/11/secure/lib/libcrypto/man/RAND_cleanup.3 stable/11/secure/lib/libcrypto/man/RAND_egd.3 stable/11/secure/lib/libcrypto/man/RAND_load_file.3 stable/11/secure/lib/libcrypto/man/RAND_set_rand_method.3 stable/11/secure/lib/libcrypto/man/RSA_blinding_on.3 stable/11/secure/lib/libcrypto/man/RSA_check_key.3 stable/11/secure/lib/libcrypto/man/RSA_generate_key.3 stable/11/secure/lib/libcrypto/man/RSA_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/RSA_new.3 stable/11/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 stable/11/secure/lib/libcrypto/man/RSA_print.3 stable/11/secure/lib/libcrypto/man/RSA_private_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_public_encrypt.3 stable/11/secure/lib/libcrypto/man/RSA_set_method.3 stable/11/secure/lib/libcrypto/man/RSA_sign.3 stable/11/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3 stable/11/secure/lib/libcrypto/man/RSA_size.3 stable/11/secure/lib/libcrypto/man/SMIME_read_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_read_PKCS7.3 stable/11/secure/lib/libcrypto/man/SMIME_write_CMS.3 stable/11/secure/lib/libcrypto/man/SMIME_write_PKCS7.3 stable/11/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 stable/11/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 stable/11/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 stable/11/secure/lib/libcrypto/man/X509_NAME_print_ex.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_error.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_new.3 stable/11/secure/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 stable/11/secure/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 stable/11/secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 stable/11/secure/lib/libcrypto/man/X509_check_host.3 stable/11/secure/lib/libcrypto/man/X509_check_private_key.3 stable/11/secure/lib/libcrypto/man/X509_cmp_time.3 stable/11/secure/lib/libcrypto/man/X509_new.3 stable/11/secure/lib/libcrypto/man/X509_verify_cert.3 stable/11/secure/lib/libcrypto/man/bio.3 stable/11/secure/lib/libcrypto/man/blowfish.3 stable/11/secure/lib/libcrypto/man/bn.3 stable/11/secure/lib/libcrypto/man/bn_internal.3 stable/11/secure/lib/libcrypto/man/buffer.3 stable/11/secure/lib/libcrypto/man/crypto.3 stable/11/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3 stable/11/secure/lib/libcrypto/man/d2i_CMS_ContentInfo.3 stable/11/secure/lib/libcrypto/man/d2i_DHparams.3 stable/11/secure/lib/libcrypto/man/d2i_DSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_ECPKParameters.3 stable/11/secure/lib/libcrypto/man/d2i_ECPrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_PrivateKey.3 stable/11/secure/lib/libcrypto/man/d2i_RSAPublicKey.3 stable/11/secure/lib/libcrypto/man/d2i_X509.3 stable/11/secure/lib/libcrypto/man/d2i_X509_ALGOR.3 stable/11/secure/lib/libcrypto/man/d2i_X509_CRL.3 stable/11/secure/lib/libcrypto/man/d2i_X509_NAME.3 stable/11/secure/lib/libcrypto/man/d2i_X509_REQ.3 stable/11/secure/lib/libcrypto/man/d2i_X509_SIG.3 stable/11/secure/lib/libcrypto/man/des.3 stable/11/secure/lib/libcrypto/man/dh.3 stable/11/secure/lib/libcrypto/man/dsa.3 stable/11/secure/lib/libcrypto/man/ec.3 stable/11/secure/lib/libcrypto/man/ecdsa.3 stable/11/secure/lib/libcrypto/man/engine.3 stable/11/secure/lib/libcrypto/man/err.3 stable/11/secure/lib/libcrypto/man/evp.3 stable/11/secure/lib/libcrypto/man/hmac.3 stable/11/secure/lib/libcrypto/man/i2d_CMS_bio_stream.3 stable/11/secure/lib/libcrypto/man/i2d_PKCS7_bio_stream.3 stable/11/secure/lib/libcrypto/man/lh_stats.3 stable/11/secure/lib/libcrypto/man/lhash.3 stable/11/secure/lib/libcrypto/man/md5.3 stable/11/secure/lib/libcrypto/man/mdc2.3 stable/11/secure/lib/libcrypto/man/pem.3 stable/11/secure/lib/libcrypto/man/rand.3 stable/11/secure/lib/libcrypto/man/rc4.3 stable/11/secure/lib/libcrypto/man/ripemd.3 stable/11/secure/lib/libcrypto/man/rsa.3 stable/11/secure/lib/libcrypto/man/sha.3 stable/11/secure/lib/libcrypto/man/threads.3 stable/11/secure/lib/libcrypto/man/ui.3 stable/11/secure/lib/libcrypto/man/ui_compat.3 stable/11/secure/lib/libcrypto/man/x509.3 stable/11/secure/lib/libssl/man/SSL_CIPHER_get_name.3 stable/11/secure/lib/libssl/man/SSL_COMP_add_compression_method.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set1_prefix.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_flags.3 stable/11/secure/lib/libssl/man/SSL_CONF_CTX_set_ssl_ctx.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd.3 stable/11/secure/lib/libssl/man/SSL_CONF_cmd_argv.3 stable/11/secure/lib/libssl/man/SSL_CTX_add1_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 stable/11/secure/lib/libssl/man/SSL_CTX_add_session.3 stable/11/secure/lib/libssl/man/SSL_CTX_ctrl.3 stable/11/secure/lib/libssl/man/SSL_CTX_flush_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_free.3 stable/11/secure/lib/libssl/man/SSL_CTX_get0_param.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3 stable/11/secure/lib/libssl/man/SSL_CTX_new.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_number.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 stable/11/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_sessions.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_curves.3 stable/11/secure/lib/libssl/man/SSL_CTX_set1_verify_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_alpn_select_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_store.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_custom_cli_ext.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_info_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_options.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_read_ahead.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_timeout.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_servername_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_status_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tlsext_ticket_key_cb.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 stable/11/secure/lib/libssl/man/SSL_CTX_set_verify.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_certificate.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 stable/11/secure/lib/libssl/man/SSL_CTX_use_serverinfo.3 stable/11/secure/lib/libssl/man/SSL_SESSION_free.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_SESSION_get_time.3 stable/11/secure/lib/libssl/man/SSL_accept.3 stable/11/secure/lib/libssl/man/SSL_alert_type_string.3 stable/11/secure/lib/libssl/man/SSL_check_chain.3 stable/11/secure/lib/libssl/man/SSL_clear.3 stable/11/secure/lib/libssl/man/SSL_connect.3 stable/11/secure/lib/libssl/man/SSL_do_handshake.3 stable/11/secure/lib/libssl/man/SSL_export_keying_material.3 stable/11/secure/lib/libssl/man/SSL_free.3 stable/11/secure/lib/libssl/man/SSL_get_SSL_CTX.3 stable/11/secure/lib/libssl/man/SSL_get_ciphers.3 stable/11/secure/lib/libssl/man/SSL_get_client_CA_list.3 stable/11/secure/lib/libssl/man/SSL_get_current_cipher.3 stable/11/secure/lib/libssl/man/SSL_get_default_timeout.3 stable/11/secure/lib/libssl/man/SSL_get_error.3 stable/11/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 stable/11/secure/lib/libssl/man/SSL_get_ex_new_index.3 stable/11/secure/lib/libssl/man/SSL_get_fd.3 stable/11/secure/lib/libssl/man/SSL_get_peer_cert_chain.3 stable/11/secure/lib/libssl/man/SSL_get_peer_certificate.3 stable/11/secure/lib/libssl/man/SSL_get_psk_identity.3 stable/11/secure/lib/libssl/man/SSL_get_rbio.3 stable/11/secure/lib/libssl/man/SSL_get_session.3 stable/11/secure/lib/libssl/man/SSL_get_verify_result.3 stable/11/secure/lib/libssl/man/SSL_get_version.3 stable/11/secure/lib/libssl/man/SSL_library_init.3 stable/11/secure/lib/libssl/man/SSL_load_client_CA_file.3 stable/11/secure/lib/libssl/man/SSL_new.3 stable/11/secure/lib/libssl/man/SSL_pending.3 stable/11/secure/lib/libssl/man/SSL_read.3 stable/11/secure/lib/libssl/man/SSL_rstate_string.3 stable/11/secure/lib/libssl/man/SSL_session_reused.3 stable/11/secure/lib/libssl/man/SSL_set_bio.3 stable/11/secure/lib/libssl/man/SSL_set_connect_state.3 stable/11/secure/lib/libssl/man/SSL_set_fd.3 stable/11/secure/lib/libssl/man/SSL_set_session.3 stable/11/secure/lib/libssl/man/SSL_set_shutdown.3 stable/11/secure/lib/libssl/man/SSL_set_verify_result.3 stable/11/secure/lib/libssl/man/SSL_shutdown.3 stable/11/secure/lib/libssl/man/SSL_state_string.3 stable/11/secure/lib/libssl/man/SSL_want.3 stable/11/secure/lib/libssl/man/SSL_write.3 stable/11/secure/lib/libssl/man/d2i_SSL_SESSION.3 stable/11/secure/lib/libssl/man/ssl.3 stable/11/secure/usr.bin/openssl/man/CA.pl.1 stable/11/secure/usr.bin/openssl/man/asn1parse.1 stable/11/secure/usr.bin/openssl/man/ca.1 stable/11/secure/usr.bin/openssl/man/ciphers.1 stable/11/secure/usr.bin/openssl/man/cms.1 stable/11/secure/usr.bin/openssl/man/crl.1 stable/11/secure/usr.bin/openssl/man/crl2pkcs7.1 stable/11/secure/usr.bin/openssl/man/dgst.1 stable/11/secure/usr.bin/openssl/man/dhparam.1 stable/11/secure/usr.bin/openssl/man/dsa.1 stable/11/secure/usr.bin/openssl/man/dsaparam.1 stable/11/secure/usr.bin/openssl/man/ec.1 stable/11/secure/usr.bin/openssl/man/ecparam.1 stable/11/secure/usr.bin/openssl/man/enc.1 stable/11/secure/usr.bin/openssl/man/errstr.1 stable/11/secure/usr.bin/openssl/man/gendsa.1 stable/11/secure/usr.bin/openssl/man/genpkey.1 stable/11/secure/usr.bin/openssl/man/genrsa.1 stable/11/secure/usr.bin/openssl/man/nseq.1 stable/11/secure/usr.bin/openssl/man/ocsp.1 stable/11/secure/usr.bin/openssl/man/openssl.1 stable/11/secure/usr.bin/openssl/man/passwd.1 stable/11/secure/usr.bin/openssl/man/pkcs12.1 stable/11/secure/usr.bin/openssl/man/pkcs7.1 stable/11/secure/usr.bin/openssl/man/pkcs8.1 stable/11/secure/usr.bin/openssl/man/pkey.1 stable/11/secure/usr.bin/openssl/man/pkeyparam.1 stable/11/secure/usr.bin/openssl/man/pkeyutl.1 stable/11/secure/usr.bin/openssl/man/rand.1 stable/11/secure/usr.bin/openssl/man/req.1 stable/11/secure/usr.bin/openssl/man/rsa.1 stable/11/secure/usr.bin/openssl/man/rsautl.1 stable/11/secure/usr.bin/openssl/man/s_client.1 stable/11/secure/usr.bin/openssl/man/s_server.1 stable/11/secure/usr.bin/openssl/man/s_time.1 stable/11/secure/usr.bin/openssl/man/sess_id.1 stable/11/secure/usr.bin/openssl/man/smime.1 stable/11/secure/usr.bin/openssl/man/speed.1 stable/11/secure/usr.bin/openssl/man/spkac.1 stable/11/secure/usr.bin/openssl/man/ts.1 stable/11/secure/usr.bin/openssl/man/tsget.1 stable/11/secure/usr.bin/openssl/man/verify.1 stable/11/secure/usr.bin/openssl/man/version.1 stable/11/secure/usr.bin/openssl/man/x509.1 stable/11/secure/usr.bin/openssl/man/x509v3_config.1 Modified: stable/11/crypto/openssl/CHANGES ============================================================================== --- stable/11/crypto/openssl/CHANGES Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/CHANGES Tue Sep 10 21:14:56 2019 (r352193) @@ -7,6 +7,48 @@ https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + Changes between 1.0.2s and 1.0.2t [10 Sep 2019] + + *) For built-in EC curves, ensure an EC_GROUP built from the curve name is + used even when parsing explicit parameters, when loading a serialized key + or calling `EC_GROUP_new_from_ecpkparameters()`/ + `EC_GROUP_new_from_ecparameters()`. + This prevents bypass of security hardening and performance gains, + especially for curves with specialized EC_METHODs. + By default, if a key encoded with explicit parameters is loaded and later + serialized, the output is still encoded with explicit parameters, even if + internally a "named" EC_GROUP is used for computation. + [Nicola Tuveri] + + *) Compute ECC cofactors if not provided during EC_GROUP construction. Before + this change, EC_GROUP_set_generator would accept order and/or cofactor as + NULL. After this change, only the cofactor parameter can be NULL. It also + does some minimal sanity checks on the passed order. + (CVE-2019-1547) + [Billy Bob Brumley] + + *) Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey. + An attack is simple, if the first CMS_recipientInfo is valid but the + second CMS_recipientInfo is chosen ciphertext. If the second + recipientInfo decodes to PKCS #1 v1.5 form plaintext, the correct + encryption key will be replaced by garbage, and the message cannot be + decoded, but if the RSA decryption fails, the correct encryption key is + used and the recipient will not notice the attack. + As a work around for this potential attack the length of the decrypted + key must be equal to the cipher default key length, in case the + certifiate is not given and all recipientInfo are tried out. + The old behaviour can be re-enabled in the CMS code by setting the + CMS_DEBUG_DECRYPT flag. + (CVE-2019-1563) + [Bernd Edlinger] + + *) Document issue with installation paths in diverse Windows builds + + '/usr/local/ssl' is an unsafe prefix for location to install OpenSSL + binaries and run-time config file. + (CVE-2019-1552) + [Richard Levitte] + Changes between 1.0.2r and 1.0.2s [28 May 2019] *) Change the default RSA, DSA and DH size to 2048 bit instead of 1024. Modified: stable/11/crypto/openssl/Configure ============================================================================== --- stable/11/crypto/openssl/Configure Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/Configure Tue Sep 10 21:14:56 2019 (r352193) @@ -118,7 +118,7 @@ my $gcc_devteam_warn = "-Wall -pedantic -DPEDANTIC -Wn # -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align, # -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token # -Wextended-offsetof -my $clang_disabled_warnings = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof"; +my $clang_disabled_warnings = "-Wno-unknown-warning-option -Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof"; # These are used in addition to $gcc_devteam_warn when the compiler is clang. # TODO(openssl-team): fix problems and investigate if (at least) the @@ -128,7 +128,7 @@ my $clang_disabled_warnings = "-Wno-unused-parameter - # -Wincompatible-pointer-types-discards-qualifiers, -Wcast-align, # -Wunreachable-code -Wunused-parameter -Wlanguage-extension-token # -Wextended-offsetof -my $clang_devteam_warn = "-Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments"; +my $clang_devteam_warn = "-Wno-unknown-warning-option -Wno-unused-parameter -Wno-missing-field-initializers -Wno-language-extension-token -Wno-extended-offsetof -Qunused-arguments"; # Warn that "make depend" should be run? my $warn_make_depend = 0; Modified: stable/11/crypto/openssl/Makefile ============================================================================== --- stable/11/crypto/openssl/Makefile Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/Makefile Tue Sep 10 21:14:56 2019 (r352193) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2s +VERSION=1.0.2t MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -70,7 +70,7 @@ AR= ar $(ARFLAGS) r RANLIB= /usr/bin/ranlib RC= windres NM= nm -PERL= /usr/local/bin/perl +PERL= /usr/bin/perl TAR= tar TARFLAGS= --no-recursion MAKEDEPPROG= gcc Modified: stable/11/crypto/openssl/NEWS ============================================================================== --- stable/11/crypto/openssl/NEWS Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/NEWS Tue Sep 10 21:14:56 2019 (r352193) @@ -5,6 +5,21 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2s and OpenSSL 1.0.2t [10 Sep 2019] + + o Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey + (CVE-2019-1563) + o For built-in EC curves, ensure an EC_GROUP built from the curve name is + used even when parsing explicit parameters + o Compute ECC cofactors if not provided during EC_GROUP construction + (CVE-2019-1547) + o Document issue with installation paths in diverse Windows builds + (CVE-2019-1552) + + Major changes between OpenSSL 1.0.2r and OpenSSL 1.0.2s [28 May 2019] + + o None + Major changes between OpenSSL 1.0.2q and OpenSSL 1.0.2r [26 Feb 2019] o 0-byte record padding oracle (CVE-2019-1559) Modified: stable/11/crypto/openssl/README ============================================================================== --- stable/11/crypto/openssl/README Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/README Tue Sep 10 21:14:56 2019 (r352193) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2s 28 May 2019 + OpenSSL 1.0.2t 10 Sep 2019 Copyright (c) 1998-2019 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson Modified: stable/11/crypto/openssl/apps/CA.pl ============================================================================== --- stable/11/crypto/openssl/apps/CA.pl Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/apps/CA.pl Tue Sep 10 21:14:56 2019 (r352193) @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # # CA - wrapper around ca to make it easier to use ... basically ca requires # some setup stuff to be done before you can use it and this makes Modified: stable/11/crypto/openssl/crypto/arm_arch.h ============================================================================== --- stable/11/crypto/openssl/crypto/arm_arch.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/arm_arch.h Tue Sep 10 21:14:56 2019 (r352193) @@ -64,7 +64,7 @@ # endif # endif -# if !__ASSEMBLER__ +# ifndef __ASSEMBLER__ extern unsigned int OPENSSL_armcap_P; # endif Modified: stable/11/crypto/openssl/crypto/armcap.c ============================================================================== --- stable/11/crypto/openssl/crypto/armcap.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/armcap.c Tue Sep 10 21:14:56 2019 (r352193) @@ -5,6 +5,7 @@ #include #include +#include "cryptlib.h" #include "arm_arch.h" __attribute__ ((visibility("hidden"))) Modified: stable/11/crypto/openssl/crypto/bn/Makefile ============================================================================== --- stable/11/crypto/openssl/crypto/bn/Makefile Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/bn/Makefile Tue Sep 10 21:14:56 2019 (r352193) @@ -297,8 +297,8 @@ bn_lib.o: ../../include/openssl/e_os2.h ../../include/ bn_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h bn_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h bn_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -bn_lib.o: ../../include/openssl/symhacks.h ../bn_int.h ../cryptlib.h bn_lcl.h -bn_lib.o: bn_lib.c +bn_lib.o: ../../include/openssl/symhacks.h ../bn_int.h ../constant_time_locl.h +bn_lib.o: ../cryptlib.h bn_lcl.h bn_lib.c bn_mod.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h bn_mod.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h bn_mod.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h Modified: stable/11/crypto/openssl/crypto/bn/bn_lib.c ============================================================================== --- stable/11/crypto/openssl/crypto/bn/bn_lib.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/bn/bn_lib.c Tue Sep 10 21:14:56 2019 (r352193) @@ -66,6 +66,7 @@ #include #include "cryptlib.h" #include "bn_lcl.h" +#include "constant_time_locl.h" const char BN_version[] = "Big Number" OPENSSL_VERSION_PTEXT; @@ -187,13 +188,57 @@ int BN_num_bits_word(BN_ULONG l) return bits; } +/* + * This function still leaks `a->dmax`: it's caller's responsibility to + * expand the input `a` in advance to a public length. + */ +static inline +int bn_num_bits_consttime(const BIGNUM *a) +{ + int j, ret; + unsigned int mask, past_i; + int i = a->top - 1; + bn_check_top(a); + + for (j = 0, past_i = 0, ret = 0; j < a->dmax; j++) { + mask = constant_time_eq_int(i, j); /* 0xff..ff if i==j, 0x0 otherwise */ + + ret += BN_BITS2 & (~mask & ~past_i); + ret += BN_num_bits_word(a->d[j]) & mask; + + past_i |= mask; /* past_i will become 0xff..ff after i==j */ + } + + /* + * if BN_is_zero(a) => i is -1 and ret contains garbage, so we mask the + * final result. + */ + mask = ~(constant_time_eq_int(i, ((int)-1))); + + return ret & mask; +} + int BN_num_bits(const BIGNUM *a) { int i = a->top - 1; bn_check_top(a); + if (a->flags & BN_FLG_CONSTTIME) { + /* + * We assume that BIGNUMs flagged as CONSTTIME have also been expanded + * so that a->dmax is not leaking secret information. + * + * In other words, it's the caller's responsibility to ensure `a` has + * been preallocated in advance to a public length if we hit this + * branch. + * + */ + return bn_num_bits_consttime(a); + } + if (BN_is_zero(a)) return 0; + return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); } @@ -613,8 +658,11 @@ BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIG return (ret); } +typedef enum {big, little} endianess_t; + /* ignore negative */ -static int bn2binpad(const BIGNUM *a, unsigned char *to, int tolen) +static +int bn2binpad(const BIGNUM *a, unsigned char *to, int tolen, endianess_t endianess) { int n; size_t i, lasti, j, atop, mask; @@ -646,10 +694,17 @@ static int bn2binpad(const BIGNUM *a, unsigned char *t lasti = atop - 1; atop = a->top * BN_BYTES; - for (i = 0, j = 0, to += tolen; j < (size_t)tolen; j++) { + if (endianess == big) + to += tolen; /* start from the end of the buffer */ + for (i = 0, j = 0; j < (size_t)tolen; j++) { + unsigned char val; l = a->d[i / BN_BYTES]; mask = 0 - ((j - atop) >> (8 * sizeof(i) - 1)); - *--to = (unsigned char)(l >> (8 * (i % BN_BYTES)) & mask); + val = (unsigned char)(l >> (8 * (i % BN_BYTES)) & mask); + if (endianess == big) + *--to = val; + else + *to++ = val; i += (i - lasti) >> (8 * sizeof(i) - 1); /* stay on last limb */ } @@ -660,21 +715,66 @@ int bn_bn2binpad(const BIGNUM *a, unsigned char *to, i { if (tolen < 0) return -1; - return bn2binpad(a, to, tolen); + return bn2binpad(a, to, tolen, big); } int BN_bn2bin(const BIGNUM *a, unsigned char *to) { - int n, i; + return bn2binpad(a, to, -1, big); +} + +BIGNUM *bn_lebin2bn(const unsigned char *s, int len, BIGNUM *ret) +{ + unsigned int i, m; + unsigned int n; BN_ULONG l; + BIGNUM *bn = NULL; - bn_check_top(a); - n = i = BN_num_bytes(a); - while (i--) { - l = a->d[i / BN_BYTES]; - *(to++) = (unsigned char)(l >> (8 * (i % BN_BYTES))) & 0xff; + if (ret == NULL) + ret = bn = BN_new(); + if (ret == NULL) + return NULL; + bn_check_top(ret); + s += len; + /* Skip trailing zeroes. */ + for ( ; len > 0 && s[-1] == 0; s--, len--) + continue; + n = len; + if (n == 0) { + ret->top = 0; + return ret; } - return (n); + i = ((n - 1) / BN_BYTES) + 1; + m = ((n - 1) % (BN_BYTES)); + if (bn_wexpand(ret, (int)i) == NULL) { + BN_free(bn); + return NULL; + } + ret->top = i; + ret->neg = 0; + l = 0; + while (n--) { + s--; + l = (l << 8L) | *s; + if (m-- == 0) { + ret->d[--i] = l; + l = 0; + m = BN_BYTES - 1; + } + } + /* + * need to call this due to clear byte at top if avoiding having the top + * bit set (-ve number) + */ + bn_correct_top(ret); + return ret; +} + +int bn_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen) +{ + if (tolen < 0) + return -1; + return bn2binpad(a, to, tolen, little); } int BN_ucmp(const BIGNUM *a, const BIGNUM *b) Modified: stable/11/crypto/openssl/crypto/bn_int.h ============================================================================== --- stable/11/crypto/openssl/crypto/bn_int.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/bn_int.h Tue Sep 10 21:14:56 2019 (r352193) @@ -19,3 +19,6 @@ int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); int bn_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen); + +BIGNUM *bn_lebin2bn(const unsigned char *s, int len, BIGNUM *ret); +int bn_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen); Modified: stable/11/crypto/openssl/crypto/cms/cms_env.c ============================================================================== --- stable/11/crypto/openssl/crypto/cms/cms_env.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/cms/cms_env.c Tue Sep 10 21:14:56 2019 (r352193) @@ -4,7 +4,7 @@ * project. */ /* ==================================================================== - * Copyright (c) 2008 The OpenSSL Project. All rights reserved. + * Copyright (c) 2008-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -422,6 +422,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentI unsigned char *ek = NULL; size_t eklen; int ret = 0; + size_t fixlen = 0; CMS_EncryptedContentInfo *ec; ec = cms->d.envelopedData->encryptedContentInfo; @@ -430,6 +431,19 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentI return 0; } + if (cms->d.envelopedData->encryptedContentInfo->havenocert + && !cms->d.envelopedData->encryptedContentInfo->debug) { + X509_ALGOR *calg = ec->contentEncryptionAlgorithm; + const EVP_CIPHER *ciph = EVP_get_cipherbyobj(calg->algorithm); + + if (ciph == NULL) { + CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_UNKNOWN_CIPHER); + return 0; + } + + fixlen = EVP_CIPHER_key_length(ciph); + } + ktri->pctx = EVP_PKEY_CTX_new(pkey, NULL); if (!ktri->pctx) return 0; @@ -460,7 +474,9 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentI if (EVP_PKEY_decrypt(ktri->pctx, ek, &eklen, ktri->encryptedKey->data, - ktri->encryptedKey->length) <= 0) { + ktri->encryptedKey->length) <= 0 + || eklen == 0 + || (fixlen != 0 && eklen != fixlen)) { CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT, CMS_R_CMS_LIB); goto err; } Modified: stable/11/crypto/openssl/crypto/cms/cms_lcl.h ============================================================================== --- stable/11/crypto/openssl/crypto/cms/cms_lcl.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/cms/cms_lcl.h Tue Sep 10 21:14:56 2019 (r352193) @@ -4,7 +4,7 @@ * project. */ /* ==================================================================== - * Copyright (c) 2008 The OpenSSL Project. All rights reserved. + * Copyright (c) 2008-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -172,6 +172,8 @@ struct CMS_EncryptedContentInfo_st { size_t keylen; /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */ int debug; + /* Set to 1 if we have no cert and need extra safety measures for MMA */ + int havenocert; }; struct CMS_RecipientInfo_st { Modified: stable/11/crypto/openssl/crypto/cms/cms_smime.c ============================================================================== --- stable/11/crypto/openssl/crypto/cms/cms_smime.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/cms/cms_smime.c Tue Sep 10 21:14:56 2019 (r352193) @@ -4,7 +4,7 @@ * project. */ /* ==================================================================== - * Copyright (c) 2008 The OpenSSL Project. All rights reserved. + * Copyright (c) 2008-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -737,6 +737,10 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X5 cms->d.envelopedData->encryptedContentInfo->debug = 1; else cms->d.envelopedData->encryptedContentInfo->debug = 0; + if (!cert) + cms->d.envelopedData->encryptedContentInfo->havenocert = 1; + else + cms->d.envelopedData->encryptedContentInfo->havenocert = 0; if (!pk && !cert && !dcont && !out) return 1; if (pk && !CMS_decrypt_set1_pkey(cms, pk, cert)) Modified: stable/11/crypto/openssl/crypto/constant_time_locl.h ============================================================================== --- stable/11/crypto/openssl/crypto/constant_time_locl.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/constant_time_locl.h Tue Sep 10 21:14:56 2019 (r352193) @@ -6,7 +6,7 @@ * Based on previous work by Bodo Moeller, Emilia Kasper, Adam Langley * (Google). * ==================================================================== - * Copyright (c) 2014 The OpenSSL Project. All rights reserved. + * Copyright (c) 2014-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -185,11 +185,29 @@ static inline unsigned char constant_time_eq_int_8(int return constant_time_eq_8((unsigned)(a), (unsigned)(b)); } +/* + * Returns the value unmodified, but avoids optimizations. + * The barriers prevent the compiler from narrowing down the + * possible value range of the mask and ~mask in the select + * statements, which avoids the recognition of the select + * and turning it into a conditional load or branch. + */ +static inline unsigned int value_barrier(unsigned int a) +{ +#if !defined(OPENSSL_NO_ASM) && defined(__GNUC__) + unsigned int r; + __asm__("" : "=r"(r) : "0"(a)); +#else + volatile unsigned int r = a; +#endif + return r; +} + static inline unsigned int constant_time_select(unsigned int mask, unsigned int a, unsigned int b) { - return (mask & a) | (~mask & b); + return (value_barrier(mask) & a) | (value_barrier(~mask) & b); } static inline unsigned char constant_time_select_8(unsigned char mask, Modified: stable/11/crypto/openssl/crypto/cryptlib.h ============================================================================== --- stable/11/crypto/openssl/crypto/cryptlib.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/cryptlib.h Tue Sep 10 21:14:56 2019 (r352193) @@ -106,6 +106,8 @@ extern int OPENSSL_NONPIC_relocated; char *ossl_safe_getenv(const char *); +unsigned long OPENSSL_rdtsc(void); + #ifdef __cplusplus } #endif Modified: stable/11/crypto/openssl/crypto/ec/Makefile ============================================================================== --- stable/11/crypto/openssl/crypto/ec/Makefile Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/Makefile Tue Sep 10 21:14:56 2019 (r352193) @@ -156,7 +156,7 @@ ec_curve.o: ../../include/openssl/err.h ../../include/ ec_curve.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h ec_curve.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h ec_curve.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -ec_curve.o: ../../include/openssl/symhacks.h ec_curve.c ec_lcl.h +ec_curve.o: ../../include/openssl/symhacks.h ../bn_int.h ec_curve.c ec_lcl.h ec_cvt.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h ec_cvt.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h ec_cvt.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h Modified: stable/11/crypto/openssl/crypto/ec/ec.h ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec.h Tue Sep 10 21:14:56 2019 (r352193) @@ -7,7 +7,7 @@ * \author Originally written by Bodo Moeller for the OpenSSL project */ /* ==================================================================== - * Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1073,6 +1073,7 @@ int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int o * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ + void ERR_load_EC_strings(void); /* Error codes for the EC functions. */ @@ -1270,13 +1271,14 @@ void ERR_load_EC_strings(void); # define EC_R_SLOT_FULL 108 # define EC_R_UNDEFINED_GENERATOR 113 # define EC_R_UNDEFINED_ORDER 128 +# define EC_R_UNKNOWN_COFACTOR 152 # define EC_R_UNKNOWN_GROUP 129 # define EC_R_UNKNOWN_ORDER 114 # define EC_R_UNSUPPORTED_FIELD 131 # define EC_R_WRONG_CURVE_PARAMETERS 145 # define EC_R_WRONG_ORDER 130 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif #endif Modified: stable/11/crypto/openssl/crypto/ec/ec_asn1.c ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec_asn1.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec_asn1.c Tue Sep 10 21:14:56 2019 (r352193) @@ -3,7 +3,7 @@ * Written by Nils Larsch for the OpenSSL project. */ /* ==================================================================== - * Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved. + * Copyright (c) 2000-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -695,10 +695,12 @@ ECPKPARAMETERS *ec_asn1_group2pkparameters(const EC_GR static EC_GROUP *ec_asn1_parameters2group(const ECPARAMETERS *params) { int ok = 0, tmp; - EC_GROUP *ret = NULL; + EC_GROUP *ret = NULL, *dup = NULL; BIGNUM *p = NULL, *a = NULL, *b = NULL; EC_POINT *point = NULL; long field_bits; + int curve_name = NID_undef; + BN_CTX *ctx = NULL; if (!params->fieldID || !params->fieldID->fieldType || !params->fieldID->p.ptr) { @@ -914,13 +916,75 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARA goto err; } + /* + * Check if the explicit parameters group just created matches one of the + * built-in curves. + * + * We create a copy of the group just built, so that we can remove optional + * fields for the lookup: we do this to avoid the possibility that one of + * the optional parameters is used to force the library into using a less + * performant and less secure EC_METHOD instead of the specialized one. + * In any case, `seed` is not really used in any computation, while a + * cofactor different from the one in the built-in table is just + * mathematically wrong anyway and should not be used. + */ + if ((ctx = BN_CTX_new()) == NULL) { + ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_BN_LIB); + goto err; + } + if ((dup = EC_GROUP_dup(ret)) == NULL + || EC_GROUP_set_seed(dup, NULL, 0) != 1 + || !EC_GROUP_set_generator(dup, point, a, NULL)) { + ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB); + goto err; + } + if ((curve_name = ec_curve_nid_from_params(dup, ctx)) != NID_undef) { + /* + * The input explicit parameters successfully matched one of the + * built-in curves: often for built-in curves we have specialized + * methods with better performance and hardening. + * + * In this case we replace the `EC_GROUP` created through explicit + * parameters with one created from a named group. + */ + EC_GROUP *named_group = NULL; + +#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 + /* + * NID_wap_wsg_idm_ecid_wtls12 and NID_secp224r1 are both aliases for + * the same curve, we prefer the SECP nid when matching explicit + * parameters as that is associated with a specialized EC_METHOD. + */ + if (curve_name == NID_wap_wsg_idm_ecid_wtls12) + curve_name = NID_secp224r1; +#endif /* !def(OPENSSL_NO_EC_NISTP_64_GCC_128) */ + + if ((named_group = EC_GROUP_new_by_curve_name(curve_name)) == NULL) { + ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP, ERR_R_EC_LIB); + goto err; + } + EC_GROUP_free(ret); + ret = named_group; + + /* + * Set the flag so that EC_GROUPs created from explicit parameters are + * serialized using explicit parameters by default. + * + * 0x0 = OPENSSL_EC_EXPLICIT_CURVE + */ + EC_GROUP_set_asn1_flag(ret, 0x0); + } + ok = 1; - err:if (!ok) { + err: + if (!ok) { if (ret) - EC_GROUP_clear_free(ret); + EC_GROUP_free(ret); ret = NULL; } + if (dup) + EC_GROUP_free(dup); if (p) BN_free(p); @@ -930,6 +994,8 @@ static EC_GROUP *ec_asn1_parameters2group(const ECPARA BN_free(b); if (point) EC_POINT_free(point); + if (ctx) + BN_CTX_free(ctx); return (ret); } @@ -990,7 +1056,7 @@ EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsig } if (a && *a) - EC_GROUP_clear_free(*a); + EC_GROUP_free(*a); if (a) *a = group; @@ -1040,7 +1106,7 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned ch if (priv_key->parameters) { if (ret->group) - EC_GROUP_clear_free(ret->group); + EC_GROUP_free(ret->group); ret->group = ec_asn1_pkparameters2group(priv_key->parameters); } Modified: stable/11/crypto/openssl/crypto/ec/ec_curve.c ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec_curve.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec_curve.c Tue Sep 10 21:14:56 2019 (r352193) @@ -3,7 +3,7 @@ * Written by Nils Larsch for the OpenSSL project. */ /* ==================================================================== - * Copyright (c) 1998-2010 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -75,6 +75,8 @@ #include #include +#include "bn_int.h" + #ifdef OPENSSL_FIPS # include #endif @@ -3245,4 +3247,116 @@ int EC_curve_nist2nid(const char *name) return nist_curves[i].nid; } return NID_undef; +} + +#define NUM_BN_FIELDS 6 +/* + * Validates EC domain parameter data for known named curves. + * This can be used when a curve is loaded explicitly (without a curve + * name) or to validate that domain parameters have not been modified. + * + * Returns: The nid associated with the found named curve, or NID_undef + * if not found. If there was an error it returns -1. + */ +int ec_curve_nid_from_params(const EC_GROUP *group, BN_CTX *ctx) +{ + int ret = -1, nid, len, field_type, param_len; + size_t i, seed_len; + const unsigned char *seed, *params_seed, *params; + unsigned char *param_bytes = NULL; + const EC_CURVE_DATA *data; + const EC_POINT *generator = NULL; + const EC_METHOD *meth; + const BIGNUM *cofactor = NULL; + /* An array of BIGNUMs for (p, a, b, x, y, order) */ + BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL}; + + meth = EC_GROUP_method_of(group); + if (meth == NULL) + return -1; + /* Use the optional named curve nid as a search field */ + nid = EC_GROUP_get_curve_name(group); + field_type = EC_METHOD_get_field_type(meth); + seed_len = EC_GROUP_get_seed_len(group); + seed = EC_GROUP_get0_seed(group); + cofactor = &group->cofactor; + + BN_CTX_start(ctx); + + /* + * The built-in curves contains data fields (p, a, b, x, y, order) that are + * all zero-padded to be the same size. The size of the padding is + * determined by either the number of bytes in the field modulus (p) or the + * EC group order, whichever is larger. + */ + param_len = BN_num_bytes(&group->order); + len = BN_num_bytes(&group->field); + if (len > param_len) + param_len = len; + + /* Allocate space to store the padded data for (p, a, b, x, y, order) */ + param_bytes = OPENSSL_malloc(param_len * NUM_BN_FIELDS); + if (param_bytes == NULL) + goto end; + + /* Create the bignums */ + for (i = 0; i < NUM_BN_FIELDS; ++i) { + if ((bn[i] = BN_CTX_get(ctx)) == NULL) + goto end; + } + /* + * Fill in the bn array with the same values as the internal curves + * i.e. the values are p, a, b, x, y, order. + */ + /* Get p, a & b */ + if (!(ec_group_get_curve(group, bn[0], bn[1], bn[2], ctx) + && ((generator = EC_GROUP_get0_generator(group)) != NULL) + /* Get x & y */ + && ec_point_get_affine_coordinates(group, generator, bn[3], bn[4], ctx) + /* Get order */ + && EC_GROUP_get_order(group, bn[5], ctx))) + goto end; + + /* + * Convert the bignum array to bytes that are joined together to form + * a single buffer that contains data for all fields. + * (p, a, b, x, y, order) are all zero padded to be the same size. + */ + for (i = 0; i < NUM_BN_FIELDS; ++i) { + if (bn_bn2binpad(bn[i], ¶m_bytes[i*param_len], param_len) <= 0) + goto end; + } + + for (i = 0; i < curve_list_length; i++) { + const ec_list_element curve = curve_list[i]; + + data = curve.data; + /* Get the raw order byte data */ + params_seed = (const unsigned char *)(data + 1); /* skip header */ + params = params_seed + data->seed_len; + + /* Look for unique fields in the fixed curve data */ + if (data->field_type == field_type + && param_len == data->param_len + && (nid <= 0 || nid == curve.nid) + /* check the optional cofactor (ignore if its zero) */ + && (BN_is_zero(cofactor) + || BN_is_word(cofactor, (const BN_ULONG)curve.data->cofactor)) + /* Check the optional seed (ignore if its not set) */ + && (data->seed_len == 0 || seed_len == 0 + || ((size_t)data->seed_len == seed_len + && memcmp(params_seed, seed, seed_len) == 0)) + /* Check that the groups params match the built-in curve params */ + && memcmp(param_bytes, params, param_len * NUM_BN_FIELDS) + == 0) { + ret = curve.nid; + goto end; + } + } + /* Gets here if the group was not found */ + ret = NID_undef; +end: + OPENSSL_free(param_bytes); + BN_CTX_end(ctx); + return ret; } Modified: stable/11/crypto/openssl/crypto/ec/ec_err.c ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec_err.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec_err.c Tue Sep 10 21:14:56 2019 (r352193) @@ -1,6 +1,6 @@ /* crypto/ec/ec_err.c */ /* ==================================================================== - * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved. + * Copyright (c) 1999-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -310,6 +310,7 @@ static ERR_STRING_DATA EC_str_reasons[] = { {ERR_REASON(EC_R_SLOT_FULL), "slot full"}, {ERR_REASON(EC_R_UNDEFINED_GENERATOR), "undefined generator"}, {ERR_REASON(EC_R_UNDEFINED_ORDER), "undefined order"}, + {ERR_REASON(EC_R_UNKNOWN_COFACTOR), "unknown cofactor"}, {ERR_REASON(EC_R_UNKNOWN_GROUP), "unknown group"}, {ERR_REASON(EC_R_UNKNOWN_ORDER), "unknown order"}, {ERR_REASON(EC_R_UNSUPPORTED_FIELD), "unsupported field"}, Modified: stable/11/crypto/openssl/crypto/ec/ec_lcl.h ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec_lcl.h Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec_lcl.h Tue Sep 10 21:14:56 2019 (r352193) @@ -3,7 +3,7 @@ * Originally written by Bodo Moeller for the OpenSSL project. */ /* ==================================================================== - * Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -565,3 +565,18 @@ EC_GROUP *FIPS_ec_group_new_curve_gf2m(const BIGNUM *p const BIGNUM *b, BN_CTX *ctx); EC_GROUP *FIPS_ec_group_new_by_curve_name(int nid); #endif + +int ec_curve_nid_from_params(const EC_GROUP *group, BN_CTX *ctx); + +/* + * The next 2 functions are just internal wrappers around the omonimous + * functions with either the `_GFp` or the `_GF2m` suffix. + * + * They are meant to facilitate backporting of code from newer branches, where + * the public API includes a "field agnostic" version of these 2 functions. + */ +int ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, + BIGNUM *b, BN_CTX *ctx); +int ec_point_get_affine_coordinates(const EC_GROUP *group, + const EC_POINT *point, BIGNUM *x, + BIGNUM *y, BN_CTX *ctx); Modified: stable/11/crypto/openssl/crypto/ec/ec_lib.c ============================================================================== --- stable/11/crypto/openssl/crypto/ec/ec_lib.c Tue Sep 10 21:13:37 2019 (r352192) +++ stable/11/crypto/openssl/crypto/ec/ec_lib.c Tue Sep 10 21:14:56 2019 (r352193) @@ -294,6 +294,67 @@ int EC_METHOD_get_field_type(const EC_METHOD *meth) return meth->field_type; } +/*- + * Try computing cofactor from the generator order (n) and field cardinality (q). + * This works for all curves of cryptographic interest. + * + * Hasse thm: q + 1 - 2*sqrt(q) <= n*h <= q + 1 + 2*sqrt(q) + * h_min = (q + 1 - 2*sqrt(q))/n + * h_max = (q + 1 + 2*sqrt(q))/n + * h_max - h_min = 4*sqrt(q)/n + * So if n > 4*sqrt(q) holds, there is only one possible value for h: + * h = \lfloor (h_min + h_max)/2 \rceil = \lfloor (q + 1)/n \rceil + * + * Otherwise, zero cofactor and return success. + */ +static int ec_guess_cofactor(EC_GROUP *group) { + int ret = 0; + BN_CTX *ctx = NULL; + BIGNUM *q = NULL; + + /*- + * If the cofactor is too large, we cannot guess it. + * The RHS of below is a strict overestimate of lg(4 * sqrt(q)) + */ + if (BN_num_bits(&group->order) <= (BN_num_bits(&group->field) + 1) / 2 + 3) { + /* default to 0 */ + BN_zero(&group->cofactor); + /* return success */ + return 1; + } + + if ((ctx = BN_CTX_new()) == NULL) + return 0; + + BN_CTX_start(ctx); + if ((q = BN_CTX_get(ctx)) == NULL) + goto err; + + /* set q = 2**m for binary fields; q = p otherwise */ + if (group->meth->field_type == NID_X9_62_characteristic_two_field) { + BN_zero(q); + if (!BN_set_bit(q, BN_num_bits(&group->field) - 1)) + goto err; + } else { + if (!BN_copy(q, &group->field)) + goto err; + } + + /* compute h = \lfloor (q + 1)/n \rceil = \lfloor (q + 1 + n/2)/n \rfloor */ + if (!BN_rshift1(&group->cofactor, &group->order) /* n/2 */ + || !BN_add(&group->cofactor, &group->cofactor, q) /* q + n/2 */ + /* q + 1 + n/2 */ + || !BN_add(&group->cofactor, &group->cofactor, BN_value_one()) + /* (q + 1 + n/2)/n */ + || !BN_div(&group->cofactor, NULL, &group->cofactor, &group->order, ctx)) + goto err; + ret = 1; + err: + BN_CTX_end(ctx); + BN_CTX_free(ctx); + return ret; +} + int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor) { @@ -302,6 +363,33 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_P return 0; } + /* require group->field >= 1 */ + if (BN_is_zero(&group->field) || BN_is_negative(&group->field)) { + ECerr(EC_F_EC_GROUP_SET_GENERATOR, EC_R_INVALID_FIELD); + return 0; + } + + /*- + * - require order >= 1 + * - enforce upper bound due to Hasse thm: order can be no more than one bit + * longer than field cardinality + */ + if (order == NULL || BN_is_zero(order) || BN_is_negative(order) + || BN_num_bits(order) > BN_num_bits(&group->field) + 1) { + ECerr(EC_F_EC_GROUP_SET_GENERATOR, EC_R_INVALID_GROUP_ORDER); + return 0; + } + + /*- + * Unfortunately the cofactor is an optional field in many standards. + * Internally, the lib uses 0 cofactor as a marker for "unknown cofactor". + * So accept cofactor == NULL or cofactor >= 0. + */ + if (cofactor != NULL && BN_is_negative(cofactor)) { + ECerr(EC_F_EC_GROUP_SET_GENERATOR, EC_R_UNKNOWN_COFACTOR); + return 0; + } + if (group->generator == NULL) { group->generator = EC_POINT_new(group); if (group->generator == NULL) @@ -310,17 +398,17 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_P if (!EC_POINT_copy(group->generator, generator)) return 0; - if (order != NULL) { - if (!BN_copy(&group->order, order)) - return 0; - } else - BN_zero(&group->order); + if (!BN_copy(&group->order, order)) + return 0; - if (cofactor != NULL) { + /* Either take the provided positive cofactor, or try to compute it */ + if (cofactor != NULL && !BN_is_zero(cofactor)) { if (!BN_copy(&group->cofactor, cofactor)) return 0; - } else + } else if (!ec_guess_cofactor(group)) { BN_zero(&group->cofactor); + return 0; + } /*- * Access to the `mont_data` field of an EC_GROUP struct should always be @@ -1168,4 +1256,61 @@ int ec_precompute_mont_data(EC_GROUP *group) if (ctx) BN_CTX_free(ctx); return ret; +} + +/* + * This is just a wrapper around the public functions + * - EC_GROUP_get_curve_GF2m + * - EC_GROUP_get_curve_GFp + * + * It is meant to facilitate backporting of code from newer branches, where + * the public API includes a "field agnostic" version of it. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Sep 10 22:26: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 CD966E68DA; Tue, 10 Sep 2019 22:26:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46SflC555bz46qv; Tue, 10 Sep 2019 22:26:31 +0000 (UTC) (envelope-from jkim@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 8D69F2CDFE; Tue, 10 Sep 2019 22:26:31 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8AMQVXo030308; Tue, 10 Sep 2019 22:26:31 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8AMQVfU030307; Tue, 10 Sep 2019 22:26:31 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201909102226.x8AMQVfU030307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Tue, 10 Sep 2019 22:26:31 +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: r352198 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 352198 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, 10 Sep 2019 22:26:31 -0000 Author: jkim Date: Tue Sep 10 22:26:31 2019 New Revision: 352198 URL: https://svnweb.freebsd.org/changeset/base/352198 Log: MFC: r352197 Remove unnecessary entries from the previous commit. Modified: stable/12/ObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Tue Sep 10 22:24:42 2019 (r352197) +++ stable/12/ObsoleteFiles.inc Tue Sep 10 22:26:31 2019 (r352198) @@ -38,9 +38,6 @@ # xargs -n1 | sort | uniq -d; # done -# 20190910: OpenSSL 1.1.1d -OLD_FILES+=usr/share/openssl/man/man3/d2i_ECDSA_SIG.3.gz -OLD_FILES+=usr/share/openssl/man/man3/i2d_ECDSA_SIG.3.gz # 20190811: sys/pwm.h renamed to dev/pwmc.h and pwm(9) removed OLD_FILES+=usr/include/sys/pwm.h usr/share/man/man9/pwm.9 # 20190723: new clang import which bumps version from 8.0.0 to 8.0.1. From owner-svn-src-stable@freebsd.org Wed Sep 11 04:55: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 5E7F0EE97F; Wed, 11 Sep 2019 04:55:11 +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 46SqMg1t0wz4Qq3; Wed, 11 Sep 2019 04:55:11 +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 1FBB313D8; Wed, 11 Sep 2019 04:55:11 +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 x8B4tAga062845; Wed, 11 Sep 2019 04:55:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8B4tAn9062844; Wed, 11 Sep 2019 04:55:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909110455.x8B4tAn9062844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 11 Sep 2019 04:55: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: r352202 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 352202 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, 11 Sep 2019 04:55:11 -0000 Author: kib Date: Wed Sep 11 04:55:10 2019 New Revision: 352202 URL: https://svnweb.freebsd.org/changeset/base/352202 Log: MFC r351830: madvise(MADV_FREE): Quick fix to time rewind. PR: 240061 Modified: stable/12/sys/vm/vm_map.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Wed Sep 11 03:25:30 2019 (r352201) +++ stable/12/sys/vm/vm_map.c Wed Sep 11 04:55:10 2019 (r352202) @@ -2735,6 +2735,18 @@ vm_map_madvise( if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; + /* + * MADV_FREE would otherwise rewind time to + * the creation of the shadow object. Because + * we hold the VM map read-locked, neither the + * entry's object nor the presence of a + * backing object can change. + */ + if (behav == MADV_FREE && + current->object.vm_object != NULL && + current->object.vm_object->backing_object != NULL) + continue; + pstart = OFF_TO_IDX(current->offset); pend = pstart + atop(current->end - current->start); useStart = current->start; From owner-svn-src-stable@freebsd.org Wed Sep 11 04:59:28 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 1AAEEEEA71; Wed, 11 Sep 2019 04:59:28 +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 46SqSb6n1Zz4R0Y; Wed, 11 Sep 2019 04:59:27 +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 C853A13E4; Wed, 11 Sep 2019 04:59:27 +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 x8B4xRLQ063105; Wed, 11 Sep 2019 04:59:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8B4xRum063104; Wed, 11 Sep 2019 04:59:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909110459.x8B4xRum063104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 11 Sep 2019 04:59:27 +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: r352203 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 352203 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, 11 Sep 2019 04:59:28 -0000 Author: kib Date: Wed Sep 11 04:59:27 2019 New Revision: 352203 URL: https://svnweb.freebsd.org/changeset/base/352203 Log: MFC r351830: madvise(MADV_FREE): Quick fix to time rewind. PR: 240061 Modified: stable/11/sys/vm/vm_map.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_map.c ============================================================================== --- stable/11/sys/vm/vm_map.c Wed Sep 11 04:55:10 2019 (r352202) +++ stable/11/sys/vm/vm_map.c Wed Sep 11 04:59:27 2019 (r352203) @@ -2279,6 +2279,18 @@ vm_map_madvise( if (current->eflags & MAP_ENTRY_IS_SUB_MAP) continue; + /* + * MADV_FREE would otherwise rewind time to + * the creation of the shadow object. Because + * we hold the VM map read-locked, neither the + * entry's object nor the presence of a + * backing object can change. + */ + if (behav == MADV_FREE && + current->object.vm_object != NULL && + current->object.vm_object->backing_object != NULL) + continue; + pstart = OFF_TO_IDX(current->offset); pend = pstart + atop(current->end - current->start); useStart = current->start; From owner-svn-src-stable@freebsd.org Wed Sep 11 16:06:05 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 B7C50D85E1; Wed, 11 Sep 2019 16:06:05 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46T6Fn4QDsz46ZQ; Wed, 11 Sep 2019 16:06:05 +0000 (UTC) (envelope-from oshogbo@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 7770B8E7D; Wed, 11 Sep 2019 16:06:05 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8BG65eC060655; Wed, 11 Sep 2019 16:06:05 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8BG65Em060654; Wed, 11 Sep 2019 16:06:05 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201909111606.x8BG65Em060654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 11 Sep 2019 16:06: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: r352217 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352217 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, 11 Sep 2019 16:06:05 -0000 Author: oshogbo Date: Wed Sep 11 16:06:05 2019 New Revision: 352217 URL: https://svnweb.freebsd.org/changeset/base/352217 Log: Fix miss merge in r352179. Modified: stable/12/sys/kern/kern_exit.c Modified: stable/12/sys/kern/kern_exit.c ============================================================================== --- stable/12/sys/kern/kern_exit.c Wed Sep 11 16:00:03 2019 (r352216) +++ stable/12/sys/kern/kern_exit.c Wed Sep 11 16:06:05 2019 (r352217) @@ -437,7 +437,6 @@ exit1(struct thread *td, int rval, int signo) LIST_REMOVE(p, p_hash); sx_xunlock(&allproc_lock); - sx_xlock(&proctree_lock); PROC_LOCK(p); p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE); PROC_UNLOCK(p); From owner-svn-src-stable@freebsd.org Wed Sep 11 20:13: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 3481FDEF27; Wed, 11 Sep 2019 20:13:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TClR1Bg3z4NTJ; Wed, 11 Sep 2019 20:13:39 +0000 (UTC) (envelope-from asomers@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 0C212BD67; Wed, 11 Sep 2019 20:13:39 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8BKDda0010505; Wed, 11 Sep 2019 20:13:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8BKDdIi010504; Wed, 11 Sep 2019 20:13:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909112013.x8BKDdIi010504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 11 Sep 2019 20:13: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: r352232 - stable/12/sbin/ping6 X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sbin/ping6 X-SVN-Commit-Revision: 352232 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, 11 Sep 2019 20:13:39 -0000 Author: asomers Date: Wed Sep 11 20:13:38 2019 New Revision: 352232 URL: https://svnweb.freebsd.org/changeset/base/352232 Log: MFC r350993, r350997, r351079-r351080, r351082, r351090, r351101-r351102 r350993: Consistently use the byteorder functions in the correct direction Though ntohs and htons are functionally identical, they have different meanings.Using the correct one helps to document the code. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21219 r350997: ping6: use the monotonic clock to measure durations Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21226 r351079: ping6: quiet warning about unused copyright variable Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21270 r351080: ping6: quiet an undefined variable warning GCC 4.2 isn't smart enough to know that this variable is already defined by the time it's used. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21269 r351082: ping6: fix uninitialized variable warning for intvl GCC isn't smart enough to realize that this variable was always initialized. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21271 r351090: ping6: Fix data type of the buffer for ancillary data of a received message The old code worked, but wasted some stack space. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21275 r351101: ping6: fix uninitialized variable warnings when MK_CASPER=no Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21273 r351102: ping6: Fix alignment errors This fixes -Wcast-align errors when compiled with WARNS=6. Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21217 Modified: stable/12/sbin/ping6/ping6.c Modified: stable/12/sbin/ping6/ping6.c ============================================================================== --- stable/12/sbin/ping6/ping6.c Wed Sep 11 19:48:32 2019 (r352231) +++ stable/12/sbin/ping6/ping6.c Wed Sep 11 20:13:38 2019 (r352232) @@ -65,6 +65,7 @@ * SUCH DAMAGE. */ +#if 0 #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1989, 1993\n\ @@ -72,10 +73,9 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -#if 0 static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; -#endif #endif /* not lint */ +#endif #include __FBSDID("$FreeBSD$"); @@ -107,7 +107,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -133,6 +132,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef IPSEC @@ -144,7 +144,7 @@ __FBSDID("$FreeBSD$"); struct tv32 { u_int32_t tv32_sec; - u_int32_t tv32_usec; + u_int32_t tv32_nsec; }; #define MAXPACKETLEN 131072 @@ -288,7 +288,6 @@ static void pr_rthdr(void *, size_t); static int pr_bitrange(u_int32_t, int, int); static void pr_retip(struct ip6_hdr *, u_char *); static void summary(void); -static void tvsub(struct timeval *, struct timeval *); static int setpolicy(int, char *); static char *nigroup(char *, int); static void usage(void); @@ -296,7 +295,7 @@ static void usage(void); int main(int argc, char *argv[]) { - struct timeval last, intvl; + struct timespec last, intvl; struct sockaddr_in6 from, *sin6; struct addrinfo hints, *res; struct sigaction si_sa; @@ -308,13 +307,14 @@ main(int argc, char *argv[]) int ip6optlen = 0; struct cmsghdr *scmsgp = NULL; /* For control (ancillary) data received from recvmsg() */ - struct cmsghdr cm[CONTROLLEN]; + u_char cm[CONTROLLEN]; #if defined(SO_SNDBUF) && defined(SO_RCVBUF) u_long lsockbufsize; int sockbufsize = 0; #endif int usepktinfo = 0; - struct in6_pktinfo *pktinfo = NULL; + struct in6_pktinfo pktinfo; + char *cmsg_pktinfo = NULL; struct ip6_rthdr *rthdr = NULL; #ifdef IPSEC_POLICY_IPSEC char *policy_in = NULL; @@ -333,7 +333,11 @@ main(int argc, char *argv[]) /* just to be sure */ memset(&smsghdr, 0, sizeof(smsghdr)); memset(&smsgiov, 0, sizeof(smsgiov)); + memset(&pktinfo, 0, sizeof(pktinfo)); + intvl.tv_sec = interval / 1000; + intvl.tv_nsec = interval % 1000 * 1000000; + alarmtimeout = preload = 0; datap = &outpack[ICMP6ECHOLEN + ICMP6ECHOTMLEN]; capdns = capdns_setup(); @@ -456,15 +460,15 @@ main(int argc, char *argv[]) errx(1, "%s: only root may use interval < 1s", strerror(EPERM)); } - intvl.tv_sec = (long)t; - intvl.tv_usec = - (long)((t - intvl.tv_sec) * 1000000); + intvl.tv_sec = (time_t)t; + intvl.tv_nsec = + (long)((t - intvl.tv_sec) * 1000000000); if (intvl.tv_sec < 0) errx(1, "illegal timing interval %s", optarg); /* less than 1/hz does not make sense */ - if (intvl.tv_sec == 0 && intvl.tv_usec < 1) { + if (intvl.tv_sec == 0 && intvl.tv_nsec < 1000) { warnx("too small interval, raised to .000001"); - intvl.tv_usec = 1; + intvl.tv_nsec = 1000; } options |= F_INTERVAL; break; @@ -894,11 +898,10 @@ main(int argc, char *argv[]) errx(1, "can't allocate enough memory"); smsghdr.msg_control = (caddr_t)scmsg; smsghdr.msg_controllen = ip6optlen; - scmsgp = (struct cmsghdr *)scmsg; + scmsgp = CMSG_FIRSTHDR(&smsghdr); } if (usepktinfo) { - pktinfo = (struct in6_pktinfo *)(CMSG_DATA(scmsgp)); - memset(pktinfo, 0, sizeof(*pktinfo)); + cmsg_pktinfo = CMSG_DATA(scmsgp); scmsgp->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); scmsgp->cmsg_level = IPPROTO_IPV6; scmsgp->cmsg_type = IPV6_PKTINFO; @@ -909,7 +912,7 @@ main(int argc, char *argv[]) if (ifname) { #ifndef USE_SIN6_SCOPE_ID /* pktinfo must have already been allocated */ - if ((pktinfo->ipi6_ifindex = if_nametoindex(ifname)) == 0) + if ((pktinfo.ipi6_ifindex = if_nametoindex(ifname)) == 0) errx(1, "%s: invalid interface name", ifname); #else if ((dst.sin6_scope_id = if_nametoindex(ifname)) == 0) @@ -920,7 +923,7 @@ main(int argc, char *argv[]) scmsgp->cmsg_len = CMSG_LEN(sizeof(int)); scmsgp->cmsg_level = IPPROTO_IPV6; scmsgp->cmsg_type = IPV6_HOPLIMIT; - *(int *)(CMSG_DATA(scmsgp)) = hoplimit; + memcpy(CMSG_DATA(scmsgp), &hoplimit, sizeof(hoplimit)); scmsgp = CMSG_NXTHDR(&smsghdr, scmsgp); } @@ -959,6 +962,7 @@ main(int argc, char *argv[]) } /* From now on we will use only reverse DNS lookups. */ +#ifdef WITH_CASPER if (capdns != NULL) { const char *types[1]; @@ -966,7 +970,7 @@ main(int argc, char *argv[]) if (cap_dns_type_limit(capdns, types, nitems(types)) < 0) err(1, "unable to limit access to system.dns service"); } - +#endif if (!(options & F_SRCADDR)) { /* * get the source address. XXX since we revoked the root @@ -983,9 +987,9 @@ main(int argc, char *argv[]) src.sin6_port = ntohs(DUMMY_PORT); src.sin6_scope_id = dst.sin6_scope_id; - if (pktinfo && + if (usepktinfo && setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTINFO, - (void *)pktinfo, sizeof(*pktinfo))) + (void *)&pktinfo, sizeof(pktinfo))) err(1, "UDP setsockopt(IPV6_PKTINFO)"); if (hoplimit != -1 && @@ -1012,6 +1016,10 @@ main(int argc, char *argv[]) close(dummy); } + /* Save pktinfo in the ancillary data. */ + if (usepktinfo) + memcpy(cmsg_pktinfo, &pktinfo, sizeof(pktinfo)); + if (connect(ssend, (struct sockaddr *)&dst, sizeof(dst)) != 0) err(1, "connect() ssend"); @@ -1102,7 +1110,7 @@ main(int argc, char *argv[]) while (preload--) pinger(); } - gettimeofday(&last, NULL); + clock_gettime(CLOCK_MONOTONIC, &last); sigemptyset(&si_sa.sa_mask); si_sa.sa_flags = 0; @@ -1121,15 +1129,12 @@ main(int argc, char *argv[]) } if (options & F_FLOOD) { intvl.tv_sec = 0; - intvl.tv_usec = 10000; - } else if ((options & F_INTERVAL) == 0) { - intvl.tv_sec = interval / 1000; - intvl.tv_usec = interval % 1000 * 1000; + intvl.tv_nsec = 10000000; } almost_done = 0; while (seenint == 0) { - struct timeval now, timeout; + struct timespec now, timeout; struct msghdr m; struct iovec iov[2]; fd_set rfds; @@ -1147,21 +1152,13 @@ main(int argc, char *argv[]) #endif FD_ZERO(&rfds); FD_SET(srecv, &rfds); - gettimeofday(&now, NULL); - timeout.tv_sec = last.tv_sec + intvl.tv_sec - now.tv_sec; - timeout.tv_usec = last.tv_usec + intvl.tv_usec - now.tv_usec; - while (timeout.tv_usec < 0) { - timeout.tv_usec += 1000000; - timeout.tv_sec--; - } - while (timeout.tv_usec > 1000000) { - timeout.tv_usec -= 1000000; - timeout.tv_sec++; - } + clock_gettime(CLOCK_MONOTONIC, &now); + timespecadd(&last, &intvl, &timeout); + timespecsub(&timeout, &now, &timeout); if (timeout.tv_sec < 0) - timeout.tv_sec = timeout.tv_usec = 0; + timespecclear(&timeout); - n = select(srecv + 1, &rfds, NULL, NULL, &timeout); + n = pselect(srecv + 1, &rfds, NULL, NULL, &timeout, NULL); if (n < 0) continue; /* EINTR */ if (n == 1) { @@ -1222,17 +1219,18 @@ main(int argc, char *argv[]) * if we've received any packets or (waittime) * milliseconds if we haven't. */ - intvl.tv_usec = 0; + intvl.tv_nsec = 0; if (nreceived) { intvl.tv_sec = 2 * tmax / 1000; if (intvl.tv_sec == 0) intvl.tv_sec = 1; } else { intvl.tv_sec = waittime / 1000; - intvl.tv_usec = waittime % 1000 * 1000; + intvl.tv_nsec = + waittime % 1000 * 1000000; } } - gettimeofday(&last, NULL); + clock_gettime(CLOCK_MONOTONIC, &last); if (ntransmitted - nreceived - 1 > nmissedmax) { nmissedmax = ntransmitted - nreceived - 1; if (options & F_MISSED) @@ -1275,7 +1273,7 @@ onsignal(int sig) * Compose and transmit an ICMP ECHO REQUEST packet. The IP packet * will be added on by the kernel. The ID field is our UNIX process ID, * and the sequence number is an ascending integer. The first 8 bytes - * of the data portion are used to hold a UNIX "timeval" struct in VAX + * of the data portion are used to hold a UNIX "timespec" struct in VAX * byte-order, to compute the round-trip time. */ static size_t @@ -1317,6 +1315,8 @@ pinger(void) CLR(seq % mx_dup_ck); if (options & F_FQDN) { + uint16_t s; + icp->icmp6_type = ICMP6_NI_QUERY; icp->icmp6_code = ICMP6_NI_SUBJ_IPV6; nip->ni_qtype = htons(NI_QTYPE_FQDN); @@ -1324,13 +1324,15 @@ pinger(void) memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + s = htons(seq); + memcpy(nip->icmp6_ni_nonce, &s, sizeof(s)); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); cc = ICMP6_NIQLEN + sizeof(dst.sin6_addr); datalen = 0; } else if (options & F_FQDNOLD) { + uint16_t s; /* packet format in 03 draft - no Subject data on queries */ icp->icmp6_type = ICMP6_NI_QUERY; icp->icmp6_code = 0; /* code field is always 0 */ @@ -1339,11 +1341,14 @@ pinger(void) memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + s = htons(seq); + memcpy(nip->icmp6_ni_nonce, &s, sizeof(s)); cc = ICMP6_NIQLEN; datalen = 0; } else if (options & F_NODEADDR) { + uint16_t s; + icp->icmp6_type = ICMP6_NI_QUERY; icp->icmp6_code = ICMP6_NI_SUBJ_IPV6; nip->ni_qtype = htons(NI_QTYPE_NODEADDR); @@ -1351,13 +1356,16 @@ pinger(void) memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + s = htons(seq); + memcpy(nip->icmp6_ni_nonce, &s, sizeof(s)); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); cc = ICMP6_NIQLEN + sizeof(dst.sin6_addr); datalen = 0; } else if (options & F_SUPTYPES) { + uint16_t s; + icp->icmp6_type = ICMP6_NI_QUERY; icp->icmp6_code = ICMP6_NI_SUBJ_FQDN; /*empty*/ nip->ni_qtype = htons(NI_QTYPE_SUPTYPES); @@ -1366,21 +1374,29 @@ pinger(void) memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + s = htons(seq); + memcpy(nip->icmp6_ni_nonce, &s, sizeof(s)); + cc = ICMP6_NIQLEN; datalen = 0; } else { icp->icmp6_type = ICMP6_ECHO_REQUEST; icp->icmp6_code = 0; icp->icmp6_id = htons(ident); - icp->icmp6_seq = ntohs(seq); + icp->icmp6_seq = htons(seq); if (timing) { - struct timeval tv; - struct tv32 *tv32; - (void)gettimeofday(&tv, NULL); - tv32 = (struct tv32 *)&outpack[ICMP6ECHOLEN]; - tv32->tv32_sec = htonl(tv.tv_sec); - tv32->tv32_usec = htonl(tv.tv_usec); + struct timespec tv; + struct tv32 tv32; + (void)clock_gettime(CLOCK_MONOTONIC, &tv); + /* + * Truncate seconds down to 32 bits in order + * to fit the timestamp within 8 bytes of the + * packet. We're only concerned with + * durations, not absolute times. + */ + tv32.tv32_sec = (uint32_t)htonl(tv.tv_sec); + tv32.tv32_nsec = (uint32_t)htonl(tv.tv_nsec); + memcpy(&outpack[ICMP6ECHOLEN], &tv32, sizeof(tv32)); } cc = ICMP6ECHOLEN + datalen; } @@ -1525,8 +1541,8 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) const u_char *cp = NULL; u_char *dp, *end = buf + cc; struct in6_pktinfo *pktinfo = NULL; - struct timeval tv, tp; - struct tv32 *tpp; + struct timespec tv, tp; + struct tv32 tpp; double triptime = 0; int dupflag; size_t off; @@ -1534,7 +1550,7 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) u_int16_t seq; char dnsname[MAXDNAME + 1]; - (void)gettimeofday(&tv, NULL); + (void)clock_gettime(CLOCK_MONOTONIC, &tv); if (!mhdr || !mhdr->msg_name || mhdr->msg_namelen != sizeof(struct sockaddr_in6) || @@ -1571,12 +1587,12 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) seq = ntohs(icp->icmp6_seq); ++nreceived; if (timing) { - tpp = (struct tv32 *)(icp + 1); - tp.tv_sec = ntohl(tpp->tv32_sec); - tp.tv_usec = ntohl(tpp->tv32_usec); - tvsub(&tv, &tp); + memcpy(&tpp, icp + 1, sizeof(tpp)); + tp.tv_sec = ntohl(tpp.tv32_sec); + tp.tv_nsec = ntohl(tpp.tv32_nsec); + timespecsub(&tv, &tp, &tv); triptime = ((double)tv.tv_sec) * 1000.0 + - ((double)tv.tv_usec) / 1000.0; + ((double)tv.tv_nsec) / 1000000.0; tsum += triptime; tsumsq += triptime * triptime; if (triptime < tmin) @@ -1637,7 +1653,8 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) } } } else if (icp->icmp6_type == ICMP6_NI_REPLY && mynireply(ni)) { - seq = ntohs(*(u_int16_t *)ni->icmp6_ni_nonce); + memcpy(&seq, ni->icmp6_ni_nonce, sizeof(seq)); + seq = ntohs(seq); ++nreceived; if (TST(seq % mx_dup_ck)) { ++nrepeats; @@ -1716,6 +1733,7 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) } } if (options & F_VERBOSE) { + u_long t; int32_t ttl; int comma = 0; @@ -1738,7 +1756,8 @@ pr_pack(u_char *buf, int cc, struct msghdr *mhdr) putchar(')'); goto fqdnend; } - ttl = (int32_t)ntohl(*(u_long *)&buf[off+ICMP6ECHOLEN+8]); + memcpy(&t, &buf[off+ICMP6ECHOLEN+8], sizeof(t)); + ttl = (int32_t)ntohl(t); if (comma) printf(","); if (!(ni->ni_flags & NI_FQDN_FLAG_VALIDTTL)) { @@ -2101,11 +2120,13 @@ pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen) if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) withttl = 1; while (nilen > 0) { - u_int32_t ttl; + u_int32_t ttl = 0; if (withttl) { - /* XXX: alignment? */ - ttl = (u_int32_t)ntohl(*(u_int32_t *)cp); + uint32_t t; + + memcpy(&t, cp, sizeof(t)); + ttl = (u_int32_t)ntohl(t); cp += sizeof(u_int32_t); nilen -= sizeof(u_int32_t); } @@ -2144,8 +2165,12 @@ get_hoplim(struct msghdr *mhdr) if (cm->cmsg_level == IPPROTO_IPV6 && cm->cmsg_type == IPV6_HOPLIMIT && - cm->cmsg_len == CMSG_LEN(sizeof(int))) - return(*(int *)CMSG_DATA(cm)); + cm->cmsg_len == CMSG_LEN(sizeof(int))) { + int r; + + memcpy(&r, CMSG_DATA(cm), sizeof(r)); + return(r); + } } return(-1); @@ -2154,6 +2179,7 @@ get_hoplim(struct msghdr *mhdr) static struct in6_pktinfo * get_rcvpktinfo(struct msghdr *mhdr) { + static struct in6_pktinfo pi; struct cmsghdr *cm; for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm; @@ -2163,8 +2189,10 @@ get_rcvpktinfo(struct msghdr *mhdr) if (cm->cmsg_level == IPPROTO_IPV6 && cm->cmsg_type == IPV6_PKTINFO && - cm->cmsg_len == CMSG_LEN(sizeof(struct in6_pktinfo))) - return((struct in6_pktinfo *)CMSG_DATA(cm)); + cm->cmsg_len == CMSG_LEN(sizeof(struct in6_pktinfo))) { + memcpy(&pi, CMSG_DATA(cm), sizeof(pi)); + return(&pi); + } } return(NULL); @@ -2175,7 +2203,7 @@ get_pathmtu(struct msghdr *mhdr) { #ifdef IPV6_RECVPATHMTU struct cmsghdr *cm; - struct ip6_mtuinfo *mtuctl = NULL; + struct ip6_mtuinfo mtuctl; for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(mhdr); cm; cm = (struct cmsghdr *)CMSG_NXTHDR(mhdr, cm)) { @@ -2185,7 +2213,7 @@ get_pathmtu(struct msghdr *mhdr) if (cm->cmsg_level == IPPROTO_IPV6 && cm->cmsg_type == IPV6_PATHMTU && cm->cmsg_len == CMSG_LEN(sizeof(struct ip6_mtuinfo))) { - mtuctl = (struct ip6_mtuinfo *)CMSG_DATA(cm); + memcpy(&mtuctl, CMSG_DATA(cm), sizeof(mtuctl)); /* * If the notified destination is different from @@ -2195,17 +2223,17 @@ get_pathmtu(struct msghdr *mhdr) * have used the default scope zone ID for sending, * in which case the scope ID value is 0. */ - if (!IN6_ARE_ADDR_EQUAL(&mtuctl->ip6m_addr.sin6_addr, + if (!IN6_ARE_ADDR_EQUAL(&mtuctl.ip6m_addr.sin6_addr, &dst.sin6_addr) || - (mtuctl->ip6m_addr.sin6_scope_id && + (mtuctl.ip6m_addr.sin6_scope_id && dst.sin6_scope_id && - mtuctl->ip6m_addr.sin6_scope_id != + mtuctl.ip6m_addr.sin6_scope_id != dst.sin6_scope_id)) { if ((options & F_VERBOSE) != 0) { printf("path MTU for %s is notified. " "(ignored)\n", - pr_addr((struct sockaddr *)&mtuctl->ip6m_addr, - sizeof(mtuctl->ip6m_addr))); + pr_addr((struct sockaddr *)&mtuctl.ip6m_addr, + sizeof(mtuctl.ip6m_addr))); } return(0); } @@ -2214,11 +2242,11 @@ get_pathmtu(struct msghdr *mhdr) * Ignore an invalid MTU. XXX: can we just believe * the kernel check? */ - if (mtuctl->ip6m_mtu < IPV6_MMTU) + if (mtuctl.ip6m_mtu < IPV6_MMTU) return(0); /* notification for our destination. return the MTU. */ - return((int)mtuctl->ip6m_mtu); + return((int)mtuctl.ip6m_mtu); } } #endif @@ -2226,21 +2254,6 @@ get_pathmtu(struct msghdr *mhdr) } /* - * tvsub -- - * Subtract 2 timeval structs: out = out - in. Out is assumed to - * be >= in. - */ -static void -tvsub(struct timeval *out, struct timeval *in) -{ - if ((out->tv_usec -= in->tv_usec) < 0) { - --out->tv_sec; - out->tv_usec += 1000000; - } - out->tv_sec -= in->tv_sec; -} - -/* * onint -- * SIGINT handler. */ @@ -2605,6 +2618,8 @@ pr_retip(struct ip6_hdr *ip6, u_char *end) nh = ip6->ip6_nxt; cp += hlen; while (end - cp >= 8) { + struct ah ah; + switch (nh) { case IPPROTO_HOPOPTS: printf("HBH "); @@ -2629,8 +2644,9 @@ pr_retip(struct ip6_hdr *ip6, u_char *end) #ifdef IPSEC case IPPROTO_AH: printf("AH "); - hlen = (((struct ah *)cp)->ah_len+2) << 2; - nh = ((struct ah *)cp)->ah_nxt; + memcpy(&ah, cp, sizeof(ah)); + hlen = (ah.ah_len+2) << 2; + nh = ah.ah_nxt; break; #endif case IPPROTO_ICMPV6: @@ -2815,9 +2831,10 @@ static cap_channel_t * capdns_setup(void) { cap_channel_t *capcas, *capdnsloc; +#ifdef WITH_CASPER const char *types[2]; int families[1]; - +#endif capcas = cap_init(); if (capcas == NULL) err(1, "unable to create casper process"); @@ -2826,6 +2843,7 @@ capdns_setup(void) cap_close(capcas); if (capdnsloc == NULL) err(1, "unable to open system.dns service"); +#ifdef WITH_CASPER types[0] = "NAME2ADDR"; types[1] = "ADDR2NAME"; if (cap_dns_type_limit(capdnsloc, types, nitems(types)) < 0) @@ -2833,6 +2851,6 @@ capdns_setup(void) families[0] = AF_INET6; if (cap_dns_family_limit(capdnsloc, families, nitems(families)) < 0) err(1, "unable to limit access to system.dns service"); - +#endif return (capdnsloc); } From owner-svn-src-stable@freebsd.org Wed Sep 11 23:41: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 38F85E377A; Wed, 11 Sep 2019 23:41:11 +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 46TJLt6x3xz4XZg; Wed, 11 Sep 2019 23:41:10 +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 D2C69E1A0; Wed, 11 Sep 2019 23:41:10 +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 x8BNfAkw030272; Wed, 11 Sep 2019 23:41:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8BNfA8s030269; Wed, 11 Sep 2019 23:41:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909112341.x8BNfA8s030269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 11 Sep 2019 23:41: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: r352234 - in stable/12/sys: crypto/aesni opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: crypto/aesni opencrypto X-SVN-Commit-Revision: 352234 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, 11 Sep 2019 23:41:11 -0000 Author: mav Date: Wed Sep 11 23:41:09 2019 New Revision: 352234 URL: https://svnweb.freebsd.org/changeset/base/352234 Log: MFC r342024 (by mmacy): Generalize AES iov optimization Right now, aesni_cipher_alloc does a bit of special-casing for CRYPTO_F_IOV, to not do any allocation if the first uio is large enough for the requested size. While working on ZFS crypto port, I ran into horrible performance because the code uses scatter-gather, and many of the times the data to encrypt was in the second entry. This code looks through the list, and tries to see if there is a single uio that can contain the requested data, and, if so, uses that. This has a slight impact on the current consumers, in that the check is a little more complicated for the ones that use CRYPTO_F_IOV -- but none of them meet the criteria for testing more than one. Modified: stable/12/sys/crypto/aesni/aesni.c stable/12/sys/opencrypto/criov.c stable/12/sys/opencrypto/cryptodev.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/crypto/aesni/aesni.c ============================================================================== --- stable/12/sys/crypto/aesni/aesni.c Wed Sep 11 21:24:14 2019 (r352233) +++ stable/12/sys/crypto/aesni/aesni.c Wed Sep 11 23:41:09 2019 (r352234) @@ -403,29 +403,14 @@ static uint8_t * aesni_cipher_alloc(struct cryptodesc *enccrd, struct cryptop *crp, bool *allocated) { - struct mbuf *m; - struct uio *uio; - struct iovec *iov; uint8_t *addr; - if (crp->crp_flags & CRYPTO_F_IMBUF) { - m = (struct mbuf *)crp->crp_buf; - if (m->m_next != NULL) - goto alloc; - addr = mtod(m, uint8_t *); - } else if (crp->crp_flags & CRYPTO_F_IOV) { - uio = (struct uio *)crp->crp_buf; - if (uio->uio_iovcnt != 1) - goto alloc; - iov = uio->uio_iov; - addr = (uint8_t *)iov->iov_base; - } else - addr = (uint8_t *)crp->crp_buf; - *allocated = false; - addr += enccrd->crd_skip; - return (addr); - -alloc: + addr = crypto_contiguous_subsegment(crp->crp_flags, + crp->crp_buf, enccrd->crd_skip, enccrd->crd_len); + if (addr != NULL) { + *allocated = false; + return (addr); + } addr = malloc(enccrd->crd_len, M_AESNI, M_NOWAIT); if (addr != NULL) { *allocated = true; Modified: stable/12/sys/opencrypto/criov.c ============================================================================== --- stable/12/sys/opencrypto/criov.c Wed Sep 11 21:24:14 2019 (r352233) +++ stable/12/sys/opencrypto/criov.c Wed Sep 11 23:41:09 2019 (r352234) @@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include @@ -239,3 +241,55 @@ crypto_mbuftoiov(struct mbuf *mbuf, struct iovec **iov *cnt = i; return 0; } + +static inline void * +m_contiguous_subsegment(struct mbuf *m, size_t skip, size_t len) +{ + int rel_off; + + MPASS(skip <= INT_MAX); + + m = m_getptr(m, (int)skip, &rel_off); + if (m == NULL) + return (NULL); + + MPASS(rel_off >= 0); + skip = rel_off; + if (skip + len > m->m_len) + return (NULL); + + return (mtod(m, char*) + skip); +} + +static inline void * +cuio_contiguous_segment(struct uio *uio, size_t skip, size_t len) +{ + int rel_off, idx; + + MPASS(skip <= INT_MAX); + idx = cuio_getptr(uio, (int)skip, &rel_off); + if (idx < 0) + return (NULL); + + MPASS(rel_off >= 0); + skip = rel_off; + if (skip + len > uio->uio_iov[idx].iov_len) + return (NULL); + return ((char *)uio->uio_iov[idx].iov_base + skip); +} + +void * +crypto_contiguous_subsegment(int crp_flags, void *crpbuf, + size_t skip, size_t len) +{ + if ((crp_flags & CRYPTO_F_IMBUF) != 0) + return (m_contiguous_subsegment(crpbuf, skip, len)); + else if ((crp_flags & CRYPTO_F_IOV) != 0) + return (cuio_contiguous_segment(crpbuf, skip, len)); + else { + MPASS((crp_flags & (CRYPTO_F_IMBUF | CRYPTO_F_IOV)) != + (CRYPTO_F_IMBUF | CRYPTO_F_IOV)); + return ((char*)crpbuf + skip); + } +} + Modified: stable/12/sys/opencrypto/cryptodev.h ============================================================================== --- stable/12/sys/opencrypto/cryptodev.h Wed Sep 11 21:24:14 2019 (r352233) +++ stable/12/sys/opencrypto/cryptodev.h Wed Sep 11 23:41:09 2019 (r352234) @@ -571,5 +571,7 @@ extern void crypto_copydata(int flags, caddr_t buf, in extern int crypto_apply(int flags, caddr_t buf, int off, int len, int (*f)(void *, void *, u_int), void *arg); +extern void *crypto_contiguous_subsegment(int, void *, size_t, size_t); + #endif /* _KERNEL */ #endif /* _CRYPTO_CRYPTO_H_ */ From owner-svn-src-stable@freebsd.org Wed Sep 11 23:46: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 1ADBBE3978; Wed, 11 Sep 2019 23:46:00 +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 46TJSR6ym4z4Xv8; Wed, 11 Sep 2019 23:45:59 +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 D1957E337; Wed, 11 Sep 2019 23:45:59 +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 x8BNjxVj034176; Wed, 11 Sep 2019 23:45:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8BNjwFD034170; Wed, 11 Sep 2019 23:45:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909112345.x8BNjwFD034170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 11 Sep 2019 23:45: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: r352235 - in stable/12/sys: conf crypto/aesni modules/aesni X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: conf crypto/aesni modules/aesni X-SVN-Commit-Revision: 352235 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, 11 Sep 2019 23:46:00 -0000 Author: mav Date: Wed Sep 11 23:45:58 2019 New Revision: 352235 URL: https://svnweb.freebsd.org/changeset/base/352235 Log: MFC r348268 (by sef), r348293 (by cem): Add an AESNI-optimized version of the CCM/CBC cryptographic and authentication code. The primary client of this is probably going to be ZFS encryption. Added: stable/12/sys/crypto/aesni/aesni_ccm.c - copied, changed from r348268, head/sys/crypto/aesni/aesni_ccm.c Modified: stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.i386 stable/12/sys/crypto/aesni/aesni.c stable/12/sys/crypto/aesni/aesni.h stable/12/sys/crypto/aesni/aesni_wrap.c stable/12/sys/modules/aesni/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/conf/files.amd64 Wed Sep 11 23:45:58 2019 (r352235) @@ -175,6 +175,11 @@ aesni_ghash.o optional aesni \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ no-implicit-rule \ clean "aesni_ghash.o" +aesni_ccm.o optional aesni \ + dependency "$S/crypto/aesni/aesni_ccm.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesni_ccm.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ Modified: stable/12/sys/conf/files.i386 ============================================================================== --- stable/12/sys/conf/files.i386 Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/conf/files.i386 Wed Sep 11 23:45:58 2019 (r352235) @@ -127,6 +127,11 @@ aesni_ghash.o optional aesni \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ no-implicit-rule \ clean "aesni_ghash.o" +aesni_ccm.o optional aesni \ + dependency "$S/crypto/aesni/aesni_ccm.c" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesni_ccm.o" aesni_wrap.o optional aesni \ dependency "$S/crypto/aesni/aesni_wrap.c" \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${NO_WCAST_QUAL} ${PROF} -mmmx -msse -msse4 -maes ${.IMPSRC}" \ Modified: stable/12/sys/crypto/aesni/aesni.c ============================================================================== --- stable/12/sys/crypto/aesni/aesni.c Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/crypto/aesni/aesni.c Wed Sep 11 23:45:58 2019 (r352235) @@ -131,9 +131,10 @@ aesni_probe(device_t dev) return (EINVAL); } else if (has_aes && has_sha) device_set_desc(dev, - "AES-CBC,AES-XTS,AES-GCM,AES-ICM,SHA1,SHA256"); + "AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,SHA1,SHA256"); else if (has_aes) - device_set_desc(dev, "AES-CBC,AES-XTS,AES-GCM,AES-ICM"); + device_set_desc(dev, + "AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS"); else device_set_desc(dev, "SHA1,SHA256"); @@ -193,6 +194,8 @@ aesni_attach(device_t dev) crypto_register(sc->cid, CRYPTO_AES_192_NIST_GMAC, 0, 0); crypto_register(sc->cid, CRYPTO_AES_256_NIST_GMAC, 0, 0); crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_CCM_16, 0, 0); + crypto_register(sc->cid, CRYPTO_AES_CCM_CBC_MAC, 0, 0); } if (sc->has_sha) { crypto_register(sc->cid, CRYPTO_SHA1, 0, 0); @@ -226,6 +229,7 @@ aesni_newsession(device_t dev, crypto_session_t cses, struct aesni_session *ses; struct cryptoini *encini, *authini; bool gcm_hash, gcm; + bool cbc_hash, ccm; int error; KASSERT(cses != NULL, ("EDOOFUS")); @@ -242,10 +246,17 @@ aesni_newsession(device_t dev, crypto_session_t cses, encini = NULL; gcm = false; gcm_hash = false; + ccm = cbc_hash = false; + for (; cri != NULL; cri = cri->cri_next) { switch (cri->cri_alg) { case CRYPTO_AES_NIST_GCM_16: - gcm = true; + case CRYPTO_AES_CCM_16: + if (cri->cri_alg == CRYPTO_AES_NIST_GCM_16) { + gcm = true; + } else if (cri->cri_alg == CRYPTO_AES_CCM_16) { + ccm = true; + } /* FALLTHROUGH */ case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: @@ -258,6 +269,10 @@ aesni_newsession(device_t dev, crypto_session_t cses, } encini = cri; break; + case CRYPTO_AES_CCM_CBC_MAC: + cbc_hash = true; + authini = cri; + break; case CRYPTO_AES_128_NIST_GMAC: case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC: @@ -265,7 +280,12 @@ aesni_newsession(device_t dev, crypto_session_t cses, * nothing to do here, maybe in the future cache some * values for GHASH */ + if (authini != NULL) { + CRYPTDEB("authini already set"); + return (EINVAL); + } gcm_hash = true; + authini = cri; break; case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: @@ -295,9 +315,16 @@ unhandled: * GMAC algorithms are only supported with simultaneous GCM. Likewise * GCM is not supported without GMAC. */ - if (gcm_hash != gcm) + if (gcm_hash != gcm) { + CRYPTDEB("gcm_hash != gcm"); return (EINVAL); + } + if (cbc_hash != ccm) { + CRYPTDEB("cbc_hash != ccm"); + return (EINVAL); + } + if (encini != NULL) ses->algo = encini->cri_alg; if (authini != NULL) @@ -338,6 +365,7 @@ aesni_process(device_t dev, struct cryptop *crp, int h for (crd = crp->crp_desc; crd != NULL; crd = crd->crd_next) { switch (crd->crd_alg) { case CRYPTO_AES_NIST_GCM_16: + case CRYPTO_AES_CCM_16: needauth = 1; /* FALLTHROUGH */ case CRYPTO_AES_CBC: @@ -353,6 +381,7 @@ aesni_process(device_t dev, struct cryptop *crp, int h case CRYPTO_AES_128_NIST_GMAC: case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC: + case CRYPTO_AES_CCM_CBC_MAC: case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: case CRYPTO_SHA2_224: @@ -647,6 +676,7 @@ aesni_cipher_process(struct aesni_session *ses, struct if (enccrd != NULL) { if ((enccrd->crd_alg == CRYPTO_AES_ICM || + enccrd->crd_alg == CRYPTO_AES_CCM_16 || enccrd->crd_alg == CRYPTO_AES_NIST_GCM_16) && (enccrd->crd_flags & CRD_F_IV_EXPLICIT) == 0) return (EINVAL); @@ -700,8 +730,9 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c int error, ivlen; bool encflag, allocated, authallocated; - KASSERT(ses->algo != CRYPTO_AES_NIST_GCM_16 || authcrd != NULL, - ("AES_NIST_GCM_16 must include MAC descriptor")); + KASSERT((ses->algo != CRYPTO_AES_NIST_GCM_16 && + ses->algo != CRYPTO_AES_CCM_16) || authcrd != NULL, + ("AES_NIST_GCM_16/AES_CCM_16 must include MAC descriptor")); ivlen = 0; authbuf = NULL; @@ -711,7 +742,8 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c return (ENOMEM); authallocated = false; - if (ses->algo == CRYPTO_AES_NIST_GCM_16) { + if (ses->algo == CRYPTO_AES_NIST_GCM_16 || + ses->algo == CRYPTO_AES_CCM_16) { authbuf = aesni_cipher_alloc(authcrd, crp, &authallocated); if (authbuf == NULL) { error = ENOMEM; @@ -737,6 +769,7 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c ivlen = 8; break; case CRYPTO_AES_NIST_GCM_16: + case CRYPTO_AES_CCM_16: ivlen = 12; /* should support arbitarily larger */ break; } @@ -786,7 +819,7 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c case CRYPTO_AES_NIST_GCM_16: if (!encflag) crypto_copydata(crp->crp_flags, crp->crp_buf, - authcrd->crd_inject, GMAC_DIGEST_LEN, tag); + authcrd->crd_inject, sizeof(tag), tag); else bzero(tag, sizeof tag); @@ -797,7 +830,7 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c if (authcrd != NULL) crypto_copyback(crp->crp_flags, crp->crp_buf, - authcrd->crd_inject, GMAC_DIGEST_LEN, tag); + authcrd->crd_inject, sizeof(tag), tag); } else { if (!AES_GCM_decrypt(buf, buf, authbuf, iv, tag, enccrd->crd_len, authcrd->crd_len, ivlen, @@ -805,9 +838,28 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c error = EBADMSG; } break; + case CRYPTO_AES_CCM_16: + if (!encflag) + crypto_copydata(crp->crp_flags, crp->crp_buf, + authcrd->crd_inject, sizeof(tag), tag); + else + bzero(tag, sizeof tag); + if (encflag) { + AES_CCM_encrypt(buf, buf, authbuf, iv, tag, + enccrd->crd_len, authcrd->crd_len, ivlen, + ses->enc_schedule, ses->rounds); + if (authcrd != NULL) + crypto_copyback(crp->crp_flags, crp->crp_buf, + authcrd->crd_inject, sizeof(tag), tag); + } else { + if (!AES_CCM_decrypt(buf, buf, authbuf, iv, tag, + enccrd->crd_len, authcrd->crd_len, ivlen, + ses->enc_schedule, ses->rounds)) + error = EBADMSG; + } + break; } - - if (allocated) + if (allocated && error == 0) crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, enccrd->crd_len, buf); Modified: stable/12/sys/crypto/aesni/aesni.h ============================================================================== --- stable/12/sys/crypto/aesni/aesni.h Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/crypto/aesni/aesni.h Wed Sep 11 23:45:58 2019 (r352235) @@ -111,6 +111,15 @@ int AES_GCM_decrypt(const unsigned char *in, unsigned const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, const unsigned char *key, int nr); +/* CCM + CBC-MAC functions */ +void AES_CCM_encrypt(const unsigned char *in, unsigned char *out, + const unsigned char *addt, const unsigned char *ivec, + unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, + const unsigned char *key, int nr); +int AES_CCM_decrypt(const unsigned char *in, unsigned char *out, + const unsigned char *addt, const unsigned char *ivec, + const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, + const unsigned char *key, int nr); int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, int keylen); Copied and modified: stable/12/sys/crypto/aesni/aesni_ccm.c (from r348268, head/sys/crypto/aesni/aesni_ccm.c) ============================================================================== --- head/sys/crypto/aesni/aesni_ccm.c Sat May 25 07:26:30 2019 (r348268, copy source) +++ stable/12/sys/crypto/aesni/aesni_ccm.c Wed Sep 11 23:45:58 2019 (r352235) @@ -58,7 +58,7 @@ static inline __m128i xor_and_encrypt(__m128i a, __m128i b, const unsigned char *k, int nr) { - __m128 retval = _mm_xor_si128(a, b); + __m128i retval = _mm_xor_si128(a, b); retval = AESNI_ENC(retval, k, nr); return (retval); Modified: stable/12/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- stable/12/sys/crypto/aesni/aesni_wrap.c Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/crypto/aesni/aesni_wrap.c Wed Sep 11 23:45:58 2019 (r352235) @@ -446,6 +446,7 @@ aesni_cipher_setup_common(struct aesni_session *ses, c switch (ses->algo) { case CRYPTO_AES_ICM: case CRYPTO_AES_NIST_GCM_16: + case CRYPTO_AES_CCM_16: decsched = 0; /* FALLTHROUGH */ case CRYPTO_AES_CBC: Modified: stable/12/sys/modules/aesni/Makefile ============================================================================== --- stable/12/sys/modules/aesni/Makefile Wed Sep 11 23:41:09 2019 (r352234) +++ stable/12/sys/modules/aesni/Makefile Wed Sep 11 23:45:58 2019 (r352235) @@ -8,16 +8,20 @@ SRCS= aesni.c SRCS+= aeskeys_${MACHINE_CPUARCH}.S SRCS+= device_if.h bus_if.h opt_bus.h cryptodev_if.h -OBJS+= aesni_ghash.o aesni_wrap.o +OBJS+= aesni_ghash.o aesni_wrap.o aesni_ccm.o OBJS+= intel_sha1.o intel_sha256.o # Remove -nostdinc so we can get the intrinsics. aesni_ghash.o: aesni_ghash.c - # XXX - gcc won't understand -mpclmul ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} \ -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC} ${CTFCONVERT_CMD} +aesni_ccm.o: aesni_ccm.c + ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} \ + -mmmx -msse -msse4 -maes -mpclmul ${.IMPSRC} + ${CTFCONVERT_CMD} + aesni_wrap.o: aesni_wrap.c ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} \ -mmmx -msse -msse4 -maes ${.IMPSRC} @@ -35,6 +39,7 @@ intel_sha256.o: intel_sha256.c aesni_ghash.o: aesni.h aesni_wrap.o: aesni.h +aesni_ccm.o: aesni.h intel_sha1.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h intel_sha256.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h From owner-svn-src-stable@freebsd.org Thu Sep 12 06:20: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 3AAABEC705; Thu, 12 Sep 2019 06:20:21 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TTCT0mKPz3NYd; Thu, 12 Sep 2019 06:20:21 +0000 (UTC) (envelope-from tsoome@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 F1BF21A906; Thu, 12 Sep 2019 06:20:20 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8C6KK8h067223; Thu, 12 Sep 2019 06:20:20 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8C6KKfZ067221; Thu, 12 Sep 2019 06:20:20 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909120620.x8C6KKfZ067221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 12 Sep 2019 06:20:20 +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: r352240 - in stable/11/stand/ficl: . softwords X-SVN-Group: stable-11 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/11/stand/ficl: . softwords X-SVN-Commit-Revision: 352240 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, 12 Sep 2019 06:20:21 -0000 Author: tsoome Date: Thu Sep 12 06:20:20 2019 New Revision: 352240 URL: https://svnweb.freebsd.org/changeset/base/352240 Log: MFC r351865, r351837: ficl: add xemit word ficl: add uIsGreater word (needed for xemit) We need xemit to support userboot.so loading images from CURRENT. Modified: stable/11/stand/ficl/softwords/softcore.fr stable/11/stand/ficl/words.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/ficl/softwords/softcore.fr ============================================================================== --- stable/11/stand/ficl/softwords/softcore.fr Thu Sep 12 00:33:01 2019 (r352239) +++ stable/11/stand/ficl/softwords/softcore.fr Thu Sep 12 06:20:20 2019 (r352240) @@ -199,6 +199,14 @@ set-current \ stop hiding words a-addr 0 b-addr b-u strcat ; +: xemit ( xchar -- ) + dup 0x80 u< if emit exit then \ special case ASCII + 0 swap 0x3F + begin 2dup u> while + 2/ >r dup 0x3F and 0x80 or swap 6 rshift r> + repeat 0x7F xor 2* or + begin dup 0x80 u< 0= while emit repeat drop + ; previous \ lose hidden words from search order Modified: stable/11/stand/ficl/words.c ============================================================================== --- stable/11/stand/ficl/words.c Thu Sep 12 00:33:01 2019 (r352239) +++ stable/11/stand/ficl/words.c Thu Sep 12 06:20:20 2019 (r352240) @@ -1930,6 +1930,18 @@ static void isGreater(FICL_VM *pVM) return; } +static void uIsGreater(FICL_VM *pVM) +{ + FICL_UNS u1, u2; +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 2, 1); +#endif + u2 = stackPopUNS(pVM->pStack); + u1 = stackPopUNS(pVM->pStack); + PUSHINT(FICL_BOOL(u1 > u2)); + return; +} + static void bitwiseAnd(FICL_VM *pVM) { CELL x, y; @@ -4975,6 +4987,7 @@ void ficlCompileCore(FICL_SYSTEM *pSys) dictAppendWord(dp, "type", type, FW_DEFAULT); dictAppendWord(dp, "u.", uDot, FW_DEFAULT); dictAppendWord(dp, "u<", uIsLess, FW_DEFAULT); + dictAppendWord(dp, "u>", uIsGreater, FW_DEFAULT); dictAppendWord(dp, "um*", umStar, FW_DEFAULT); dictAppendWord(dp, "um/mod", umSlashMod, FW_DEFAULT); dictAppendWord(dp, "unloop", unloopCo, FW_COMPILE); From owner-svn-src-stable@freebsd.org Thu Sep 12 06:26: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 1E1C6EC933; Thu, 12 Sep 2019 06:26:23 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TTLQ6mWGz3Nvn; Thu, 12 Sep 2019 06:26:22 +0000 (UTC) (envelope-from tsoome@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 C702D1AAB9; Thu, 12 Sep 2019 06:26:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8C6QMAN072740; Thu, 12 Sep 2019 06:26:22 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8C6QMx7072738; Thu, 12 Sep 2019 06:26:22 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201909120626.x8C6QMx7072738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 12 Sep 2019 06:26: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: r352241 - in stable/12/stand/ficl: . softwords X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12/stand/ficl: . softwords X-SVN-Commit-Revision: 352241 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, 12 Sep 2019 06:26:23 -0000 Author: tsoome Date: Thu Sep 12 06:26:22 2019 New Revision: 352241 URL: https://svnweb.freebsd.org/changeset/base/352241 Log: MFC r351865, r351837: ficl: add xemit word ficl: add uIsGreater word (needed for xemit) We need xemit to support userboot.so loading images from CURRENT. Modified: stable/12/stand/ficl/softwords/softcore.fr stable/12/stand/ficl/words.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/ficl/softwords/softcore.fr ============================================================================== --- stable/12/stand/ficl/softwords/softcore.fr Thu Sep 12 06:20:20 2019 (r352240) +++ stable/12/stand/ficl/softwords/softcore.fr Thu Sep 12 06:26:22 2019 (r352241) @@ -199,6 +199,14 @@ set-current \ stop hiding words a-addr 0 b-addr b-u strcat ; +: xemit ( xchar -- ) + dup 0x80 u< if emit exit then \ special case ASCII + 0 swap 0x3F + begin 2dup u> while + 2/ >r dup 0x3F and 0x80 or swap 6 rshift r> + repeat 0x7F xor 2* or + begin dup 0x80 u< 0= while emit repeat drop + ; previous \ lose hidden words from search order Modified: stable/12/stand/ficl/words.c ============================================================================== --- stable/12/stand/ficl/words.c Thu Sep 12 06:20:20 2019 (r352240) +++ stable/12/stand/ficl/words.c Thu Sep 12 06:26:22 2019 (r352241) @@ -1930,6 +1930,18 @@ static void isGreater(FICL_VM *pVM) return; } +static void uIsGreater(FICL_VM *pVM) +{ + FICL_UNS u1, u2; +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 2, 1); +#endif + u2 = stackPopUNS(pVM->pStack); + u1 = stackPopUNS(pVM->pStack); + PUSHINT(FICL_BOOL(u1 > u2)); + return; +} + static void bitwiseAnd(FICL_VM *pVM) { CELL x, y; @@ -4975,6 +4987,7 @@ void ficlCompileCore(FICL_SYSTEM *pSys) dictAppendWord(dp, "type", type, FW_DEFAULT); dictAppendWord(dp, "u.", uDot, FW_DEFAULT); dictAppendWord(dp, "u<", uIsLess, FW_DEFAULT); + dictAppendWord(dp, "u>", uIsGreater, FW_DEFAULT); dictAppendWord(dp, "um*", umStar, FW_DEFAULT); dictAppendWord(dp, "um/mod", umSlashMod, FW_DEFAULT); dictAppendWord(dp, "unloop", unloopCo, FW_COMPILE); From owner-svn-src-stable@freebsd.org Thu Sep 12 16:23: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 D6F02D3517; Thu, 12 Sep 2019 16:23:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TkbG5NY3z4SP0; Thu, 12 Sep 2019 16:23:22 +0000 (UTC) (envelope-from asomers@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 9C0DA216AB; Thu, 12 Sep 2019 16:23:22 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8CGNMsG029095; Thu, 12 Sep 2019 16:23:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8CGNMoA029094; Thu, 12 Sep 2019 16:23:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909121623.x8CGNMoA029094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 12 Sep 2019 16:23: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: r352252 - stable/12/sbin/ping6 X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sbin/ping6 X-SVN-Commit-Revision: 352252 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, 12 Sep 2019 16:23:22 -0000 Author: asomers Date: Thu Sep 12 16:23:22 2019 New Revision: 352252 URL: https://svnweb.freebsd.org/changeset/base/352252 Log: MFC r351172: ping6: Raise WARNS level to 6 Submitted by: Ján Sučan Sponsored by: Google, inc. (Google Summer of Code 2019) Differential Revision: https://reviews.freebsd.org/D21260 Modified: stable/12/sbin/ping6/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ping6/Makefile ============================================================================== --- stable/12/sbin/ping6/Makefile Thu Sep 12 16:20:03 2019 (r352251) +++ stable/12/sbin/ping6/Makefile Thu Sep 12 16:23:22 2019 (r352252) @@ -7,7 +7,6 @@ PROG= ping6 MAN= ping6.8 CFLAGS+=-DIPSEC -DKAME_SCOPEID -WARNS?= 3 BINOWN= root BINMODE=4555 From owner-svn-src-stable@freebsd.org Thu Sep 12 16:28: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 F2111D3708; Thu, 12 Sep 2019 16:28:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TkjB648Jz4SjH; Thu, 12 Sep 2019 16:28:30 +0000 (UTC) (envelope-from asomers@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 99A7C216C0; Thu, 12 Sep 2019 16:28:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8CGSUt2029469; Thu, 12 Sep 2019 16:28:30 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8CGSU06029468; Thu, 12 Sep 2019 16:28:30 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909121628.x8CGSU06029468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 12 Sep 2019 16:28: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: r352254 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 352254 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, 12 Sep 2019 16:28:31 -0000 Author: asomers Date: Thu Sep 12 16:28:30 2019 New Revision: 352254 URL: https://svnweb.freebsd.org/changeset/base/352254 Log: Record mergeinfo for r352232 Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Thu Sep 12 20:15:05 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 A71E3D9390; Thu, 12 Sep 2019 20:15:05 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Tqkd3ty2z3DhH; Thu, 12 Sep 2019 20:15:05 +0000 (UTC) (envelope-from johalun@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 63F89240B2; Thu, 12 Sep 2019 20:15:05 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8CKF571066059; Thu, 12 Sep 2019 20:15:05 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8CKF5Tx066058; Thu, 12 Sep 2019 20:15:05 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909122015.x8CKF5Tx066058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Thu, 12 Sep 2019 20:15: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: r352264 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352264 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, 12 Sep 2019 20:15:05 -0000 Author: johalun Date: Thu Sep 12 20:15:04 2019 New Revision: 352264 URL: https://svnweb.freebsd.org/changeset/base/352264 Log: MFC r345100: Implement task_euid() and get_task_state() function macros in the LinuxKPI. Submitted by: Johannes Lundberg Sponsored by: Limelight Networks Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Thu Sep 12 18:53:29 2019 (r352263) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Thu Sep 12 20:15:04 2019 (r352264) @@ -96,7 +96,9 @@ struct task_struct { #define get_pid(x) (x) #define put_pid(x) do { } while (0) #define current_euid() (curthread->td_ucred->cr_uid) +#define task_euid(task) ((task)->task_thread->td_ucred->cr_uid) +#define get_task_state(task) atomic_read(&(task)->state) #define set_task_state(task, x) atomic_set(&(task)->state, (x)) #define __set_task_state(task, x) ((task)->state.counter = (x)) #define set_current_state(x) set_task_state(current, x) From owner-svn-src-stable@freebsd.org Thu Sep 12 21:12: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 E18A7DA630; Thu, 12 Sep 2019 21:12:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Ts135N3Cz3HB8; Thu, 12 Sep 2019 21:12:39 +0000 (UTC) (envelope-from johalun@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 9BB6C24B6A; Thu, 12 Sep 2019 21:12:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8CLCdfK001134; Thu, 12 Sep 2019 21:12:39 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8CLCd4K001133; Thu, 12 Sep 2019 21:12:39 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201909122112.x8CLCd4K001133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Thu, 12 Sep 2019 21:12: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: r352266 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352266 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, 12 Sep 2019 21:12:39 -0000 Author: johalun Date: Thu Sep 12 21:12:39 2019 New Revision: 352266 URL: https://svnweb.freebsd.org/changeset/base/352266 Log: MFC r345103: Implement more PCI speed related functions and macros in the LinuxKPI. Submitted by: Johannes Lundberg Sponsored by: Limelight Networks Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu Sep 12 20:46:46 2019 (r352265) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Thu Sep 12 21:12:39 2019 (r352266) @@ -139,10 +139,13 @@ struct pci_device_id { #define PCI_EXP_TYPE_RC_EC PCIEM_TYPE_ROOT_EC /* Root Complex Event Collector */ #define PCI_EXP_LNKCAP_SLS_2_5GB 0x01 /* Supported Link Speed 2.5GT/s */ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x02 /* Supported Link Speed 5.0GT/s */ +#define PCI_EXP_LNKCAP_SLS_8_0GB 0x04 /* Supported Link Speed 8.0GT/s */ +#define PCI_EXP_LNKCAP_SLS_16_0GB 0x08 /* Supported Link Speed 16.0GT/s */ #define PCI_EXP_LNKCAP_MLW 0x03f0 /* Maximum Link Width */ #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x02 /* Supported Link Speed 2.5GT/s */ #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ +#define PCI_EXP_LNKCAP2_SLS_16_0GB 0x10 /* Supported Link Speed 16.0GT/s */ #define PCI_EXP_LNKCTL_HAWD PCIEM_LINK_CTL_HAWD #define PCI_EXP_LNKCAP_CLKPM 0x00040000 @@ -157,10 +160,19 @@ enum pci_bus_speed { PCIE_SPEED_2_5GT, PCIE_SPEED_5_0GT, PCIE_SPEED_8_0GT, + PCIE_SPEED_16_0GT, }; enum pcie_link_width { - PCIE_LNK_WIDTH_UNKNOWN = 0xFF, + PCIE_LNK_WIDTH_RESRV = 0x00, + PCIE_LNK_X1 = 0x01, + PCIE_LNK_X2 = 0x02, + PCIE_LNK_X4 = 0x04, + PCIE_LNK_X8 = 0x08, + PCIE_LNK_X12 = 0x0c, + PCIE_LNK_X16 = 0x10, + PCIE_LNK_X32 = 0x20, + PCIE_LNK_WIDTH_UNKNOWN = 0xff, }; typedef int pci_power_t; @@ -889,6 +901,67 @@ static inline int pci_num_vf(struct pci_dev *dev) { return (0); +} + +static inline enum pci_bus_speed +pcie_get_speed_cap(struct pci_dev *dev) +{ + device_t root; + uint32_t lnkcap, lnkcap2; + int error, pos; + + root = device_get_parent(dev->dev.bsddev); + if (root == NULL) + return (PCI_SPEED_UNKNOWN); + root = device_get_parent(root); + if (root == NULL) + return (PCI_SPEED_UNKNOWN); + root = device_get_parent(root); + if (root == NULL) + return (PCI_SPEED_UNKNOWN); + + if (pci_get_vendor(root) == PCI_VENDOR_ID_VIA || + pci_get_vendor(root) == PCI_VENDOR_ID_SERVERWORKS) + return (PCI_SPEED_UNKNOWN); + + if ((error = pci_find_cap(root, PCIY_EXPRESS, &pos)) != 0) + return (PCI_SPEED_UNKNOWN); + + lnkcap2 = pci_read_config(root, pos + PCIER_LINK_CAP2, 4); + + if (lnkcap2) { /* PCIe r3.0-compliant */ + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_2_5GB) + return (PCIE_SPEED_2_5GT); + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_5_0GB) + return (PCIE_SPEED_5_0GT); + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB) + return (PCIE_SPEED_8_0GT); + if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_16_0GB) + return (PCIE_SPEED_16_0GT); + } else { /* pre-r3.0 */ + lnkcap = pci_read_config(root, pos + PCIER_LINK_CAP, 4); + if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB) + return (PCIE_SPEED_2_5GT); + if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB) + return (PCIE_SPEED_5_0GT); + if (lnkcap & PCI_EXP_LNKCAP_SLS_8_0GB) + return (PCIE_SPEED_8_0GT); + if (lnkcap & PCI_EXP_LNKCAP_SLS_16_0GB) + return (PCIE_SPEED_16_0GT); + } + return (PCI_SPEED_UNKNOWN); +} + +static inline enum pcie_link_width +pcie_get_width_cap(struct pci_dev *dev) +{ + uint32_t lnkcap; + + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap); + if (lnkcap) + return ((lnkcap & PCI_EXP_LNKCAP_MLW) >> 4); + + return (PCIE_LNK_WIDTH_UNKNOWN); } #endif /* _LINUX_PCI_H_ */ From owner-svn-src-stable@freebsd.org Fri Sep 13 00:53: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 F1DF6E0575; Fri, 13 Sep 2019 00:53:09 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TxvT5wCyz3yLW; Fri, 13 Sep 2019 00:53:09 +0000 (UTC) (envelope-from np@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 AF76A2730B; Fri, 13 Sep 2019 00:53:09 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D0r9tP030262; Fri, 13 Sep 2019 00:53:09 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D0r9Yk030261; Fri, 13 Sep 2019 00:53:09 GMT (envelope-from np@FreeBSD.org) Message-Id: <201909130053.x8D0r9Yk030261@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 13 Sep 2019 00:53: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: r352267 - stable/12/sys/dev/cxgbe/tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 352267 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, 13 Sep 2019 00:53:10 -0000 Author: np Date: Fri Sep 13 00:53:09 2019 New Revision: 352267 URL: https://svnweb.freebsd.org/changeset/base/352267 Log: MFC r351446: cxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field implies that window scaling is not in use. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_listen.c Thu Sep 12 21:12:39 2019 (r352266) +++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Fri Sep 13 00:53:09 2019 (r352267) @@ -994,7 +994,7 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_mss = be16toh(t4opt->mss); } - if (t4opt->wsf) { + if (t4opt->wsf > 0 && t4opt->wsf < 15) { to->to_flags |= TOF_SCALE; to->to_wscale = t4opt->wsf; } From owner-svn-src-stable@freebsd.org Fri Sep 13 00:58: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 99119E06EE; Fri, 13 Sep 2019 00:58:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Ty1k3W4Gz3yTx; Fri, 13 Sep 2019 00:58:34 +0000 (UTC) (envelope-from np@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 56CB82730C; Fri, 13 Sep 2019 00:58:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D0wYYW030554; Fri, 13 Sep 2019 00:58:34 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D0wYuJ030553; Fri, 13 Sep 2019 00:58:34 GMT (envelope-from np@FreeBSD.org) Message-Id: <201909130058.x8D0wYuJ030553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 13 Sep 2019 00:58: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: r352268 - stable/12/sys/dev/cxgbe/tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 352268 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, 13 Sep 2019 00:58:34 -0000 Author: np Date: Fri Sep 13 00:58:33 2019 New Revision: 352268 URL: https://svnweb.freebsd.org/changeset/base/352268 Log: MFC r351524: cxgbe/t4_tom: Limit work requests with immediate payload to a single descriptor. The per-tid tx credits are in demand during active Tx and it's best not to use too many just for payload. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Sep 13 00:53:09 2019 (r352267) +++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Sep 13 00:58:33 2019 (r352268) @@ -562,7 +562,7 @@ t4_close_conn(struct adapter *sc, struct toepcb *toep) static inline int max_imm_payload(int tx_credits) { - const int n = 2; /* Use only up to 2 desc for imm. data WR */ + const int n = 1; /* Use no more than one desc for imm. data WR */ KASSERT(tx_credits >= 0 && tx_credits <= MAX_OFLD_TX_CREDITS, From owner-svn-src-stable@freebsd.org Fri Sep 13 01:12:19 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 6FE50E0E3C; Fri, 13 Sep 2019 01:12:19 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TyKb35Pjz40Pp; Fri, 13 Sep 2019 01:12:19 +0000 (UTC) (envelope-from np@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 4D20227667; Fri, 13 Sep 2019 01:12:19 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D1CJfI041123; Fri, 13 Sep 2019 01:12:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D1CHEZ041114; Fri, 13 Sep 2019 01:12:17 GMT (envelope-from np@FreeBSD.org) Message-Id: <201909130112.x8D1CHEZ041114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 13 Sep 2019 01:12:17 +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: r352271 - in stable/12/sys/dev/cxgbe: . cxgbei iw_cxgbe tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: in stable/12/sys/dev/cxgbe: . cxgbei iw_cxgbe tom X-SVN-Commit-Revision: 352271 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, 13 Sep 2019 01:12:19 -0000 Author: np Date: Fri Sep 13 01:12:17 2019 New Revision: 352271 URL: https://svnweb.freebsd.org/changeset/base/352271 Log: MFC r351540, r351590 r351540: cxgbe/t4_tom: Initialize all TOE connection parameters in one place. Remove now-redundant items from toepcb and synq_entry and the code to support them. Let the driver calculate tx_align, rx_coalesce, and sndbuf by default. Reviewed by: jhb@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D21387 r351590: cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx. This should have been part of r351540. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c stable/12/sys/dev/cxgbe/iw_cxgbe/qp.c stable/12/sys/dev/cxgbe/t4_main.c stable/12/sys/dev/cxgbe/tom/t4_connect.c stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c stable/12/sys/dev/cxgbe/tom/t4_ddp.c stable/12/sys/dev/cxgbe/tom/t4_listen.c stable/12/sys/dev/cxgbe/tom/t4_tls.c stable/12/sys/dev/cxgbe/tom/t4_tom.c stable/12/sys/dev/cxgbe/tom/t4_tom.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Fri Sep 13 01:12:17 2019 (r352271) @@ -696,7 +696,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) ISCSI_DATA_DIGEST_SIZE; } so->so_options |= SO_NO_DDP; - toep->ulp_mode = ULP_MODE_ISCSI; + toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; send_iscsi_flowc_wr(icc->sc, toep, ci->max_tx_pdu_len); Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- stable/12/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Sep 13 01:12:17 2019 (r352271) @@ -1415,7 +1415,7 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw ret = c4iw_wait_for_reply(rdev, &ep->com.wr_wait, ep->hwtid, qhp->wq.sq.qid, ep->com.so, __func__); - toep->ulp_mode = ULP_MODE_RDMA; + toep->params.ulp_mode = ULP_MODE_RDMA; free_ird(rhp, qhp->attr.max_ird); return ret; Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/t4_main.c Fri Sep 13 01:12:17 2019 (r352271) @@ -6231,15 +6231,15 @@ t4_sysctls(struct adapter *sc) "(-1 = default, 0 = reno, 1 = tahoe, 2 = newreno, " "3 = highspeed)"); - sc->tt.sndbuf = 256 * 1024; + sc->tt.sndbuf = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sndbuf", CTLFLAG_RW, - &sc->tt.sndbuf, 0, "max hardware send buffer size"); + &sc->tt.sndbuf, 0, "hardware send buffer"); sc->tt.ddp = 0; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "ddp", CTLFLAG_RW, &sc->tt.ddp, 0, "DDP allowed"); - sc->tt.rx_coalesce = 1; + sc->tt.rx_coalesce = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_coalesce", CTLFLAG_RW, &sc->tt.rx_coalesce, 0, "receive coalescing"); @@ -6251,7 +6251,7 @@ t4_sysctls(struct adapter *sc) CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_tls_rx_ports, "I", "TCP ports that use inline TLS+TOE RX"); - sc->tt.tx_align = 1; + sc->tt.tx_align = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tx_align", CTLFLAG_RW, &sc->tt.tx_align, 0, "chop and align payload"); Modified: stable/12/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_connect.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/tom/t4_connect.c Fri Sep 13 01:12:17 2019 (r352271) @@ -102,7 +102,7 @@ do_act_establish(struct sge_iq *iq, const struct rss_h make_established(toep, be32toh(cpl->snd_isn) - 1, be32toh(cpl->rcv_isn) - 1, cpl->tcp_opt); - if (toep->ulp_mode == ULP_MODE_TLS) + if (ulp_mode(toep) == ULP_MODE_TLS) tls_establish(toep); done: @@ -165,96 +165,6 @@ do_act_open_rpl(struct sge_iq *iq, const struct rss_he return (0); } -/* - * Options2 for active open. - */ -static uint32_t -calc_opt2a(struct socket *so, struct toepcb *toep, - const struct offload_settings *s) -{ - struct tcpcb *tp = so_sototcpcb(so); - struct port_info *pi = toep->vi->pi; - struct adapter *sc = pi->adapter; - uint32_t opt2 = 0; - - /* - * rx flow control, rx coalesce, congestion control, and tx pace are all - * explicitly set by the driver. On T5+ the ISS is also set by the - * driver to the value picked by the kernel. - */ - if (is_t4(sc)) { - opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; - opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; - } else { - opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ - opt2 |= F_T5_ISS; /* ISS provided in CPL */ - } - - if (s->sack > 0 || (s->sack < 0 && (tp->t_flags & TF_SACK_PERMIT))) - opt2 |= F_SACK_EN; - - if (s->tstamp > 0 || (s->tstamp < 0 && (tp->t_flags & TF_REQ_TSTMP))) - opt2 |= F_TSTAMPS_EN; - - if (tp->t_flags & TF_REQ_SCALE) - opt2 |= F_WND_SCALE_EN; - - if (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn == 1)) - opt2 |= F_CCTRL_ECN; - - /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ - - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - - /* These defaults are subject to ULP specific fixups later. */ - opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); - - opt2 |= V_PACE(0); - - if (s->cong_algo >= 0) - opt2 |= V_CONG_CNTRL(s->cong_algo); - else if (sc->tt.cong_algorithm >= 0) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); - else { - struct cc_algo *cc = CC_ALGO(tp); - - if (strcasecmp(cc->name, "reno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); - else if (strcasecmp(cc->name, "tahoe") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); - if (strcasecmp(cc->name, "newreno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - if (strcasecmp(cc->name, "highspeed") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); - else { - /* - * Use newreno in case the algorithm selected by the - * host stack is not supported by the hardware. - */ - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - } - } - - if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) - opt2 |= V_RX_COALESCE(M_RX_COALESCE); - - /* Note that ofld_rxq is already set according to s->rxq. */ - opt2 |= F_RSS_QUEUE_VALID; - opt2 |= V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); - -#ifdef USE_DDP_RX_FLOW_CONTROL - if (toep->ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_DDP; -#endif - - if (toep->ulp_mode == ULP_MODE_TLS) { - opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); - opt2 |= F_RX_FC_DISABLE; - } - - return (htobe32(opt2)); -} - void t4_init_connect_cpl_handlers(void) { @@ -322,7 +232,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru struct wrqe *wr = NULL; struct ifnet *rt_ifp = rt->rt_ifp; struct vi_info *vi; - int mtu_idx, rscale, qid_atid, rc, isipv6, txqid, rxqid; + int qid_atid, rc, isipv6; struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); int reason; @@ -353,18 +263,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru if (!settings.offload) DONT_OFFLOAD_ACTIVE_OPEN(EPERM); - if (settings.txq >= 0 && settings.txq < vi->nofldtxq) - txqid = settings.txq; - else - txqid = arc4random() % vi->nofldtxq; - txqid += vi->first_ofld_txq; - if (settings.rxq >= 0 && settings.rxq < vi->nofldrxq) - rxqid = settings.rxq; - else - rxqid = arc4random() % vi->nofldrxq; - rxqid += vi->first_ofld_rxq; - - toep = alloc_toepcb(vi, txqid, rxqid, M_NOWAIT | M_ZERO); + toep = alloc_toepcb(vi, M_NOWAIT); if (toep == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); @@ -377,27 +276,16 @@ t4_connect(struct toedev *tod, struct socket *so, stru if (toep->l2te == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); + toep->vnet = so->so_vnet; + init_conn_params(vi, &settings, &inp->inp_inc, so, NULL, + toep->l2te->idx, &toep->params); + init_toepcb(vi, toep); + isipv6 = nam->sa_family == AF_INET6; wr = alloc_wrqe(act_open_cpl_size(sc, isipv6), toep->ctrlq); if (wr == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); - toep->vnet = so->so_vnet; - set_ulp_mode(toep, select_ulp_mode(so, sc, &settings)); - SOCKBUF_LOCK(&so->so_rcv); - toep->opt0_rcv_bufsize = min(select_rcv_wnd(so) >> 10, M_RCV_BUFSIZ); - SOCKBUF_UNLOCK(&so->so_rcv); - - /* - * The kernel sets request_r_scale based on sb_max whereas we need to - * take hardware's MAX_RCV_WND into account too. This is normally a - * no-op as MAX_RCV_WND is much larger than the default sb_max. - */ - if (tp->t_flags & TF_REQ_SCALE) - rscale = tp->request_r_scale = select_rcv_wscale(); - else - rscale = 0; - mtu_idx = find_best_mtu_idx(sc, &inp->inp_inc, &settings); qid_atid = V_TID_QID(toep->ofld_rxq->iq.abs_id) | V_TID_TID(toep->tid) | V_TID_COOKIE(CPL_COOKIE_TOM); @@ -438,9 +326,13 @@ t4_connect(struct toedev *tod, struct socket *so, stru cpl->peer_port = inp->inp_fport; cpl->peer_ip_hi = *(uint64_t *)&inp->in6p_faddr.s6_addr[0]; cpl->peer_ip_lo = *(uint64_t *)&inp->in6p_faddr.s6_addr[8]; - cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->opt0_rcv_bufsize, toep->ulp_mode, &settings); - cpl->opt2 = calc_opt2a(so, toep, &settings); + cpl->opt0 = calc_options0(vi, &toep->params); + cpl->opt2 = calc_options2(vi, &toep->params); + + CTR6(KTR_CXGBE, + "%s: atid %u, toep %p, inp %p, opt0 %#016lx, opt2 %#08x", + __func__, toep->tid, toep, inp, be64toh(cpl->opt0), + be32toh(cpl->opt2)); } else { struct cpl_act_open_req *cpl = wrtod(wr); struct cpl_t5_act_open_req *cpl5 = (void *)cpl; @@ -467,13 +359,14 @@ t4_connect(struct toedev *tod, struct socket *so, stru qid_atid)); inp_4tuple_get(inp, &cpl->local_ip, &cpl->local_port, &cpl->peer_ip, &cpl->peer_port); - cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->opt0_rcv_bufsize, toep->ulp_mode, &settings); - cpl->opt2 = calc_opt2a(so, toep, &settings); - } + cpl->opt0 = calc_options0(vi, &toep->params); + cpl->opt2 = calc_options2(vi, &toep->params); - CTR5(KTR_CXGBE, "%s: atid %u (%s), toep %p, inp %p", __func__, - toep->tid, tcpstates[tp->t_state], toep, inp); + CTR6(KTR_CXGBE, + "%s: atid %u, toep %p, inp %p, opt0 %#016lx, opt2 %#08x", + __func__, toep->tid, toep, inp, be64toh(cpl->opt0), + be32toh(cpl->opt2)); + } offload_socket(so, toep); rc = t4_l2t_send(sc, wr, toep->l2te); Modified: stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Sep 13 01:12:17 2019 (r352271) @@ -99,7 +99,7 @@ aiotx_mbuf_pages(struct mbuf *m) } void -send_flowc_wr(struct toepcb *toep, struct flowc_tx_params *ftxp) +send_flowc_wr(struct toepcb *toep, struct tcpcb *tp) { struct wrqe *wr; struct fw_flowc_wr *flowc; @@ -113,17 +113,17 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT), ("%s: flowc for tid %u sent already", __func__, toep->tid)); - if (ftxp != NULL) + if (tp != NULL) nparams = 8; else nparams = 6; - if (toep->ulp_mode == ULP_MODE_TLS) + if (ulp_mode(toep) == ULP_MODE_TLS) nparams++; if (toep->tls.fcplenmax != 0) nparams++; - if (toep->tc_idx != -1) { - MPASS(toep->tc_idx >= 0 && - toep->tc_idx < sc->chip_params->nsched_cls); + if (toep->params.tc_idx != -1) { + MPASS(toep->params.tc_idx >= 0 && + toep->params.tc_idx < sc->chip_params->nsched_cls); nparams++; } @@ -155,30 +155,23 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par FLOWC_PARAM(CH, pi->tx_chan); FLOWC_PARAM(PORT, pi->tx_chan); FLOWC_PARAM(IQID, toep->ofld_rxq->iq.abs_id); - if (ftxp) { - uint32_t sndbuf = min(ftxp->snd_space, sc->tt.sndbuf); - - FLOWC_PARAM(SNDNXT, ftxp->snd_nxt); - FLOWC_PARAM(RCVNXT, ftxp->rcv_nxt); - FLOWC_PARAM(SNDBUF, sndbuf); - FLOWC_PARAM(MSS, ftxp->mss); - - CTR6(KTR_CXGBE, - "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", - __func__, toep->tid, ftxp->mss, sndbuf, ftxp->snd_nxt, - ftxp->rcv_nxt); - } else { - FLOWC_PARAM(SNDBUF, 512); - FLOWC_PARAM(MSS, 512); - - CTR2(KTR_CXGBE, "%s: tid %u", __func__, toep->tid); + FLOWC_PARAM(SNDBUF, toep->params.sndbuf); + FLOWC_PARAM(MSS, toep->params.emss); + if (tp) { + FLOWC_PARAM(SNDNXT, tp->snd_nxt); + FLOWC_PARAM(RCVNXT, tp->rcv_nxt); } - if (toep->ulp_mode == ULP_MODE_TLS) - FLOWC_PARAM(ULP_MODE, toep->ulp_mode); + CTR6(KTR_CXGBE, + "%s: tid %u, mss %u, sndbuf %u, snd_nxt 0x%x, rcv_nxt 0x%x", + __func__, toep->tid, toep->params.emss, toep->params.sndbuf, + tp ? tp->snd_nxt : 0, tp ? tp->rcv_nxt : 0); + + if (ulp_mode(toep) == ULP_MODE_TLS) + FLOWC_PARAM(ULP_MODE, ulp_mode(toep)); if (toep->tls.fcplenmax != 0) FLOWC_PARAM(TXDATAPLEN_MAX, toep->tls.fcplenmax); - if (toep->tc_idx != -1) - FLOWC_PARAM(SCHEDCLASS, toep->tc_idx); + if (toep->params.tc_idx != -1) + FLOWC_PARAM(SCHEDCLASS, toep->params.tc_idx); #undef FLOWC_PARAM KASSERT(paramidx == nparams, ("nparams mismatch")); @@ -219,7 +212,7 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); } - if (toep->tc_idx != tc_idx) { + if (toep->params.tc_idx != tc_idx) { struct wrqe *wr; struct fw_flowc_wr *flowc; int nparams = 1, flowclen, flowclen16; @@ -258,9 +251,9 @@ update_tx_rate_limit(struct adapter *sc, struct toepcb t4_wrq_tx(sc, wr); } - if (toep->tc_idx >= 0) - t4_release_cl_rl(sc, port_id, toep->tc_idx); - toep->tc_idx = tc_idx; + if (toep->params.tc_idx >= 0) + t4_release_cl_rl(sc, port_id, toep->params.tc_idx); + toep->params.tc_idx = tc_idx; return (0); } @@ -335,30 +328,30 @@ assign_rxopt(struct tcpcb *tp, uint16_t opt) INP_LOCK_ASSERT(inp); - toep->tcp_opt = opt; - toep->mtu_idx = G_TCPOPT_MSS(opt); - tp->t_maxseg = sc->params.mtus[toep->mtu_idx]; + toep->params.mtu_idx = G_TCPOPT_MSS(opt); + tp->t_maxseg = sc->params.mtus[toep->params.mtu_idx]; if (inp->inp_inc.inc_flags & INC_ISIPV6) tp->t_maxseg -= sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else tp->t_maxseg -= sizeof(struct ip) + sizeof(struct tcphdr); - toep->emss = tp->t_maxseg; + toep->params.emss = tp->t_maxseg; if (G_TCPOPT_TSTAMP(opt)) { + toep->params.tstamp = 1; + toep->params.emss -= TCPOLEN_TSTAMP_APPA; tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */ tp->ts_recent = 0; /* hmmm */ tp->ts_recent_age = tcp_ts_getticks(); - toep->emss -= TCPOLEN_TSTAMP_APPA; - } + } else + toep->params.tstamp = 0; - CTR6(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), t_maxseg %u, emss %u", - __func__, toep->tid, toep->mtu_idx, - sc->params.mtus[G_TCPOPT_MSS(opt)], tp->t_maxseg, toep->emss); - - if (G_TCPOPT_SACK(opt)) + if (G_TCPOPT_SACK(opt)) { + toep->params.sack = 1; tp->t_flags |= TF_SACK_PERMIT; /* should already be set */ - else + } else { + toep->params.sack = 0; tp->t_flags &= ~TF_SACK_PERMIT; /* sack disallowed by peer */ + } if (G_TCPOPT_WSCALE_OK(opt)) tp->t_flags |= TF_RCVD_SCALE; @@ -368,7 +361,13 @@ assign_rxopt(struct tcpcb *tp, uint16_t opt) (TF_RCVD_SCALE | TF_REQ_SCALE)) { tp->rcv_scale = tp->request_r_scale; tp->snd_scale = G_TCPOPT_SND_WSCALE(opt); - } + } else + toep->params.wscale = 0; + + CTR6(KTR_CXGBE, + "assign_rxopt: tid %d, mtu_idx %u, emss %u, ts %u, sack %u, wscale %u", + toep->tid, toep->params.mtu_idx, toep->params.emss, + toep->params.tstamp, toep->params.sack, toep->params.wscale); } /* @@ -383,9 +382,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui struct inpcb *inp = toep->inp; struct socket *so = inp->inp_socket; struct tcpcb *tp = intotcpcb(inp); - long bufsize; uint16_t tcpopt = be16toh(opt); - struct flowc_tx_params ftxp; INP_WLOCK_ASSERT(inp); KASSERT(tp->t_state == TCPS_SYN_SENT || @@ -401,7 +398,7 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->irs = irs; tcp_rcvseqinit(tp); - tp->rcv_wnd = (u_int)toep->opt0_rcv_bufsize << 10; + tp->rcv_wnd = (u_int)toep->params.opt0_bufsize << 10; tp->rcv_adv += tp->rcv_wnd; tp->last_ack_sent = tp->rcv_nxt; @@ -412,20 +409,8 @@ make_established(struct toepcb *toep, uint32_t iss, ui tp->snd_max = iss + 1; assign_rxopt(tp, tcpopt); + send_flowc_wr(toep, tp); - SOCKBUF_LOCK(&so->so_snd); - if (so->so_snd.sb_flags & SB_AUTOSIZE && V_tcp_do_autosndbuf) - bufsize = V_tcp_autosndbuf_max; - else - bufsize = sbspace(&so->so_snd); - SOCKBUF_UNLOCK(&so->so_snd); - - ftxp.snd_nxt = tp->snd_nxt; - ftxp.rcv_nxt = tp->rcv_nxt; - ftxp.snd_space = bufsize; - ftxp.mss = toep->emss; - send_flowc_wr(toep, &ftxp); - soisconnected(so); } @@ -481,7 +466,7 @@ t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp) SOCKBUF_LOCK_ASSERT(sb); rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { if (toep->tls.rcv_over >= rx_credits) { toep->tls.rcv_over -= rx_credits; rx_credits = 0; @@ -600,7 +585,7 @@ max_dsgl_nsegs(int tx_credits) static inline void write_tx_wr(void *dst, struct toepcb *toep, unsigned int immdlen, - unsigned int plen, uint8_t credits, int shove, int ulp_submode, int txalign) + unsigned int plen, uint8_t credits, int shove, int ulp_submode) { struct fw_ofld_tx_data_wr *txwr = dst; @@ -608,20 +593,18 @@ write_tx_wr(void *dst, struct toepcb *toep, unsigned i V_FW_WR_IMMDLEN(immdlen)); txwr->flowid_len16 = htobe32(V_FW_WR_FLOWID(toep->tid) | V_FW_WR_LEN16(credits)); - txwr->lsodisable_to_flags = htobe32(V_TX_ULP_MODE(toep->ulp_mode) | + txwr->lsodisable_to_flags = htobe32(V_TX_ULP_MODE(ulp_mode(toep)) | V_TX_ULP_SUBMODE(ulp_submode) | V_TX_URG(0) | V_TX_SHOVE(shove)); txwr->plen = htobe32(plen); - if (txalign > 0) { - struct tcpcb *tp = intotcpcb(toep->inp); - - if (plen < 2 * toep->emss) + if (toep->params.tx_align > 0) { + if (plen < 2 * toep->params.emss) txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_LSODISABLE); else txwr->lsodisable_to_flags |= htobe32(F_FW_OFLD_TX_DATA_WR_ALIGNPLD | - (tp->t_flags & TF_NODELAY ? 0 : + (toep->params.nagle == 0 ? 0 : F_FW_OFLD_TX_DATA_WR_ALIGNPLDSHOVE)); } } @@ -717,11 +700,11 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep KASSERT(toep->flags & TPF_FLOWC_WR_SENT, ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid)); - KASSERT(toep->ulp_mode == ULP_MODE_NONE || - toep->ulp_mode == ULP_MODE_TCPDDP || - toep->ulp_mode == ULP_MODE_TLS || - toep->ulp_mode == ULP_MODE_RDMA, - ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); + KASSERT(ulp_mode(toep) == ULP_MODE_NONE || + ulp_mode(toep) == ULP_MODE_TCPDDP || + ulp_mode(toep) == ULP_MODE_TLS || + ulp_mode(toep) == ULP_MODE_RDMA, + ("%s: ulp_mode %u for toep %p", __func__, ulp_mode(toep), toep)); #ifdef VERBOSE_TRACES CTR5(KTR_CXGBE, "%s: tid %d toep flags %#x tp flags %#x drop %d", @@ -861,8 +844,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep } txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); - write_tx_wr(txwr, toep, plen, plen, credits, shove, 0, - sc->tt.tx_align); + write_tx_wr(txwr, toep, plen, plen, credits, shove, 0); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -880,8 +862,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep } txwr = wrtod(wr); credits = howmany(wr_len, 16); - write_tx_wr(txwr, toep, 0, plen, credits, shove, 0, - sc->tt.tx_align); + write_tx_wr(txwr, toep, 0, plen, credits, shove, 0); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -901,7 +882,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep toep->tx_nocompl >= toep->tx_total / 4) compl = 1; - if (compl || toep->ulp_mode == ULP_MODE_RDMA) { + if (compl || ulp_mode(toep) == ULP_MODE_RDMA) { txwr->op_to_immdlen |= htobe32(F_FW_WR_COMPL); toep->tx_nocompl = 0; toep->plen_nocompl = 0; @@ -975,8 +956,8 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, INP_WLOCK_ASSERT(inp); KASSERT(toep->flags & TPF_FLOWC_WR_SENT, ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid)); - KASSERT(toep->ulp_mode == ULP_MODE_ISCSI, - ("%s: ulp_mode %u for toep %p", __func__, toep->ulp_mode, toep)); + KASSERT(ulp_mode(toep) == ULP_MODE_ISCSI, + ("%s: ulp_mode %u for toep %p", __func__, ulp_mode(toep), toep)); if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) return; @@ -1059,7 +1040,7 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, txwr = wrtod(wr); credits = howmany(wr->wr_len, 16); write_tx_wr(txwr, toep, plen, adjusted_plen, credits, - shove, ulp_submode, sc->tt.tx_align); + shove, ulp_submode); m_copydata(sndptr, 0, plen, (void *)(txwr + 1)); nsegs = 0; } else { @@ -1077,7 +1058,7 @@ t4_push_pdus(struct adapter *sc, struct toepcb *toep, txwr = wrtod(wr); credits = howmany(wr_len, 16); write_tx_wr(txwr, toep, 0, adjusted_plen, credits, - shove, ulp_submode, sc->tt.tx_align); + shove, ulp_submode); write_tx_sgl(txwr + 1, sndptr, m, nsegs, max_nsegs_1mbuf); if (wr_len & 0xf) { @@ -1143,7 +1124,7 @@ t4_tod_output(struct toedev *tod, struct tcpcb *tp) ("%s: inp %p dropped.", __func__, inp)); KASSERT(toep != NULL, ("%s: toep is NULL", __func__)); - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, 0); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, 0); @@ -1169,7 +1150,7 @@ t4_send_fin(struct toedev *tod, struct tcpcb *tp) toep->flags |= TPF_SEND_FIN; if (tp->t_state >= TCPS_ESTABLISHED) { - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, 0); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, 0); @@ -1256,7 +1237,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head so = inp->inp_socket; socantrcvmore(so); - if (toep->ulp_mode == ULP_MODE_TCPDDP) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { DDP_LOCK(toep); if (__predict_false(toep->ddp.flags & (DDP_BUF0_ACTIVE | DDP_BUF1_ACTIVE))) @@ -1264,7 +1245,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head DDP_UNLOCK(toep); } - if (toep->ulp_mode != ULP_MODE_RDMA) { + if (ulp_mode(toep) != ULP_MODE_RDMA) { KASSERT(tp->rcv_nxt == be32toh(cpl->rcv_nxt), ("%s: rcv_nxt mismatch: %u %u", __func__, tp->rcv_nxt, be32toh(cpl->rcv_nxt))); @@ -1575,14 +1556,14 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp->rcv_nxt += len; if (tp->rcv_wnd < len) { - KASSERT(toep->ulp_mode == ULP_MODE_RDMA, + KASSERT(ulp_mode(toep) == ULP_MODE_RDMA, ("%s: negative window size", __func__)); } tp->rcv_wnd -= len; tp->t_rcvtime = ticks; - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_LOCK(toep); so = inp_inpcbtosocket(inp); sb = &so->so_rcv; @@ -1593,7 +1574,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header __func__, tid, len); m_freem(m); SOCKBUF_UNLOCK(sb); - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_UNLOCK(toep); INP_WUNLOCK(inp); @@ -1624,7 +1605,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header sb->sb_flags &= ~SB_AUTOSIZE; } - if (toep->ulp_mode == ULP_MODE_TCPDDP) { + if (ulp_mode(toep) == ULP_MODE_TCPDDP) { int changed = !(toep->ddp.flags & DDP_ON) ^ cpl->ddp_off; if (toep->ddp.waiting_count != 0 || toep->ddp.active_count != 0) @@ -1667,7 +1648,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp->rcv_adv += rx_credits; } - if (toep->ulp_mode == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && + if (ulp_mode(toep) == ULP_MODE_TCPDDP && toep->ddp.waiting_count > 0 && sbavail(sb) != 0) { CTR2(KTR_CXGBE, "%s: tid %u queueing AIO task", __func__, tid); @@ -1675,7 +1656,7 @@ do_rx_data(struct sge_iq *iq, const struct rss_header } sorwakeup_locked(so); SOCKBUF_UNLOCK_ASSERT(sb); - if (toep->ulp_mode == ULP_MODE_TCPDDP) + if (ulp_mode(toep) == ULP_MODE_TCPDDP) DDP_UNLOCK(toep); INP_WUNLOCK(inp); @@ -1785,7 +1766,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header #endif toep->flags &= ~TPF_TX_SUSPENDED; CURVNET_SET(toep->vnet); - if (toep->ulp_mode == ULP_MODE_ISCSI) + if (ulp_mode(toep) == ULP_MODE_ISCSI) t4_push_pdus(sc, toep, plen); else if (tls_tx_key(toep)) t4_push_tls_records(sc, toep, plen); @@ -1798,7 +1779,7 @@ do_fw4_ack(struct sge_iq *iq, const struct rss_header SOCKBUF_LOCK(sb); sbu = sbused(sb); - if (toep->ulp_mode == ULP_MODE_ISCSI) { + if (ulp_mode(toep) == ULP_MODE_ISCSI) { if (__predict_false(sbu > 0)) { /* @@ -2013,7 +1994,6 @@ hold_aio(struct kaiocb *job) static void t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job) { - struct adapter *sc; struct sockbuf *sb; struct file *fp; struct aiotx_buffer *ab; @@ -2023,7 +2003,6 @@ t4_aiotx_process_job(struct toepcb *toep, struct socke int error; bool moretocome, sendmore; - sc = td_adapter(toep->td); sb = &so->so_snd; SOCKBUF_UNLOCK(sb); fp = job->fd_file; @@ -2107,8 +2086,8 @@ sendanother: moretocome = false; } else moretocome = true; - if (m->m_len > sc->tt.sndbuf) { - m->m_len = sc->tt.sndbuf; + if (m->m_len > toep->params.sndbuf) { + m->m_len = toep->params.sndbuf; sendmore = true; } else sendmore = false; Modified: stable/12/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_ddp.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/tom/t4_ddp.c Fri Sep 13 01:12:17 2019 (r352271) @@ -769,7 +769,7 @@ do_rx_data_ddp(struct sge_iq *iq, const struct rss_hea __func__, vld, tid, toep); } - if (toep->ulp_mode == ULP_MODE_ISCSI) { + if (ulp_mode(toep) == ULP_MODE_ISCSI) { t4_cpl_handler[CPL_RX_ISCSI_DDP](iq, rss, m); return (0); } Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_listen.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Fri Sep 13 01:12:17 2019 (r352271) @@ -348,7 +348,7 @@ send_reset_synqe(struct toedev *tod, struct synq_entry struct ifnet *ifp = m->m_pkthdr.rcvif; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; struct wrqe *wr; struct fw_flowc_wr *flowc; struct cpl_abort_req *req; @@ -368,8 +368,8 @@ send_reset_synqe(struct toedev *tod, struct synq_entry return; /* abort already in progress */ synqe->flags |= TPF_ABORT_SHUTDOWN; - ofld_txq = &sc->sge.ofld_txq[synqe->txqid]; - ofld_rxq = &sc->sge.ofld_rxq[synqe->rxqid]; + ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; + ofld_rxq = &sc->sge.ofld_rxq[synqe->params.rxq_idx]; /* The wrqe will have two WRs - a flowc followed by an abort_req */ flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); @@ -836,7 +836,7 @@ done_with_synqe(struct adapter *sc, struct synq_entry { struct listen_ctx *lctx = synqe->lctx; struct inpcb *inp = lctx->inp; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; int ntids; INP_WLOCK_ASSERT(inp); @@ -887,7 +887,7 @@ do_abort_req_synqe(struct sge_iq *iq, const struct rss INP_WLOCK(inp); - ofld_txq = &sc->sge.ofld_txq[synqe->txqid]; + ofld_txq = &sc->sge.ofld_txq[synqe->params.txq_idx]; /* * If we'd initiated an abort earlier the reply to it is responsible for @@ -962,28 +962,6 @@ t4_offload_socket(struct toedev *tod, void *arg, struc synqe->flags |= TPF_SYNQE_EXPANDED; } -static inline void -save_qids_in_synqe(struct synq_entry *synqe, struct vi_info *vi, - struct offload_settings *s) -{ - uint32_t txqid, rxqid; - - if (s->txq >= 0 && s->txq < vi->nofldtxq) - txqid = s->txq; - else - txqid = arc4random() % vi->nofldtxq; - txqid += vi->first_ofld_txq; - - if (s->rxq >= 0 && s->rxq < vi->nofldrxq) - rxqid = s->rxq; - else - rxqid = arc4random() % vi->nofldrxq; - rxqid += vi->first_ofld_rxq; - - synqe->txqid = txqid; - synqe->rxqid = rxqid; -} - static void t4opt_to_tcpopt(const struct tcp_options *t4opt, struct tcpopt *to) { @@ -1006,95 +984,6 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_flags |= TOF_SACKPERM; } -/* - * Options2 for passive open. - */ -static uint32_t -calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, - const struct tcp_options *tcpopt, struct tcphdr *th, int ulp_mode, - struct cc_algo *cc, const struct offload_settings *s) -{ - struct sge_ofld_rxq *ofld_rxq = &sc->sge.ofld_rxq[rxqid]; - uint32_t opt2 = 0; - - /* - * rx flow control, rx coalesce, congestion control, and tx pace are all - * explicitly set by the driver. On T5+ the ISS is also set by the - * driver to the value picked by the kernel. - */ - if (is_t4(sc)) { - opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; - opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; - } else { - opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ - opt2 |= F_T5_ISS; /* ISS provided in CPL */ - } - - if (tcpopt->sack && (s->sack > 0 || (s->sack < 0 && V_tcp_do_rfc1323))) - opt2 |= F_SACK_EN; - - if (tcpopt->tstamp && - (s->tstamp > 0 || (s->tstamp < 0 && V_tcp_do_rfc1323))) - opt2 |= F_TSTAMPS_EN; - - if (tcpopt->wsf < 15 && V_tcp_do_rfc1323) - opt2 |= F_WND_SCALE_EN; - - if (th->th_flags & (TH_ECE | TH_CWR) && - (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn))) - opt2 |= F_CCTRL_ECN; - - /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ - - opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); - - /* These defaults are subject to ULP specific fixups later. */ - opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); - - opt2 |= V_PACE(0); - - if (s->cong_algo >= 0) - opt2 |= V_CONG_CNTRL(s->cong_algo); - else if (sc->tt.cong_algorithm >= 0) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); - else { - if (strcasecmp(cc->name, "reno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); - else if (strcasecmp(cc->name, "tahoe") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); - if (strcasecmp(cc->name, "newreno") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - if (strcasecmp(cc->name, "highspeed") == 0) - opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); - else { - /* - * Use newreno in case the algorithm selected by the - * host stack is not supported by the hardware. - */ - opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); - } - } - - if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) - opt2 |= V_RX_COALESCE(M_RX_COALESCE); - - /* Note that ofld_rxq is already set according to s->rxq. */ - opt2 |= F_RSS_QUEUE_VALID; - opt2 |= V_RSS_QUEUE(ofld_rxq->iq.abs_id); - -#ifdef USE_DDP_RX_FLOW_CONTROL - if (ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_DDP; -#endif - - if (ulp_mode == ULP_MODE_TLS) { - opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); - opt2 |= F_RX_FC_DISABLE; - } - - return (htobe32(opt2)); -} - static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th) @@ -1189,7 +1078,7 @@ send_synack(struct adapter *sc, struct synq_entry *syn { struct wrqe *wr; struct cpl_pass_accept_rpl *rpl; - struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; wr = alloc_wrqe(is_t4(sc) ? sizeof(struct cpl_pass_accept_rpl) : sizeof(struct cpl_t5_pass_accept_rpl), &sc->sge.ctrlq[0]); @@ -1385,6 +1274,9 @@ found: } atomic_store_int(&synqe->ok_to_respond, 0); + init_conn_params(vi, &settings, &inc, so, &cpl->tcpopt, e->idx, + &synqe->params); + /* * If all goes well t4_syncache_respond will get called during * syncache_add. Note that syncache_add releases the pcb lock. @@ -1395,27 +1287,12 @@ found: if (atomic_load_int(&synqe->ok_to_respond) > 0) { uint64_t opt0; uint32_t opt2; - u_int wnd; - int rscale, mtu_idx, rx_credits; - mtu_idx = find_best_mtu_idx(sc, &inc, &settings); - rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; - wnd = max(so->sol_sbrcv_hiwat, MIN_RCV_WND); - wnd = min(wnd, MAX_RCV_WND); - rx_credits = min(wnd >> 10, M_RCV_BUFSIZ); + opt0 = calc_options0(vi, &synqe->params); + opt2 = calc_options2(vi, &synqe->params); - save_qids_in_synqe(synqe, vi, &settings); - synqe->ulp_mode = select_ulp_mode(so, sc, &settings); - - opt0 = calc_opt0(so, vi, e, mtu_idx, rscale, rx_credits, - synqe->ulp_mode, &settings); - opt2 = calc_opt2p(sc, pi, synqe->rxqid, &cpl->tcpopt, &th, - synqe->ulp_mode, CC_ALGO(intotcpcb(inp)), &settings); - insert_tid(sc, tid, synqe, ntids); synqe->tid = tid; - synqe->l2e_idx = e->idx; - synqe->rcv_bufsize = rx_credits; synqe->syn = m; m = NULL; @@ -1427,8 +1304,8 @@ found: } CTR6(KTR_CXGBE, - "%s: stid %u, tid %u, lctx %p, synqe %p, mode %d, SYNACK", - __func__, stid, tid, lctx, synqe, synqe->ulp_mode); + "%s: stid %u, tid %u, synqe %p, opt0 %#016lx, opt2 %#08x", + __func__, stid, tid, synqe, be64toh(opt0), be32toh(opt2)); } else REJECT_PASS_ACCEPT_REQ(false); @@ -1540,18 +1417,19 @@ reset: return (0); } - KASSERT(synqe->rxqid == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], + KASSERT(synqe->params.rxq_idx == iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0], ("%s: CPL arrived on unexpected rxq. %d %d", __func__, - synqe->rxqid, (int)(iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0]))); + synqe->params.rxq_idx, + (int)(iq_to_ofld_rxq(iq) - &sc->sge.ofld_rxq[0]))); - toep = alloc_toepcb(vi, synqe->txqid, synqe->rxqid, M_NOWAIT); + toep = alloc_toepcb(vi, M_NOWAIT); if (toep == NULL) goto reset; toep->tid = tid; - toep->l2te = &sc->l2t->l2tab[synqe->l2e_idx]; + toep->l2te = &sc->l2t->l2tab[synqe->params.l2t_idx]; toep->vnet = lctx->vnet; - set_ulp_mode(toep, synqe->ulp_mode); - toep->opt0_rcv_bufsize = synqe->rcv_bufsize; + bcopy(&synqe->params, &toep->params, sizeof(toep->params)); + init_toepcb(vi, toep); MPASS(be32toh(cpl->snd_isn) - 1 == synqe->iss); MPASS(be32toh(cpl->rcv_isn) - 1 == synqe->irs); Modified: stable/12/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tls.c Fri Sep 13 01:07:19 2019 (r352270) +++ stable/12/sys/dev/cxgbe/tom/t4_tls.c Fri Sep 13 01:12:17 2019 (r352271) @@ -589,7 +589,7 @@ program_key_context(struct tcpcb *tp, struct toepcb *t "KEY_WRITE_TX", uk_ctx->proto_ver); if (G_KEY_GET_LOC(uk_ctx->l_p_key) == KEY_WRITE_RX && - toep->ulp_mode != ULP_MODE_TLS) + ulp_mode(toep) != ULP_MODE_TLS) return (EOPNOTSUPP); /* Don't copy the 'tx' and 'rx' fields. */ @@ -787,7 +787,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so INP_WUNLOCK(inp); break; case TCP_TLSOM_CLR_TLS_TOM: - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { CTR2(KTR_CXGBE, "%s: tid %d CLR_TLS_TOM", __func__, toep->tid); tls_clr_ofld_mode(toep); @@ -796,7 +796,7 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so INP_WUNLOCK(inp); break; case TCP_TLSOM_CLR_QUIES: - if (toep->ulp_mode == ULP_MODE_TLS) { + if (ulp_mode(toep) == ULP_MODE_TLS) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Sep 13 01:14: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 1547EE0F1E; Fri, 13 Sep 2019 01:14:59 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46TyNf6pNzz40j9; Fri, 13 Sep 2019 01:14:58 +0000 (UTC) (envelope-from np@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 C927227683; Fri, 13 Sep 2019 01:14:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D1Ewqq042198; Fri, 13 Sep 2019 01:14:58 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D1EwA7042197; Fri, 13 Sep 2019 01:14:58 GMT (envelope-from np@FreeBSD.org) Message-Id: <201909130114.x8D1EwA7042197@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 13 Sep 2019 01:14: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: r352272 - stable/12/sys/dev/cxgbe/tom X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 352272 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, 13 Sep 2019 01:14:59 -0000 Author: np Date: Fri Sep 13 01:14:58 2019 New Revision: 352272 URL: https://svnweb.freebsd.org/changeset/base/352272 Log: MFC r351445: whitespace nit. Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_listen.c Fri Sep 13 01:12:17 2019 (r352271) +++ stable/12/sys/dev/cxgbe/tom/t4_listen.c Fri Sep 13 01:14:58 2019 (r352272) @@ -1034,7 +1034,7 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifne struct l2t_entry *e; struct sockaddr_in6 sin6; struct sockaddr *dst = (void *)&sin6; - + if (inc->inc_flags & INC_ISIPV6) { struct nhop6_basic nh6; From owner-svn-src-stable@freebsd.org Fri Sep 13 05:54: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 A58FAE649F; Fri, 13 Sep 2019 05:54:09 +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 46V4Zn3ytfz4BZn; Fri, 13 Sep 2019 05:54:09 +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 69D472941; Fri, 13 Sep 2019 05:54:09 +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 x8D5s9Cf007425; Fri, 13 Sep 2019 05:54:09 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D5s906007424; Fri, 13 Sep 2019 05:54:09 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201909130554.x8D5s906007424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 13 Sep 2019 05:54: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: r352273 - 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: 352273 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, 13 Sep 2019 05:54:09 -0000 Author: sjg Date: Fri Sep 13 05:54:09 2019 New Revision: 352273 URL: https://svnweb.freebsd.org/changeset/base/352273 Log: Use file destdir for stage_as sets We cannot use file (without :T) to name targets but we can use the destination directory (with / replaced by _) This has the benefit of minimizing the targets created. MFC r351954 Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org//D21283 Modified: stable/12/share/mk/bsd.files.mk Modified: stable/12/share/mk/bsd.files.mk ============================================================================== --- stable/12/share/mk/bsd.files.mk Fri Sep 13 01:14:58 2019 (r352272) +++ stable/12/share/mk/bsd.files.mk Fri Sep 13 05:54:09 2019 (r352273) @@ -37,7 +37,6 @@ ${group}GRP= ${SHAREGRP} ${group}MODE?= ${SHAREMODE} ${group}DIR?= BINDIR STAGE_SETS+= ${group:C,[/*],_,g} -STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} .if defined(NO_ROOT) .if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} @@ -57,6 +56,7 @@ DIRS+= ${group}DIR _${group}DIR= ${group}DIR .endif +STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} .for file in ${${group}} ${group}OWN_${file}?= ${${group}OWN} @@ -97,11 +97,16 @@ ${group}NAME_${file}?= ${${group}NAME} .else ${group}NAME_${file}?= ${file:T} .endif # defined(${group}NAME) -STAGE_AS_SETS+= ${file} STAGE_AS_${file}= ${${group}NAME_${file}} -# XXX {group}OWN,GRP,MODE -STAGE_DIR.${file}= ${STAGE_OBJTOP}${${group}DIR_${file}} -stage_as.${file}: ${file} +# we cannot use file safely as a set name +# since we cannot? apply :T +# but we can use the ${group}DIR_${file} +# as a set - meta.stage.mk will :O:u for us +# we need to expand ${group}DIR_${file} and replace +# all '/' and '*' with '_' to make a safe target name. +STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g} +STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR_${file}} +stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file} installfiles-${group}: _${group}INS1_${file} _${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file} @@ -118,12 +123,16 @@ realinstall: installfiles .ORDER: beforeinstall installfiles .if ${MK_STAGING} != "no" +.if ${FILESGROUPS:@g@${$g}@} != "" .if !empty(STAGE_SETS) buildfiles: stage_files STAGE_TARGETS+= stage_files +stage_files: .if !empty(STAGE_AS_SETS) buildfiles: stage_as STAGE_TARGETS+= stage_as +stage_as: +.endif .endif .endif .endif From owner-svn-src-stable@freebsd.org Fri Sep 13 07:08:47 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 847CDE8505; Fri, 13 Sep 2019 07:08:47 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6Dv2zlmz4G6l; Fri, 13 Sep 2019 07:08:47 +0000 (UTC) (envelope-from bapt@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 2D4A137C2; Fri, 13 Sep 2019 07:08:47 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D78k3T048655; Fri, 13 Sep 2019 07:08:46 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D78h5a048639; Fri, 13 Sep 2019 07:08:43 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130708.x8D78h5a048639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:08: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: r352276 - in stable/12: sbin/devd usr.sbin/apmd usr.sbin/config usr.sbin/ctld usr.sbin/jail usr.sbin/kbdcontrol usr.sbin/ndiscvt usr.sbin/rrenumd X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in stable/12: sbin/devd usr.sbin/apmd usr.sbin/config usr.sbin/ctld usr.sbin/jail usr.sbin/kbdcontrol usr.sbin/ndiscvt usr.sbin/rrenumd X-SVN-Commit-Revision: 352276 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, 13 Sep 2019 07:08:47 -0000 Author: bapt Date: Fri Sep 13 07:08:43 2019 New Revision: 352276 URL: https://svnweb.freebsd.org/changeset/base/352276 Log: MFC r352119-r352124, r352130 Stop linking to libl by specifying we do not need yywrap Modified: stable/12/sbin/devd/Makefile stable/12/sbin/devd/token.l stable/12/usr.sbin/apmd/Makefile stable/12/usr.sbin/apmd/apmdlex.l stable/12/usr.sbin/config/Makefile stable/12/usr.sbin/ctld/Makefile stable/12/usr.sbin/ctld/token.l stable/12/usr.sbin/jail/Makefile stable/12/usr.sbin/jail/jaillex.l stable/12/usr.sbin/kbdcontrol/Makefile stable/12/usr.sbin/kbdcontrol/lex.l stable/12/usr.sbin/ndiscvt/Makefile stable/12/usr.sbin/ndiscvt/inf-token.l stable/12/usr.sbin/rrenumd/Makefile stable/12/usr.sbin/rrenumd/lexer.l Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/devd/Makefile ============================================================================== --- stable/12/sbin/devd/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/sbin/devd/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -34,7 +34,7 @@ MAN= devd.8 devd.conf.5 NO_SHARED?=YES -LIBADD= l util +LIBADD= util YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} Modified: stable/12/sbin/devd/token.l ============================================================================== --- stable/12/sbin/devd/token.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/sbin/devd/token.l Fri Sep 13 07:08:43 2019 (r352276) @@ -50,6 +50,7 @@ update_lineno(const char *cp) %} +%option noyywrap %option nounput %option noinput Modified: stable/12/usr.sbin/apmd/Makefile ============================================================================== --- stable/12/usr.sbin/apmd/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/apmd/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -10,8 +10,6 @@ PACKAGE=apm WARNS?= 3 -LIBADD= l - CFLAGS+= -I${.CURDIR} test: Modified: stable/12/usr.sbin/apmd/apmdlex.l ============================================================================== --- stable/12/usr.sbin/apmd/apmdlex.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/apmd/apmdlex.l Fri Sep 13 07:08:43 2019 (r352276) @@ -44,6 +44,7 @@ int first_time; %} /* We don't need it, avoid the warning. */ +%option noyywrap %option nounput %option noinput Modified: stable/12/usr.sbin/config/Makefile ============================================================================== --- stable/12/usr.sbin/config/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/config/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= -LIBADD= l nv sbuf +LIBADD= nv sbuf CLEANFILES+= kernconf.c Modified: stable/12/usr.sbin/ctld/Makefile ============================================================================== --- stable/12/usr.sbin/ctld/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/ctld/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -15,7 +15,7 @@ CFLAGS+= -I${SRCTOP}/sys/dev/iscsi #CFLAGS+= -DICL_KERNEL_PROXY MAN= ctld.8 ctl.conf.5 -LIBADD= bsdxml l md sbuf util ucl m nv +LIBADD= bsdxml md sbuf util ucl m nv YFLAGS+= -v CLEANFILES= y.tab.c y.tab.h y.output Modified: stable/12/usr.sbin/ctld/token.l ============================================================================== --- stable/12/usr.sbin/ctld/token.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/ctld/token.l Fri Sep 13 07:08:43 2019 (r352276) @@ -45,6 +45,7 @@ extern int yylex(void); %} +%option noyywrap %option noinput %option nounput Modified: stable/12/usr.sbin/jail/Makefile ============================================================================== --- stable/12/usr.sbin/jail/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/jail/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -6,7 +6,7 @@ PROG= jail MAN= jail.8 jail.conf.5 SRCS= jail.c command.c config.c state.c jailp.h jaillex.l jailparse.y y.tab.h -LIBADD= jail kvm util l +LIBADD= jail kvm util PACKAGE=jail Modified: stable/12/usr.sbin/jail/jaillex.l ============================================================================== --- stable/12/usr.sbin/jail/jaillex.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/jail/jaillex.l Fri Sep 13 07:08:43 2019 (r352276) @@ -48,6 +48,7 @@ static int lineno = 1; #define YY_DECL int yylex(void) %} +%option noyywrap %option noinput %option nounput Modified: stable/12/usr.sbin/kbdcontrol/Makefile ============================================================================== --- stable/12/usr.sbin/kbdcontrol/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/kbdcontrol/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -8,6 +8,4 @@ SRCS= kbdcontrol.c lex.l WARNS?= 4 CFLAGS+= -I${.CURDIR} -LIBADD= l - .include Modified: stable/12/usr.sbin/kbdcontrol/lex.l ============================================================================== --- stable/12/usr.sbin/kbdcontrol/lex.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/kbdcontrol/lex.l Fri Sep 13 07:08:43 2019 (r352276) @@ -36,6 +36,7 @@ %} +%option noyywrap %option nounput %option noinput Modified: stable/12/usr.sbin/ndiscvt/Makefile ============================================================================== --- stable/12/usr.sbin/ndiscvt/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/ndiscvt/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -13,8 +13,6 @@ MAN+= ndisgen.8 WARNS?= 4 NO_WCAST_ALIGN= -LIBADD= l - YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} -I${SRCTOP}/sys Modified: stable/12/usr.sbin/ndiscvt/inf-token.l ============================================================================== --- stable/12/usr.sbin/ndiscvt/inf-token.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/ndiscvt/inf-token.l Fri Sep 13 07:08:43 2019 (r352276) @@ -59,6 +59,7 @@ update_lineno(const char *cp) %} +%option noyywrap %option nounput %option noinput Modified: stable/12/usr.sbin/rrenumd/Makefile ============================================================================== --- stable/12/usr.sbin/rrenumd/Makefile Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/rrenumd/Makefile Fri Sep 13 07:08:43 2019 (r352276) @@ -23,7 +23,7 @@ YFLAGS= -d WARNS?= 2 -LIBADD= ipsec l y +LIBADD= ipsec CLEANFILES= y.tab.h SRCS+= y.tab.h Modified: stable/12/usr.sbin/rrenumd/lexer.l ============================================================================== --- stable/12/usr.sbin/rrenumd/lexer.l Fri Sep 13 06:50:02 2019 (r352275) +++ stable/12/usr.sbin/rrenumd/lexer.l Fri Sep 13 07:08:43 2019 (r352276) @@ -60,6 +60,7 @@ void yyerror(const char *); int yylex(void); %} +%option noyywrap %option nounput /* common section */ From owner-svn-src-stable@freebsd.org Fri Sep 13 07:10: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 2BC51E8714; Fri, 13 Sep 2019 07:10:53 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6HJ6YDjz4GN5; Fri, 13 Sep 2019 07:10:52 +0000 (UTC) (envelope-from bapt@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 A996337D5; Fri, 13 Sep 2019 07:10:52 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7AqbE048829; Fri, 13 Sep 2019 07:10:52 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7Ap15048821; Fri, 13 Sep 2019 07:10:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130710.x8D7Ap15048821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:10:51 +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: r352277 - stable/12/usr.bin/m4 X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/usr.bin/m4 X-SVN-Commit-Revision: 352277 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, 13 Sep 2019 07:10:53 -0000 Author: bapt Date: Fri Sep 13 07:10:50 2019 New Revision: 352277 URL: https://svnweb.freebsd.org/changeset/base/352277 Log: MFC r352065-r352070 Sync with OpenBSD, in particular this adds support for -E flags (GNU compatibility) Modified: stable/12/usr.bin/m4/Makefile stable/12/usr.bin/m4/eval.c stable/12/usr.bin/m4/extern.h stable/12/usr.bin/m4/gnum4.c stable/12/usr.bin/m4/m4.1 stable/12/usr.bin/m4/main.c stable/12/usr.bin/m4/misc.c stable/12/usr.bin/m4/tokenizer.l Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/m4/Makefile ============================================================================== --- stable/12/usr.bin/m4/Makefile Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/Makefile Fri Sep 13 07:10:50 2019 (r352277) @@ -8,7 +8,7 @@ PROG= m4 CFLAGS+=-DEXTENDED -I${.CURDIR} -I${SRCTOP}/lib/libopenbsd -LIBADD= y l m openbsd +LIBADD= m openbsd NO_WMISSING_VARIABLE_DECLARATIONS= Modified: stable/12/usr.bin/m4/eval.c ============================================================================== --- stable/12/usr.bin/m4/eval.c Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/eval.c Fri Sep 13 07:10:50 2019 (r352277) @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.74 2015/02/05 12:59:57 millert Exp $ */ +/* $OpenBSD: eval.c,v 1.78 2019/06/28 05:35:34 deraadt Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /*- @@ -126,6 +126,7 @@ void expand_builtin(const char *argv[], int argc, int td) { int c, n; + const char *errstr; int ac; static int sysval = 0; @@ -186,13 +187,15 @@ expand_builtin(const char *argv[], int argc, int td) if (argc > 3) { base = strtonum(argv[3], 2, 36, &errstr); if (errstr) { - m4errx(1, "expr: base %s invalid.", argv[3]); + m4errx(1, "expr: base is %s: %s.", + errstr, argv[3]); } } if (argc > 4) { maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr); if (errstr) { - m4errx(1, "expr: maxdigits %s invalid.", argv[4]); + m4errx(1, "expr: maxdigits is %s: %s.", + errstr, argv[4]); } } if (argc > 2) @@ -201,8 +204,7 @@ expand_builtin(const char *argv[], int argc, int td) } case IFELTYPE: - if (argc > 4) - doifelse(argv, argc); + doifelse(argv, argc); break; case IFDFTYPE: @@ -232,8 +234,13 @@ expand_builtin(const char *argv[], int argc, int td) * doincr - increment the value of the * argument */ - if (argc > 2) - pbnum(atoi(argv[2]) + 1); + if (argc > 2) { + n = strtonum(argv[2], INT_MIN, INT_MAX-1, &errstr); + if (errstr != NULL) + m4errx(1, "incr: argument is %s: %s.", + errstr, argv[2]); + pbnum(n + 1); + } break; case DECRTYPE: @@ -241,8 +248,13 @@ expand_builtin(const char *argv[], int argc, int td) * dodecr - decrement the value of the * argument */ - if (argc > 2) - pbnum(atoi(argv[2]) - 1); + if (argc > 2) { + n = strtonum(argv[2], INT_MIN+1, INT_MAX, &errstr); + if (errstr) + m4errx(1, "decr: argument is %s: %s.", + errstr, argv[2]); + pbnum(n - 1); + } break; case SYSCTYPE: @@ -275,6 +287,10 @@ expand_builtin(const char *argv[], int argc, int td) warn("%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); exit_code = 1; + if (fatal_warns) { + killdiv(); + exit(exit_code); + } } else err(1, "%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); @@ -339,12 +355,18 @@ expand_builtin(const char *argv[], int argc, int td) break; case DIVRTYPE: - if (argc > 2 && (n = atoi(argv[2])) != 0) - dodiv(n); - else { - active = stdout; - oindex = 0; + if (argc > 2) { + n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr); + if (errstr) + m4errx(1, "divert: argument is %s: %s.", + errstr, argv[2]); + if (n != 0) { + dodiv(n); + break; + } } + active = stdout; + oindex = 0; break; case UNDVTYPE: @@ -691,17 +713,17 @@ dotrace(const char *argv[], int argc, int on) static void doifelse(const char *argv[], int argc) { - cycle { - if (STREQ(argv[2], argv[3])) + while (argc > 4) { + if (STREQ(argv[2], argv[3])) { pbstr(argv[4]); - else if (argc == 6) + break; + } else if (argc == 6) { pbstr(argv[5]); - else if (argc > 6) { + break; + } else { argv += 3; argc -= 3; - continue; } - break; } } @@ -824,7 +846,7 @@ dodiv(int n) if (outfile[n] == NULL) { char fname[] = _PATH_DIVNAME; - if ((fd = mkstemp(fname)) < 0 || + if ((fd = mkstemp(fname)) == -1 || unlink(fname) == -1 || (outfile[n] = fdopen(fd, "w+")) == NULL) err(1, "%s: cannot divert", fname); Modified: stable/12/usr.bin/m4/extern.h ============================================================================== --- stable/12/usr.bin/m4/extern.h Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/extern.h Fri Sep 13 07:10:50 2019 (r352277) @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.54 2014/05/12 19:11:19 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.55 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- @@ -61,6 +61,8 @@ extern void doesyscmd(const char *); extern void getdivfile(const char *); extern void doformat(const char *[], int); +extern void m4_warnx(const char *, ...); + /* look.c */ #define FLAG_UNTRACED 0 @@ -178,4 +180,5 @@ extern int synch_lines; /* line synchronisation direc extern int mimic_gnu; /* behaves like gnu-m4 */ extern int prefix_builtins; /* prefix builtin macros with m4_ */ - +extern int error_warns; /* make warnings cause exit_code = 1 */ +extern int fatal_warns; /* make warnings fatal */ Modified: stable/12/usr.bin/m4/gnum4.c ============================================================================== --- stable/12/usr.bin/m4/gnum4.c Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/gnum4.c Fri Sep 13 07:10:50 2019 (r352277) @@ -1,4 +1,4 @@ -/* $OpenBSD: gnum4.c,v 1.50 2015/04/29 00:13:26 millert Exp $ */ +/* $OpenBSD: gnum4.c,v 1.52 2017/08/21 21:41:13 deraadt Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -259,11 +260,29 @@ exit_regerror(int er, regex_t *re, const char *source) m4errx(1, "regular expression error in %s: %s.", source, errbuf); } +/* warnx() plus check to see if we need to change exit code or exit . + * -E flag functionality. + */ +void +m4_warnx(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + warnx(fmt, ap); + va_end(ap); + + if (fatal_warns) + exit(1); + if (error_warns) + exit_code = 1; +} + static void add_sub(int n, const char *string, regex_t *re, regmatch_t *pm) { if (n > (int)re->re_nsub) - warnx("No subexpression %d", n); + m4_warnx("No subexpression %d", n); /* Subexpressions that did not match are * not an error. */ else if (pm[n].rm_so != -1 && @@ -446,7 +465,7 @@ void dopatsubst(const char *argv[], int argc) { if (argc <= 3) { - warnx("Too few arguments to patsubst"); + m4_warnx("Too few arguments to patsubst"); return; } /* special case: empty regexp */ @@ -498,7 +517,7 @@ doregexp(const char *argv[], int argc) const char *source; if (argc <= 3) { - warnx("Too few arguments to regexp"); + m4_warnx("Too few arguments to regexp"); return; } /* special gnu case */ @@ -615,7 +634,7 @@ void doesyscmd(const char *cmd) { int p[2]; - pid_t pid, cpid; + pid_t cpid; char *argv[4]; int cc; int status; @@ -653,8 +672,10 @@ doesyscmd(const char *cmd) } while (cc > 0 || (cc == -1 && errno == EINTR)); (void) close(p[0]); - while ((pid = wait(&status)) != cpid && pid >= 0) - continue; + while (waitpid(cpid, &status, 0) == -1) { + if (errno != EINTR) + break; + } pbstr(getstring()); } } Modified: stable/12/usr.bin/m4/m4.1 ============================================================================== --- stable/12/usr.bin/m4/m4.1 Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/m4.1 Fri Sep 13 07:10:50 2019 (r352277) @@ -1,5 +1,5 @@ .\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $ -.\" @(#) $OpenBSD: m4.1,v 1.63 2015/09/14 20:06:58 schwarze Exp $ +.\" @(#) $OpenBSD: m4.1,v 1.64 2017/06/15 13:48:42 bcallah Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd $Mdocdate: September 14 2015 $ +.Dd $Mdocdate: June 15 2017 $ .Dt M4 1 .Os .Sh NAME @@ -41,7 +41,7 @@ .Nd macro language processor .Sh SYNOPSIS .Nm -.Op Fl gPs +.Op Fl EgPs .Oo .Sm off .Fl D Ar name Op No = Ar value @@ -130,6 +130,21 @@ turn on all options. .Pp By default, trace is set to .Qq eq . +.It Fl E +Set warnings to be fatal. +When a single +.Fl E +flag is specified, if warnings are issued, execution +continues but +.Nm +will exit with a non-zero exit status. +When multiple +.Fl E +flags are specified, execution will halt upon issuing the +first warning and +.Nm +will exit with a non-zero exit status. +This behaviour matches GNU-m4 1.4.9 and later. .It Fl g Activate GNU-m4 compatibility mode. In this mode, translit handles simple character @@ -437,7 +452,9 @@ Returns the current file's name. .Pp But note that the .Ic m4exit -macro can modify the exit status. +macro can modify the exit status, as can the +.Fl E +flag. .Sh STANDARDS The .Nm @@ -446,7 +463,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl dgIPot +.Op Fl dEgIPot and the macros .Ic builtin , .Ic esyscmd , Modified: stable/12/usr.bin/m4/main.c ============================================================================== --- stable/12/usr.bin/m4/main.c Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/main.c Fri Sep 13 07:10:50 2019 (r352277) @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.86 2015/11/03 16:21:47 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.87 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -81,6 +81,8 @@ char scommt[MAXCCHARS+1] = {SCOMMT}; /* start characte char ecommt[MAXCCHARS+1] = {ECOMMT}; /* end character for comment */ int synch_lines = 0; /* line synchronisation for C preprocessor */ int prefix_builtins = 0; /* -P option to prefix builtin keywords */ +int error_warns = 0; /* -E option to make warnings exit_code = 1 */ +int fatal_warns = 0; /* -E -E option to make warnings fatal */ struct keyblk { const char *knam; /* keyword name */ @@ -186,7 +188,7 @@ main(int argc, char *argv[]) outfile = NULL; resizedivs(MAXOUT); - while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1) + while ((c = getopt(argc, argv, "gst:d:D:EU:o:I:P")) != -1) switch(c) { case 'D': /* define something..*/ @@ -196,6 +198,12 @@ main(int argc, char *argv[]) if (*p) *p++ = EOS; dodefine(optarg, p); + break; + case 'E': /* like GNU m4 1.4.9+ */ + if (error_warns == 0) + error_warns = 1; + else + fatal_warns = 1; break; case 'I': addtoincludepath(optarg); Modified: stable/12/usr.bin/m4/misc.c ============================================================================== --- stable/12/usr.bin/m4/misc.c Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/misc.c Fri Sep 13 07:10:50 2019 (r352277) @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.46 2015/12/07 14:12:46 espie Exp $ */ +/* $OpenBSD: misc.c,v 1.47 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /*- @@ -386,7 +386,7 @@ xstrdup(const char *s) void usage(void) { - fprintf(stderr, "usage: m4 [-gPs] [-Dname[=value]] [-d flags] " + fprintf(stderr, "usage: m4 [-EgPs] [-Dname[=value]] [-d flags] " "[-I dirname] [-o filename]\n" "\t[-t macro] [-Uname] [file ...]\n"); exit(1); Modified: stable/12/usr.bin/m4/tokenizer.l ============================================================================== --- stable/12/usr.bin/m4/tokenizer.l Fri Sep 13 07:08:43 2019 (r352276) +++ stable/12/usr.bin/m4/tokenizer.l Fri Sep 13 07:10:50 2019 (r352277) @@ -1,6 +1,6 @@ %option nounput noinput %{ -/* $OpenBSD: tokenizer.l,v 1.8 2012/04/12 17:00:11 espie Exp $ */ +/* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ /* * Copyright (c) 2004 Marc Espie * @@ -25,6 +25,7 @@ #include #include +extern void m4_warnx(const char *, ...); extern int mimic_gnu; extern int32_t yylval; @@ -42,6 +43,8 @@ oct 0[0-7]* dec [1-9][0-9]* radix 0[rR][0-9]+:[0-9a-zA-Z]+ +%option noyywrap + %% {ws} {/* just skip it */} {hex}|{oct}|{dec} { yylval = number(); return(NUMBER); } @@ -72,7 +75,7 @@ number(void) l = strtol(yytext, NULL, 0); if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || l > INT32_MAX || l < INT32_MIN) { - fprintf(stderr, "m4: numeric overflow in expr: %s\n", yytext); + m4_warnx("numeric overflow in expr: %s", yytext); } return l; } @@ -88,7 +91,7 @@ parse_radix(void) l = 0; base = strtol(yytext+2, &next, 0); if (base > 36 || next == NULL) { - fprintf(stderr, "m4: error in number %s\n", yytext); + m4_warnx("error in number %s", yytext); } else { next++; while (*next != 0) { @@ -101,8 +104,7 @@ parse_radix(void) d = *next - 'A' + 10; } if (d >= base) { - fprintf(stderr, - "m4: error in number %s\n", yytext); + m4_warnx("error in number %s", yytext); return 0; } l = base * l + d; From owner-svn-src-stable@freebsd.org Fri Sep 13 07:15: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 14152E884D; Fri, 13 Sep 2019 07:15:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6P06hJBz4Gdh; Fri, 13 Sep 2019 07:15:48 +0000 (UTC) (envelope-from bapt@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 C8A4239A7; Fri, 13 Sep 2019 07:15:48 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7FmdT054527; Fri, 13 Sep 2019 07:15:48 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7Fm7x054526; Fri, 13 Sep 2019 07:15:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130715.x8D7Fm7x054526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:15:48 +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: r352278 - stable/12/share/man/man7 X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/share/man/man7 X-SVN-Commit-Revision: 352278 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, 13 Sep 2019 07:15:49 -0000 Author: bapt Date: Fri Sep 13 07:15:48 2019 New Revision: 352278 URL: https://svnweb.freebsd.org/changeset/base/352278 Log: MFC r352126: Remove reference to mklocale regarding the nls directory mklocale never had anything to do with the content of this directory Modified: stable/12/share/man/man7/hier.7 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man7/hier.7 ============================================================================== --- stable/12/share/man/man7/hier.7 Fri Sep 13 07:10:50 2019 (r352277) +++ stable/12/share/man/man7/hier.7 Fri Sep 13 07:15:48 2019 (r352278) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd June 18, 2018 +.Dd September 10, 2019 .Dt HIER 7 .Os .Sh NAME @@ -529,9 +529,7 @@ templates for make; see .Xr make 1 .It Pa nls/ -national language support files; -see -.Xr mklocale 1 +national language support files .It Pa security/ data files for security policies such as .Xr mac_lomac 4 From owner-svn-src-stable@freebsd.org Fri Sep 13 07:18: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 1F709E8949; Fri, 13 Sep 2019 07:18:34 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6S9753Kz4Gmh; Fri, 13 Sep 2019 07:18:33 +0000 (UTC) (envelope-from bapt@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 D156139A8; Fri, 13 Sep 2019 07:18:33 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7IX5r054694; Fri, 13 Sep 2019 07:18:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7IX63054691; Fri, 13 Sep 2019 07:18:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130718.x8D7IX63054691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:18: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: r352279 - stable/12/lib/libc/locale X-SVN-Group: stable-12 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/12/lib/libc/locale X-SVN-Commit-Revision: 352279 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, 13 Sep 2019 07:18:34 -0000 Author: bapt Date: Fri Sep 13 07:18:32 2019 New Revision: 352279 URL: https://svnweb.freebsd.org/changeset/base/352279 Log: MFC r352127: In FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1) tools to generate the locales data. state it in the libc manpages. Modified: stable/12/lib/libc/locale/euc.5 stable/12/lib/libc/locale/multibyte.3 stable/12/lib/libc/locale/setlocale.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/locale/euc.5 ============================================================================== --- stable/12/lib/libc/locale/euc.5 Fri Sep 13 07:15:48 2019 (r352278) +++ stable/12/lib/libc/locale/euc.5 Fri Sep 13 07:18:32 2019 (r352279) @@ -31,7 +31,7 @@ .\" @(#)euc.4 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 8, 2003 +.Dd September 9, 2019 .Dt EUC 5 .Os .Sh NAME @@ -58,7 +58,7 @@ .\".Ux .\"based systems. .\"See -.\".Xr mklocale 1 +.\".Xr localedef 1 .\"for a complete description of the .\".Ev LC_CTYPE .\"source file format. @@ -130,5 +130,5 @@ Notice that the global is set to 0x8080, this implies that from those 2 bits the codeset can be determined. .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 Modified: stable/12/lib/libc/locale/multibyte.3 ============================================================================== --- stable/12/lib/libc/locale/multibyte.3 Fri Sep 13 07:15:48 2019 (r352278) +++ stable/12/lib/libc/locale/multibyte.3 Fri Sep 13 07:18:32 2019 (r352279) @@ -32,7 +32,7 @@ .\" @(#)multibyte.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 8, 2004 +.Dd September 9, 2019 .Dt MULTIBYTE 3 .Os .Sh NAME @@ -127,7 +127,7 @@ multibyte characters: .It Xr wctomb 3 Ta "convert a wide-character code to a character" .El .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 , .Xr stdio 3 , .Xr big5 5 , Modified: stable/12/lib/libc/locale/setlocale.3 ============================================================================== --- stable/12/lib/libc/locale/setlocale.3 Fri Sep 13 07:15:48 2019 (r352278) +++ stable/12/lib/libc/locale/setlocale.3 Fri Sep 13 07:18:32 2019 (r352279) @@ -31,7 +31,7 @@ .\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 21, 2003 +.Dd September 9, 2019 .Dt SETLOCALE 3 .Os .Sh NAME @@ -150,8 +150,7 @@ and the category .Sh ERRORS No errors are defined. .Sh SEE ALSO -.Xr colldef 1 , -.Xr mklocale 1 , +.Xr localedef 1 , .Xr catopen 3 , .Xr ctype 3 , .Xr localeconv 3 , From owner-svn-src-stable@freebsd.org Fri Sep 13 07:21: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 DCE1BE8A07; Fri, 13 Sep 2019 07:21:09 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6W95YBvz4H6d; Fri, 13 Sep 2019 07:21:09 +0000 (UTC) (envelope-from bapt@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 883E23B74; Fri, 13 Sep 2019 07:21:09 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7L9tX054894; Fri, 13 Sep 2019 07:21:09 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7L6DC054878; Fri, 13 Sep 2019 07:21:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130721.x8D7L6DC054878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:21:06 +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: r352280 - in stable/11: sbin/devd usr.sbin/apmd usr.sbin/config usr.sbin/ctld usr.sbin/jail usr.sbin/kbdcontrol usr.sbin/ndiscvt usr.sbin/rrenumd X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in stable/11: sbin/devd usr.sbin/apmd usr.sbin/config usr.sbin/ctld usr.sbin/jail usr.sbin/kbdcontrol usr.sbin/ndiscvt usr.sbin/rrenumd X-SVN-Commit-Revision: 352280 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, 13 Sep 2019 07:21:09 -0000 Author: bapt Date: Fri Sep 13 07:21:06 2019 New Revision: 352280 URL: https://svnweb.freebsd.org/changeset/base/352280 Log: MFC r352119-r352124, r352130 Stop linking to libl by specifying we do not need yywrap Modified: stable/11/sbin/devd/Makefile stable/11/sbin/devd/token.l stable/11/usr.sbin/apmd/Makefile stable/11/usr.sbin/apmd/apmdlex.l stable/11/usr.sbin/config/Makefile stable/11/usr.sbin/ctld/Makefile stable/11/usr.sbin/ctld/token.l stable/11/usr.sbin/jail/Makefile stable/11/usr.sbin/jail/jaillex.l stable/11/usr.sbin/kbdcontrol/Makefile stable/11/usr.sbin/kbdcontrol/lex.l stable/11/usr.sbin/ndiscvt/Makefile stable/11/usr.sbin/ndiscvt/inf-token.l stable/11/usr.sbin/rrenumd/Makefile stable/11/usr.sbin/rrenumd/lexer.l Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/devd/Makefile ============================================================================== --- stable/11/sbin/devd/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/sbin/devd/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -11,7 +11,7 @@ WARNS?= 3 NO_SHARED?=YES -LIBADD= l util +LIBADD= util YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} Modified: stable/11/sbin/devd/token.l ============================================================================== --- stable/11/sbin/devd/token.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/sbin/devd/token.l Fri Sep 13 07:21:06 2019 (r352280) @@ -50,6 +50,7 @@ update_lineno(const char *cp) %} +%option noyywrap %option nounput %option noinput Modified: stable/11/usr.sbin/apmd/Makefile ============================================================================== --- stable/11/usr.sbin/apmd/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/apmd/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -9,8 +9,6 @@ PACKAGE=apm WARNS?= 3 -LIBADD= l - CFLAGS+= -I${.CURDIR} test: Modified: stable/11/usr.sbin/apmd/apmdlex.l ============================================================================== --- stable/11/usr.sbin/apmd/apmdlex.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/apmd/apmdlex.l Fri Sep 13 07:21:06 2019 (r352280) @@ -44,6 +44,7 @@ int first_time; %} /* We don't need it, avoid the warning. */ +%option noyywrap %option nounput %option noinput Modified: stable/11/usr.sbin/config/Makefile ============================================================================== --- stable/11/usr.sbin/config/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/config/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= -LIBADD= l nv sbuf +LIBADD= nv sbuf CLEANFILES+= kernconf.c Modified: stable/11/usr.sbin/ctld/Makefile ============================================================================== --- stable/11/usr.sbin/ctld/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/ctld/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -15,7 +15,7 @@ CFLAGS+= -I${SRCTOP}/sys/dev/iscsi #CFLAGS+= -DICL_KERNEL_PROXY MAN= ctld.8 ctl.conf.5 -LIBADD= bsdxml l md sbuf util ucl m +LIBADD= bsdxml md sbuf util ucl m YFLAGS+= -v CLEANFILES= y.tab.c y.tab.h y.output Modified: stable/11/usr.sbin/ctld/token.l ============================================================================== --- stable/11/usr.sbin/ctld/token.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/ctld/token.l Fri Sep 13 07:21:06 2019 (r352280) @@ -45,6 +45,7 @@ extern int yylex(void); %} +%option noyywrap %option noinput %option nounput Modified: stable/11/usr.sbin/jail/Makefile ============================================================================== --- stable/11/usr.sbin/jail/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/jail/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -6,7 +6,7 @@ PROG= jail MAN= jail.8 jail.conf.5 SRCS= jail.c command.c config.c state.c jailp.h jaillex.l jailparse.y y.tab.h -LIBADD= jail kvm util l +LIBADD= jail kvm util PACKAGE=jail Modified: stable/11/usr.sbin/jail/jaillex.l ============================================================================== --- stable/11/usr.sbin/jail/jaillex.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/jail/jaillex.l Fri Sep 13 07:21:06 2019 (r352280) @@ -48,6 +48,7 @@ static int lineno = 1; #define YY_DECL int yylex(void) %} +%option noyywrap %option noinput %option nounput Modified: stable/11/usr.sbin/kbdcontrol/Makefile ============================================================================== --- stable/11/usr.sbin/kbdcontrol/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/kbdcontrol/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -8,6 +8,4 @@ SRCS= kbdcontrol.c lex.l WARNS?= 4 CFLAGS+= -I${.CURDIR} -LIBADD= l - .include Modified: stable/11/usr.sbin/kbdcontrol/lex.l ============================================================================== --- stable/11/usr.sbin/kbdcontrol/lex.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/kbdcontrol/lex.l Fri Sep 13 07:21:06 2019 (r352280) @@ -36,6 +36,7 @@ %} +%option noyywrap %option nounput %option noinput Modified: stable/11/usr.sbin/ndiscvt/Makefile ============================================================================== --- stable/11/usr.sbin/ndiscvt/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/ndiscvt/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -13,8 +13,6 @@ MAN+= ndisgen.8 WARNS?= 4 NO_WCAST_ALIGN= -LIBADD= l - YFLAGS+=-v CFLAGS+=-I. -I${.CURDIR} -I${SRCTOP}/sys Modified: stable/11/usr.sbin/ndiscvt/inf-token.l ============================================================================== --- stable/11/usr.sbin/ndiscvt/inf-token.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/ndiscvt/inf-token.l Fri Sep 13 07:21:06 2019 (r352280) @@ -57,6 +57,7 @@ update_lineno(const char *cp) %} +%option noyywrap %option nounput %option noinput Modified: stable/11/usr.sbin/rrenumd/Makefile ============================================================================== --- stable/11/usr.sbin/rrenumd/Makefile Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/rrenumd/Makefile Fri Sep 13 07:21:06 2019 (r352280) @@ -23,7 +23,7 @@ YFLAGS= -d WARNS?= 2 -LIBADD= ipsec l y +LIBADD= ipsec CLEANFILES= y.tab.h SRCS+= y.tab.h Modified: stable/11/usr.sbin/rrenumd/lexer.l ============================================================================== --- stable/11/usr.sbin/rrenumd/lexer.l Fri Sep 13 07:18:32 2019 (r352279) +++ stable/11/usr.sbin/rrenumd/lexer.l Fri Sep 13 07:21:06 2019 (r352280) @@ -58,6 +58,7 @@ void yyerror(const char *); int yylex(void); %} +%option noyywrap %option nounput /* common section */ From owner-svn-src-stable@freebsd.org Fri Sep 13 07:22: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 7F4CCE8C43; Fri, 13 Sep 2019 07:22:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6XM2s5Tz4HNc; Fri, 13 Sep 2019 07:22:11 +0000 (UTC) (envelope-from bapt@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 2D0DD3BE2; Fri, 13 Sep 2019 07:22:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7MACk060584; Fri, 13 Sep 2019 07:22:10 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7M9Lv060575; Fri, 13 Sep 2019 07:22:09 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130722.x8D7M9Lv060575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:22:09 +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: r352281 - stable/11/usr.bin/m4 X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/usr.bin/m4 X-SVN-Commit-Revision: 352281 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, 13 Sep 2019 07:22:11 -0000 Author: bapt Date: Fri Sep 13 07:22:09 2019 New Revision: 352281 URL: https://svnweb.freebsd.org/changeset/base/352281 Log: MFC r352065-r352070 Sync with OpenBSD, in particular this adds support for -E flags (GNU compatibility) Modified: stable/11/usr.bin/m4/Makefile stable/11/usr.bin/m4/eval.c stable/11/usr.bin/m4/extern.h stable/11/usr.bin/m4/gnum4.c stable/11/usr.bin/m4/m4.1 stable/11/usr.bin/m4/main.c stable/11/usr.bin/m4/misc.c stable/11/usr.bin/m4/tokenizer.l Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/m4/Makefile ============================================================================== --- stable/11/usr.bin/m4/Makefile Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/Makefile Fri Sep 13 07:22:09 2019 (r352281) @@ -8,7 +8,7 @@ PROG= m4 CFLAGS+=-DEXTENDED -I${.CURDIR} -I${SRCTOP}/lib/libopenbsd -LIBADD= y l m openbsd +LIBADD= m openbsd NO_WMISSING_VARIABLE_DECLARATIONS= Modified: stable/11/usr.bin/m4/eval.c ============================================================================== --- stable/11/usr.bin/m4/eval.c Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/eval.c Fri Sep 13 07:22:09 2019 (r352281) @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.74 2015/02/05 12:59:57 millert Exp $ */ +/* $OpenBSD: eval.c,v 1.78 2019/06/28 05:35:34 deraadt Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -124,6 +124,7 @@ void expand_builtin(const char *argv[], int argc, int td) { int c, n; + const char *errstr; int ac; static int sysval = 0; @@ -184,13 +185,15 @@ expand_builtin(const char *argv[], int argc, int td) if (argc > 3) { base = strtonum(argv[3], 2, 36, &errstr); if (errstr) { - m4errx(1, "expr: base %s invalid.", argv[3]); + m4errx(1, "expr: base is %s: %s.", + errstr, argv[3]); } } if (argc > 4) { maxdigits = strtonum(argv[4], 0, INT_MAX, &errstr); if (errstr) { - m4errx(1, "expr: maxdigits %s invalid.", argv[4]); + m4errx(1, "expr: maxdigits is %s: %s.", + errstr, argv[4]); } } if (argc > 2) @@ -199,8 +202,7 @@ expand_builtin(const char *argv[], int argc, int td) } case IFELTYPE: - if (argc > 4) - doifelse(argv, argc); + doifelse(argv, argc); break; case IFDFTYPE: @@ -230,8 +232,13 @@ expand_builtin(const char *argv[], int argc, int td) * doincr - increment the value of the * argument */ - if (argc > 2) - pbnum(atoi(argv[2]) + 1); + if (argc > 2) { + n = strtonum(argv[2], INT_MIN, INT_MAX-1, &errstr); + if (errstr != NULL) + m4errx(1, "incr: argument is %s: %s.", + errstr, argv[2]); + pbnum(n + 1); + } break; case DECRTYPE: @@ -239,8 +246,13 @@ expand_builtin(const char *argv[], int argc, int td) * dodecr - decrement the value of the * argument */ - if (argc > 2) - pbnum(atoi(argv[2]) - 1); + if (argc > 2) { + n = strtonum(argv[2], INT_MIN+1, INT_MAX, &errstr); + if (errstr) + m4errx(1, "decr: argument is %s: %s.", + errstr, argv[2]); + pbnum(n - 1); + } break; case SYSCTYPE: @@ -273,6 +285,10 @@ expand_builtin(const char *argv[], int argc, int td) warn("%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); exit_code = 1; + if (fatal_warns) { + killdiv(); + exit(exit_code); + } } else err(1, "%s at line %lu: include(%s)", CURRENT_NAME, CURRENT_LINE, argv[2]); @@ -337,12 +353,18 @@ expand_builtin(const char *argv[], int argc, int td) break; case DIVRTYPE: - if (argc > 2 && (n = atoi(argv[2])) != 0) - dodiv(n); - else { - active = stdout; - oindex = 0; + if (argc > 2) { + n = strtonum(argv[2], INT_MIN, INT_MAX, &errstr); + if (errstr) + m4errx(1, "divert: argument is %s: %s.", + errstr, argv[2]); + if (n != 0) { + dodiv(n); + break; + } } + active = stdout; + oindex = 0; break; case UNDVTYPE: @@ -689,17 +711,17 @@ dotrace(const char *argv[], int argc, int on) static void doifelse(const char *argv[], int argc) { - cycle { - if (STREQ(argv[2], argv[3])) + while (argc > 4) { + if (STREQ(argv[2], argv[3])) { pbstr(argv[4]); - else if (argc == 6) + break; + } else if (argc == 6) { pbstr(argv[5]); - else if (argc > 6) { + break; + } else { argv += 3; argc -= 3; - continue; } - break; } } @@ -822,7 +844,7 @@ dodiv(int n) if (outfile[n] == NULL) { char fname[] = _PATH_DIVNAME; - if ((fd = mkstemp(fname)) < 0 || + if ((fd = mkstemp(fname)) == -1 || unlink(fname) == -1 || (outfile[n] = fdopen(fd, "w+")) == NULL) err(1, "%s: cannot divert", fname); Modified: stable/11/usr.bin/m4/extern.h ============================================================================== --- stable/11/usr.bin/m4/extern.h Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/extern.h Fri Sep 13 07:22:09 2019 (r352281) @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.54 2014/05/12 19:11:19 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.55 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- @@ -59,6 +59,8 @@ extern void doesyscmd(const char *); extern void getdivfile(const char *); extern void doformat(const char *[], int); +extern void m4_warnx(const char *, ...); + /* look.c */ #define FLAG_UNTRACED 0 @@ -176,4 +178,5 @@ extern int synch_lines; /* line synchronisation direc extern int mimic_gnu; /* behaves like gnu-m4 */ extern int prefix_builtins; /* prefix builtin macros with m4_ */ - +extern int error_warns; /* make warnings cause exit_code = 1 */ +extern int fatal_warns; /* make warnings fatal */ Modified: stable/11/usr.bin/m4/gnum4.c ============================================================================== --- stable/11/usr.bin/m4/gnum4.c Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/gnum4.c Fri Sep 13 07:22:09 2019 (r352281) @@ -1,4 +1,4 @@ -/* $OpenBSD: gnum4.c,v 1.50 2015/04/29 00:13:26 millert Exp $ */ +/* $OpenBSD: gnum4.c,v 1.52 2017/08/21 21:41:13 deraadt Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -259,11 +260,29 @@ exit_regerror(int er, regex_t *re, const char *source) m4errx(1, "regular expression error in %s: %s.", source, errbuf); } +/* warnx() plus check to see if we need to change exit code or exit . + * -E flag functionality. + */ +void +m4_warnx(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + warnx(fmt, ap); + va_end(ap); + + if (fatal_warns) + exit(1); + if (error_warns) + exit_code = 1; +} + static void add_sub(int n, const char *string, regex_t *re, regmatch_t *pm) { if (n > (int)re->re_nsub) - warnx("No subexpression %d", n); + m4_warnx("No subexpression %d", n); /* Subexpressions that did not match are * not an error. */ else if (pm[n].rm_so != -1 && @@ -446,7 +465,7 @@ void dopatsubst(const char *argv[], int argc) { if (argc <= 3) { - warnx("Too few arguments to patsubst"); + m4_warnx("Too few arguments to patsubst"); return; } /* special case: empty regexp */ @@ -498,7 +517,7 @@ doregexp(const char *argv[], int argc) const char *source; if (argc <= 3) { - warnx("Too few arguments to regexp"); + m4_warnx("Too few arguments to regexp"); return; } /* special gnu case */ @@ -615,7 +634,7 @@ void doesyscmd(const char *cmd) { int p[2]; - pid_t pid, cpid; + pid_t cpid; char *argv[4]; int cc; int status; @@ -653,8 +672,10 @@ doesyscmd(const char *cmd) } while (cc > 0 || (cc == -1 && errno == EINTR)); (void) close(p[0]); - while ((pid = wait(&status)) != cpid && pid >= 0) - continue; + while (waitpid(cpid, &status, 0) == -1) { + if (errno != EINTR) + break; + } pbstr(getstring()); } } Modified: stable/11/usr.bin/m4/m4.1 ============================================================================== --- stable/11/usr.bin/m4/m4.1 Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/m4.1 Fri Sep 13 07:22:09 2019 (r352281) @@ -1,5 +1,5 @@ .\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $ -.\" @(#) $OpenBSD: m4.1,v 1.63 2015/09/14 20:06:58 schwarze Exp $ +.\" @(#) $OpenBSD: m4.1,v 1.64 2017/06/15 13:48:42 bcallah Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd $Mdocdate: September 14 2015 $ +.Dd $Mdocdate: June 15 2017 $ .Dt M4 1 .Os .Sh NAME @@ -41,7 +41,7 @@ .Nd macro language processor .Sh SYNOPSIS .Nm -.Op Fl gPs +.Op Fl EgPs .Oo .Sm off .Fl D Ar name Op No = Ar value @@ -130,6 +130,21 @@ turn on all options. .Pp By default, trace is set to .Qq eq . +.It Fl E +Set warnings to be fatal. +When a single +.Fl E +flag is specified, if warnings are issued, execution +continues but +.Nm +will exit with a non-zero exit status. +When multiple +.Fl E +flags are specified, execution will halt upon issuing the +first warning and +.Nm +will exit with a non-zero exit status. +This behaviour matches GNU-m4 1.4.9 and later. .It Fl g Activate GNU-m4 compatibility mode. In this mode, translit handles simple character @@ -437,7 +452,9 @@ Returns the current file's name. .Pp But note that the .Ic m4exit -macro can modify the exit status. +macro can modify the exit status, as can the +.Fl E +flag. .Sh STANDARDS The .Nm @@ -446,7 +463,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl dgIPot +.Op Fl dEgIPot and the macros .Ic builtin , .Ic esyscmd , Modified: stable/11/usr.bin/m4/main.c ============================================================================== --- stable/11/usr.bin/m4/main.c Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/main.c Fri Sep 13 07:22:09 2019 (r352281) @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.86 2015/11/03 16:21:47 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.87 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: main.c,v 1.12 1997/02/08 23:54:49 cgd Exp $ */ /*- @@ -79,6 +79,8 @@ char scommt[MAXCCHARS+1] = {SCOMMT}; /* start characte char ecommt[MAXCCHARS+1] = {ECOMMT}; /* end character for comment */ int synch_lines = 0; /* line synchronisation for C preprocessor */ int prefix_builtins = 0; /* -P option to prefix builtin keywords */ +int error_warns = 0; /* -E option to make warnings exit_code = 1 */ +int fatal_warns = 0; /* -E -E option to make warnings fatal */ struct keyblk { const char *knam; /* keyword name */ @@ -184,7 +186,7 @@ main(int argc, char *argv[]) outfile = NULL; resizedivs(MAXOUT); - while ((c = getopt(argc, argv, "gst:d:D:U:o:I:P")) != -1) + while ((c = getopt(argc, argv, "gst:d:D:EU:o:I:P")) != -1) switch(c) { case 'D': /* define something..*/ @@ -194,6 +196,12 @@ main(int argc, char *argv[]) if (*p) *p++ = EOS; dodefine(optarg, p); + break; + case 'E': /* like GNU m4 1.4.9+ */ + if (error_warns == 0) + error_warns = 1; + else + fatal_warns = 1; break; case 'I': addtoincludepath(optarg); Modified: stable/11/usr.bin/m4/misc.c ============================================================================== --- stable/11/usr.bin/m4/misc.c Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/misc.c Fri Sep 13 07:22:09 2019 (r352281) @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.46 2015/12/07 14:12:46 espie Exp $ */ +/* $OpenBSD: misc.c,v 1.47 2017/06/15 13:48:42 bcallah Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* @@ -384,7 +384,7 @@ xstrdup(const char *s) void usage(void) { - fprintf(stderr, "usage: m4 [-gPs] [-Dname[=value]] [-d flags] " + fprintf(stderr, "usage: m4 [-EgPs] [-Dname[=value]] [-d flags] " "[-I dirname] [-o filename]\n" "\t[-t macro] [-Uname] [file ...]\n"); exit(1); Modified: stable/11/usr.bin/m4/tokenizer.l ============================================================================== --- stable/11/usr.bin/m4/tokenizer.l Fri Sep 13 07:21:06 2019 (r352280) +++ stable/11/usr.bin/m4/tokenizer.l Fri Sep 13 07:22:09 2019 (r352281) @@ -1,6 +1,6 @@ %option nounput noinput %{ -/* $OpenBSD: tokenizer.l,v 1.8 2012/04/12 17:00:11 espie Exp $ */ +/* $OpenBSD: tokenizer.l,v 1.9 2017/06/15 13:48:42 bcallah Exp $ */ /* * Copyright (c) 2004 Marc Espie * @@ -25,6 +25,7 @@ #include #include +extern void m4_warnx(const char *, ...); extern int mimic_gnu; extern int32_t yylval; @@ -42,6 +43,8 @@ oct 0[0-7]* dec [1-9][0-9]* radix 0[rR][0-9]+:[0-9a-zA-Z]+ +%option noyywrap + %% {ws} {/* just skip it */} {hex}|{oct}|{dec} { yylval = number(); return(NUMBER); } @@ -72,7 +75,7 @@ number(void) l = strtol(yytext, NULL, 0); if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || l > INT32_MAX || l < INT32_MIN) { - fprintf(stderr, "m4: numeric overflow in expr: %s\n", yytext); + m4_warnx("numeric overflow in expr: %s", yytext); } return l; } @@ -88,7 +91,7 @@ parse_radix(void) l = 0; base = strtol(yytext+2, &next, 0); if (base > 36 || next == NULL) { - fprintf(stderr, "m4: error in number %s\n", yytext); + m4_warnx("error in number %s", yytext); } else { next++; while (*next != 0) { @@ -101,8 +104,7 @@ parse_radix(void) d = *next - 'A' + 10; } if (d >= base) { - fprintf(stderr, - "m4: error in number %s\n", yytext); + m4_warnx("error in number %s", yytext); return 0; } l = base * l + d; From owner-svn-src-stable@freebsd.org Fri Sep 13 07:23:47 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 75607E8D4D; Fri, 13 Sep 2019 07:23:47 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6ZC2Z5pz4HXK; Fri, 13 Sep 2019 07:23:47 +0000 (UTC) (envelope-from bapt@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 3BE813C02; Fri, 13 Sep 2019 07:23:47 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7NlGk060687; Fri, 13 Sep 2019 07:23:47 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7NlFq060686; Fri, 13 Sep 2019 07:23:47 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130723.x8D7NlFq060686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:23:47 +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: r352282 - stable/11/share/man/man7 X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/share/man/man7 X-SVN-Commit-Revision: 352282 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, 13 Sep 2019 07:23:47 -0000 Author: bapt Date: Fri Sep 13 07:23:46 2019 New Revision: 352282 URL: https://svnweb.freebsd.org/changeset/base/352282 Log: MFC r352126: Remove reference to mklocale regarding the nls directory mklocale never had anything to do with the content of this directory Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Fri Sep 13 07:22:09 2019 (r352281) +++ stable/11/share/man/man7/hier.7 Fri Sep 13 07:23:46 2019 (r352282) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 11, 2018 +.Dd September 10, 2019 .Dt HIER 7 .Os .Sh NAME @@ -568,9 +568,7 @@ templates for make; see .Xr make 1 .It Pa nls/ -national language support files; -see -.Xr mklocale 1 +national language support files .It Pa security/ data files for security policies such as .Xr mac_lomac 4 From owner-svn-src-stable@freebsd.org Fri Sep 13 07:24: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 9840CE8DD2; Fri, 13 Sep 2019 07:24:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46V6b2351Lz4Hfd; Fri, 13 Sep 2019 07:24:30 +0000 (UTC) (envelope-from bapt@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 4E08C3C05; Fri, 13 Sep 2019 07:24:30 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8D7OUL0060766; Fri, 13 Sep 2019 07:24:30 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D7OTTo060764; Fri, 13 Sep 2019 07:24:29 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201909130724.x8D7OTTo060764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Sep 2019 07:24: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: r352283 - stable/11/lib/libc/locale X-SVN-Group: stable-11 X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: stable/11/lib/libc/locale X-SVN-Commit-Revision: 352283 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, 13 Sep 2019 07:24:30 -0000 Author: bapt Date: Fri Sep 13 07:24:29 2019 New Revision: 352283 URL: https://svnweb.freebsd.org/changeset/base/352283 Log: MFC r352127: In FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1) tools to generate the locales data. state it in the libc manpages. Modified: stable/11/lib/libc/locale/euc.5 stable/11/lib/libc/locale/multibyte.3 stable/11/lib/libc/locale/setlocale.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/locale/euc.5 ============================================================================== --- stable/11/lib/libc/locale/euc.5 Fri Sep 13 07:23:46 2019 (r352282) +++ stable/11/lib/libc/locale/euc.5 Fri Sep 13 07:24:29 2019 (r352283) @@ -31,7 +31,7 @@ .\" @(#)euc.4 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd November 8, 2003 +.Dd September 9, 2019 .Dt EUC 5 .Os .Sh NAME @@ -58,7 +58,7 @@ .\".Ux .\"based systems. .\"See -.\".Xr mklocale 1 +.\".Xr localedef 1 .\"for a complete description of the .\".Ev LC_CTYPE .\"source file format. @@ -130,5 +130,5 @@ Notice that the global is set to 0x8080, this implies that from those 2 bits the codeset can be determined. .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 Modified: stable/11/lib/libc/locale/multibyte.3 ============================================================================== --- stable/11/lib/libc/locale/multibyte.3 Fri Sep 13 07:23:46 2019 (r352282) +++ stable/11/lib/libc/locale/multibyte.3 Fri Sep 13 07:24:29 2019 (r352283) @@ -32,7 +32,7 @@ .\" @(#)multibyte.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 8, 2004 +.Dd September 9, 2019 .Dt MULTIBYTE 3 .Os .Sh NAME @@ -127,7 +127,7 @@ multibyte characters: .It Xr wctomb 3 Ta "convert a wide-character code to a character" .El .Sh SEE ALSO -.Xr mklocale 1 , +.Xr localedef 1 , .Xr setlocale 3 , .Xr stdio 3 , .Xr big5 5 , Modified: stable/11/lib/libc/locale/setlocale.3 ============================================================================== --- stable/11/lib/libc/locale/setlocale.3 Fri Sep 13 07:23:46 2019 (r352282) +++ stable/11/lib/libc/locale/setlocale.3 Fri Sep 13 07:24:29 2019 (r352283) @@ -31,7 +31,7 @@ .\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd November 21, 2003 +.Dd September 9, 2019 .Dt SETLOCALE 3 .Os .Sh NAME @@ -150,8 +150,7 @@ and the category .Sh ERRORS No errors are defined. .Sh SEE ALSO -.Xr colldef 1 , -.Xr mklocale 1 , +.Xr localedef 1 , .Xr catopen 3 , .Xr ctype 3 , .Xr localeconv 3 , From owner-svn-src-stable@freebsd.org Fri Sep 13 08:14:47 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 41A5BEA941; Fri, 13 Sep 2019 08:14:47 +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 46V7j30TGrz4Knn; Fri, 13 Sep 2019 08:14:47 +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 E453E4536; Fri, 13 Sep 2019 08:14:46 +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 x8D8Ekjv090163; Fri, 13 Sep 2019 08:14:46 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8D8EkPe090161; Fri, 13 Sep 2019 08:14:46 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909130814.x8D8EkPe090161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 13 Sep 2019 08:14:46 +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: r352284 - in stable/12/sys/netinet: . tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 352284 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, 13 Sep 2019 08:14:47 -0000 Author: tuexen Date: Fri Sep 13 08:14:46 2019 New Revision: 352284 URL: https://svnweb.freebsd.org/changeset/base/352284 Log: MFC r352072: Only update SACK/DSACK lists when a non-empty segment was received. This fixes hitting a KASSERT with a valid packet exchange. PR: 240471 Reviewed by: rrs@, Richard Scheffenegger Sponsored by: Neflix, Inc. Differential Revision: https://reviews.freebsd.org/D21567 Modified: stable/12/sys/netinet/tcp_input.c stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_input.c ============================================================================== --- stable/12/sys/netinet/tcp_input.c Fri Sep 13 07:24:29 2019 (r352283) +++ stable/12/sys/netinet/tcp_input.c Fri Sep 13 08:14:46 2019 (r352284) @@ -3065,9 +3065,8 @@ dodata: /* XXX */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } - if (tp->t_flags & TF_SACK_PERMIT) { - if (((tlen == 0) && (save_tlen > 0) && - (SEQ_LT(save_start, save_rnxt)))) { + if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0)) { + if ((tlen == 0) && (SEQ_LT(save_start, save_rnxt))) { /* * DSACK actually handled in the fastpath * above. @@ -3075,20 +3074,20 @@ dodata: /* XXX */ tcp_update_sack_list(tp, save_start, save_start + save_tlen); } else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) { - /* - * Cleaning sackblks by using zero length - * update. - */ if ((tp->rcv_numsacks >= 1) && (tp->sackblks[0].end == save_start)) { - /* partial overlap, recorded at todrop above */ - tcp_update_sack_list(tp, tp->sackblks[0].start, + /* + * Partial overlap, recorded at todrop + * above. + */ + tcp_update_sack_list(tp, + tp->sackblks[0].start, tp->sackblks[0].end); } else { tcp_update_dsack_list(tp, save_start, save_start + save_tlen); } - } else if ((tlen > 0) && (tlen >= save_tlen)) { + } else if (tlen >= save_tlen) { /* Update of sackblks. */ tcp_update_dsack_list(tp, save_start, save_start + save_tlen); Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Fri Sep 13 07:24:29 2019 (r352283) +++ stable/12/sys/netinet/tcp_stacks/rack.c Fri Sep 13 08:14:46 2019 (r352284) @@ -4883,35 +4883,36 @@ dodata: /* XXX */ thflags = tcp_reass(tp, th, &temp, &tlen, m); tp->t_flags |= TF_ACKNOW; } - if (((tlen == 0) && (save_tlen > 0) && - (SEQ_LT(save_start, save_rnxt)))) { - /* - * DSACK actually handled in the fastpath - * above. - */ - tcp_update_sack_list(tp, save_start, - save_start + save_tlen); - } else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) { - /* - * Cleaning sackblks by using zero length - * update. - */ - if ((tp->rcv_numsacks >= 1) && - (tp->sackblks[0].end == save_start)) { - /* partial overlap, recorded at todrop above */ - tcp_update_sack_list(tp, tp->sackblks[0].start, - tp->sackblks[0].end); - } else { + if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0)) { + if ((tlen == 0) && (SEQ_LT(save_start, save_rnxt))) { + /* + * DSACK actually handled in the fastpath + * above. + */ + tcp_update_sack_list(tp, save_start, + save_start + save_tlen); + } else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) { + if ((tp->rcv_numsacks >= 1) && + (tp->sackblks[0].end == save_start)) { + /* + * Partial overlap, recorded at todrop + * above. + */ + tcp_update_sack_list(tp, + tp->sackblks[0].start, + tp->sackblks[0].end); + } else { + tcp_update_dsack_list(tp, save_start, + save_start + save_tlen); + } + } else if (tlen >= save_tlen) { + /* Update of sackblks. */ tcp_update_dsack_list(tp, save_start, save_start + save_tlen); + } else if (tlen > 0) { + tcp_update_dsack_list(tp, save_start, + save_start + tlen); } - } else if ((tlen > 0) && (tlen >= save_tlen)) { - /* Update of sackblks. */ - tcp_update_dsack_list(tp, save_start, - save_start + save_tlen); - } else if (tlen > 0) { - tcp_update_dsack_list(tp, save_start, - save_start + tlen); } } else { m_freem(m); From owner-svn-src-stable@freebsd.org Fri Sep 13 14:42:38 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 809D7F3492; Fri, 13 Sep 2019 14:42:38 +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 46VJJZ3bx6z3FYv; Fri, 13 Sep 2019 14:42:38 +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 5EC448B2E; Fri, 13 Sep 2019 14:42:38 +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 x8DEgcMX026692; Fri, 13 Sep 2019 14:42:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DEgb84026689; Fri, 13 Sep 2019 14:42:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131442.x8DEgb84026689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 14:42: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: r352285 - in stable/12: sbin/camcontrol sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: sbin/camcontrol sys/cam/scsi X-SVN-Commit-Revision: 352285 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, 13 Sep 2019 14:42:38 -0000 Author: mav Date: Fri Sep 13 14:42:37 2019 New Revision: 352285 URL: https://svnweb.freebsd.org/changeset/base/352285 Log: MFC r352011: Supply SAT layer with valid transfer sizes. This is a rework of r344701, that noticed that number of bytes passes to 8 bit sector count field gets truncated. First decision was to not pass anything, since ATA specs define the field as N/A. But it appeared to be a problem for some SAT devices, that require information about data transfer to operate properly. Some additional investigation shown that it is quite a common practice to set unused fields of ATA commands (fortunately ATA specs formally allow it) to supply the information to SAT layer. I have found SAS-SATA interposer that does not allow pass-through without it. As side effect, reduce code duplication by removing ata_do_28bit_cmd() function, replacing it with more universal ata_do_cmd(). Modified: stable/12/sbin/camcontrol/camcontrol.c stable/12/sbin/camcontrol/fwdownload.c stable/12/sys/cam/scsi/scsi_all.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 08:14:46 2019 (r352284) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 14:42:37 2019 (r352285) @@ -1897,13 +1897,11 @@ ata_cam_send(struct cam_device *device, union ccb *ccb static int ata_do_pass_16(struct cam_device *device, union ccb *ccb, int retries, u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, - u_int8_t tag_action, u_int8_t command, u_int8_t features, - u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int8_t tag_action, u_int8_t command, u_int16_t features, + u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, int timeout, int quiet) { if (data_ptr != NULL) { - ata_flags |= AP_FLAG_BYT_BLOK_BYTES | - AP_FLAG_TLEN_SECT_CNT; if (flags & CAM_DIR_OUT) ata_flags |= AP_FLAG_TDIR_TO_DEV; else @@ -1954,44 +1952,10 @@ ata_try_pass_16(struct cam_device *device) } static int -ata_do_28bit_cmd(struct cam_device *device, union ccb *ccb, int retries, - u_int32_t flags, u_int8_t protocol, u_int8_t tag_action, - u_int8_t command, u_int8_t features, u_int32_t lba, - u_int8_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, - int timeout, int quiet) -{ - - - switch (ata_try_pass_16(device)) { - case -1: - return (1); - case 1: - /* Try using SCSI Passthrough */ - return ata_do_pass_16(device, ccb, retries, flags, protocol, - 0, tag_action, command, features, lba, - sector_count, data_ptr, dxfer_len, - timeout, quiet); - } - - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); - cam_fill_ataio(&ccb->ataio, - retries, - NULL, - flags, - tag_action, - data_ptr, - dxfer_len, - timeout); - - ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); - return ata_cam_send(device, ccb, quiet); -} - -static int ata_do_cmd(struct cam_device *device, union ccb *ccb, int retries, u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, - u_int8_t tag_action, u_int8_t command, u_int8_t features, - u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int8_t tag_action, u_int8_t command, u_int16_t features, + u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, int timeout, int force48bit) { int retval; @@ -2238,14 +2202,15 @@ atahpa_password(struct cam_device *device, int retry_c retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_SET_PWD, /*lba*/0, - /*sector_count*/0, + /*sector_count*/sizeof(*pwd) / 512, /*data_ptr*/(u_int8_t*)pwd, - /*dxfer_len*/sizeof(struct ata_set_max_pwd), + /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, is48bit); @@ -2305,14 +2270,15 @@ atahpa_unlock(struct cam_device *device, int retry_cou retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_UNLOCK, /*lba*/0, - /*sector_count*/0, + /*sector_count*/sizeof(*pwd) / 512, /*data_ptr*/(u_int8_t*)pwd, - /*dxfer_len*/sizeof(struct ata_set_max_pwd), + /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, is48bit); @@ -2482,45 +2448,32 @@ ata_do_identify(struct cam_device *device, int retry_c return (1); } - error = ata_do_28bit_cmd(device, - ccb, - /*retries*/retry_count, - /*flags*/CAM_DIR_IN, - /*protocol*/AP_PROTO_PIO_IN, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/command, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); +retry: + error = ata_do_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/command, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(struct ata_params) / 512, + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*force48bit*/0); if (error != 0) { - if (retry_command == 0) { - free(ptr); - return (1); + if (retry_command != 0) { + command = retry_command; + retry_command = 0; + goto retry; } - error = ata_do_28bit_cmd(device, - ccb, - /*retries*/retry_count, - /*flags*/CAM_DIR_IN, - /*protocol*/AP_PROTO_PIO_IN, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/retry_command, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/0); - - if (error != 0) { - free(ptr); - return (1); - } + free(ptr); + return (1); } ident_buf = (struct ata_params *)ptr; @@ -2708,20 +2661,21 @@ atasecurity_freeze(struct cam_device *device, union cc if (quiet == 0) atasecurity_notify(ATA_SECURITY_FREEZE_LOCK, NULL); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_FREEZE_LOCK, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_FREEZE_LOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*force48bit*/0); } static int @@ -2733,20 +2687,22 @@ atasecurity_unlock(struct cam_device *device, union cc if (quiet == 0) atasecurity_notify(ATA_SECURITY_UNLOCK, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_UNLOCK, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_UNLOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } static int @@ -2757,20 +2713,22 @@ atasecurity_disable(struct cam_device *device, union c if (quiet == 0) atasecurity_notify(ATA_SECURITY_DISABLE_PASSWORD, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_DISABLE_PASSWORD, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_DISABLE_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } @@ -2816,20 +2774,21 @@ atasecurity_erase(struct cam_device *device, union ccb if (quiet == 0) atasecurity_notify(ATA_SECURITY_ERASE_PREPARE, NULL); - error = ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_ERASE_PREPARE, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/timeout, - /*quiet*/0); + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_PREPARE, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*force48bit*/0); if (error != 0) return error; @@ -2837,20 +2796,22 @@ atasecurity_erase(struct cam_device *device, union ccb if (quiet == 0) atasecurity_notify(ATA_SECURITY_ERASE_UNIT, pwd); - error = ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_ERASE_UNIT, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/erase_timeout, - /*quiet*/0); + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_UNIT, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/erase_timeout, + /*force48bit*/0); if (error == 0 && quiet == 0) printf("\nErase Complete\n"); @@ -2867,20 +2828,22 @@ atasecurity_set_password(struct cam_device *device, un if (quiet == 0) atasecurity_notify(ATA_SECURITY_SET_PASSWORD, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_SET_PASSWORD, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_SET_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } static void @@ -9481,7 +9444,7 @@ atapm(struct cam_device *device, int argc, char **argv /*data_ptr*/NULL, /*dxfer_len*/0, /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); + /*force48bit*/0); cam_freeccb(ccb); @@ -9534,11 +9497,12 @@ ataaxm(struct cam_device *device, int argc, char **arg } } - retval = ata_do_28bit_cmd(device, + retval = ata_do_cmd(device, ccb, /*retries*/retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_SETFEATURES, /*features*/cmd, @@ -9547,7 +9511,7 @@ ataaxm(struct cam_device *device, int argc, char **arg /*data_ptr*/NULL, /*dxfer_len*/0, /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); + /*force48bit*/0); cam_freeccb(ccb); return (retval); Modified: stable/12/sbin/camcontrol/fwdownload.c ============================================================================== --- stable/12/sbin/camcontrol/fwdownload.c Fri Sep 13 08:14:46 2019 (r352284) +++ stable/12/sbin/camcontrol/fwdownload.c Fri Sep 13 14:42:37 2019 (r352285) @@ -701,11 +701,11 @@ fw_check_device_ready(struct cam_device *dev, camcontr /*flags*/ CAM_DIR_IN, /*tag_action*/ MSG_SIMPLE_Q_TAG, /*protocol*/ AP_PROTO_PIO_IN, - /*ata_flags*/ AP_FLAG_BYT_BLOK_BYTES | + /*ata_flags*/ AP_FLAG_BYT_BLOK_BLOCKS | AP_FLAG_TLEN_SECT_CNT | AP_FLAG_TDIR_FROM_DEV, /*features*/ 0, - /*sector_count*/ (uint8_t) dxfer_len, + /*sector_count*/ dxfer_len / 512, /*lba*/ 0, /*command*/ ATA_ATA_IDENTIFY, /*auxiliary*/ 0, Modified: stable/12/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.c Fri Sep 13 08:14:46 2019 (r352284) +++ stable/12/sys/cam/scsi/scsi_all.c Fri Sep 13 14:42:37 2019 (r352285) @@ -8281,10 +8281,10 @@ scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t r tag_action, /*protocol*/AP_PROTO_PIO_IN, /*ata_flags*/AP_FLAG_TDIR_FROM_DEV | - AP_FLAG_BYT_BLOK_BYTES | + AP_FLAG_BYT_BLOK_BLOCKS | AP_FLAG_TLEN_SECT_CNT, /*features*/0, - /*sector_count*/dxfer_len, + /*sector_count*/dxfer_len / 512, /*lba*/0, /*command*/ATA_ATA_IDENTIFY, /*device*/ 0, From owner-svn-src-stable@freebsd.org Fri Sep 13 14:43: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 D25DBF34F7; Fri, 13 Sep 2019 14:43:06 +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 46VJK65z4jz3Fjb; Fri, 13 Sep 2019 14:43:06 +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 AFF068B30; Fri, 13 Sep 2019 14:43:06 +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 x8DEh6qD026781; Fri, 13 Sep 2019 14:43:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DEh6Vv026778; Fri, 13 Sep 2019 14:43:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131443.x8DEh6Vv026778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 14:43:06 +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: r352286 - in stable/11: sbin/camcontrol sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11: sbin/camcontrol sys/cam/scsi X-SVN-Commit-Revision: 352286 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, 13 Sep 2019 14:43:06 -0000 Author: mav Date: Fri Sep 13 14:43:05 2019 New Revision: 352286 URL: https://svnweb.freebsd.org/changeset/base/352286 Log: Supply SAT layer with valid transfer sizes. This is a rework of r344701, that noticed that number of bytes passes to 8 bit sector count field gets truncated. First decision was to not pass anything, since ATA specs define the field as N/A. But it appeared to be a problem for some SAT devices, that require information about data transfer to operate properly. Some additional investigation shown that it is quite a common practice to set unused fields of ATA commands (fortunately ATA specs formally allow it) to supply the information to SAT layer. I have found SAS-SATA interposer that does not allow pass-through without it. As side effect, reduce code duplication by removing ata_do_28bit_cmd() function, replacing it with more universal ata_do_cmd(). Modified: stable/11/sbin/camcontrol/camcontrol.c stable/11/sbin/camcontrol/fwdownload.c stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 14:42:37 2019 (r352285) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 14:43:05 2019 (r352286) @@ -1730,13 +1730,11 @@ ata_cam_send(struct cam_device *device, union ccb *ccb static int ata_do_pass_16(struct cam_device *device, union ccb *ccb, int retries, u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, - u_int8_t tag_action, u_int8_t command, u_int8_t features, - u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int8_t tag_action, u_int8_t command, u_int16_t features, + u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, int timeout, int quiet) { if (data_ptr != NULL) { - ata_flags |= AP_FLAG_BYT_BLOK_BYTES | - AP_FLAG_TLEN_SECT_CNT; if (flags & CAM_DIR_OUT) ata_flags |= AP_FLAG_TDIR_TO_DEV; else @@ -1787,44 +1785,10 @@ ata_try_pass_16(struct cam_device *device) } static int -ata_do_28bit_cmd(struct cam_device *device, union ccb *ccb, int retries, - u_int32_t flags, u_int8_t protocol, u_int8_t tag_action, - u_int8_t command, u_int8_t features, u_int32_t lba, - u_int8_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, - int timeout, int quiet) -{ - - - switch (ata_try_pass_16(device)) { - case -1: - return (1); - case 1: - /* Try using SCSI Passthrough */ - return ata_do_pass_16(device, ccb, retries, flags, protocol, - 0, tag_action, command, features, lba, - sector_count, data_ptr, dxfer_len, - timeout, quiet); - } - - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); - cam_fill_ataio(&ccb->ataio, - retries, - NULL, - flags, - tag_action, - data_ptr, - dxfer_len, - timeout); - - ata_28bit_cmd(&ccb->ataio, command, features, lba, sector_count); - return ata_cam_send(device, ccb, quiet); -} - -static int ata_do_cmd(struct cam_device *device, union ccb *ccb, int retries, u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, - u_int8_t tag_action, u_int8_t command, u_int8_t features, - u_int64_t lba, u_int8_t sector_count, u_int8_t *data_ptr, + u_int8_t tag_action, u_int8_t command, u_int16_t features, + u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, u_int16_t dxfer_len, int timeout, int force48bit) { int retval; @@ -2071,14 +2035,15 @@ atahpa_password(struct cam_device *device, int retry_c retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_SET_PWD, /*lba*/0, - /*sector_count*/0, + /*sector_count*/sizeof(*pwd) / 512, /*data_ptr*/(u_int8_t*)pwd, - /*dxfer_len*/sizeof(struct ata_set_max_pwd), + /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, is48bit); @@ -2138,14 +2103,15 @@ atahpa_unlock(struct cam_device *device, int retry_cou retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_UNLOCK, /*lba*/0, - /*sector_count*/0, + /*sector_count*/sizeof(*pwd) / 512, /*data_ptr*/(u_int8_t*)pwd, - /*dxfer_len*/sizeof(struct ata_set_max_pwd), + /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, is48bit); @@ -2315,45 +2281,32 @@ ata_do_identify(struct cam_device *device, int retry_c return (1); } - error = ata_do_28bit_cmd(device, - ccb, - /*retries*/retry_count, - /*flags*/CAM_DIR_IN, - /*protocol*/AP_PROTO_PIO_IN, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/command, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); +retry: + error = ata_do_cmd(device, + ccb, + /*retries*/retry_count, + /*flags*/CAM_DIR_IN, + /*protocol*/AP_PROTO_PIO_IN, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/command, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(struct ata_params) / 512, + /*data_ptr*/(u_int8_t *)ptr, + /*dxfer_len*/sizeof(struct ata_params), + /*timeout*/timeout ? timeout : 30 * 1000, + /*force48bit*/0); if (error != 0) { - if (retry_command == 0) { - free(ptr); - return (1); + if (retry_command != 0) { + command = retry_command; + retry_command = 0; + goto retry; } - error = ata_do_28bit_cmd(device, - ccb, - /*retries*/retry_count, - /*flags*/CAM_DIR_IN, - /*protocol*/AP_PROTO_PIO_IN, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/retry_command, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)ptr, - /*dxfer_len*/sizeof(struct ata_params), - /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/0); - - if (error != 0) { - free(ptr); - return (1); - } + free(ptr); + return (1); } error = 1; @@ -2527,20 +2480,21 @@ atasecurity_freeze(struct cam_device *device, union cc if (quiet == 0) atasecurity_notify(ATA_SECURITY_FREEZE_LOCK, NULL); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_FREEZE_LOCK, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_FREEZE_LOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*force48bit*/0); } static int @@ -2552,20 +2506,22 @@ atasecurity_unlock(struct cam_device *device, union cc if (quiet == 0) atasecurity_notify(ATA_SECURITY_UNLOCK, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_UNLOCK, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_UNLOCK, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } static int @@ -2576,20 +2532,22 @@ atasecurity_disable(struct cam_device *device, union c if (quiet == 0) atasecurity_notify(ATA_SECURITY_DISABLE_PASSWORD, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_DISABLE_PASSWORD, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_DISABLE_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } @@ -2635,20 +2593,21 @@ atasecurity_erase(struct cam_device *device, union ccb if (quiet == 0) atasecurity_notify(ATA_SECURITY_ERASE_PREPARE, NULL); - error = ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_ERASE_PREPARE, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/timeout, - /*quiet*/0); + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_NONE, + /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_PREPARE, + /*features*/0, + /*lba*/0, + /*sector_count*/0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + /*timeout*/timeout, + /*force48bit*/0); if (error != 0) return error; @@ -2656,20 +2615,22 @@ atasecurity_erase(struct cam_device *device, union ccb if (quiet == 0) atasecurity_notify(ATA_SECURITY_ERASE_UNIT, pwd); - error = ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_ERASE_UNIT, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/erase_timeout, - /*quiet*/0); + error = ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_ERASE_UNIT, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/erase_timeout, + /*force48bit*/0); if (error == 0 && quiet == 0) printf("\nErase Complete\n"); @@ -2686,20 +2647,22 @@ atasecurity_set_password(struct cam_device *device, un if (quiet == 0) atasecurity_notify(ATA_SECURITY_SET_PASSWORD, pwd); - return ata_do_28bit_cmd(device, - ccb, - retry_count, - /*flags*/CAM_DIR_OUT, - /*protocol*/AP_PROTO_PIO_OUT, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SECURITY_SET_PASSWORD, - /*features*/0, - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/(u_int8_t *)pwd, - /*dxfer_len*/sizeof(*pwd), - /*timeout*/timeout, - /*quiet*/0); + return ata_do_cmd(device, + ccb, + retry_count, + /*flags*/CAM_DIR_OUT, + /*protocol*/AP_PROTO_PIO_OUT, + /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | + AP_FLAG_TLEN_SECT_CNT, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*command*/ATA_SECURITY_SET_PASSWORD, + /*features*/0, + /*lba*/0, + /*sector_count*/sizeof(*pwd) / 512, + /*data_ptr*/(u_int8_t *)pwd, + /*dxfer_len*/sizeof(*pwd), + /*timeout*/timeout, + /*force48bit*/0); } static void @@ -8995,7 +8958,7 @@ atapm(struct cam_device *device, int argc, char **argv /*data_ptr*/NULL, /*dxfer_len*/0, /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); + /*force48bit*/0); cam_freeccb(ccb); @@ -9048,11 +9011,12 @@ ataaxm(struct cam_device *device, int argc, char **arg } } - retval = ata_do_28bit_cmd(device, + retval = ata_do_cmd(device, ccb, /*retries*/retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_SETFEATURES, /*features*/cmd, @@ -9061,7 +9025,7 @@ ataaxm(struct cam_device *device, int argc, char **arg /*data_ptr*/NULL, /*dxfer_len*/0, /*timeout*/timeout ? timeout : 30 * 1000, - /*quiet*/1); + /*force48bit*/0); cam_freeccb(ccb); return (retval); Modified: stable/11/sbin/camcontrol/fwdownload.c ============================================================================== --- stable/11/sbin/camcontrol/fwdownload.c Fri Sep 13 14:42:37 2019 (r352285) +++ stable/11/sbin/camcontrol/fwdownload.c Fri Sep 13 14:43:05 2019 (r352286) @@ -701,11 +701,11 @@ fw_check_device_ready(struct cam_device *dev, camcontr /*flags*/ CAM_DIR_IN, /*tag_action*/ MSG_SIMPLE_Q_TAG, /*protocol*/ AP_PROTO_PIO_IN, - /*ata_flags*/ AP_FLAG_BYT_BLOK_BYTES | + /*ata_flags*/ AP_FLAG_BYT_BLOK_BLOCKS | AP_FLAG_TLEN_SECT_CNT | AP_FLAG_TDIR_FROM_DEV, /*features*/ 0, - /*sector_count*/ (uint8_t) dxfer_len, + /*sector_count*/ dxfer_len / 512, /*lba*/ 0, /*command*/ ATA_ATA_IDENTIFY, /*auxiliary*/ 0, Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Fri Sep 13 14:42:37 2019 (r352285) +++ stable/11/sys/cam/scsi/scsi_all.c Fri Sep 13 14:43:05 2019 (r352286) @@ -8266,10 +8266,10 @@ scsi_ata_identify(struct ccb_scsiio *csio, u_int32_t r tag_action, /*protocol*/AP_PROTO_PIO_IN, /*ata_flags*/AP_FLAG_TDIR_FROM_DEV | - AP_FLAG_BYT_BLOK_BYTES | + AP_FLAG_BYT_BLOK_BLOCKS | AP_FLAG_TLEN_SECT_CNT, /*features*/0, - /*sector_count*/dxfer_len, + /*sector_count*/dxfer_len / 512, /*lba*/0, /*command*/ATA_ATA_IDENTIFY, /*device*/ 0, From owner-svn-src-stable@freebsd.org Fri Sep 13 14:43: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 C0809F3568; Fri, 13 Sep 2019 14:43:45 +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 46VJKs4hT1z3Fqt; Fri, 13 Sep 2019 14:43:45 +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 844A78B31; Fri, 13 Sep 2019 14:43:45 +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 x8DEhjJL026933; Fri, 13 Sep 2019 14:43:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DEhiZa026869; Fri, 13 Sep 2019 14:43:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131443.x8DEhiZa026869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 14:43:44 +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: r352287 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 352287 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, 13 Sep 2019 14:43:45 -0000 Author: mav Date: Fri Sep 13 14:43:44 2019 New Revision: 352287 URL: https://svnweb.freebsd.org/changeset/base/352287 Log: MFC r352018: Unify cam_send_ccb() error reporting. Error there mean that command was not even executed, and all information we have about it is errno, and cam_error_print() call is not very useful. Plus it is most likely a programmatic error, that shoud not happen. Modified: stable/12/sbin/camcontrol/attrib.c stable/12/sbin/camcontrol/camcontrol.c stable/12/sbin/camcontrol/persist.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/attrib.c ============================================================================== --- stable/12/sbin/camcontrol/attrib.c Fri Sep 13 14:43:05 2019 (r352286) +++ stable/12/sbin/camcontrol/attrib.c Fri Sep 13 14:43:44 2019 (r352287) @@ -344,12 +344,6 @@ scsiattrib(struct cam_device *device, int argc, char * if (cam_send_ccb(device, ccb) < 0) { warn("error sending %s ATTRIBUTE", (read_attr != 0) ? "READ" : "WRITE"); - - if (verbosemode != 0) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - error = 1; goto bailout; } Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 14:43:05 2019 (r352286) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 14:43:44 2019 (r352287) @@ -437,7 +437,7 @@ getdevlist(struct cam_device *device) ccb->cgdl.status = CAM_GDEVLIST_MORE_DEVS; while (ccb->cgdl.status == CAM_GDEVLIST_MORE_DEVS) { if (cam_send_ccb(device, ccb) < 0) { - perror("error getting device list"); + warn("error getting device list"); cam_freeccb(ccb); return (1); } @@ -787,7 +787,7 @@ print_dev_mmcsd(struct device_match_result *dev_result advi->buf = (uint8_t *)&mmc_ident_data; if (cam_send_ccb(dev, ccb) < 0) { - warn("error sending CAMIOCOMMAND ioctl"); + warn("error sending XPT_DEV_ADVINFO CCB"); cam_freeccb(ccb); cam_close_device(dev); return (1); @@ -829,7 +829,7 @@ nvme_get_cdata(struct cam_device *dev, struct nvme_con advi->buf = (uint8_t *)cdata; if (cam_send_ccb(dev, ccb) < 0) { - warn("error sending CAMIOCOMMAND ioctl"); + warn("error sending XPT_DEV_ADVINFO CCB"); cam_freeccb(ccb); cam_close_device(dev); return(1); @@ -895,13 +895,7 @@ testunitready(struct cam_device *device, int task_attr if (cam_send_ccb(device, ccb) < 0) { if (quiet == 0) - perror("error sending test unit ready"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending TEST UNIT READY command"); cam_freeccb(ccb); return (1); } @@ -964,13 +958,7 @@ scsistart(struct cam_device *device, int startstop, in ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending start unit"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending START STOP UNIT command"); cam_freeccb(ccb); return (1); } @@ -1133,13 +1121,7 @@ scsiinquiry(struct cam_device *device, int task_attr, ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending SCSI inquiry"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending INQUIRY command"); cam_freeccb(ccb); return (1); } @@ -1215,13 +1197,7 @@ scsiserial(struct cam_device *device, int task_attr, i ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - warn("error getting serial number"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending INQUIRY command"); cam_freeccb(ccb); free(serial_buf); return (1); @@ -1821,12 +1797,6 @@ scsi_cam_pass_16_send(struct cam_device *device, union warn("error sending ATA %s via pass_16", ata_op_string(&ata_cmd)); } - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - return (1); } @@ -1868,12 +1838,6 @@ ata_cam_send(struct cam_device *device, union ccb *ccb warn("error sending ATA %s", ata_op_string(&(ccb->ataio.cmd))); } - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - return (1); } @@ -4150,13 +4114,7 @@ next_batch: ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; if (cam_send_ccb(device, ccb) < 0) { - perror("error reading defect list"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending READ DEFECT DATA command"); error = 1; goto defect_bailout; } @@ -5293,7 +5251,7 @@ tagcontrol(struct cam_device *device, int argc, char * if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_REL_SIMQ CCB"); + warn("error sending XPT_REL_SIMQ CCB"); retval = 1; goto tagcontrol_bailout; } @@ -5317,7 +5275,7 @@ tagcontrol(struct cam_device *device, int argc, char * ccb->ccb_h.func_code = XPT_GDEV_STATS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_GDEV_STATS CCB"); + warn("error sending XPT_GDEV_STATS CCB"); retval = 1; goto tagcontrol_bailout; } @@ -5533,9 +5491,6 @@ get_cpi(struct cam_device *device, struct ccb_pathinq ccb->ccb_h.func_code = XPT_PATH_INQ; if (cam_send_ccb(device, ccb) < 0) { warn("get_cpi: error sending Path Inquiry CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); retval = 1; goto get_cpi_bailout; } @@ -5570,10 +5525,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev * CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); ccb->ccb_h.func_code = XPT_GDEV_TYPE; if (cam_send_ccb(device, ccb) < 0) { - warn("get_cgd: error sending Path Inquiry CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + warn("get_cgd: error sending Get type information CCB"); retval = 1; goto get_cgd_bailout; } @@ -6129,10 +6081,7 @@ get_print_cts(struct cam_device *device, int user_sett ccb->cts.type = CTS_TYPE_USER_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_GET_TRAN_SETTINGS CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + warn("error sending XPT_GET_TRAN_SETTINGS CCB"); retval = 1; goto get_print_cts_bailout; } @@ -6259,32 +6208,13 @@ ratecontrol(struct cam_device *device, int task_attr, break; } } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); /* * Grab path inquiry information, so we can determine whether * or not the initiator is capable of the things that the user * requests. */ - ccb->ccb_h.func_code = XPT_PATH_INQ; - if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_PATH_INQ CCB"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - retval = 1; + if ((retval = get_cpi(device, &cpi)) != 0) goto ratecontrol_bailout; - } - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - warnx("XPT_PATH_INQ CCB failed"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - retval = 1; - goto ratecontrol_bailout; - } - bcopy(&ccb->cpi, &cpi, sizeof(struct ccb_pathinq)); CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); if (quiet == 0) { fprintf(stdout, "%s parameters:\n", @@ -6472,11 +6402,7 @@ ratecontrol(struct cam_device *device, int task_attr, } ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_SET_TRAN_SETTINGS CCB"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending XPT_SET_TRAN_SETTINGS CCB"); retval = 1; goto ratecontrol_bailout; } @@ -6710,11 +6636,7 @@ doreport: * errors are expected. */ if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending TEST UNIT READY command"); error = 1; goto scsiformat_bailout; } @@ -6901,11 +6823,7 @@ sanitize_wait_scsi(struct cam_device *device, union cc * errors are expected. */ if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending TEST UNIT READY command"); return (1); } @@ -7443,11 +7361,6 @@ retry: if (cam_send_ccb(device, ccb) < 0) { warn("error sending REPORT LUNS command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -7699,11 +7612,6 @@ scsireadcapacity(struct cam_device *device, int argc, if (cam_send_ccb(device, ccb) < 0) { warn("error sending READ CAPACITY command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -7746,11 +7654,6 @@ long_only: if (cam_send_ccb(device, ccb) < 0) { warn("error sending READ CAPACITY (16) command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -9603,7 +9506,7 @@ retry_alloc: ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending REPORT SUPPORTED OPERATION CODES"); + warn("error sending REPORT SUPPORTED OPERATION CODES command"); retval = 1; goto bailout; } Modified: stable/12/sbin/camcontrol/persist.c ============================================================================== --- stable/12/sbin/camcontrol/persist.c Fri Sep 13 14:43:05 2019 (r352286) +++ stable/12/sbin/camcontrol/persist.c Fri Sep 13 14:43:44 2019 (r352287) @@ -858,12 +858,6 @@ retry: if (cam_send_ccb(device, ccb) < 0) { warn("error sending PERSISTENT RESERVE %s", (in != 0) ? "IN" : "OUT"); - - if (verbosemode != 0) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - error = 1; goto bailout; } From owner-svn-src-stable@freebsd.org Fri Sep 13 15:13: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 D408BF3D79; Fri, 13 Sep 2019 15:13:22 +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 46VK025DBPz3HNC; Fri, 13 Sep 2019 15:13:22 +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 9689D90A0; Fri, 13 Sep 2019 15:13:22 +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 x8DFDMHU045119; Fri, 13 Sep 2019 15:13:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFDLPj045116; Fri, 13 Sep 2019 15:13:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131513.x8DFDLPj045116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:13: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: r352289 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 352289 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, 13 Sep 2019 15:13:22 -0000 Author: mav Date: Fri Sep 13 15:13:21 2019 New Revision: 352289 URL: https://svnweb.freebsd.org/changeset/base/352289 Log: MFC r352018: Unify cam_send_ccb() error reporting. Error there mean that command was not even executed, and all information we have about it is errno, and cam_error_print() call is not very useful. Plus it is most likely a programmatic error, that shoud not happen. Modified: stable/11/sbin/camcontrol/attrib.c stable/11/sbin/camcontrol/camcontrol.c stable/11/sbin/camcontrol/persist.c Modified: stable/11/sbin/camcontrol/attrib.c ============================================================================== --- stable/11/sbin/camcontrol/attrib.c Fri Sep 13 14:51:00 2019 (r352288) +++ stable/11/sbin/camcontrol/attrib.c Fri Sep 13 15:13:21 2019 (r352289) @@ -344,12 +344,6 @@ scsiattrib(struct cam_device *device, int argc, char * if (cam_send_ccb(device, ccb) < 0) { warn("error sending %s ATTRIBUTE", (read_attr != 0) ? "READ" : "WRITE"); - - if (verbosemode != 0) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - error = 1; goto bailout; } Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 14:51:00 2019 (r352288) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:13:21 2019 (r352289) @@ -421,7 +421,7 @@ getdevlist(struct cam_device *device) ccb->cgdl.status = CAM_GDEVLIST_MORE_DEVS; while (ccb->cgdl.status == CAM_GDEVLIST_MORE_DEVS) { if (cam_send_ccb(device, ccb) < 0) { - perror("error getting device list"); + warn("error getting device list"); cam_freeccb(ccb); return (1); } @@ -728,13 +728,7 @@ testunitready(struct cam_device *device, int task_attr if (cam_send_ccb(device, ccb) < 0) { if (quiet == 0) - perror("error sending test unit ready"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending TEST UNIT READY command"); cam_freeccb(ccb); return (1); } @@ -797,13 +791,7 @@ scsistart(struct cam_device *device, int startstop, in ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending start unit"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending START STOP UNIT command"); cam_freeccb(ccb); return (1); } @@ -966,13 +954,7 @@ scsiinquiry(struct cam_device *device, int task_attr, ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending SCSI inquiry"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending INQUIRY command"); cam_freeccb(ccb); return (1); } @@ -1048,13 +1030,7 @@ scsiserial(struct cam_device *device, int task_attr, i ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - warn("error getting serial number"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending INQUIRY command"); cam_freeccb(ccb); free(serial_buf); return (1); @@ -1654,12 +1630,6 @@ scsi_cam_pass_16_send(struct cam_device *device, union warn("error sending ATA %s via pass_16", ata_op_string(&ata_cmd)); } - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - return (1); } @@ -1701,12 +1671,6 @@ ata_cam_send(struct cam_device *device, union ccb *ccb warn("error sending ATA %s", ata_op_string(&(ccb->ataio.cmd))); } - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - return (1); } @@ -3969,13 +3933,7 @@ next_batch: ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; if (cam_send_ccb(device, ccb) < 0) { - perror("error reading defect list"); - - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - + warn("error sending READ DEFECT DATA command"); error = 1; goto defect_bailout; } @@ -5112,7 +5070,7 @@ tagcontrol(struct cam_device *device, int argc, char * if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_REL_SIMQ CCB"); + warn("error sending XPT_REL_SIMQ CCB"); retval = 1; goto tagcontrol_bailout; } @@ -5136,7 +5094,7 @@ tagcontrol(struct cam_device *device, int argc, char * ccb->ccb_h.func_code = XPT_GDEV_STATS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_GDEV_STATS CCB"); + warn("error sending XPT_GDEV_STATS CCB"); retval = 1; goto tagcontrol_bailout; } @@ -5335,9 +5293,6 @@ get_cpi(struct cam_device *device, struct ccb_pathinq ccb->ccb_h.func_code = XPT_PATH_INQ; if (cam_send_ccb(device, ccb) < 0) { warn("get_cpi: error sending Path Inquiry CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); retval = 1; goto get_cpi_bailout; } @@ -5372,10 +5327,7 @@ get_cgd(struct cam_device *device, struct ccb_getdev * CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cgd); ccb->ccb_h.func_code = XPT_GDEV_TYPE; if (cam_send_ccb(device, ccb) < 0) { - warn("get_cgd: error sending Path Inquiry CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + warn("get_cgd: error sending Get type information CCB"); retval = 1; goto get_cgd_bailout; } @@ -5927,10 +5879,7 @@ get_print_cts(struct cam_device *device, int user_sett ccb->cts.type = CTS_TYPE_USER_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_GET_TRAN_SETTINGS CCB"); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + warn("error sending XPT_GET_TRAN_SETTINGS CCB"); retval = 1; goto get_print_cts_bailout; } @@ -6057,32 +6006,13 @@ ratecontrol(struct cam_device *device, int task_attr, break; } } - CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cpi); /* * Grab path inquiry information, so we can determine whether * or not the initiator is capable of the things that the user * requests. */ - ccb->ccb_h.func_code = XPT_PATH_INQ; - if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_PATH_INQ CCB"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - retval = 1; + if ((retval = get_cpi(device, &cpi)) != 0) goto ratecontrol_bailout; - } - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - warnx("XPT_PATH_INQ CCB failed"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - retval = 1; - goto ratecontrol_bailout; - } - bcopy(&ccb->cpi, &cpi, sizeof(struct ccb_pathinq)); CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->cts); if (quiet == 0) { fprintf(stdout, "%s parameters:\n", @@ -6270,11 +6200,7 @@ ratecontrol(struct cam_device *device, int task_attr, } ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending XPT_SET_TRAN_SETTINGS CCB"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending XPT_SET_TRAN_SETTINGS CCB"); retval = 1; goto ratecontrol_bailout; } @@ -6508,11 +6434,7 @@ doreport: * errors are expected. */ if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending TEST UNIT READY command"); error = 1; goto scsiformat_bailout; } @@ -6699,11 +6621,7 @@ sanitize_wait_scsi(struct cam_device *device, union cc * errors are expected. */ if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + warn("error sending TEST UNIT READY command"); return (1); } @@ -7241,11 +7159,6 @@ retry: if (cam_send_ccb(device, ccb) < 0) { warn("error sending REPORT LUNS command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -7497,11 +7410,6 @@ scsireadcapacity(struct cam_device *device, int argc, if (cam_send_ccb(device, ccb) < 0) { warn("error sending READ CAPACITY command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -7544,11 +7452,6 @@ long_only: if (cam_send_ccb(device, ccb) < 0) { warn("error sending READ CAPACITY (16) command"); - - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - retval = 1; goto bailout; } @@ -9117,7 +9020,7 @@ retry_alloc: ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - perror("error sending REPORT SUPPORTED OPERATION CODES"); + warn("error sending REPORT SUPPORTED OPERATION CODES command"); retval = 1; goto bailout; } Modified: stable/11/sbin/camcontrol/persist.c ============================================================================== --- stable/11/sbin/camcontrol/persist.c Fri Sep 13 14:51:00 2019 (r352288) +++ stable/11/sbin/camcontrol/persist.c Fri Sep 13 15:13:21 2019 (r352289) @@ -858,12 +858,6 @@ retry: if (cam_send_ccb(device, ccb) < 0) { warn("error sending PERSISTENT RESERVE %s", (in != 0) ? "IN" : "OUT"); - - if (verbosemode != 0) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } - error = 1; goto bailout; } From owner-svn-src-stable@freebsd.org Fri Sep 13 15:15: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 29C40F3E26; Fri, 13 Sep 2019 15:15:59 +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 46VK3314xfz3Hgc; Fri, 13 Sep 2019 15:15:59 +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 03AE190A1; Fri, 13 Sep 2019 15:15:59 +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 x8DFFwCu045313; Fri, 13 Sep 2019 15:15:58 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFFwL7045312; Fri, 13 Sep 2019 15:15:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131515.x8DFFwL7045312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:15: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: r352290 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 352290 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, 13 Sep 2019 15:15:59 -0000 Author: mav Date: Fri Sep 13 15:15:58 2019 New Revision: 352290 URL: https://svnweb.freebsd.org/changeset/base/352290 Log: MFC r352082, r352103: Fix number of problems found while testing on SAT devices. - Remove incomplete and dangerous ata_res decoding from ata_do_cmd(). Instead switch all functions that need the result to use get_ata_status(), doing the same, but more careful, also reducing code duplication. - Made get_ata_status() to also decode fixed format sense. In many cases it is still not enough to make it useful, since it can only report results of 28-bit command, but it is slightly better then nothing. - Organize error reporting in ata_do_cmd(), so that if caller specified AP_FLAG_CHK_COND, it is responsible for command errors (non-ioctl ones). - Make HPA/AMA errors not fatal for `identify` subcommand. - Fix reprobe() not being called on HPA/AMA when in quiet mode. - Remove not very useful messages from `format` and `sanitize` commands with -y flag. Once they started, they often can't be stopped any way. Modified: stable/12/sbin/camcontrol/camcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:13:21 2019 (r352289) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:15:58 2019 (r352290) @@ -1770,7 +1770,7 @@ atacapprint(struct ata_params *parm) } static int -scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb, int quiet) +scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb) { struct ata_pass_16 *ata_pass_16; struct ata_cmd ata_cmd; @@ -1793,24 +1793,21 @@ scsi_cam_pass_16_send(struct cam_device *device, union ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warn("error sending ATA %s via pass_16", - ata_op_string(&ata_cmd)); - } + warn("error sending ATA %s via pass_16", ata_op_string(&ata_cmd)); return (1); } + /* + * Consider any non-CAM_REQ_CMP status as error and report it here, + * unless caller set AP_FLAG_CHK_COND, in which case it is reponsible. + */ if (!(ata_pass_16->flags & AP_FLAG_CHK_COND) && (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warnx("ATA %s via pass_16 failed", - ata_op_string(&ata_cmd)); - } + warnx("ATA %s via pass_16 failed", ata_op_string(&ata_cmd)); if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - return (1); } @@ -1819,7 +1816,7 @@ scsi_cam_pass_16_send(struct cam_device *device, union static int -ata_cam_send(struct cam_device *device, union ccb *ccb, int quiet) +ata_cam_send(struct cam_device *device, union ccb *ccb) { if (arglist & CAM_ARG_VERBOSE) { warnx("sending ATA %s with timeout of %u msecs", @@ -1834,24 +1831,21 @@ ata_cam_send(struct cam_device *device, union ccb *ccb ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warn("error sending ATA %s", - ata_op_string(&(ccb->ataio.cmd))); - } + warn("error sending ATA %s", ata_op_string(&(ccb->ataio.cmd))); return (1); } - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warnx("ATA %s failed: %d", - ata_op_string(&(ccb->ataio.cmd)), quiet); - } - + /* + * Consider any non-CAM_REQ_CMP status as error and report it here, + * unless caller set AP_FLAG_CHK_COND, in which case it is reponsible. + */ + if (!(ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT) && + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + warnx("ATA %s failed", ata_op_string(&(ccb->ataio.cmd))); if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - return (1); } @@ -1863,7 +1857,7 @@ ata_do_pass_16(struct cam_device *device, union ccb *c u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, u_int8_t tag_action, u_int8_t command, u_int16_t features, u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, - u_int16_t dxfer_len, int timeout, int quiet) + u_int16_t dxfer_len, int timeout) { if (data_ptr != NULL) { if (flags & CAM_DIR_OUT) @@ -1893,7 +1887,7 @@ ata_do_pass_16(struct cam_device *device, union ccb *c /*sense_len*/SSD_FULL_SIZE, timeout); - return scsi_cam_pass_16_send(device, ccb, quiet); + return scsi_cam_pass_16_send(device, ccb); } static int @@ -1929,50 +1923,10 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, return (1); if (retval == 1) { - int error; - - /* Try using SCSI Passthrough */ - error = ata_do_pass_16(device, ccb, retries, flags, protocol, + return (ata_do_pass_16(device, ccb, retries, flags, protocol, ata_flags, tag_action, command, features, lba, sector_count, data_ptr, dxfer_len, - timeout, 0); - - if (ata_flags & AP_FLAG_CHK_COND) { - /* Decode ata_res from sense data */ - struct ata_res_pass16 *res_pass16; - struct ata_res *res; - u_int i; - u_int16_t *ptr; - - /* sense_data is 4 byte aligned */ - ptr = (uint16_t*)(uintptr_t)&ccb->csio.sense_data; - for (i = 0; i < sizeof(*res_pass16) / 2; i++) - ptr[i] = le16toh(ptr[i]); - - /* sense_data is 4 byte aligned */ - res_pass16 = (struct ata_res_pass16 *)(uintptr_t) - &ccb->csio.sense_data; - res = &ccb->ataio.res; - res->flags = res_pass16->flags; - res->status = res_pass16->status; - res->error = res_pass16->error; - res->lba_low = res_pass16->lba_low; - res->lba_mid = res_pass16->lba_mid; - res->lba_high = res_pass16->lba_high; - res->device = res_pass16->device; - res->lba_low_exp = res_pass16->lba_low_exp; - res->lba_mid_exp = res_pass16->lba_mid_exp; - res->lba_high_exp = res_pass16->lba_high_exp; - res->sector_count = res_pass16->sector_count; - res->sector_count_exp = res_pass16->sector_count_exp; - ccb->ccb_h.status &= ~CAM_STATUS_MASK; - if (res->status & ATA_STATUS_ERROR) - ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR; - else - ccb->ccb_h.status |= CAM_REQ_CMP; - } - - return (error); + timeout)); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); @@ -1993,7 +1947,7 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, if (ata_flags & AP_FLAG_CHK_COND) ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; - return ata_cam_send(device, ccb, 0); + return ata_cam_send(device, ccb); } static void @@ -2013,52 +1967,43 @@ dump_data(uint16_t *ptr, uint32_t len) } static int -atahpa_proc_resp(struct cam_device *device, union ccb *ccb, - int is48bit, u_int64_t *hpasize) +atahpa_proc_resp(struct cam_device *device, union ccb *ccb, u_int64_t *hpasize) { - struct ata_res *res; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; + int retval; - res = &ccb->ataio.res; - if (res->status & ATA_STATUS_ERROR) { + retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device, + &status); + if (retval == 1) { if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - printf("error = 0x%02x, sector_count = 0x%04x, " - "device = 0x%02x, status = 0x%02x\n", - res->error, res->sector_count, - res->device, res->status); } + warnx("Can't get ATA command status"); + return (retval); + } - if (res->error & ATA_ERROR_ID_NOT_FOUND) { + if (status & ATA_STATUS_ERROR) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + if (error & ATA_ERROR_ID_NOT_FOUND) { warnx("Max address has already been set since " "last power-on or hardware reset"); - } + } else if (hpasize == NULL) + warnx("Command failed with ATA error"); return (1); } - if (arglist & CAM_ARG_VERBOSE) { - fprintf(stdout, "%s%d: Raw native max data:\n", - device->device_name, device->dev_unit_num); - /* res is 4 byte aligned */ - dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); - - printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " - "status = 0x%02x\n", res->error, res->sector_count, - res->device, res->status); - } - if (hpasize != NULL) { - if (is48bit) { - *hpasize = (((u_int64_t)((res->lba_high_exp << 16) | - (res->lba_mid_exp << 8) | res->lba_low_exp) << 24) | - ((res->lba_high << 16) | (res->lba_mid << 8) | - res->lba_low)) + 1; - } else { - *hpasize = (((res->device & 0x0f) << 24) | - (res->lba_high << 16) | (res->lba_mid << 8) | - res->lba_low) + 1; - } + if (retval == 2 || retval == 6) + return (1); + *hpasize = lba; } return (0); @@ -2102,7 +2047,7 @@ ata_read_native_max(struct cam_device *device, int ret if (error) return (error); - return atahpa_proc_resp(device, ccb, is48bit, hpasize); + return atahpa_proc_resp(device, ccb, hpasize); } static int @@ -2146,7 +2091,7 @@ atahpa_set_max(struct cam_device *device, int retry_co if (error) return (error); - return atahpa_proc_resp(device, ccb, is48bit, NULL); + return atahpa_proc_resp(device, ccb, NULL); } static int @@ -2154,20 +2099,19 @@ atahpa_password(struct cam_device *device, int retry_c u_int32_t timeout, union ccb *ccb, int is48bit, struct ata_set_max_pwd *pwd) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_PIO_OUT; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | - AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, + AP_FLAG_TLEN_SECT_CNT, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_SET_PWD, @@ -2176,31 +2120,25 @@ atahpa_password(struct cam_device *device, int retry_c /*data_ptr*/(u_int8_t*)pwd, /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int atahpa_lock(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb, int is48bit) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_NON_DATA; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_LOCK, @@ -2209,12 +2147,7 @@ atahpa_lock(struct cam_device *device, int retry_count /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int @@ -2222,20 +2155,19 @@ atahpa_unlock(struct cam_device *device, int retry_cou u_int32_t timeout, union ccb *ccb, int is48bit, struct ata_set_max_pwd *pwd) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_PIO_OUT; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | - AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, + AP_FLAG_TLEN_SECT_CNT, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_UNLOCK, @@ -2244,31 +2176,25 @@ atahpa_unlock(struct cam_device *device, int retry_cou /*data_ptr*/(u_int8_t*)pwd, /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int atahpa_freeze_lock(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb, int is48bit) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_NON_DATA; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_FREEZE, @@ -2277,12 +2203,7 @@ atahpa_freeze_lock(struct cam_device *device, int retr /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int @@ -2311,7 +2232,7 @@ ata_get_native_max(struct cam_device *device, int retr if (error) return (error); - return atahpa_proc_resp(device, ccb, /*is48bit*/1, nativesize); + return atahpa_proc_resp(device, ccb, nativesize); } static int @@ -2343,21 +2264,20 @@ ataama_set(struct cam_device *device, int retry_count, if (error) return (error); - return atahpa_proc_resp(device, ccb, /*is48bit*/1, NULL); + return atahpa_proc_resp(device, ccb, NULL); } static int ataama_freeze(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb) { - int error; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_AMAX_ADDR, /*features*/ATA_AMAX_ADDR_FREEZE, @@ -2366,12 +2286,7 @@ ataama_freeze(struct cam_device *device, int retry_cou /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 30 * 1000, - /*force48bit*/1); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, /*is48bit*/1, NULL); + /*force48bit*/1)); } int @@ -2467,7 +2382,7 @@ ataidentify(struct cam_device *device, int retry_count { union ccb *ccb; struct ata_params *ident_buf; - u_int64_t hpasize, nativesize; + u_int64_t hpasize = 0, nativesize = 0; if ((ccb = cam_getccb(device)) == NULL) { warnx("couldn't allocate CCB"); @@ -2486,22 +2401,12 @@ ataidentify(struct cam_device *device, int retry_count } if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) { - if (ata_read_native_max(device, retry_count, timeout, ccb, - ident_buf, &hpasize) != 0) { - cam_freeccb(ccb); - return (1); - } - } else { - hpasize = 0; + ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); } if (ident_buf->support2 & ATA_SUPPORT_AMAX_ADDR) { - if (ata_get_native_max(device, retry_count, timeout, ccb, - &nativesize) != 0) { - cam_freeccb(ccb); - return (1); - } - } else { - nativesize = 0; + ata_get_native_max(device, retry_count, timeout, ccb, + &nativesize); } printf("%s%d: ", device->device_name, device->dev_unit_num); @@ -3024,10 +2929,11 @@ atahpa(struct cam_device *device, int retry_count, int } if (action == ATA_HPA_ACTION_PRINT) { - error = ata_read_native_max(device, retry_count, timeout, ccb, - ident_buf, &hpasize); - if (error == 0) - atahpa_print(ident_buf, hpasize, 1); + hpasize = 0; + if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) + ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); + atahpa_print(ident_buf, hpasize, 1); cam_freeccb(ccb); free(ident_buf); @@ -3070,12 +2976,14 @@ atahpa(struct cam_device *device, int retry_count, int if (error == 0) { error = atahpa_set_max(device, retry_count, timeout, ccb, is48bit, maxsize, persist); - if (error == 0 && quiet == 0) { - /* redo identify to get new lba values */ - error = ata_do_identify(device, retry_count, - timeout, ccb, - &ident_buf); - atahpa_print(ident_buf, hpasize, 1); + if (error == 0) { + if (quiet == 0) { + /* redo identify to get new values */ + error = ata_do_identify(device, + retry_count, timeout, ccb, + &ident_buf); + atahpa_print(ident_buf, hpasize, 1); + } /* Hint CAM to reprobe the device. */ reprobe(device); } @@ -3191,10 +3099,11 @@ ataama(struct cam_device *device, int retry_count, int } if (action == ATA_AMA_ACTION_PRINT) { - error = ata_get_native_max(device, retry_count, timeout, ccb, + nativesize = 0; + if (ident_buf->support2 & ATA_SUPPORT_AMAX_ADDR) + ata_get_native_max(device, retry_count, timeout, ccb, &nativesize); - if (error == 0) - ataama_print(ident_buf, nativesize, 1); + ataama_print(ident_buf, nativesize, 1); cam_freeccb(ccb); free(ident_buf); @@ -3215,11 +3124,14 @@ ataama(struct cam_device *device, int retry_count, int if (error == 0) { error = ataama_set(device, retry_count, timeout, ccb, maxsize); - if (error == 0 && quiet == 0) { - /* redo identify to get new lba values */ - error = ata_do_identify(device, retry_count, - timeout, ccb, &ident_buf); - ataama_print(ident_buf, nativesize, 1); + if (error == 0) { + if (quiet == 0) { + /* redo identify to get new values */ + error = ata_do_identify(device, + retry_count, timeout, ccb, + &ident_buf); + ataama_print(ident_buf, nativesize, 1); + } /* Hint CAM to reprobe the device. */ reprobe(device); } @@ -5754,16 +5666,21 @@ build_ata_cmd(union ccb *ccb, uint32_t retry_count, ui return (retval); } +/* + * Returns: 0 -- success, 1 -- error, 2 -- lba truncated, + * 4 -- count truncated, 6 -- lba and count truncated. + */ int get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error, uint16_t *count, uint64_t *lba, uint8_t *device, uint8_t *status) { - int retval = 0; + int retval; switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { uint8_t opcode; int error_code = 0, sense_key = 0, asc = 0, ascq = 0; + u_int sense_len; /* * In this case, we have SCSI ATA PASS-THROUGH command, 12 @@ -5775,20 +5692,17 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, opcode = ccb->csio.cdb_io.cdb_bytes[0]; if ((opcode != ATA_PASS_12) && (opcode != ATA_PASS_16)) { - retval = 1; warnx("%s: unsupported opcode %02x", __func__, opcode); - goto bailout; + return (1); } retval = scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq); /* Note: the _ccb() variant returns 0 for an error */ - if (retval == 0) { - retval = 1; - goto bailout; - } else - retval = 0; + if (retval == 0) + return (1); + sense_len = ccb->csio.sense_len - ccb->csio.sense_resid; switch (error_code) { case SSD_DESC_CURRENT_ERROR: case SSD_DESC_DEFERRED_ERROR: { @@ -5799,13 +5713,12 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, sense = (struct scsi_sense_data_desc *) &ccb->csio.sense_data; - desc_ptr = scsi_find_desc(sense, ccb->csio.sense_len - - ccb->csio.sense_resid, SSD_DESC_ATA); + desc_ptr = scsi_find_desc(sense, sense_len, + SSD_DESC_ATA); if (desc_ptr == NULL) { cam_error_print(dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; - goto bailout; + return (1); } desc = (struct scsi_sense_ata_ret_desc *)desc_ptr; @@ -5837,22 +5750,47 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, } case SSD_CURRENT_ERROR: case SSD_DEFERRED_ERROR: { -#if 0 - struct scsi_sense_data_fixed *sense; -#endif + uint64_t val; + /* - * XXX KDM need to support fixed sense data. + * In my understanding of SAT-5 specification, saying: + * "without interpreting the contents of the STATUS", + * this should not happen if CK_COND was set, but it + * does at least for some devices, so try to revert. */ - warnx("%s: Fixed sense data not supported yet", - __func__); - retval = 1; - goto bailout; - break; /*NOTREACHED*/ + if ((sense_key == SSD_KEY_ABORTED_COMMAND) && + (asc == 0) && (ascq == 0)) { + *status = ATA_STATUS_ERROR; + *error = ATA_ERROR_ABORT; + *device = 0; + *count = 0; + *lba = 0; + return (0); + } + + if ((sense_key != SSD_KEY_RECOVERED_ERROR) || + (asc != 0x00) || (ascq != 0x1d)) + return (1); + + val = 0; + scsi_get_sense_info(&ccb->csio.sense_data, sense_len, + SSD_DESC_INFO, &val, NULL); + *error = (val >> 24) & 0xff; + *status = (val >> 16) & 0xff; + *device = (val >> 8) & 0xff; + *count = val & 0xff; + + val = 0; + scsi_get_sense_info(&ccb->csio.sense_data, sense_len, + SSD_DESC_COMMAND, &val, NULL); + *lba = ((val >> 16) & 0xff) | (val & 0xff00) | + ((val & 0xff) << 16); + + /* Report UPPER NONZERO bits as errors 2, 4 and 6. */ + return ((val >> 28) & 0x06); } default: - retval = 1; - goto bailout; - break; + return (1); } break; @@ -5860,11 +5798,11 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, case XPT_ATA_IO: { struct ata_res *res; - /* - * In this case, we have an ATA command, and we need to - * fill in the requested values from the result register - * set. - */ + /* Only some statuses return ATA result register set. */ + if (cam_ccb_status(ccb) != CAM_REQ_CMP && + cam_ccb_status(ccb) != CAM_ATA_STATUS_ERROR) + return (1); + res = &ccb->ataio.res; *error = res->error; *status = res->status; @@ -5873,7 +5811,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, *lba = (res->lba_high << 16) | (res->lba_mid << 8) | (res->lba_low); - if (res->flags & CAM_ATAIO_48BIT) { + if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) { *count |= (res->sector_count_exp << 8); *lba |= ((uint64_t)res->lba_low_exp << 24) | ((uint64_t)res->lba_mid_exp << 32) | @@ -5884,11 +5822,9 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, break; } default: - retval = 1; - break; + return (1); } -bailout: - return (retval); + return (0); } static void @@ -6486,7 +6422,7 @@ scsiformat(struct cam_device *device, int argc, char * if (reportonly) goto doreport; - if (quiet == 0) { + if (quiet == 0 && ycount == 0) { fprintf(stdout, "You are about to REMOVE ALL DATA from the " "following device:\n"); @@ -6727,66 +6663,78 @@ scsiformat_bailout: } static int -sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet) +sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet, + camcontrol_devtype devtype) { - struct ata_res *res; int retval; - cam_status status; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; u_int val, perc; do { - retval = ata_do_cmd(device, - ccb, - /*retries*/1, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SANITIZE, - /*features*/0x00, /* SANITIZE STATUS EXT */ - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/10000, - /*is48bit*/1); - if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + retval = build_ata_cmd(ccb, + /*retries*/ 0, + /*flags*/ CAM_DIR_NONE, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*protocol*/ AP_PROTO_NON_DATA, + /*ata_flags*/ AP_FLAG_CHK_COND, + /*features*/ 0x00, /* SANITIZE STATUS EXT */ + /*sector_count*/ 0, + /*lba*/ 0, + /*command*/ ATA_SANITIZE, + /*auxiliary*/ 0, + /*data_ptr*/ NULL, + /*dxfer_len*/ 0, + /*cdb_storage*/ NULL, + /*cdb_storage_len*/ 0, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 10000, + /*is48bit*/ 1, + /*devtype*/ devtype); + if (retval != 0) { + warnx("%s: build_ata_cmd() failed, likely " + "programmer error", __func__); return (1); } - status = ccb->ccb_h.status & CAM_STATUS_MASK; - if (status == CAM_REQ_CMP) { - res = &ccb->ataio.res; - if (res->sector_count_exp & 0x40) { - if (quiet == 0) { - val = (res->lba_mid << 8) + res->lba_low; - perc = 10000 * val; - fprintf(stdout, - "Sanitizing: %u.%02u%% (%d/%d)\r", - (perc / (0x10000 * 100)), - ((perc / 0x10000) % 100), - val, 0x10000); - fflush(stdout); - } - sleep(1); - } else if ((res->sector_count_exp & 0x80) == 0) { - warnx("Sanitize complete with an error. "); - return (1); - } else - break; + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + retval = cam_send_ccb(device, ccb); + if (retval != 0) { + warn("error sending SANITIZE STATUS EXT command"); + return (1); + } - } else if (status != CAM_REQ_CMP && status != CAM_REQUEUE_REQ) { - warnx("Unexpected CAM status %#x", status); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + retval = get_ata_status(device, ccb, &error, &count, &lba, + &ata_device, &status); + if (retval != 0) { + warnx("Can't get SANITIZE STATUS EXT status, " + "sanitize may still run."); + return (retval); + } + if (status & ATA_STATUS_ERROR) { + warnx("SANITIZE STATUS EXT failed, " + "sanitize may still run."); return (1); } + if (count & 0x4000) { + if (quiet == 0) { + val = lba & 0xffff; + perc = 10000 * val; + fprintf(stdout, + "Sanitizing: %u.%02u%% (%d/%d)\r", + (perc / (0x10000 * 100)), + ((perc / 0x10000) % 100), + val, 0x10000); + fflush(stdout); + } + sleep(1); + } else if ((count & 0x8000) == 0) { + warnx("Sanitize complete with an error. "); + return (1); + } else + break; } while (1); return (0); } @@ -7066,7 +7014,7 @@ sanitize(struct cam_device *device, int argc, char **a } } - if (quiet == 0) { + if (quiet == 0 && ycount == 0) { fprintf(stdout, "You are about to REMOVE ALL DATA from the " "following device:\n"); @@ -7194,7 +7142,7 @@ sanitize(struct cam_device *device, int argc, char **a retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_SANITIZE, /*features*/feature, @@ -7251,7 +7199,7 @@ doreport: if (dt == CC_DT_SCSI) { error = sanitize_wait_scsi(device, ccb, task_attr, quiet); } else if (dt == CC_DT_ATA || dt == CC_DT_SATL) { - error = sanitize_wait_ata(device, ccb, quiet); + error = sanitize_wait_ata(device, ccb, quiet, dt); } else error = 1; if (error == 0 && quiet == 0) @@ -9223,56 +9171,63 @@ bailout: static int atapm_proc_resp(struct cam_device *device, union ccb *ccb) { - struct ata_res *res; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; + int retval; - res = &ccb->ataio.res; - if (res->status & ATA_STATUS_ERROR) { - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - printf("error = 0x%02x, sector_count = 0x%04x, " - "device = 0x%02x, status = 0x%02x\n", - res->error, res->sector_count, - res->device, res->status); - } + retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device, + &status); + if (retval == 1) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + warnx("Can't get ATA command status"); + return (retval); + } - return (1); - } + if (status & ATA_STATUS_ERROR) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + return (1); + } - if (arglist & CAM_ARG_VERBOSE) { - fprintf(stdout, "%s%d: Raw native check power data:\n", - device->device_name, device->dev_unit_num); - /* res is 4 byte aligned */ - dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); + printf("%s%d: ", device->device_name, device->dev_unit_num); + switch (count) { + case 0x00: + printf("Standby mode\n"); + break; + case 0x01: + printf("Standby_y mode\n"); + break; + case 0x40: + printf("NV Cache Power Mode and the spindle is spun down or spinning down\n"); + break; + case 0x41: + printf("NV Cache Power Mode and the spindle is spun up or spinning up\n"); + break; + case 0x80: + printf("Idle mode\n"); + break; + case 0x81: + printf("Idle_a mode\n"); + break; + case 0x82: + printf("Idle_b mode\n"); + break; + case 0x83: + printf("Idle_c mode\n"); + break; + case 0xff: + printf("Active or Idle mode\n"); + break; + default: + printf("Unknown mode 0x%02x\n", count); + break; + } - printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " - "status = 0x%02x\n", res->error, res->sector_count, - res->device, res->status); - } - - printf("%s%d: ", device->device_name, device->dev_unit_num); - switch (res->sector_count) { - case 0x00: - printf("Standby mode\n"); - break; - case 0x40: - printf("NV Cache Power Mode and the spindle is spun down or spinning down\n"); - break; - case 0x41: - printf("NV Cache Power Mode and the spindle is spun up or spinning up\n"); - break; - case 0x80: - printf("Idle mode\n"); - break; - case 0xff: - printf("Active or Idle mode\n"); - break; - default: - printf("Unknown mode 0x%02x\n", res->sector_count); - break; - } - - return (0); + return (0); } static int From owner-svn-src-stable@freebsd.org Fri Sep 13 15:17: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 2615FF3F8D; Fri, 13 Sep 2019 15:17:31 +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 46VK4q0yYNz3Hq4; Fri, 13 Sep 2019 15:17:31 +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 0431790A3; Fri, 13 Sep 2019 15:17:31 +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 x8DFHUOc045461; Fri, 13 Sep 2019 15:17:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFHUYC045460; Fri, 13 Sep 2019 15:17:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131517.x8DFHUYC045460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:17: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: r352291 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 352291 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, 13 Sep 2019 15:17:31 -0000 Author: mav Date: Fri Sep 13 15:17:30 2019 New Revision: 352291 URL: https://svnweb.freebsd.org/changeset/base/352291 Log: MFC r352082, r352103: Fix number of problems found while testing on SAT devices. - Remove incomplete and dangerous ata_res decoding from ata_do_cmd(). Instead switch all functions that need the result to use get_ata_status(), doing the same, but more careful, also reducing code duplication. - Made get_ata_status() to also decode fixed format sense. In many cases it is still not enough to make it useful, since it can only report results of 28-bit command, but it is slightly better then nothing. - Organize error reporting in ata_do_cmd(), so that if caller specified AP_FLAG_CHK_COND, it is responsible for command errors (non-ioctl ones). - Make HPA/AMA errors not fatal for `identify` subcommand. - Fix reprobe() not being called on HPA/AMA when in quiet mode. - Remove not very useful messages from `format` and `sanitize` commands with -y flag. Once they started, they often can't be stopped any way. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:15:58 2019 (r352290) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:17:30 2019 (r352291) @@ -1603,7 +1603,7 @@ atacapprint(struct ata_params *parm) } static int -scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb, int quiet) +scsi_cam_pass_16_send(struct cam_device *device, union ccb *ccb) { struct ata_pass_16 *ata_pass_16; struct ata_cmd ata_cmd; @@ -1626,24 +1626,21 @@ scsi_cam_pass_16_send(struct cam_device *device, union ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warn("error sending ATA %s via pass_16", - ata_op_string(&ata_cmd)); - } + warn("error sending ATA %s via pass_16", ata_op_string(&ata_cmd)); return (1); } + /* + * Consider any non-CAM_REQ_CMP status as error and report it here, + * unless caller set AP_FLAG_CHK_COND, in which case it is reponsible. + */ if (!(ata_pass_16->flags & AP_FLAG_CHK_COND) && (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warnx("ATA %s via pass_16 failed", - ata_op_string(&ata_cmd)); - } + warnx("ATA %s via pass_16 failed", ata_op_string(&ata_cmd)); if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - return (1); } @@ -1652,7 +1649,7 @@ scsi_cam_pass_16_send(struct cam_device *device, union static int -ata_cam_send(struct cam_device *device, union ccb *ccb, int quiet) +ata_cam_send(struct cam_device *device, union ccb *ccb) { if (arglist & CAM_ARG_VERBOSE) { warnx("sending ATA %s with timeout of %u msecs", @@ -1667,24 +1664,21 @@ ata_cam_send(struct cam_device *device, union ccb *ccb ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; if (cam_send_ccb(device, ccb) < 0) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warn("error sending ATA %s", - ata_op_string(&(ccb->ataio.cmd))); - } + warn("error sending ATA %s", ata_op_string(&(ccb->ataio.cmd))); return (1); } - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (quiet != 1 || arglist & CAM_ARG_VERBOSE) { - warnx("ATA %s failed: %d", - ata_op_string(&(ccb->ataio.cmd)), quiet); - } - + /* + * Consider any non-CAM_REQ_CMP status as error and report it here, + * unless caller set AP_FLAG_CHK_COND, in which case it is reponsible. + */ + if (!(ccb->ataio.cmd.flags & CAM_ATAIO_NEEDRESULT) && + (ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + warnx("ATA %s failed", ata_op_string(&(ccb->ataio.cmd))); if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); } - return (1); } @@ -1696,7 +1690,7 @@ ata_do_pass_16(struct cam_device *device, union ccb *c u_int32_t flags, u_int8_t protocol, u_int8_t ata_flags, u_int8_t tag_action, u_int8_t command, u_int16_t features, u_int64_t lba, u_int16_t sector_count, u_int8_t *data_ptr, - u_int16_t dxfer_len, int timeout, int quiet) + u_int16_t dxfer_len, int timeout) { if (data_ptr != NULL) { if (flags & CAM_DIR_OUT) @@ -1726,7 +1720,7 @@ ata_do_pass_16(struct cam_device *device, union ccb *c /*sense_len*/SSD_FULL_SIZE, timeout); - return scsi_cam_pass_16_send(device, ccb, quiet); + return scsi_cam_pass_16_send(device, ccb); } static int @@ -1762,50 +1756,10 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, return (1); if (retval == 1) { - int error; - - /* Try using SCSI Passthrough */ - error = ata_do_pass_16(device, ccb, retries, flags, protocol, + return (ata_do_pass_16(device, ccb, retries, flags, protocol, ata_flags, tag_action, command, features, lba, sector_count, data_ptr, dxfer_len, - timeout, 0); - - if (ata_flags & AP_FLAG_CHK_COND) { - /* Decode ata_res from sense data */ - struct ata_res_pass16 *res_pass16; - struct ata_res *res; - u_int i; - u_int16_t *ptr; - - /* sense_data is 4 byte aligned */ - ptr = (uint16_t*)(uintptr_t)&ccb->csio.sense_data; - for (i = 0; i < sizeof(*res_pass16) / 2; i++) - ptr[i] = le16toh(ptr[i]); - - /* sense_data is 4 byte aligned */ - res_pass16 = (struct ata_res_pass16 *)(uintptr_t) - &ccb->csio.sense_data; - res = &ccb->ataio.res; - res->flags = res_pass16->flags; - res->status = res_pass16->status; - res->error = res_pass16->error; - res->lba_low = res_pass16->lba_low; - res->lba_mid = res_pass16->lba_mid; - res->lba_high = res_pass16->lba_high; - res->device = res_pass16->device; - res->lba_low_exp = res_pass16->lba_low_exp; - res->lba_mid_exp = res_pass16->lba_mid_exp; - res->lba_high_exp = res_pass16->lba_high_exp; - res->sector_count = res_pass16->sector_count; - res->sector_count_exp = res_pass16->sector_count_exp; - ccb->ccb_h.status &= ~CAM_STATUS_MASK; - if (res->status & ATA_STATUS_ERROR) - ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR; - else - ccb->ccb_h.status |= CAM_REQ_CMP; - } - - return (error); + timeout)); } CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->ataio); @@ -1826,7 +1780,7 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, if (ata_flags & AP_FLAG_CHK_COND) ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT; - return ata_cam_send(device, ccb, 0); + return ata_cam_send(device, ccb); } static void @@ -1846,52 +1800,43 @@ dump_data(uint16_t *ptr, uint32_t len) } static int -atahpa_proc_resp(struct cam_device *device, union ccb *ccb, - int is48bit, u_int64_t *hpasize) +atahpa_proc_resp(struct cam_device *device, union ccb *ccb, u_int64_t *hpasize) { - struct ata_res *res; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; + int retval; - res = &ccb->ataio.res; - if (res->status & ATA_STATUS_ERROR) { + retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device, + &status); + if (retval == 1) { if (arglist & CAM_ARG_VERBOSE) { cam_error_print(device, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - printf("error = 0x%02x, sector_count = 0x%04x, " - "device = 0x%02x, status = 0x%02x\n", - res->error, res->sector_count, - res->device, res->status); } + warnx("Can't get ATA command status"); + return (retval); + } - if (res->error & ATA_ERROR_ID_NOT_FOUND) { + if (status & ATA_STATUS_ERROR) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + + if (error & ATA_ERROR_ID_NOT_FOUND) { warnx("Max address has already been set since " "last power-on or hardware reset"); - } + } else if (hpasize == NULL) + warnx("Command failed with ATA error"); return (1); } - if (arglist & CAM_ARG_VERBOSE) { - fprintf(stdout, "%s%d: Raw native max data:\n", - device->device_name, device->dev_unit_num); - /* res is 4 byte aligned */ - dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); - - printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " - "status = 0x%02x\n", res->error, res->sector_count, - res->device, res->status); - } - if (hpasize != NULL) { - if (is48bit) { - *hpasize = (((u_int64_t)((res->lba_high_exp << 16) | - (res->lba_mid_exp << 8) | res->lba_low_exp) << 24) | - ((res->lba_high << 16) | (res->lba_mid << 8) | - res->lba_low)) + 1; - } else { - *hpasize = (((res->device & 0x0f) << 24) | - (res->lba_high << 16) | (res->lba_mid << 8) | - res->lba_low) + 1; - } + if (retval == 2 || retval == 6) + return (1); + *hpasize = lba; } return (0); @@ -1935,7 +1880,7 @@ ata_read_native_max(struct cam_device *device, int ret if (error) return (error); - return atahpa_proc_resp(device, ccb, is48bit, hpasize); + return atahpa_proc_resp(device, ccb, hpasize); } static int @@ -1979,7 +1924,7 @@ atahpa_set_max(struct cam_device *device, int retry_co if (error) return (error); - return atahpa_proc_resp(device, ccb, is48bit, NULL); + return atahpa_proc_resp(device, ccb, NULL); } static int @@ -1987,20 +1932,19 @@ atahpa_password(struct cam_device *device, int retry_c u_int32_t timeout, union ccb *ccb, int is48bit, struct ata_set_max_pwd *pwd) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_PIO_OUT; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | - AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, + AP_FLAG_TLEN_SECT_CNT, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_SET_PWD, @@ -2009,31 +1953,25 @@ atahpa_password(struct cam_device *device, int retry_c /*data_ptr*/(u_int8_t*)pwd, /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int atahpa_lock(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb, int is48bit) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_NON_DATA; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_LOCK, @@ -2042,12 +1980,7 @@ atahpa_lock(struct cam_device *device, int retry_count /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int @@ -2055,20 +1988,19 @@ atahpa_unlock(struct cam_device *device, int retry_cou u_int32_t timeout, union ccb *ccb, int is48bit, struct ata_set_max_pwd *pwd) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_PIO_OUT; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_OUT, /*protocol*/protocol, /*ata_flags*/AP_FLAG_BYT_BLOK_BLOCKS | - AP_FLAG_TLEN_SECT_CNT | AP_FLAG_CHK_COND, + AP_FLAG_TLEN_SECT_CNT, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_UNLOCK, @@ -2077,31 +2009,25 @@ atahpa_unlock(struct cam_device *device, int retry_cou /*data_ptr*/(u_int8_t*)pwd, /*dxfer_len*/sizeof(*pwd), timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int atahpa_freeze_lock(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb, int is48bit) { - int error; u_int cmd; u_int8_t protocol; protocol = AP_PROTO_NON_DATA; cmd = (is48bit) ? ATA_SET_MAX_ADDRESS48 : ATA_SET_MAX_ADDRESS; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/protocol, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/cmd, /*features*/ATA_HPA_FEAT_FREEZE, @@ -2110,12 +2036,7 @@ atahpa_freeze_lock(struct cam_device *device, int retr /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 1000, - is48bit); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, is48bit, NULL); + is48bit)); } static int @@ -2144,7 +2065,7 @@ ata_get_native_max(struct cam_device *device, int retr if (error) return (error); - return atahpa_proc_resp(device, ccb, /*is48bit*/1, nativesize); + return atahpa_proc_resp(device, ccb, nativesize); } static int @@ -2176,21 +2097,20 @@ ataama_set(struct cam_device *device, int retry_count, if (error) return (error); - return atahpa_proc_resp(device, ccb, /*is48bit*/1, NULL); + return atahpa_proc_resp(device, ccb, NULL); } static int ataama_freeze(struct cam_device *device, int retry_count, u_int32_t timeout, union ccb *ccb) { - int error; - error = ata_do_cmd(device, + return (ata_do_cmd(device, ccb, retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_AMAX_ADDR, /*features*/ATA_AMAX_ADDR_FREEZE, @@ -2199,12 +2119,7 @@ ataama_freeze(struct cam_device *device, int retry_cou /*data_ptr*/NULL, /*dxfer_len*/0, timeout ? timeout : 30 * 1000, - /*force48bit*/1); - - if (error) - return (error); - - return atahpa_proc_resp(device, ccb, /*is48bit*/1, NULL); + /*force48bit*/1)); } int @@ -2318,7 +2233,7 @@ ataidentify(struct cam_device *device, int retry_count { union ccb *ccb; struct ata_params *ident_buf; - u_int64_t hpasize, nativesize; + u_int64_t hpasize = 0, nativesize = 0; if ((ccb = cam_getccb(device)) == NULL) { warnx("couldn't allocate CCB"); @@ -2337,22 +2252,12 @@ ataidentify(struct cam_device *device, int retry_count } if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) { - if (ata_read_native_max(device, retry_count, timeout, ccb, - ident_buf, &hpasize) != 0) { - cam_freeccb(ccb); - return (1); - } - } else { - hpasize = 0; + ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); } if (ident_buf->support2 & ATA_SUPPORT_AMAX_ADDR) { - if (ata_get_native_max(device, retry_count, timeout, ccb, - &nativesize) != 0) { - cam_freeccb(ccb); - return (1); - } - } else { - nativesize = 0; + ata_get_native_max(device, retry_count, timeout, ccb, + &nativesize); } printf("%s%d: ", device->device_name, device->dev_unit_num); @@ -2843,10 +2748,11 @@ atahpa(struct cam_device *device, int retry_count, int } if (action == ATA_HPA_ACTION_PRINT) { - error = ata_read_native_max(device, retry_count, timeout, ccb, - ident_buf, &hpasize); - if (error == 0) - atahpa_print(ident_buf, hpasize, 1); + hpasize = 0; + if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) + ata_read_native_max(device, retry_count, timeout, ccb, + ident_buf, &hpasize); + atahpa_print(ident_buf, hpasize, 1); cam_freeccb(ccb); free(ident_buf); @@ -2889,12 +2795,14 @@ atahpa(struct cam_device *device, int retry_count, int if (error == 0) { error = atahpa_set_max(device, retry_count, timeout, ccb, is48bit, maxsize, persist); - if (error == 0 && quiet == 0) { - /* redo identify to get new lba values */ - error = ata_do_identify(device, retry_count, - timeout, ccb, - &ident_buf); - atahpa_print(ident_buf, hpasize, 1); + if (error == 0) { + if (quiet == 0) { + /* redo identify to get new values */ + error = ata_do_identify(device, + retry_count, timeout, ccb, + &ident_buf); + atahpa_print(ident_buf, hpasize, 1); + } /* Hint CAM to reprobe the device. */ reprobe(device); } @@ -3010,10 +2918,11 @@ ataama(struct cam_device *device, int retry_count, int } if (action == ATA_AMA_ACTION_PRINT) { - error = ata_get_native_max(device, retry_count, timeout, ccb, + nativesize = 0; + if (ident_buf->support2 & ATA_SUPPORT_AMAX_ADDR) + ata_get_native_max(device, retry_count, timeout, ccb, &nativesize); - if (error == 0) - ataama_print(ident_buf, nativesize, 1); + ataama_print(ident_buf, nativesize, 1); cam_freeccb(ccb); free(ident_buf); @@ -3034,11 +2943,14 @@ ataama(struct cam_device *device, int retry_count, int if (error == 0) { error = ataama_set(device, retry_count, timeout, ccb, maxsize); - if (error == 0 && quiet == 0) { - /* redo identify to get new lba values */ - error = ata_do_identify(device, retry_count, - timeout, ccb, &ident_buf); - ataama_print(ident_buf, nativesize, 1); + if (error == 0) { + if (quiet == 0) { + /* redo identify to get new values */ + error = ata_do_identify(device, + retry_count, timeout, ccb, + &ident_buf); + ataama_print(ident_buf, nativesize, 1); + } /* Hint CAM to reprobe the device. */ reprobe(device); } @@ -5552,16 +5464,21 @@ build_ata_cmd(union ccb *ccb, uint32_t retry_count, ui return (retval); } +/* + * Returns: 0 -- success, 1 -- error, 2 -- lba truncated, + * 4 -- count truncated, 6 -- lba and count truncated. + */ int get_ata_status(struct cam_device *dev, union ccb *ccb, uint8_t *error, uint16_t *count, uint64_t *lba, uint8_t *device, uint8_t *status) { - int retval = 0; + int retval; switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { uint8_t opcode; int error_code = 0, sense_key = 0, asc = 0, ascq = 0; + u_int sense_len; /* * In this case, we have SCSI ATA PASS-THROUGH command, 12 @@ -5573,20 +5490,17 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, opcode = ccb->csio.cdb_io.cdb_bytes[0]; if ((opcode != ATA_PASS_12) && (opcode != ATA_PASS_16)) { - retval = 1; warnx("%s: unsupported opcode %02x", __func__, opcode); - goto bailout; + return (1); } retval = scsi_extract_sense_ccb(ccb, &error_code, &sense_key, &asc, &ascq); /* Note: the _ccb() variant returns 0 for an error */ - if (retval == 0) { - retval = 1; - goto bailout; - } else - retval = 0; + if (retval == 0) + return (1); + sense_len = ccb->csio.sense_len - ccb->csio.sense_resid; switch (error_code) { case SSD_DESC_CURRENT_ERROR: case SSD_DESC_DEFERRED_ERROR: { @@ -5597,13 +5511,12 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, sense = (struct scsi_sense_data_desc *) &ccb->csio.sense_data; - desc_ptr = scsi_find_desc(sense, ccb->csio.sense_len - - ccb->csio.sense_resid, SSD_DESC_ATA); + desc_ptr = scsi_find_desc(sense, sense_len, + SSD_DESC_ATA); if (desc_ptr == NULL) { cam_error_print(dev, ccb, CAM_ESF_ALL, CAM_EPF_ALL, stderr); - retval = 1; - goto bailout; + return (1); } desc = (struct scsi_sense_ata_ret_desc *)desc_ptr; @@ -5635,22 +5548,47 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, } case SSD_CURRENT_ERROR: case SSD_DEFERRED_ERROR: { -#if 0 - struct scsi_sense_data_fixed *sense; -#endif + uint64_t val; + /* - * XXX KDM need to support fixed sense data. + * In my understanding of SAT-5 specification, saying: + * "without interpreting the contents of the STATUS", + * this should not happen if CK_COND was set, but it + * does at least for some devices, so try to revert. */ - warnx("%s: Fixed sense data not supported yet", - __func__); - retval = 1; - goto bailout; - break; /*NOTREACHED*/ + if ((sense_key == SSD_KEY_ABORTED_COMMAND) && + (asc == 0) && (ascq == 0)) { + *status = ATA_STATUS_ERROR; + *error = ATA_ERROR_ABORT; + *device = 0; + *count = 0; + *lba = 0; + return (0); + } + + if ((sense_key != SSD_KEY_RECOVERED_ERROR) || + (asc != 0x00) || (ascq != 0x1d)) + return (1); + + val = 0; + scsi_get_sense_info(&ccb->csio.sense_data, sense_len, + SSD_DESC_INFO, &val, NULL); + *error = (val >> 24) & 0xff; + *status = (val >> 16) & 0xff; + *device = (val >> 8) & 0xff; + *count = val & 0xff; + + val = 0; + scsi_get_sense_info(&ccb->csio.sense_data, sense_len, + SSD_DESC_COMMAND, &val, NULL); + *lba = ((val >> 16) & 0xff) | (val & 0xff00) | + ((val & 0xff) << 16); + + /* Report UPPER NONZERO bits as errors 2, 4 and 6. */ + return ((val >> 28) & 0x06); } default: - retval = 1; - goto bailout; - break; + return (1); } break; @@ -5658,11 +5596,11 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, case XPT_ATA_IO: { struct ata_res *res; - /* - * In this case, we have an ATA command, and we need to - * fill in the requested values from the result register - * set. - */ + /* Only some statuses return ATA result register set. */ + if (cam_ccb_status(ccb) != CAM_REQ_CMP && + cam_ccb_status(ccb) != CAM_ATA_STATUS_ERROR) + return (1); + res = &ccb->ataio.res; *error = res->error; *status = res->status; @@ -5671,7 +5609,7 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, *lba = (res->lba_high << 16) | (res->lba_mid << 8) | (res->lba_low); - if (res->flags & CAM_ATAIO_48BIT) { + if (ccb->ataio.cmd.flags & CAM_ATAIO_48BIT) { *count |= (res->sector_count_exp << 8); *lba |= ((uint64_t)res->lba_low_exp << 24) | ((uint64_t)res->lba_mid_exp << 32) | @@ -5682,11 +5620,9 @@ get_ata_status(struct cam_device *dev, union ccb *ccb, break; } default: - retval = 1; - break; + return (1); } -bailout: - return (retval); + return (0); } static void @@ -6284,7 +6220,7 @@ scsiformat(struct cam_device *device, int argc, char * if (reportonly) goto doreport; - if (quiet == 0) { + if (quiet == 0 && ycount == 0) { fprintf(stdout, "You are about to REMOVE ALL DATA from the " "following device:\n"); @@ -6525,66 +6461,78 @@ scsiformat_bailout: } static int -sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet) +sanitize_wait_ata(struct cam_device *device, union ccb *ccb, int quiet, + camcontrol_devtype devtype) { - struct ata_res *res; int retval; - cam_status status; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; u_int val, perc; do { - retval = ata_do_cmd(device, - ccb, - /*retries*/1, - /*flags*/CAM_DIR_NONE, - /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*command*/ATA_SANITIZE, - /*features*/0x00, /* SANITIZE STATUS EXT */ - /*lba*/0, - /*sector_count*/0, - /*data_ptr*/NULL, - /*dxfer_len*/0, - /*timeout*/10000, - /*is48bit*/1); - if (retval < 0) { - warn("error sending CAMIOCOMMAND ioctl"); - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - } + retval = build_ata_cmd(ccb, + /*retries*/ 0, + /*flags*/ CAM_DIR_NONE, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*protocol*/ AP_PROTO_NON_DATA, + /*ata_flags*/ AP_FLAG_CHK_COND, + /*features*/ 0x00, /* SANITIZE STATUS EXT */ + /*sector_count*/ 0, + /*lba*/ 0, + /*command*/ ATA_SANITIZE, + /*auxiliary*/ 0, + /*data_ptr*/ NULL, + /*dxfer_len*/ 0, + /*cdb_storage*/ NULL, + /*cdb_storage_len*/ 0, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 10000, + /*is48bit*/ 1, + /*devtype*/ devtype); + if (retval != 0) { + warnx("%s: build_ata_cmd() failed, likely " + "programmer error", __func__); return (1); } - status = ccb->ccb_h.status & CAM_STATUS_MASK; - if (status == CAM_REQ_CMP) { - res = &ccb->ataio.res; - if (res->sector_count_exp & 0x40) { - if (quiet == 0) { - val = (res->lba_mid << 8) + res->lba_low; - perc = 10000 * val; - fprintf(stdout, - "Sanitizing: %u.%02u%% (%d/%d)\r", - (perc / (0x10000 * 100)), - ((perc / 0x10000) % 100), - val, 0x10000); - fflush(stdout); - } - sleep(1); - } else if ((res->sector_count_exp & 0x80) == 0) { - warnx("Sanitize complete with an error. "); - return (1); - } else - break; + ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER; + retval = cam_send_ccb(device, ccb); + if (retval != 0) { + warn("error sending SANITIZE STATUS EXT command"); + return (1); + } - } else if (status != CAM_REQ_CMP && status != CAM_REQUEUE_REQ) { - warnx("Unexpected CAM status %#x", status); - if (arglist & CAM_ARG_VERBOSE) - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); + retval = get_ata_status(device, ccb, &error, &count, &lba, + &ata_device, &status); + if (retval != 0) { + warnx("Can't get SANITIZE STATUS EXT status, " + "sanitize may still run."); + return (retval); + } + if (status & ATA_STATUS_ERROR) { + warnx("SANITIZE STATUS EXT failed, " + "sanitize may still run."); return (1); } + if (count & 0x4000) { + if (quiet == 0) { + val = lba & 0xffff; + perc = 10000 * val; + fprintf(stdout, + "Sanitizing: %u.%02u%% (%d/%d)\r", + (perc / (0x10000 * 100)), + ((perc / 0x10000) % 100), + val, 0x10000); + fflush(stdout); + } + sleep(1); + } else if ((count & 0x8000) == 0) { + warnx("Sanitize complete with an error. "); + return (1); + } else + break; } while (1); return (0); } @@ -6864,7 +6812,7 @@ sanitize(struct cam_device *device, int argc, char **a } } - if (quiet == 0) { + if (quiet == 0 && ycount == 0) { fprintf(stdout, "You are about to REMOVE ALL DATA from the " "following device:\n"); @@ -6992,7 +6940,7 @@ sanitize(struct cam_device *device, int argc, char **a retry_count, /*flags*/CAM_DIR_NONE, /*protocol*/AP_PROTO_NON_DATA | AP_EXTEND, - /*ata_flags*/AP_FLAG_CHK_COND, + /*ata_flags*/0, /*tag_action*/MSG_SIMPLE_Q_TAG, /*command*/ATA_SANITIZE, /*features*/feature, @@ -7049,7 +6997,7 @@ doreport: if (dt == CC_DT_SCSI) { error = sanitize_wait_scsi(device, ccb, task_attr, quiet); } else if (dt == CC_DT_ATA || dt == CC_DT_SATL) { - error = sanitize_wait_ata(device, ccb, quiet); + error = sanitize_wait_ata(device, ccb, quiet, dt); } else error = 1; if (error == 0 && quiet == 0) @@ -8737,56 +8685,63 @@ bailout: static int atapm_proc_resp(struct cam_device *device, union ccb *ccb) { - struct ata_res *res; + uint8_t error = 0, ata_device = 0, status = 0; + uint16_t count = 0; + uint64_t lba = 0; + int retval; - res = &ccb->ataio.res; - if (res->status & ATA_STATUS_ERROR) { - if (arglist & CAM_ARG_VERBOSE) { - cam_error_print(device, ccb, CAM_ESF_ALL, - CAM_EPF_ALL, stderr); - printf("error = 0x%02x, sector_count = 0x%04x, " - "device = 0x%02x, status = 0x%02x\n", - res->error, res->sector_count, - res->device, res->status); - } + retval = get_ata_status(device, ccb, &error, &count, &lba, &ata_device, + &status); + if (retval == 1) { + if (arglist & CAM_ARG_VERBOSE) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + } + warnx("Can't get ATA command status"); + return (retval); + } - return (1); - } + if (status & ATA_STATUS_ERROR) { + cam_error_print(device, ccb, CAM_ESF_ALL, + CAM_EPF_ALL, stderr); + return (1); + } - if (arglist & CAM_ARG_VERBOSE) { - fprintf(stdout, "%s%d: Raw native check power data:\n", - device->device_name, device->dev_unit_num); - /* res is 4 byte aligned */ - dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res)); + printf("%s%d: ", device->device_name, device->dev_unit_num); + switch (count) { + case 0x00: + printf("Standby mode\n"); + break; + case 0x01: + printf("Standby_y mode\n"); + break; + case 0x40: + printf("NV Cache Power Mode and the spindle is spun down or spinning down\n"); + break; + case 0x41: + printf("NV Cache Power Mode and the spindle is spun up or spinning up\n"); + break; + case 0x80: + printf("Idle mode\n"); + break; + case 0x81: + printf("Idle_a mode\n"); + break; + case 0x82: + printf("Idle_b mode\n"); + break; + case 0x83: + printf("Idle_c mode\n"); + break; + case 0xff: + printf("Active or Idle mode\n"); + break; + default: + printf("Unknown mode 0x%02x\n", count); + break; + } - printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, " - "status = 0x%02x\n", res->error, res->sector_count, - res->device, res->status); - } - - printf("%s%d: ", device->device_name, device->dev_unit_num); - switch (res->sector_count) { - case 0x00: - printf("Standby mode\n"); - break; - case 0x40: - printf("NV Cache Power Mode and the spindle is spun down or spinning down\n"); - break; - case 0x41: - printf("NV Cache Power Mode and the spindle is spun up or spinning up\n"); - break; - case 0x80: - printf("Idle mode\n"); - break; - case 0xff: - printf("Active or Idle mode\n"); - break; - default: - printf("Unknown mode 0x%02x\n", res->sector_count); - break; - } - - return (0); + return (0); } static int From owner-svn-src-stable@freebsd.org Fri Sep 13 15:18: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 744E7F405F; Fri, 13 Sep 2019 15:18:29 +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 46VK5x2VKcz3J1k; Fri, 13 Sep 2019 15:18:29 +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 3A4D290A4; Fri, 13 Sep 2019 15:18:29 +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 x8DFITso045579; Fri, 13 Sep 2019 15:18:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFIT28045578; Fri, 13 Sep 2019 15:18:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131518.x8DFIT28045578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:18: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: r352292 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 352292 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, 13 Sep 2019 15:18:29 -0000 Author: mav Date: Fri Sep 13 15:18:28 2019 New Revision: 352292 URL: https://svnweb.freebsd.org/changeset/base/352292 Log: MFC r352111: Initialize page/subpage in case of `modepage -d`. Previously without -m parameter it worked mostly by concodence. While there, make page/subpage values validation more strict. Modified: stable/12/sbin/camcontrol/camcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:17:30 2019 (r352291) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:18:28 2019 (r352292) @@ -4574,7 +4574,7 @@ modepage(struct cam_device *device, int argc, char **a int task_attr, int retry_count, int timeout) { char *str_subpage; - int c, page = -1, subpage = -1, pc = 0, llbaa = 0; + int c, page = -1, subpage = 0, pc = 0, llbaa = 0; int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { @@ -4600,11 +4600,9 @@ modepage(struct cam_device *device, int argc, char **a page = strtol(optarg, NULL, 0); if (str_subpage) subpage = strtol(str_subpage, NULL, 0); - else - subpage = 0; - if (page < 0) + if (page < 0 || page > 0x3f) errx(1, "invalid mode page %d", page); - if (subpage < 0) + if (subpage < 0 || subpage > 0xff) errx(1, "invalid mode subpage %d", subpage); break; case 'D': @@ -4623,7 +4621,10 @@ modepage(struct cam_device *device, int argc, char **a } } - if (page == -1 && desc == 0 && list == 0) + if (desc && page == -1) + page = SMS_ALL_PAGES_PAGE; + + if (page == -1 && list == 0) errx(1, "you must specify a mode page!"); if (dbd && desc) From owner-svn-src-stable@freebsd.org Fri Sep 13 15:18:46 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 67DEDF40FA; Fri, 13 Sep 2019 15:18:46 +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 46VK6G29fBz3J8J; Fri, 13 Sep 2019 15:18:46 +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 2F23890A6; Fri, 13 Sep 2019 15:18:46 +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 x8DFIkOF045654; Fri, 13 Sep 2019 15:18:46 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFIkp1045653; Fri, 13 Sep 2019 15:18:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131518.x8DFIkp1045653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:18:46 +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: r352293 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 352293 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, 13 Sep 2019 15:18:46 -0000 Author: mav Date: Fri Sep 13 15:18:45 2019 New Revision: 352293 URL: https://svnweb.freebsd.org/changeset/base/352293 Log: MFC r352111: Initialize page/subpage in case of `modepage -d`. Previously without -m parameter it worked mostly by concodence. While there, make page/subpage values validation more strict. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:18:28 2019 (r352292) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:18:45 2019 (r352293) @@ -4393,7 +4393,7 @@ modepage(struct cam_device *device, int argc, char **a int task_attr, int retry_count, int timeout) { char *str_subpage; - int c, page = -1, subpage = -1, pc = 0, llbaa = 0; + int c, page = -1, subpage = 0, pc = 0, llbaa = 0; int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { @@ -4419,11 +4419,9 @@ modepage(struct cam_device *device, int argc, char **a page = strtol(optarg, NULL, 0); if (str_subpage) subpage = strtol(str_subpage, NULL, 0); - else - subpage = 0; - if (page < 0) + if (page < 0 || page > 0x3f) errx(1, "invalid mode page %d", page); - if (subpage < 0) + if (subpage < 0 || subpage > 0xff) errx(1, "invalid mode subpage %d", subpage); break; case 'D': @@ -4442,7 +4440,10 @@ modepage(struct cam_device *device, int argc, char **a } } - if (page == -1 && desc == 0 && list == 0) + if (desc && page == -1) + page = SMS_ALL_PAGES_PAGE; + + if (page == -1 && list == 0) errx(1, "you must specify a mode page!"); if (dbd && desc) From owner-svn-src-stable@freebsd.org Fri Sep 13 15:19:51 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 24E16F41E0; Fri, 13 Sep 2019 15:19:51 +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 46VK7V7408z3JJm; Fri, 13 Sep 2019 15:19:50 +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 D758590D0; Fri, 13 Sep 2019 15:19:50 +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 x8DFJobb045778; Fri, 13 Sep 2019 15:19:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFJokt045777; Fri, 13 Sep 2019 15:19:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131519.x8DFJokt045777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:19: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: r352294 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 352294 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, 13 Sep 2019 15:19:51 -0000 Author: mav Date: Fri Sep 13 15:19:50 2019 New Revision: 352294 URL: https://svnweb.freebsd.org/changeset/base/352294 Log: MFC r352200: Remove struct ata_res_pass16, unneeded after r352082. Modified: stable/12/sbin/camcontrol/camcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:18:45 2019 (r352293) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:19:50 2019 (r352294) @@ -156,22 +156,6 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -struct ata_res_pass16 { - u_int16_t reserved[5]; - u_int8_t flags; - u_int8_t error; - u_int8_t sector_count_exp; - u_int8_t sector_count; - u_int8_t lba_low_exp; - u_int8_t lba_low; - u_int8_t lba_mid_exp; - u_int8_t lba_mid; - u_int8_t lba_high_exp; - u_int8_t lba_high; - u_int8_t device; - u_int8_t status; -}; - struct ata_set_max_pwd { u_int16_t reserved1; From owner-svn-src-stable@freebsd.org Fri Sep 13 15:20: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 D3612F4281; Fri, 13 Sep 2019 15:20:30 +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 46VK8G5FdLz3JRR; Fri, 13 Sep 2019 15:20:30 +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 95EC690D4; Fri, 13 Sep 2019 15:20:30 +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 x8DFKUnI045904; Fri, 13 Sep 2019 15:20:30 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFKUe4045903; Fri, 13 Sep 2019 15:20:30 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131520.x8DFKUe4045903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:20: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: r352295 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 352295 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, 13 Sep 2019 15:20:30 -0000 Author: mav Date: Fri Sep 13 15:20:30 2019 New Revision: 352295 URL: https://svnweb.freebsd.org/changeset/base/352295 Log: MFC r352200: Remove struct ata_res_pass16, unneeded after r352082. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:19:50 2019 (r352294) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:20:30 2019 (r352295) @@ -151,22 +151,6 @@ struct camcontrol_opts { }; #ifndef MINIMALISTIC -struct ata_res_pass16 { - u_int16_t reserved[5]; - u_int8_t flags; - u_int8_t error; - u_int8_t sector_count_exp; - u_int8_t sector_count; - u_int8_t lba_low_exp; - u_int8_t lba_low; - u_int8_t lba_mid_exp; - u_int8_t lba_mid; - u_int8_t lba_high_exp; - u_int8_t lba_high; - u_int8_t device; - u_int8_t status; -}; - struct ata_set_max_pwd { u_int16_t reserved1; From owner-svn-src-stable@freebsd.org Fri Sep 13 15:21:19 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 88688F443D; Fri, 13 Sep 2019 15:21:19 +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 46VK9C2lY4z3JjK; Fri, 13 Sep 2019 15:21:19 +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 41CD49229; Fri, 13 Sep 2019 15:21:19 +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 x8DFLJ69046705; Fri, 13 Sep 2019 15:21:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFLJ7W046704; Fri, 13 Sep 2019 15:21:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131521.x8DFLJ7W046704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:21: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: r352296 - stable/12/sbin/camcontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/camcontrol X-SVN-Commit-Revision: 352296 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, 13 Sep 2019 15:21:19 -0000 Author: mav Date: Fri Sep 13 15:21:18 2019 New Revision: 352296 URL: https://svnweb.freebsd.org/changeset/base/352296 Log: MFC r352257: Report Trusted Computing feature set support. It practically means the device is SED. Modified: stable/12/sbin/camcontrol/camcontrol.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:20:30 2019 (r352295) +++ stable/12/sbin/camcontrol/camcontrol.c Fri Sep 13 15:21:18 2019 (r352296) @@ -1736,6 +1736,9 @@ atacapprint(struct ata_params *parm) } else { printf("no\n"); } + printf("Trusted Computing %s\n", + ((parm->tcg & 0xc000) == 0x4000) && (parm->tcg & ATA_SUPPORT_TCG) ? + "yes" : "no"); printf("encrypts all user data %s\n", parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no"); printf("Sanitize "); From owner-svn-src-stable@freebsd.org Fri Sep 13 15:21: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 ED59AF44B5; Fri, 13 Sep 2019 15:21:36 +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 46VK9X61t4z3JrM; Fri, 13 Sep 2019 15:21:36 +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 B21809244; Fri, 13 Sep 2019 15:21: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 x8DFLaJF047492; Fri, 13 Sep 2019 15:21:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFLaxF047491; Fri, 13 Sep 2019 15:21:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131521.x8DFLaxF047491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:21: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: r352297 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sbin/camcontrol X-SVN-Commit-Revision: 352297 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, 13 Sep 2019 15:21:37 -0000 Author: mav Date: Fri Sep 13 15:21:36 2019 New Revision: 352297 URL: https://svnweb.freebsd.org/changeset/base/352297 Log: MFC r352257: Report Trusted Computing feature set support. It practically means the device is SED. Modified: stable/11/sbin/camcontrol/camcontrol.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.c ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:21:18 2019 (r352296) +++ stable/11/sbin/camcontrol/camcontrol.c Fri Sep 13 15:21:36 2019 (r352297) @@ -1569,6 +1569,9 @@ atacapprint(struct ata_params *parm) } else { printf("no\n"); } + printf("Trusted Computing %s\n", + ((parm->tcg & 0xc000) == 0x4000) && (parm->tcg & ATA_SUPPORT_TCG) ? + "yes" : "no"); printf("encrypts all user data %s\n", parm->support3 & ATA_ENCRYPTS_ALL_USER_DATA ? "yes" : "no"); printf("Sanitize "); From owner-svn-src-stable@freebsd.org Fri Sep 13 15:48:12 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 97E6BF4DFC; Fri, 13 Sep 2019 15:48:12 +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 46VKmD3Zc8z3LGb; Fri, 13 Sep 2019 15:48:12 +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 41224961C; Fri, 13 Sep 2019 15:48:12 +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 x8DFmCf6063956; Fri, 13 Sep 2019 15:48:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFmBWH063954; Fri, 13 Sep 2019 15:48:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131548.x8DFmBWH063954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:48: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: r352298 - in stable/12/sys/cam: . scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/cam: . scsi X-SVN-Commit-Revision: 352298 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, 13 Sep 2019 15:48:12 -0000 Author: mav Date: Fri Sep 13 15:48:11 2019 New Revision: 352298 URL: https://svnweb.freebsd.org/changeset/base/352298 Log: MFC r352201: Fix assumptions of only one device per SES slot. It is typical to have one, but no longer true for multi-actuator HDDs with separate LUN for each actuator. Modified: stable/12/sys/cam/cam_periph.c stable/12/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_periph.c ============================================================================== --- stable/12/sys/cam/cam_periph.c Fri Sep 13 15:21:36 2019 (r352297) +++ stable/12/sys/cam/cam_periph.c Fri Sep 13 15:48:11 2019 (r352298) @@ -402,7 +402,9 @@ retry: } xpt_unlock_buses(); sbuf_finish(&local_sb); - sbuf_cpy(sb, sbuf_data(&local_sb)); + if (sbuf_len(sb) != 0) + sbuf_cat(sb, ","); + sbuf_cat(sb, sbuf_data(&local_sb)); sbuf_delete(&local_sb); return (count); } Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_ses.c Fri Sep 13 15:21:36 2019 (r352297) +++ stable/12/sys/cam/scsi/scsi_enc_ses.c Fri Sep 13 15:48:11 2019 (r352298) @@ -883,6 +883,7 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele struct device_match_result *device_match; struct device_match_pattern *device_pattern; ses_path_iter_args_t *args; + struct cam_path *path; args = (ses_path_iter_args_t *)arg; match_pattern.type = DEV_MATCH_DEVICE; @@ -908,23 +909,26 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele cdm.match_buf_len = sizeof(match_result); cdm.matches = &match_result; - xpt_action((union ccb *)&cdm); - xpt_free_path(cdm.ccb_h.path); + do { + xpt_action((union ccb *)&cdm); - if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP - || (cdm.status != CAM_DEV_MATCH_LAST - && cdm.status != CAM_DEV_MATCH_MORE) - || cdm.num_matches == 0) - return; + if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP || + (cdm.status != CAM_DEV_MATCH_LAST && + cdm.status != CAM_DEV_MATCH_MORE) || + cdm.num_matches == 0) + break; - device_match = &match_result.result.device_result; - if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, - device_match->path_id, - device_match->target_id, - device_match->target_lun) != CAM_REQ_CMP) - return; + device_match = &match_result.result.device_result; + if (xpt_create_path(&path, /*periph*/NULL, + device_match->path_id, + device_match->target_id, + device_match->target_lun) == CAM_REQ_CMP) { - args->callback(enc, elem, cdm.ccb_h.path, args->callback_arg); + args->callback(enc, elem, path, args->callback_arg); + + xpt_free_path(path); + } + } while (cdm.status == CAM_DEV_MATCH_MORE); xpt_free_path(cdm.ccb_h.path); } From owner-svn-src-stable@freebsd.org Fri Sep 13 15:49: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 65EAAF4E97; Fri, 13 Sep 2019 15:49:03 +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 46VKnC23P1z3LP7; Fri, 13 Sep 2019 15:49:03 +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 0ACFA961D; Fri, 13 Sep 2019 15:49:03 +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 x8DFn27o064058; Fri, 13 Sep 2019 15:49:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DFn2sD064056; Fri, 13 Sep 2019 15:49:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909131549.x8DFn2sD064056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 13 Sep 2019 15:49: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: r352299 - in stable/11/sys/cam: . scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cam: . scsi X-SVN-Commit-Revision: 352299 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, 13 Sep 2019 15:49:03 -0000 Author: mav Date: Fri Sep 13 15:49:02 2019 New Revision: 352299 URL: https://svnweb.freebsd.org/changeset/base/352299 Log: MFC r352201: Fix assumptions of only one device per SES slot. It is typical to have one, but no longer true for multi-actuator HDDs with separate LUN for each actuator. Modified: stable/11/sys/cam/cam_periph.c stable/11/sys/cam/scsi/scsi_enc_ses.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Fri Sep 13 15:48:11 2019 (r352298) +++ stable/11/sys/cam/cam_periph.c Fri Sep 13 15:49:02 2019 (r352299) @@ -399,7 +399,9 @@ retry: } xpt_unlock_buses(); sbuf_finish(&local_sb); - sbuf_cpy(sb, sbuf_data(&local_sb)); + if (sbuf_len(sb) != 0) + sbuf_cat(sb, ","); + sbuf_cat(sb, sbuf_data(&local_sb)); sbuf_delete(&local_sb); return (count); } Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_enc_ses.c Fri Sep 13 15:48:11 2019 (r352298) +++ stable/11/sys/cam/scsi/scsi_enc_ses.c Fri Sep 13 15:49:02 2019 (r352299) @@ -881,6 +881,7 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele struct device_match_result *device_match; struct device_match_pattern *device_pattern; ses_path_iter_args_t *args; + struct cam_path *path; args = (ses_path_iter_args_t *)arg; match_pattern.type = DEV_MATCH_DEVICE; @@ -906,23 +907,26 @@ ses_path_iter_devid_callback(enc_softc_t *enc, enc_ele cdm.match_buf_len = sizeof(match_result); cdm.matches = &match_result; - xpt_action((union ccb *)&cdm); - xpt_free_path(cdm.ccb_h.path); + do { + xpt_action((union ccb *)&cdm); - if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP - || (cdm.status != CAM_DEV_MATCH_LAST - && cdm.status != CAM_DEV_MATCH_MORE) - || cdm.num_matches == 0) - return; + if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP || + (cdm.status != CAM_DEV_MATCH_LAST && + cdm.status != CAM_DEV_MATCH_MORE) || + cdm.num_matches == 0) + break; - device_match = &match_result.result.device_result; - if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, - device_match->path_id, - device_match->target_id, - device_match->target_lun) != CAM_REQ_CMP) - return; + device_match = &match_result.result.device_result; + if (xpt_create_path(&path, /*periph*/NULL, + device_match->path_id, + device_match->target_id, + device_match->target_lun) == CAM_REQ_CMP) { - args->callback(enc, elem, cdm.ccb_h.path, args->callback_arg); + args->callback(enc, elem, path, args->callback_arg); + + xpt_free_path(path); + } + } while (cdm.status == CAM_DEV_MATCH_MORE); xpt_free_path(cdm.ccb_h.path); } From owner-svn-src-stable@freebsd.org Fri Sep 13 21:20:25 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 BC789D3845; Fri, 13 Sep 2019 21:20:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46VT7Y4ZB8z486j; Fri, 13 Sep 2019 21:20:25 +0000 (UTC) (envelope-from manu@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 7D288D5D8; Fri, 13 Sep 2019 21:20:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8DLKPNa061336; Fri, 13 Sep 2019 21:20:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DLKOmh061333; Fri, 13 Sep 2019 21:20:24 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201909132120.x8DLKOmh061333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 13 Sep 2019 21:20:24 +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: r352309 - in stable/12/sys: arm/mv dev/extres/syscon dev/fdt X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in stable/12/sys: arm/mv dev/extres/syscon dev/fdt X-SVN-Commit-Revision: 352309 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, 13 Sep 2019 21:20:25 -0000 Author: manu Date: Fri Sep 13 21:20:24 2019 New Revision: 352309 URL: https://svnweb.freebsd.org/changeset/base/352309 Log: MFC r351184, r351189, r351217 r351184: Add method for getting of syscon handle from parent device. If simple multifuction device also provides syscon interface, its childern should be able to consume it. Due to this: - declare coresponding method in syscon interface - implement it in simple multifunction device driver r351189: Fix bug introduced by r351184. We should check the returned handle, not the pointer to it. Noticed by: ian X-MFC with: r351184 r351217: arm64: a37x0_gpio: Use syscon instead of MMIO region The fdt node for this driver is a simple-mfd and syscon compatible one meaning that simplemfd will be the driver attached for it. The gpio driver is attached to the 'gpio' subnode so use syscon_get_handle_default to obtain the handle of the syscon from the parent device and use this to read/write to the memory region. Modified: stable/12/sys/arm/mv/a37x0_gpio.c stable/12/sys/dev/extres/syscon/syscon.c stable/12/sys/dev/extres/syscon/syscon_if.m stable/12/sys/dev/fdt/simple_mfd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/mv/a37x0_gpio.c ============================================================================== --- stable/12/sys/arm/mv/a37x0_gpio.c Fri Sep 13 21:15:01 2019 (r352308) +++ stable/12/sys/arm/mv/a37x0_gpio.c Fri Sep 13 21:20:24 2019 (r352309) @@ -46,21 +46,14 @@ __FBSDID("$FreeBSD$"); #include #include "gpio_if.h" +#include "syscon_if.h" -static struct resource_spec a37x0_gpio_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Pinctl / GPIO */ - { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* Interrupts control */ - { -1, 0, 0 } -}; - struct a37x0_gpio_softc { - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; device_t sc_busdev; int sc_type; uint32_t sc_max_pins; uint32_t sc_npins; - struct resource *sc_mem_res[nitems(a37x0_gpio_res_spec) - 1]; + struct syscon *syscon; }; /* Memory regions. */ @@ -72,9 +65,9 @@ struct a37x0_gpio_softc { #define A37X0_SB_GPIO 2 #define A37X0_GPIO_WRITE(_sc, _off, _val) \ - bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off), (_val)) + SYSCON_WRITE_4((_sc)->syscon, (_off), (_val)) #define A37X0_GPIO_READ(_sc, _off) \ - bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off)) + SYSCON_READ_4((_sc)->syscon, (_off)) #define A37X0_GPIO_BIT(_p) (1U << ((_p) % 32)) #define A37X0_GPIO_OUT_EN(_p) (0x0 + ((_p) / 32) * 4) @@ -280,6 +273,12 @@ a37x0_gpio_attach(device_t dev) sc = device_get_softc(dev); + err = syscon_get_handle_default(dev, &sc->syscon); + if (err != 0) { + device_printf(dev, "Cannot get syscon handle from parent\n"); + return (ENXIO); + } + /* Read and verify the "gpio-ranges" property. */ ncells = OF_getencprop_alloc(ofw_bus_get_node(dev), "gpio-ranges", (void **)&ranges); @@ -295,14 +294,6 @@ a37x0_gpio_attach(device_t dev) /* Check the number of pins in the DTS vs HW capabilities. */ if (sc->sc_npins > sc->sc_max_pins) return (ENXIO); - - err = bus_alloc_resources(dev, a37x0_gpio_res_spec, sc->sc_mem_res); - if (err != 0) { - device_printf(dev, "cannot allocate memory window\n"); - return (ENXIO); - } - sc->sc_bst = rman_get_bustag(sc->sc_mem_res[A37X0_GPIO]); - sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res[A37X0_GPIO]); sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) Modified: stable/12/sys/dev/extres/syscon/syscon.c ============================================================================== --- stable/12/sys/dev/extres/syscon/syscon.c Fri Sep 13 21:15:01 2019 (r352308) +++ stable/12/sys/dev/extres/syscon/syscon.c Fri Sep 13 21:20:24 2019 (r352309) @@ -254,3 +254,14 @@ syscon_get_by_ofw_property(device_t cdev, phandle_t cn return (0); } #endif + +int +syscon_get_handle_default(device_t dev, struct syscon **syscon) +{ + device_t parent; + + parent = device_get_parent(dev); + if (parent == NULL) + return (ENODEV); + return (SYSCON_GET_HANDLE(parent, syscon)); +} Modified: stable/12/sys/dev/extres/syscon/syscon_if.m ============================================================================== --- stable/12/sys/dev/extres/syscon/syscon_if.m Fri Sep 13 21:15:01 2019 (r352308) +++ stable/12/sys/dev/extres/syscon/syscon_if.m Fri Sep 13 21:20:24 2019 (r352309) @@ -32,6 +32,7 @@ INTERFACE syscon; HEADER { struct syscon; + int syscon_get_handle_default(device_t dev, struct syscon **syscon); } METHOD int init { @@ -62,3 +63,11 @@ METHOD int modify_4 { uint32_t clear_bits; uint32_t set_bits; }; + +/** + * Get syscon handle from parent driver + */ +METHOD int get_handle { + device_t dev; + struct syscon **syscon; +} DEFAULT syscon_get_handle_default; Modified: stable/12/sys/dev/fdt/simple_mfd.c ============================================================================== --- stable/12/sys/dev/fdt/simple_mfd.c Fri Sep 13 21:15:01 2019 (r352308) +++ stable/12/sys/dev/fdt/simple_mfd.c Fri Sep 13 21:20:24 2019 (r352309) @@ -49,14 +49,16 @@ __FBSDID("$FreeBSD$"); device_t simple_mfd_add_device(device_t dev, phandle_t node, u_int order, const char *name, int unit, struct simplebus_devinfo *di); -struct simplebus_devinfo *simple_mfd_setup_dinfo(device_t dev, phandle_t node, struct simplebus_devinfo *di); +struct simplebus_devinfo *simple_mfd_setup_dinfo(device_t dev, phandle_t node, + struct simplebus_devinfo *di); #include "syscon_if.h" #include MALLOC_DECLARE(M_SYSCON); -static uint32_t simple_mfd_syscon_read_4(struct syscon *syscon, bus_size_t offset); +static uint32_t simple_mfd_syscon_read_4(struct syscon *syscon, + bus_size_t offset); static int simple_mfd_syscon_write_4(struct syscon *syscon, bus_size_t offset, uint32_t val); static int simple_mfd_syscon_modify_4(struct syscon *syscon, bus_size_t offset, @@ -125,7 +127,18 @@ simple_mfd_syscon_modify_4(struct syscon *syscon, bus_ SYSCON_UNLOCK(sc); return (0); } +static int +simple_mfd_syscon_get_handle(device_t dev, struct syscon **syscon) +{ + struct simple_mfd_softc *sc; + sc = device_get_softc(dev); + *syscon = sc->syscon; + if (*syscon == NULL) + return (ENODEV); + return (0); +} + static int simple_mfd_probe(device_t dev) { @@ -278,6 +291,8 @@ simple_mfd_add_device(device_t dev, phandle_t node, u_ } static device_method_t simple_mfd_methods[] = { + /* syscon interface */ + DEVMETHOD(syscon_get_handle, simple_mfd_syscon_get_handle), /* Device interface */ DEVMETHOD(device_probe, simple_mfd_probe), DEVMETHOD(device_attach, simple_mfd_attach), From owner-svn-src-stable@freebsd.org Fri Sep 13 21:28: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 9D18FD4249; Fri, 13 Sep 2019 21:28:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46VTJT3ClCz48tK; Fri, 13 Sep 2019 21:28:09 +0000 (UTC) (envelope-from manu@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 346CFD793; Fri, 13 Sep 2019 21:28:09 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8DLS935067525; Fri, 13 Sep 2019 21:28:09 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8DLS9Zp067524; Fri, 13 Sep 2019 21:28:09 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201909132128.x8DLS9Zp067524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 13 Sep 2019 21:28: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: r352310 - stable/12/sys/arm/ti X-SVN-Group: stable-12 X-SVN-Commit-Author: manu X-SVN-Commit-Paths: stable/12/sys/arm/ti X-SVN-Commit-Revision: 352310 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, 13 Sep 2019 21:28:09 -0000 Author: manu Date: Fri Sep 13 21:28:08 2019 New Revision: 352310 URL: https://svnweb.freebsd.org/changeset/base/352310 Log: MFC r351218: ti: sdhci: Correct voltage caps ti,dual-volt property say that the eMMC support 1.8V and 3.3V not 3.0V Use the correct caps for the mmc stack. Note that the MMCHS_SD_CAPA register can only be written once after bootup so if one is using a u-boot compiled with eMMC support (this is the default) this code is a no-op but just in case someone have u-boot compiled without eMMC support this make eMMC works when the kernel is booted. Modified: stable/12/sys/arm/ti/ti_sdhci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/12/sys/arm/ti/ti_sdhci.c Fri Sep 13 21:20:24 2019 (r352309) +++ stable/12/sys/arm/ti/ti_sdhci.c Fri Sep 13 21:28:08 2019 (r352310) @@ -482,15 +482,14 @@ ti_sdhci_hw_init(device_t dev) * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those * values in the CAPA register. The manual says that these values can - * only be set once, "before initialization" whatever that means, and - * that they survive a reset. So maybe doing this will be a no-op if - * u-boot has already initialized the hardware. + * only be set once, and that they survive a reset so unless u-boot didn't + * set this register this code is a no-op. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) regval |= MMCHS_SD_CAPA_VS18; - if (sc->slot.host.caps & (MMC_OCR_290_300 | MMC_OCR_300_310)) - regval |= MMCHS_SD_CAPA_VS30; + if (sc->slot.host.caps & (MMC_OCR_320_330 | MMC_OCR_330_340)) + regval |= MMCHS_SD_CAPA_VS33; ti_mmchs_write_4(sc, MMCHS_SD_CAPA, regval); /* Set initial host configuration (1-bit, std speed, pwr off). */ @@ -524,17 +523,20 @@ ti_sdhci_attach(device_t dev) } /* - * The hardware can inherently do dual-voltage (1p8v, 3p0v) on the first + * The hardware can inherently do dual-voltage (1p8v, 3p3v) on the first * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so * that it can set the right values in the CAPA register, which can only * be done once and never reset. */ - sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; - if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { - sc->slot.host.caps |= MMC_OCR_290_300 | MMC_OCR_300_310; - } + if (OF_hasprop(node, "ti,dual-volt")) { + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE | MMC_OCR_320_330 | MMC_OCR_330_340; + } else if (OF_hasprop(node, "no-1-8-v")) { + sc->slot.host.caps |= MMC_OCR_320_330 | MMC_OCR_330_340; + } else + sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; + /* * Set the offset from the device's memory start to the MMCHS registers. From owner-svn-src-stable@freebsd.org Sat Sep 14 13:25:55 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 7D3ADF4984; Sat, 14 Sep 2019 13:25:55 +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 46VtYb2nJfz3y4g; Sat, 14 Sep 2019 13:25:55 +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 3E709205DE; Sat, 14 Sep 2019 13:25:55 +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 x8EDPt3l033584; Sat, 14 Sep 2019 13:25:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDPtOZ033583; Sat, 14 Sep 2019 13:25:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141325.x8EDPtOZ033583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:25:55 +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: r352321 - stable/12/sys/ufs/ufs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/ufs/ufs X-SVN-Commit-Revision: 352321 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, 14 Sep 2019 13:25:55 -0000 Author: kib Date: Sat Sep 14 13:25:54 2019 New Revision: 352321 URL: https://svnweb.freebsd.org/changeset/base/352321 Log: MFC r352012: Properly check for writers when fetching quotas for writeable vnodes in UFS quotaon(). Modified: stable/12/sys/ufs/ufs/ufs_quota.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/12/sys/ufs/ufs/ufs_quota.c Sat Sep 14 12:40:46 2019 (r352320) +++ stable/12/sys/ufs/ufs/ufs_quota.c Sat Sep 14 13:25:54 2019 (r352321) @@ -617,7 +617,7 @@ again: MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); goto again; } - if (vp->v_type == VNON || vp->v_writecount == 0) { + if (vp->v_type == VNON || vp->v_writecount <= 0) { VOP_UNLOCK(vp, 0); vrele(vp); continue; From owner-svn-src-stable@freebsd.org Sat Sep 14 13:27: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 540E9F4A0D; Sat, 14 Sep 2019 13:27:08 +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 46Vtb01Dvrz3yBw; Sat, 14 Sep 2019 13:27:08 +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 0DE53205DF; Sat, 14 Sep 2019 13:27:08 +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 x8EDR7LD033700; Sat, 14 Sep 2019 13:27:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDR7Sh033699; Sat, 14 Sep 2019 13:27:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141327.x8EDR7Sh033699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:27: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: r352322 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 352322 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, 14 Sep 2019 13:27:08 -0000 Author: kib Date: Sat Sep 14 13:27:07 2019 New Revision: 352322 URL: https://svnweb.freebsd.org/changeset/base/352322 Log: MFC r352013: vm_object_coalesce(): avoid extending any nosplit objects, not only that which back tmpfs nodes. Modified: stable/12/sys/vm/vm_object.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_object.c ============================================================================== --- stable/12/sys/vm/vm_object.c Sat Sep 14 13:25:54 2019 (r352321) +++ stable/12/sys/vm/vm_object.c Sat Sep 14 13:27:07 2019 (r352322) @@ -2093,7 +2093,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset VM_OBJECT_WLOCK(prev_object); if ((prev_object->type != OBJT_DEFAULT && prev_object->type != OBJT_SWAP) || - (prev_object->flags & OBJ_TMPFS_NODE) != 0) { + (prev_object->flags & OBJ_NOSPLIT) != 0) { VM_OBJECT_WUNLOCK(prev_object); return (FALSE); } From owner-svn-src-stable@freebsd.org Sat Sep 14 13:29: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 AC692F4C02; Sat, 14 Sep 2019 13:29:42 +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 46Vtdy3y0jz3yQg; Sat, 14 Sep 2019 13:29:42 +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 6AB66205E2; Sat, 14 Sep 2019 13:29:42 +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 x8EDTgKQ033872; Sat, 14 Sep 2019 13:29:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDTgsV033871; Sat, 14 Sep 2019 13:29:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141329.x8EDTgsV033871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:29: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: r352323 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 352323 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, 14 Sep 2019 13:29:42 -0000 Author: kib Date: Sat Sep 14 13:29:41 2019 New Revision: 352323 URL: https://svnweb.freebsd.org/changeset/base/352323 Log: MFC r352014: vm_object_deallocate(): Remove no longer needed code. Modified: stable/12/sys/vm/vm_object.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_object.c ============================================================================== --- stable/12/sys/vm/vm_object.c Sat Sep 14 13:27:07 2019 (r352322) +++ stable/12/sys/vm/vm_object.c Sat Sep 14 13:29:41 2019 (r352323) @@ -515,7 +515,6 @@ void vm_object_deallocate(vm_object_t object) { vm_object_t temp; - struct vnode *vp; while (object != NULL) { VM_OBJECT_WLOCK(object); @@ -538,25 +537,6 @@ vm_object_deallocate(vm_object_t object) VM_OBJECT_WUNLOCK(object); return; } else if (object->ref_count == 1) { - if (object->type == OBJT_SWAP && - (object->flags & OBJ_TMPFS) != 0) { - vp = object->un_pager.swp.swp_tmpfs; - vhold(vp); - VM_OBJECT_WUNLOCK(object); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - VM_OBJECT_WLOCK(object); - if (object->type == OBJT_DEAD || - object->ref_count != 1) { - VM_OBJECT_WUNLOCK(object); - VOP_UNLOCK(vp, 0); - vdrop(vp); - return; - } - if ((object->flags & OBJ_TMPFS) != 0) - VOP_UNSET_TEXT(vp); - VOP_UNLOCK(vp, 0); - vdrop(vp); - } if (object->shadow_count == 0 && object->handle == NULL && (object->type == OBJT_DEFAULT || From owner-svn-src-stable@freebsd.org Sat Sep 14 13:30: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 8FE93F4D44; Sat, 14 Sep 2019 13:30:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Vtfl2QDpz3yZJ; Sat, 14 Sep 2019 13:30:23 +0000 (UTC) (envelope-from hselasky@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 2FC8B205E7; Sat, 14 Sep 2019 13:30:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8EDUNC5034012; Sat, 14 Sep 2019 13:30:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDUNQ9034011; Sat, 14 Sep 2019 13:30:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909141330.x8EDUNQ9034011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 14 Sep 2019 13:30: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: r352324 - stable/12/sys/dev/sound/pcm X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/sound/pcm X-SVN-Commit-Revision: 352324 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, 14 Sep 2019 13:30:23 -0000 Author: hselasky Date: Sat Sep 14 13:30:22 2019 New Revision: 352324 URL: https://svnweb.freebsd.org/changeset/base/352324 Log: MFC r351847: Decrease the default audio playback latency to a maximum of 21.3ms. This significantly improves the audio playback response time. Discussed with: mav@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/sound/pcm/channel.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pcm/channel.h ============================================================================== --- stable/12/sys/dev/sound/pcm/channel.h Sat Sep 14 13:29:41 2019 (r352323) +++ stable/12/sys/dev/sound/pcm/channel.h Sat Sep 14 13:30:22 2019 (r352324) @@ -413,7 +413,7 @@ extern int report_soft_matrix; #define CHN_LATENCY_MIN 0 #define CHN_LATENCY_MAX 10 -#define CHN_LATENCY_DEFAULT 5 +#define CHN_LATENCY_DEFAULT 2 /* 21.3ms total buffering */ #define CHN_POLICY_MIN CHN_LATENCY_MIN #define CHN_POLICY_MAX CHN_LATENCY_MAX #define CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT From owner-svn-src-stable@freebsd.org Sat Sep 14 13:30:55 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 23D49F4FD4; Sat, 14 Sep 2019 13:30:55 +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 46VtgL5sJkz3ynv; Sat, 14 Sep 2019 13:30:54 +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 909BD205FE; Sat, 14 Sep 2019 13:30:54 +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 x8EDUsi8036333; Sat, 14 Sep 2019 13:30:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDUsgw036332; Sat, 14 Sep 2019 13:30:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141330.x8EDUsgw036332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:30: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: r352325 - 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: 352325 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, 14 Sep 2019 13:30:55 -0000 Author: kib Date: Sat Sep 14 13:30:53 2019 New Revision: 352325 URL: https://svnweb.freebsd.org/changeset/base/352325 Log: MFC r352015: When loading ELF interpreter, initialize whole nested image_params with zero. 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 14 13:30:22 2019 (r352324) +++ stable/12/sys/kern/imgact_elf.c Sat Sep 14 13:30:53 2019 (r352325) @@ -735,7 +735,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_ return (ECAPMODE); #endif - tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK); + tempdata = malloc(sizeof(*tempdata), M_TEMP, M_WAITOK | M_ZERO); nd = &tempdata->nd; attr = &tempdata->attr; imgp = &tempdata->image_params; @@ -745,10 +745,6 @@ __elfN(load_file)(struct proc *p, const char *file, u_ */ imgp->proc = p; imgp->attr = attr; - imgp->firstpage = NULL; - imgp->image_header = NULL; - imgp->object = NULL; - imgp->execlabel = NULL; NDINIT(nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, file, curthread); From owner-svn-src-stable@freebsd.org Sat Sep 14 13:31: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 70C9BF502E; Sat, 14 Sep 2019 13:31:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Vtgc0yv8z3ywX; Sat, 14 Sep 2019 13:31:08 +0000 (UTC) (envelope-from hselasky@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 EE60A20613; Sat, 14 Sep 2019 13:31:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8EDV7Am036403; Sat, 14 Sep 2019 13:31:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDV7xH036402; Sat, 14 Sep 2019 13:31:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909141331.x8EDV7xH036402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 14 Sep 2019 13:31:07 +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: r352326 - stable/11/sys/dev/sound/pcm X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/dev/sound/pcm X-SVN-Commit-Revision: 352326 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, 14 Sep 2019 13:31:08 -0000 Author: hselasky Date: Sat Sep 14 13:31:07 2019 New Revision: 352326 URL: https://svnweb.freebsd.org/changeset/base/352326 Log: MFC r351847: Decrease the default audio playback latency to a maximum of 21.3ms. This significantly improves the audio playback response time. Discussed with: mav@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/sound/pcm/channel.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pcm/channel.h ============================================================================== --- stable/11/sys/dev/sound/pcm/channel.h Sat Sep 14 13:30:53 2019 (r352325) +++ stable/11/sys/dev/sound/pcm/channel.h Sat Sep 14 13:31:07 2019 (r352326) @@ -411,7 +411,7 @@ extern int report_soft_matrix; #define CHN_LATENCY_MIN 0 #define CHN_LATENCY_MAX 10 -#define CHN_LATENCY_DEFAULT 5 +#define CHN_LATENCY_DEFAULT 2 /* 21.3ms total buffering */ #define CHN_POLICY_MIN CHN_LATENCY_MIN #define CHN_POLICY_MAX CHN_LATENCY_MAX #define CHN_POLICY_DEFAULT CHN_LATENCY_DEFAULT From owner-svn-src-stable@freebsd.org Sat Sep 14 13:32:14 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 4F940F52AA; Sat, 14 Sep 2019 13:32:14 +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 46Vtht1Tc0z40JN; Sat, 14 Sep 2019 13:32:14 +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 15BDC20775; Sat, 14 Sep 2019 13:32:14 +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 x8EDWD4c038743; Sat, 14 Sep 2019 13:32:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDWDJo038742; Sat, 14 Sep 2019 13:32:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141332.x8EDWDJo038742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:32:13 +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: r352327 - 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: 352327 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, 14 Sep 2019 13:32:14 -0000 Author: kib Date: Sat Sep 14 13:32:13 2019 New Revision: 352327 URL: https://svnweb.freebsd.org/changeset/base/352327 Log: MFC r352016: In do_execve(), clear imgp->textset when restarting for interpreter. Modified: stable/12/sys/kern/kern_exec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exec.c ============================================================================== --- stable/12/sys/kern/kern_exec.c Sat Sep 14 13:31:07 2019 (r352326) +++ stable/12/sys/kern/kern_exec.c Sat Sep 14 13:32:13 2019 (r352327) @@ -618,7 +618,9 @@ interpret: * The vnode lock is held over this entire period * so nothing should illegitimately be blocked. */ - VOP_UNSET_TEXT_CHECKED(imgp->vp); + MPASS(imgp->textset); + VOP_UNSET_TEXT_CHECKED(newtextvp); + imgp->textset = false; /* free name buffer and old vnode */ if (args->fname != NULL) NDFREE(&nd, NDF_ONLY_PNBUF); From owner-svn-src-stable@freebsd.org Sat Sep 14 13:32:55 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 5B53DF5345; Sat, 14 Sep 2019 13:32:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Vtjg1l5Mz40S4; Sat, 14 Sep 2019 13:32:55 +0000 (UTC) (envelope-from hselasky@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 1F17620790; Sat, 14 Sep 2019 13:32:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8EDWs81039541; Sat, 14 Sep 2019 13:32:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDWs2T039540; Sat, 14 Sep 2019 13:32:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909141332.x8EDWs2T039540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 14 Sep 2019 13:32: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: r352328 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352328 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, 14 Sep 2019 13:32:55 -0000 Author: hselasky Date: Sat Sep 14 13:32:54 2019 New Revision: 352328 URL: https://svnweb.freebsd.org/changeset/base/352328 Log: MFC r351693: Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI. This fixes system hangs on reading device registers on aarch64. Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D20789 Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/io.h Sat Sep 14 13:32:13 2019 (r352327) +++ stable/12/sys/compat/linuxkpi/common/include/linux/io.h Sat Sep 14 13:32:54 2019 (r352328) @@ -356,16 +356,25 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned lon #define _ioremap_attr(...) NULL #endif +#ifdef VM_MEMATTR_DEVICE #define ioremap_nocache(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#define ioremap_wt(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#define ioremap(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#else +#define ioremap_nocache(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) -#define ioremap_wc(addr, size) \ - _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) -#define ioremap_wb(addr, size) \ - _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) #define ioremap_wt(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_THROUGH) #define ioremap(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) +#endif +#define ioremap_wc(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) +#define ioremap_wb(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) void iounmap(void *addr); #define memset_io(a, b, c) memset((a), (b), (c)) From owner-svn-src-stable@freebsd.org Sat Sep 14 13:33: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 48576F53D0; Sat, 14 Sep 2019 13:33:37 +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 46VtkT18xBz40ZW; Sat, 14 Sep 2019 13:33:37 +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 0B4C620792; Sat, 14 Sep 2019 13:33:37 +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 x8EDXaZk039668; Sat, 14 Sep 2019 13:33:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDXaYY039667; Sat, 14 Sep 2019 13:33:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141333.x8EDXaYY039667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:33:36 +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: r352329 - 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: 352329 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, 14 Sep 2019 13:33:37 -0000 Author: kib Date: Sat Sep 14 13:33:36 2019 New Revision: 352329 URL: https://svnweb.freebsd.org/changeset/base/352329 Log: MFC r352017: In do_execve(), use shared text vnode lock consistently. Modified: stable/12/sys/kern/kern_exec.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_exec.c ============================================================================== --- stable/12/sys/kern/kern_exec.c Sat Sep 14 13:32:54 2019 (r352328) +++ stable/12/sys/kern/kern_exec.c Sat Sep 14 13:33:36 2019 (r352329) @@ -528,7 +528,7 @@ interpret: euip = uifind(attr.va_uid); change_euid(imgp->newcred, euip); } - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); if (attr.va_mode & S_ISGID) change_egid(imgp->newcred, attr.va_gid); /* @@ -557,7 +557,7 @@ interpret: oldcred->cr_svgid != oldcred->cr_gid) { VOP_UNLOCK(imgp->vp, 0); imgp->newcred = crdup(oldcred); - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); change_svuid(imgp->newcred, imgp->newcred->cr_uid); change_svgid(imgp->newcred, imgp->newcred->cr_gid); } @@ -574,7 +574,7 @@ interpret: if (vn_fullpath(td, imgp->vp, &imgp->execpath, &imgp->freepath) != 0) imgp->execpath = args->fname; - vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(imgp->vp, LK_SHARED | LK_RETRY); } /* From owner-svn-src-stable@freebsd.org Sat Sep 14 13:33: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 E3E44F5440; Sat, 14 Sep 2019 13:33:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 46Vtkm49cZz40hf; Sat, 14 Sep 2019 13:33:52 +0000 (UTC) (envelope-from hselasky@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 7325620794; Sat, 14 Sep 2019 13:33:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8EDXq6f039726; Sat, 14 Sep 2019 13:33:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDXq3n039725; Sat, 14 Sep 2019 13:33:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909141333.x8EDXq3n039725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 14 Sep 2019 13:33:52 +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: r352330 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 352330 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, 14 Sep 2019 13:33:53 -0000 Author: hselasky Date: Sat Sep 14 13:33:52 2019 New Revision: 352330 URL: https://svnweb.freebsd.org/changeset/base/352330 Log: MFC r351693: Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI. This fixes system hangs on reading device registers on aarch64. Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D20789 Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/io.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/io.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/io.h Sat Sep 14 13:33:36 2019 (r352329) +++ stable/11/sys/compat/linuxkpi/common/include/linux/io.h Sat Sep 14 13:33:52 2019 (r352330) @@ -356,16 +356,25 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned lon #define _ioremap_attr(...) NULL #endif +#ifdef VM_MEMATTR_DEVICE #define ioremap_nocache(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#define ioremap_wt(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#define ioremap(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE) +#else +#define ioremap_nocache(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) -#define ioremap_wc(addr, size) \ - _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) -#define ioremap_wb(addr, size) \ - _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) #define ioremap_wt(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_THROUGH) #define ioremap(addr, size) \ _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE) +#endif +#define ioremap_wc(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING) +#define ioremap_wb(addr, size) \ + _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK) void iounmap(void *addr); #define memset_io(a, b, c) memset((a), (b), (c)) From owner-svn-src-stable@freebsd.org Sat Sep 14 13:35: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 AD7A9F5512; Sat, 14 Sep 2019 13:35: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 46Vtn149Fvz40r6; Sat, 14 Sep 2019 13:35: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 70CD9207A3; Sat, 14 Sep 2019 13:35: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 x8EDZn3D039880; Sat, 14 Sep 2019 13:35:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EDZnLx039879; Sat, 14 Sep 2019 13:35:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909141335.x8EDZnLx039879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Sep 2019 13:35: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: r352331 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 352331 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, 14 Sep 2019 13:35:49 -0000 Author: kib Date: Sat Sep 14 13:35:48 2019 New Revision: 352331 URL: https://svnweb.freebsd.org/changeset/base/352331 Log: MFC r352013: vm_object_coalesce(): avoid extending any nosplit objects, not only that which back tmpfs nodes. Modified: stable/11/sys/vm/vm_object.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_object.c ============================================================================== --- stable/11/sys/vm/vm_object.c Sat Sep 14 13:33:52 2019 (r352330) +++ stable/11/sys/vm/vm_object.c Sat Sep 14 13:35:48 2019 (r352331) @@ -2153,7 +2153,7 @@ vm_object_coalesce(vm_object_t prev_object, vm_ooffset VM_OBJECT_WLOCK(prev_object); if ((prev_object->type != OBJT_DEFAULT && prev_object->type != OBJT_SWAP) || - (prev_object->flags & OBJ_TMPFS_NODE) != 0) { + (prev_object->flags & OBJ_NOSPLIT) != 0) { VM_OBJECT_WUNLOCK(prev_object); return (FALSE); } From owner-svn-src-stable@freebsd.org Sat Sep 14 20:26: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 EEEBAFE338; Sat, 14 Sep 2019 20:26:50 +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 46W3vG62GZz4Psx; Sat, 14 Sep 2019 20:26:50 +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 B23BA251B9; Sat, 14 Sep 2019 20:26:50 +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 x8EKQodr085253; Sat, 14 Sep 2019 20:26:50 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8EKQov2085252; Sat, 14 Sep 2019 20:26:50 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201909142026.x8EKQov2085252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 14 Sep 2019 20:26: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: r352339 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 352339 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, 14 Sep 2019 20:26:51 -0000 Author: ian Date: Sat Sep 14 20:26:50 2019 New Revision: 352339 URL: https://svnweb.freebsd.org/changeset/base/352339 Log: MFC r351885, r351887 r351885: Ensure a measurement is complete before reading the result in ads111x. Also, disable the comparator by default; it's not used for anything. The previous logic would start a measurement, and then pause_sbt() for the averaging time currently configured in the chip. After waiting that long, the code would blindly read the measurement register and return its value. The problem is that the chip's idea of averaging time is based on its internal free-running 1MHz oscillator, which may be running at a wildly different rate than the kernel clock. If the chip's internal timer was running slower than the kernel clock, we'd end up grabbing a stale result from an old measurement. The driver now still uses pause_sbt() to yield the cpu while waiting for the measurement to complete, but after sleeping it checks the chip's status register to ensure the measurement engine is idle. If it's not, the driver uses a retry loop to wait a bit (5% of the original wait time) then check again for completion. r351887: Use a single write of 3 bytes instead of iicdev_writeto() in ads111x. The iicdev_writeto() function basically does scatter-gather IO by filling in a pair of iic_msg structs to write the register address then the data from different locations but with a single bus START/xfer/STOP sequence. It turns out several low-level i2c controller drivers do not honor the IIC_NOSTART flag, so the second piece of the write gets a new START on the bus, and that confuses the ads111x chips which expect a continuous write of 3 bytes to set a register. A proper fix for this is to track down all the misbehaving controllers drivers and fix them. For now this change makes this driver work again. Modified: stable/12/sys/dev/iicbus/ads111x.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/ads111x.c ============================================================================== --- stable/12/sys/dev/iicbus/ads111x.c Sat Sep 14 19:33:36 2019 (r352338) +++ stable/12/sys/dev/iicbus/ads111x.c Sat Sep 14 20:26:50 2019 (r352339) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #define ADS111x_CONF_GAIN_SHIFT 9 /* Programmable gain amp */ #define ADS111x_CONF_MODE_SHIFT 8 /* Operational mode */ #define ADS111x_CONF_RATE_SHIFT 5 /* Sample rate */ +#define ADS111x_CONF_COMP_DISABLE 3 /* Comparator disable */ #define ADS111x_LOTHRESH 2 /* Compare lo threshold (rw) */ @@ -81,7 +82,8 @@ __FBSDID("$FreeBSD$"); * comparator and we'll leave it alone if they do. That allows them connect the * alert pin to something and use the feature without any help from this driver. */ -#define ADS111x_CONF_DEFAULT (1 << ADS111x_CONF_MODE_SHIFT) +#define ADS111x_CONF_DEFAULT \ + ((1 << ADS111x_CONF_MODE_SHIFT) | ADS111x_CONF_COMP_DISABLE) #define ADS111x_CONF_USERMASK 0x001f /* @@ -165,11 +167,21 @@ struct ads111x_softc { static int ads111x_write_2(struct ads111x_softc *sc, int reg, int val) { - uint8_t data[2]; + uint8_t data[3]; + struct iic_msg msgs[1]; + uint8_t slaveaddr; - be16enc(data, val); + slaveaddr = iicbus_get_addr(sc->dev); - return (iic2errno(iicdev_writeto(sc->dev, reg, data, 2, IIC_WAIT))); + data[0] = reg; + be16enc(&data[1], val); + + msgs[0].slave = slaveaddr; + msgs[0].flags = IIC_M_WR; + msgs[0].len = sizeof(data); + msgs[0].buf = data; + + return (iicbus_transfer_excl(sc->dev, msgs, nitems(msgs), IIC_WAIT)); } static int @@ -189,7 +201,7 @@ static int ads111x_sample_voltage(struct ads111x_softc *sc, int channum, int *voltage) { struct ads111x_channel *chan; - int err, cfgword, convword, rate, waitns; + int err, cfgword, convword, rate, retries, waitns; int64_t fsrange; chan = &sc->channels[channum]; @@ -205,7 +217,8 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c /* * Calculate how long it will take to make the measurement at the - * current sampling rate (round up), and sleep at least that long. + * current sampling rate (round up). The measurement averaging time + * ranges from 300us to 125ms, so we yield the cpu while waiting. */ rate = sc->chipinfo->ratetab[chan->rateidx]; waitns = (1000000000 + rate - 1) / rate; @@ -213,20 +226,27 @@ ads111x_sample_voltage(struct ads111x_softc *sc, int c if (err != 0 && err != EWOULDBLOCK) return (err); -#if 0 /* - * Sanity-check that the measurement is complete. Not enabled by - * default because checking wastes 200-800us just in moving the status - * command and result across the i2c bus, which could double the time it - * takes to get one measurement. Unlike most i2c slaves, this device - * does not auto-increment the register number on reads, so we can't - * read both status and measurement in one operation. + * In theory the measurement should be available now; we waited long + * enough. However, the chip times its averaging intervals using an + * internal 1 MHz oscillator which likely isn't running at the same rate + * as the system clock, so we have to double-check that the measurement + * is complete before reading the result. If it's not ready yet, yield + * the cpu again for 5% of the time we originally calculated. + * + * Unlike most i2c slaves, this device does not auto-increment the + * register number on reads, so we can't read both status and + * measurement in one operation. */ - if ((err = ads111x_read_2(sc, ADS111x_CONF, &cfgword)) != 0) - return (err); - if (!(cfgword & ADS111x_CONF_IDLE)) - return (EIO); -#endif + for (retries = 5; ; --retries) { + if (retries == 0) + return (EWOULDBLOCK); + if ((err = ads111x_read_2(sc, ADS111x_CONF, &cfgword)) != 0) + return (err); + if (cfgword & ADS111x_CONF_IDLE) + break; + pause_sbt("ads111x", nstosbt(waitns / 20), 0, C_PREL(2)); + } /* Retrieve the sample and convert it to microvolts. */ if ((err = ads111x_read_2(sc, ADS111x_CONV, &convword)) != 0)