From owner-svn-src-stable-11@freebsd.org Sun Sep 8 01:58:03 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 10:44:59 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 11:20:17 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 14:56:07 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 17:37:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 17:56:38 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 17:58:27 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Mon Sep 9 18:07:32 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Tue Sep 10 07:29:23 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Tue Sep 10 09:57:25 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Tue Sep 10 21:15:01 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Wed Sep 11 04:59:28 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Thu Sep 12 06:20:21 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 07:21:09 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 07:22:11 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 07:23:47 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 07:24:30 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 14:43:06 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:13:22 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:17:31 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:18:46 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:20:30 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:21:36 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Fri Sep 13 15:49:03 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Sat Sep 14 13:31:08 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Sat Sep 14 13:33:53 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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-11@freebsd.org Sat Sep 14 13:35:49 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org 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-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable 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); }