From owner-svn-src-stable@freebsd.org Sun Sep 11 07:24:14 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 309B4BD6714; Sun, 11 Sep 2016 07:24:14 +0000 (UTC) (envelope-from kevlo@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 mx1.freebsd.org (Postfix) with ESMTPS id E164990; Sun, 11 Sep 2016 07:24:13 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8B7ODIj057899; Sun, 11 Sep 2016 07:24:13 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8B7ODI1057898; Sun, 11 Sep 2016 07:24:13 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201609110724.u8B7ODI1057898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Sun, 11 Sep 2016 07:24:13 +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: r305691 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 07:24:14 -0000 Author: kevlo Date: Sun Sep 11 07:24:12 2016 New Revision: 305691 URL: https://svnweb.freebsd.org/changeset/base/305691 Log: MFC r305575: In m_devget(), if the data fits in a packet header mbuf, check the amount of data is less than or equal to MHLEN instead of MLEN when placing initial small packet header at end of mbuf. Reviewed by: glebius Modified: stable/11/sys/kern/uipc_mbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/uipc_mbuf.c ============================================================================== --- stable/11/sys/kern/uipc_mbuf.c Sun Sep 11 01:11:47 2016 (r305690) +++ stable/11/sys/kern/uipc_mbuf.c Sun Sep 11 07:24:12 2016 (r305691) @@ -984,7 +984,7 @@ m_devget(char *buf, int totlen, int off, len = MHLEN; /* Place initial small packet/header at end of mbuf */ - if (m && totlen + off + max_linkhdr <= MLEN) { + if (m && totlen + off + max_linkhdr <= MHLEN) { m->m_data += max_linkhdr; len -= max_linkhdr; } From owner-svn-src-stable@freebsd.org Sun Sep 11 14:19:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3023BD6A8A; Sun, 11 Sep 2016 14:19:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id C2A60E6B; Sun, 11 Sep 2016 14:19:07 +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 u8BEJ6VO013530; Sun, 11 Sep 2016 14:19:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8BEJ6DL013529; Sun, 11 Sep 2016 14:19:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609111419.u8BEJ6DL013529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 11 Sep 2016 14:19: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: r305693 - in stable: 10/contrib/gcclibs/libcpp 11/contrib/gcclibs/libcpp 9/contrib/gcclibs/libcpp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 14:19:08 -0000 Author: dim Date: Sun Sep 11 14:19:06 2016 New Revision: 305693 URL: https://svnweb.freebsd.org/changeset/base/305693 Log: MFC r305430: Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable way. Modified: stable/11/contrib/gcclibs/libcpp/system.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcclibs/libcpp/system.h stable/9/contrib/gcclibs/libcpp/system.h Directory Properties: stable/10/ (props changed) stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/11/contrib/gcclibs/libcpp/system.h ============================================================================== --- stable/11/contrib/gcclibs/libcpp/system.h Sun Sep 11 09:14:07 2016 (r305692) +++ stable/11/contrib/gcclibs/libcpp/system.h Sun Sep 11 14:19:06 2016 (r305693) @@ -347,9 +347,12 @@ extern void abort (void); ??? C99 designated initializers are not supported by most C++ compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) -#define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) +# if (!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ + ||(__STDC_VERSION__ >= 199901L) +# define HAVE_DESIGNATED_INITIALIZERS 1 +# else +# define HAVE_DESIGNATED_INITIALIZERS 0 +# endif #endif /* Be conservative and only use enum bitfields with GCC. From owner-svn-src-stable@freebsd.org Sun Sep 11 14:19:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD3EBBD6A86; Sun, 11 Sep 2016 14:19:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8CC19E6A; Sun, 11 Sep 2016 14:19:07 +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 u8BEJ6B6013524; Sun, 11 Sep 2016 14:19:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8BEJ62k013523; Sun, 11 Sep 2016 14:19:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609111419.u8BEJ62k013523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 11 Sep 2016 14:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r305693 - in stable: 10/contrib/gcclibs/libcpp 11/contrib/gcclibs/libcpp 9/contrib/gcclibs/libcpp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 14:19:07 -0000 Author: dim Date: Sun Sep 11 14:19:06 2016 New Revision: 305693 URL: https://svnweb.freebsd.org/changeset/base/305693 Log: MFC r305430: Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable way. Modified: stable/9/contrib/gcclibs/libcpp/system.h Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/gcclibs/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/gcclibs/libcpp/system.h stable/11/contrib/gcclibs/libcpp/system.h Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/9/contrib/gcclibs/libcpp/system.h ============================================================================== --- stable/9/contrib/gcclibs/libcpp/system.h Sun Sep 11 09:14:07 2016 (r305692) +++ stable/9/contrib/gcclibs/libcpp/system.h Sun Sep 11 14:19:06 2016 (r305693) @@ -347,9 +347,12 @@ extern void abort (void); ??? C99 designated initializers are not supported by most C++ compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) -#define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) +# if (!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ + ||(__STDC_VERSION__ >= 199901L) +# define HAVE_DESIGNATED_INITIALIZERS 1 +# else +# define HAVE_DESIGNATED_INITIALIZERS 0 +# endif #endif /* Be conservative and only use enum bitfields with GCC. From owner-svn-src-stable@freebsd.org Sun Sep 11 14:19:08 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 277B9BD6A8E; Sun, 11 Sep 2016 14:19:08 +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 mx1.freebsd.org (Postfix) with ESMTPS id ED927E6C; Sun, 11 Sep 2016 14:19:07 +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 u8BEJ7lA013536; Sun, 11 Sep 2016 14:19:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8BEJ7mK013535; Sun, 11 Sep 2016 14:19:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609111419.u8BEJ7mK013535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 11 Sep 2016 14:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305693 - in stable: 10/contrib/gcclibs/libcpp 11/contrib/gcclibs/libcpp 9/contrib/gcclibs/libcpp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Sep 2016 14:19:08 -0000 Author: dim Date: Sun Sep 11 14:19:06 2016 New Revision: 305693 URL: https://svnweb.freebsd.org/changeset/base/305693 Log: MFC r305430: Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable way. Modified: stable/10/contrib/gcclibs/libcpp/system.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/gcclibs/libcpp/system.h stable/9/contrib/gcclibs/libcpp/system.h Directory Properties: stable/11/ (props changed) stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/10/contrib/gcclibs/libcpp/system.h ============================================================================== --- stable/10/contrib/gcclibs/libcpp/system.h Sun Sep 11 09:14:07 2016 (r305692) +++ stable/10/contrib/gcclibs/libcpp/system.h Sun Sep 11 14:19:06 2016 (r305693) @@ -347,9 +347,12 @@ extern void abort (void); ??? C99 designated initializers are not supported by most C++ compilers, including G++. -- gdr, 2005-05-18 */ #if !defined(HAVE_DESIGNATED_INITIALIZERS) -#define HAVE_DESIGNATED_INITIALIZERS \ - ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ - || (__STDC_VERSION__ >= 199901L)) +# if (!defined(__cplusplus) && (GCC_VERSION >= 2007)) \ + ||(__STDC_VERSION__ >= 199901L) +# define HAVE_DESIGNATED_INITIALIZERS 1 +# else +# define HAVE_DESIGNATED_INITIALIZERS 0 +# endif #endif /* Be conservative and only use enum bitfields with GCC. From owner-svn-src-stable@freebsd.org Mon Sep 12 00:03:15 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6F78BD7FD2; Mon, 12 Sep 2016 00:03:15 +0000 (UTC) (envelope-from grehan@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 mx1.freebsd.org (Postfix) with ESMTPS id A78B51BC; Mon, 12 Sep 2016 00:03:15 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C03E9g042293; Mon, 12 Sep 2016 00:03:14 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C03EJ6042292; Mon, 12 Sep 2016 00:03:14 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201609120003.u8C03EJ6042292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 12 Sep 2016 00:03:14 +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: r305714 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 00:03:15 -0000 Author: grehan Date: Mon Sep 12 00:03:14 2016 New Revision: 305714 URL: https://svnweb.freebsd.org/changeset/base/305714 Log: MFC r302546 Implement right shift/ctl, and convert the VNC/xorg scancode of 0xff03 into right-alt. Modified: stable/11/usr.sbin/bhyve/ps2kbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/ps2kbd.c ============================================================================== --- stable/11/usr.sbin/bhyve/ps2kbd.c Sun Sep 11 23:08:57 2016 (r305713) +++ stable/11/usr.sbin/bhyve/ps2kbd.c Mon Sep 12 00:03:14 2016 (r305714) @@ -324,7 +324,9 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0x12); break; case 0xffe2: /* Right shift */ - /* XXX */ + if (!down) + fifo_put(sc, 0xf0); + fifo_put(sc, 0x59); break; case 0xffe3: /* Left control */ if (!down) @@ -332,7 +334,10 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0x14); break; case 0xffe4: /* Right control */ - /* XXX */ + fifo_put(sc, 0xe0); + if (!down) + fifo_put(sc, 0xf0); + fifo_put(sc, 0x14); break; case 0xffe7: /* Left meta */ /* XXX */ @@ -345,6 +350,7 @@ ps2kbd_keysym_queue(struct ps2kbd_softc fifo_put(sc, 0xf0); fifo_put(sc, 0x11); break; + case 0xfe03: /* AltGr */ case 0xffea: /* Right alt */ fifo_put(sc, 0xe0); if (!down) From owner-svn-src-stable@freebsd.org Mon Sep 12 00:16:27 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BABABD4346; Mon, 12 Sep 2016 00:16:27 +0000 (UTC) (envelope-from grehan@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 mx1.freebsd.org (Postfix) with ESMTPS id 48B789D9; Mon, 12 Sep 2016 00:16:27 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C0GQ9C046314; Mon, 12 Sep 2016 00:16:26 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C0GQUd046313; Mon, 12 Sep 2016 00:16:26 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201609120016.u8C0GQUd046313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 12 Sep 2016 00:16:26 +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: r305716 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 00:16:27 -0000 Author: grehan Date: Mon Sep 12 00:16:26 2016 New Revision: 305716 URL: https://svnweb.freebsd.org/changeset/base/305716 Log: MFC r302972,r303349 r302972 Disallow interrupt requests on disabled endpoints. r303349 Catch another case where an XHCI interrupt was being injected without state being set up. Modified: stable/11/usr.sbin/bhyve/pci_xhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_xhci.c Mon Sep 12 00:15:40 2016 (r305715) +++ stable/11/usr.sbin/bhyve/pci_xhci.c Mon Sep 12 00:16:26 2016 (r305716) @@ -2537,9 +2537,11 @@ static int pci_xhci_dev_intr(struct usb_hci *hci, int epctx) { struct pci_xhci_dev_emu *dev; + struct xhci_dev_ctx *dev_ctx; struct xhci_trb evtrb; struct pci_xhci_softc *sc; struct pci_xhci_portregs *p; + struct xhci_endp_ctx *ep_ctx; int error; int dir_in; int epid; @@ -2557,7 +2559,8 @@ pci_xhci_dev_intr(struct usb_hci *hci, i /* check if device is ready; OS has to initialise it */ if (sc->rtsregs.erstba_p == NULL || - (sc->opregs.usbcmd & XHCI_CMD_RS) == 0) + (sc->opregs.usbcmd & XHCI_CMD_RS) == 0 || + dev->dev_ctx == NULL) return (0); p = XHCI_PORTREG_PTR(sc, hci->hci_port); @@ -2578,6 +2581,14 @@ pci_xhci_dev_intr(struct usb_hci *hci, i goto done; } + dev_ctx = dev->dev_ctx; + ep_ctx = &dev_ctx->ctx_ep[epid]; + if ((ep_ctx->dwEpCtx0 & 0x7) == XHCI_ST_EPCTX_DISABLED) { + DPRINTF(("xhci device interrupt on disabled endpoint %d\r\n", + epid)); + return (0); + } + DPRINTF(("xhci device interrupt on endpoint %d\r\n", epid)); pci_xhci_device_doorbell(sc, hci->hci_port, epid, 0); From owner-svn-src-stable@freebsd.org Mon Sep 12 00:21:56 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EBEFBD44F8; Mon, 12 Sep 2016 00:21:56 +0000 (UTC) (envelope-from grehan@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 mx1.freebsd.org (Postfix) with ESMTPS id 15588C51; Mon, 12 Sep 2016 00:21:56 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C0LtUa047148; Mon, 12 Sep 2016 00:21:55 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C0LtmL047147; Mon, 12 Sep 2016 00:21:55 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201609120021.u8C0LtmL047147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 12 Sep 2016 00:21:55 +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: r305717 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 00:21:56 -0000 Author: grehan Date: Mon Sep 12 00:21:55 2016 New Revision: 305717 URL: https://svnweb.freebsd.org/changeset/base/305717 Log: MFC r303352 - Change the fbuf "vga" parameter to "vga=on|io|off". "io" is the default, and allows VGA i/o registers to be accessed. This is required by Win7/2k8 graphics guests that use a combination of BIOS int10 and UEFI. "off" disables all VGA i/o and mem accesses. "on" is not yet hooked up, but will enable full VGA rendering. OpenBSD/UEFI >= 5.9 graphics guests can be booted using "vga=off" - Allow "rfb" to be used instead of "tcp" for the fbuf VNC description. "tcp" will be removed at a future point and is kept as an alias. Modified: stable/11/usr.sbin/bhyve/pci_fbuf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_fbuf.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_fbuf.c Mon Sep 12 00:16:26 2016 (r305716) +++ stable/11/usr.sbin/bhyve/pci_fbuf.c Mon Sep 12 00:21:55 2016 (r305717) @@ -95,7 +95,8 @@ struct pci_fbuf_softc { char *rfb_host; int rfb_port; int rfb_wait; - int use_vga; + int vga_enabled; + int vga_full; uint32_t fbaddr; char *fb_base; @@ -114,7 +115,7 @@ pci_fbuf_usage(char *opt) { fprintf(stderr, "Invalid fbuf emulation \"%s\"\r\n", opt); - fprintf(stderr, "fbuf: {wait,}tcp=:port\r\n"); + fprintf(stderr, "fbuf: {wait,}{vga=on|io|off,}rfb=:port\r\n"); } static void @@ -234,13 +235,6 @@ pci_fbuf_parse_opts(struct pci_fbuf_soft continue; } -#if 0 /* notyet */ - if (strcmp(xopts, "vga") == 0) { - sc->use_vga = 1; - continue; - } -#endif - if ((config = strchr(xopts, '=')) == NULL) { pci_fbuf_usage(xopts); ret = -1; @@ -252,17 +246,31 @@ pci_fbuf_parse_opts(struct pci_fbuf_soft DPRINTF(DEBUG_VERBOSE, ("pci_fbuf option %s = %s\r\n", xopts, config)); - if (!strcmp(xopts, "tcp")) { + if (!strcmp(xopts, "tcp") || !strcmp(xopts, "rfb")) { /* parse host-ip:port */ - tmpstr = strsep(&config, ":"); + tmpstr = strsep(&config, ":"); if (!config) sc->rfb_port = atoi(tmpstr); else { sc->rfb_port = atoi(config); sc->rfb_host = tmpstr; } - } else if (!strcmp(xopts, "w")) { - sc->memregs.width = atoi(config); + } else if (!strcmp(xopts, "vga")) { + if (!strcmp(config, "off")) { + sc->vga_enabled = 0; + } else if (!strcmp(config, "io")) { + sc->vga_enabled = 1; + sc->vga_full = 0; + } else if (!strcmp(config, "on")) { + sc->vga_enabled = 1; + sc->vga_full = 1; + } else { + pci_fbuf_usage(opts); + ret = -1; + goto done; + } + } else if (!strcmp(xopts, "w")) { + sc->memregs.width = atoi(config); if (sc->memregs.width > COLS_MAX) { pci_fbuf_usage(xopts); ret = -1; @@ -299,7 +307,7 @@ pci_fbuf_render(struct bhyvegc *gc, void sc = arg; - if (sc->use_vga && sc->gc_image->vgamode) { + if (sc->vga_full && sc->gc_image->vgamode) { /* TODO: mode switching to vga and vesa should use the special * EFI-bhyve protocol port. */ @@ -352,12 +360,21 @@ pci_fbuf_init(struct vmctx *ctx, struct sc->memregs.height = ROWS_DEFAULT; sc->memregs.depth = 32; + sc->vga_enabled = 1; + sc->vga_full = 0; + sc->fsc_pi = pi; error = pci_fbuf_parse_opts(sc, opts); if (error != 0) goto done; + /* XXX until VGA rendering is enabled */ + if (sc->vga_full != 0) { + fprintf(stderr, "pci_fbuf: VGA rendering not enabled"); + goto done; + } + sc->fb_base = vm_create_devmem(ctx, VM_FRAMEBUFFER, "framebuffer", FB_SIZE); if (sc->fb_base == MAP_FAILED) { error = -1; @@ -382,7 +399,8 @@ pci_fbuf_init(struct vmctx *ctx, struct console_init(sc->memregs.width, sc->memregs.height, sc->fb_base); console_fb_register(pci_fbuf_render, sc); - sc->vgasc = vga_init(!sc->use_vga); + if (sc->vga_enabled) + sc->vgasc = vga_init(!sc->vga_full); sc->gc_image = console_get_image(); fbuf_sc = sc; From owner-svn-src-stable@freebsd.org Mon Sep 12 00:24:58 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DE2DBD45BC; Mon, 12 Sep 2016 00:24:58 +0000 (UTC) (envelope-from grehan@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 mx1.freebsd.org (Postfix) with ESMTPS id CF198F0C; Mon, 12 Sep 2016 00:24:57 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C0Ou6c049995; Mon, 12 Sep 2016 00:24:56 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C0Ou9p049994; Mon, 12 Sep 2016 00:24:56 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201609120024.u8C0Ou9p049994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 12 Sep 2016 00:24: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: r305718 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 00:24:58 -0000 Author: grehan Date: Mon Sep 12 00:24:56 2016 New Revision: 305718 URL: https://svnweb.freebsd.org/changeset/base/305718 Log: MFC r305061 Invert calloc(3) argument order Modified: stable/11/usr.sbin/bhyve/pci_e82545.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 12 00:21:55 2016 (r305717) +++ stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 12 00:24:56 2016 (r305718) @@ -2273,7 +2273,7 @@ e82545_init(struct vmctx *ctx, struct pc int mac_provided; /* Setup our softc */ - sc = calloc(sizeof(*sc), 1); + sc = calloc(1, sizeof(*sc)); pi->pi_arg = sc; sc->esc_pi = pi; From owner-svn-src-stable@freebsd.org Mon Sep 12 01:01:09 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC32EBD4BB2; Mon, 12 Sep 2016 01:01:09 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-yb0-x235.google.com (mail-yb0-x235.google.com [IPv6:2607:f8b0:4002:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7288CE1A; Mon, 12 Sep 2016 01:01:09 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-yb0-x235.google.com with SMTP id n11so721601yba.0; Sun, 11 Sep 2016 18:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ffonl+GejQu7rrhimDZqvBLvwZIpRsMLOs/cEPXG/PQ=; b=c+5B8TuB8MOnAFRr5DrItjeSMjZn7SiucLKFPhXLH/lfPh31gjm4JCGbXC306NH83s HZwXIV8pGPzRoquZJirwu0U16JYlXw9caJAhCQEfUwpWtWhFueF+fJt7J8tpA0Rh8dbA wod7b/AJebpx2nmhRj6FoPP7FCwZyNfHaoPU8PVlnWmrlxIhBBI6hBSq0VwBpU1Ay3uC vIQvHkhAR4x6pLvhWcghKrIFRzvgIch31xSklnrtaYVutDTqXz5G9Zm7tY3oUIq7a/jV cVEX+31RIZ/LvF5H2jH2B00jpXHMMjBoaOGj6YLNVuBoGs1bEJzoYLS5F23AffGj66Dk BvkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=ffonl+GejQu7rrhimDZqvBLvwZIpRsMLOs/cEPXG/PQ=; b=mg27+RYVpq8kMPc4smwQ4SMKNGVL7urtbr3tBPbAG8iU9e5yAQ4k+9pbzFHxmytKWw 9lhSv+Rt4DgTaLAJpXb1mou44PXJE33Pa51abBmRYEX5VaTRFH38phyuZbPBJ6cYHtkY NsvpSZmclPldMLW9wMt/gN+IRmi+IhoeyRl2MdPyCwjGgV3vinWBejjZI4iZKp09uUmo YR8MwsG2Tkek2IdMEwXw7LhcfmIoQjuyT5RdYIwYknjWATvjri8MiNs8d6xgpD/3vttU MYbvXNIOQX8HySDdwMcq2Blb73QR7JtAfrax8PGbtiMbf2JnTxDKrj8KiTBqaPqPuR4D dBTg== X-Gm-Message-State: AE9vXwMkccp10ZjHFXVkd88NbGOrc+BiP/gPnfLD5jdgQTp8PcyljOThY3XZDTP37e1vkMH3eakj9KunzLr8Kg== X-Received: by 10.37.57.86 with SMTP id g83mr1715139yba.64.1473642068498; Sun, 11 Sep 2016 18:01:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.56.130 with HTTP; Sun, 11 Sep 2016 18:01:07 -0700 (PDT) Received: by 10.129.56.130 with HTTP; Sun, 11 Sep 2016 18:01:07 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <201609120024.u8C0Ou9p049994@repo.freebsd.org> References: <201609120024.u8C0Ou9p049994@repo.freebsd.org> From: Marcelo Araujo Date: Mon, 12 Sep 2016 09:01:07 +0800 Message-ID: Subject: Re: svn commit: r305718 - stable/11/usr.sbin/bhyve To: Peter Grehan Cc: svn-src-stable-11@freebsd.org, src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 01:01:09 -0000 Thank you for that. On Sep 12, 2016 8:25 AM, "Peter Grehan" wrote: > Author: grehan > Date: Mon Sep 12 00:24:56 2016 > New Revision: 305718 > URL: https://svnweb.freebsd.org/changeset/base/305718 > > Log: > MFC r305061 > Invert calloc(3) argument order > > Modified: > stable/11/usr.sbin/bhyve/pci_e82545.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/usr.sbin/bhyve/pci_e82545.c > ============================================================ > ================== > --- stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 12 00:21:55 2016 > (r305717) > +++ stable/11/usr.sbin/bhyve/pci_e82545.c Mon Sep 12 00:24:56 2016 > (r305718) > @@ -2273,7 +2273,7 @@ e82545_init(struct vmctx *ctx, struct pc > int mac_provided; > > /* Setup our softc */ > - sc = calloc(sizeof(*sc), 1); > + sc = calloc(1, sizeof(*sc)); > > pi->pi_arg = sc; > sc->esc_pi = pi; > > From owner-svn-src-stable@freebsd.org Mon Sep 12 08:14:13 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 31775BD766A; Mon, 12 Sep 2016 08:14:13 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id EEADA1F5; Mon, 12 Sep 2016 08:14:12 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C8ECmi051924; Mon, 12 Sep 2016 08:14:12 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C8ECaM051923; Mon, 12 Sep 2016 08:14:12 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609120814.u8C8ECaM051923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 12 Sep 2016 08:14:12 +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: r305731 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 08:14:13 -0000 Author: sephe Date: Mon Sep 12 08:14:11 2016 New Revision: 305731 URL: https://svnweb.freebsd.org/changeset/base/305731 Log: MFC 305177 net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1. Reviewed by: araujo, hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7710 Modified: stable/11/sys/net/ethernet.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/ethernet.h ============================================================================== --- stable/11/sys/net/ethernet.h Mon Sep 12 06:12:28 2016 (r305730) +++ stable/11/sys/net/ethernet.h Mon Sep 12 08:14:11 2016 (r305731) @@ -89,7 +89,7 @@ struct ether_vlan_header { #define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) #define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1) #define EVL_MAKETAG(vlid, pri, cfi) \ - ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) + ((((((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) /* * NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields. From owner-svn-src-stable@freebsd.org Mon Sep 12 08:32:08 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F25ADBD7AF1; Mon, 12 Sep 2016 08:32:07 +0000 (UTC) (envelope-from sephe@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 mx1.freebsd.org (Postfix) with ESMTPS id BE6FFF96; Mon, 12 Sep 2016 08:32:07 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8C8W7wG061934; Mon, 12 Sep 2016 08:32:07 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8C8W7id061933; Mon, 12 Sep 2016 08:32:07 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609120832.u8C8W7id061933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 12 Sep 2016 08:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305732 - stable/10/sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 08:32:08 -0000 Author: sephe Date: Mon Sep 12 08:32:06 2016 New Revision: 305732 URL: https://svnweb.freebsd.org/changeset/base/305732 Log: MFC 305177 net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1. Reviewed by: araujo, hps Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7710 Modified: stable/10/sys/net/if_vlan_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_vlan_var.h ============================================================================== --- stable/10/sys/net/if_vlan_var.h Mon Sep 12 08:14:11 2016 (r305731) +++ stable/10/sys/net/if_vlan_var.h Mon Sep 12 08:32:06 2016 (r305732) @@ -46,7 +46,7 @@ struct ether_vlan_header { #define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) #define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1) #define EVL_MAKETAG(vlid, pri, cfi) \ - ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) + ((((((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) /* Set the VLAN ID in an mbuf packet header non-destructively. */ #define EVL_APPLY_VLID(m, vlid) \ From owner-svn-src-stable@freebsd.org Mon Sep 12 10:14:32 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80E07BD6D2F; Mon, 12 Sep 2016 10:14:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id 5B7D7F97; Mon, 12 Sep 2016 10:14:32 +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 u8CAEVag014182; Mon, 12 Sep 2016 10:14:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CAEUP9014171; Mon, 12 Sep 2016 10:14:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609121014.u8CAEUP9014171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Sep 2016 10:14: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: r305733 - in stable/11/sys: dev/usb dev/usb/template sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 10:14:32 -0000 Author: hselasky Date: Mon Sep 12 10:14:30 2016 New Revision: 305733 URL: https://svnweb.freebsd.org/changeset/base/305733 Log: MFC r305421: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@ Modified: stable/11/sys/dev/usb/template/usb_template.c stable/11/sys/dev/usb/usb_device.c stable/11/sys/dev/usb/usb_device.h stable/11/sys/dev/usb/usb_generic.c stable/11/sys/dev/usb/usb_request.c stable/11/sys/dev/usb/usb_transfer.c stable/11/sys/dev/usb/usb_util.c stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/11/sys/dev/usb/template/usb_template.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/template/usb_template.c Mon Sep 12 10:14:30 2016 (r305733) @@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev, return (0); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); uts = udev->scratch.temp_setup; @@ -1324,7 +1324,7 @@ done: if (error) usb_temp_unsetup(udev); if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/11/sys/dev/usb/usb_device.c ============================================================================== --- stable/11/sys/dev/usb/usb_device.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_device.c Mon Sep 12 10:14:30 2016 (r305733) @@ -1585,6 +1585,7 @@ usb_alloc_device(device_t parent_dev, st /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); + sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); cv_init(&udev->ctrlreq_cv, "WCTRL"); cv_init(&udev->ref_cv, "UGONE"); @@ -1770,7 +1771,7 @@ usb_alloc_device(device_t parent_dev, st */ /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); scratch_ptr = udev->scratch.data; @@ -1821,7 +1822,7 @@ usb_alloc_device(device_t parent_dev, st } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; @@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev, sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); + sx_destroy(&udev->ctrl_sx); cv_destroy(&udev->ctrlreq_cv); cv_destroy(&udev->ref_cv); @@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic uint8_t do_unlock; /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_ptr = (char *)udev->scratch.data; temp_size = sizeof(udev->scratch.data); @@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); } /* @@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u } /* + * The following function is used to serialize access to USB control + * transfers and the USB scratch area. If the lock is already grabbed + * this function returns zero. Else a value of one is returned. + */ +uint8_t +usbd_ctrl_lock(struct usb_device *udev) +{ + if (sx_xlocked(&udev->ctrl_sx)) + return (0); + sx_xlock(&udev->ctrl_sx); + + /* + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_unlock(udev); + return (1); +} + +void +usbd_ctrl_unlock(struct usb_device *udev) +{ + sx_xunlock(&udev->ctrl_sx); + + /* + * Restore the suspend and resume lock after we have unlocked + * the USB control transfer lock to avoid LOR: + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_lock(udev); +} + +/* * The following function is used to set the per-interface specific * plug and play information. The string referred to by the pnpinfo * argument can safely be freed after calling this function. The Modified: stable/11/sys/dev/usb/usb_device.h ============================================================================== --- stable/11/sys/dev/usb/usb_device.h Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_device.h Mon Sep 12 10:14:30 2016 (r305733) @@ -162,7 +162,7 @@ struct usb_temp_setup { /* * The scratch area for USB devices. Access to this structure is - * protected by the enumeration SX lock. + * protected by the control SX lock. */ union usb_device_scratch { struct usb_hw_ep_scratch hw_ep_scratch[1]; @@ -183,6 +183,7 @@ struct usb_device { struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; + struct sx ctrl_sx; struct mtx device_mtx; struct cv ctrlreq_cv; struct cv ref_cv; @@ -320,6 +321,8 @@ uint8_t usbd_enum_lock_sig(struct usb_de void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); +uint8_t usbd_ctrl_lock(struct usb_device *); +void usbd_ctrl_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); #if USB_HAVE_TT_SUPPORT Modified: stable/11/sys/dev/usb/usb_generic.c ============================================================================== --- stable/11/sys/dev/usb/usb_generic.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_generic.c Mon Sep 12 10:14:30 2016 (r305733) @@ -714,16 +714,16 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } -/* - * This function is called having the enumeration SX locked which - * protects the scratch area used. - */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr; uint16_t size; int error; + uint8_t do_unlock; + + /* Protect scratch area */ + do_unlock = usbd_ctrl_lock(f->udev); ptr = f->udev->scratch.data; size = sizeof(f->udev->scratch.data); @@ -744,6 +744,9 @@ ugen_get_sdesc(struct usb_fifo *f, struc error = copyout(ptr, ugd->ugd_data, size); } + if (do_unlock) + usbd_ctrl_unlock(f->udev); + return (error); } Modified: stable/11/sys/dev/usb/usb_request.c ============================================================================== --- stable/11/sys/dev/usb/usb_request.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_request.c Mon Sep 12 10:14:30 2016 (r305733) @@ -460,16 +460,9 @@ usbd_do_request_flags(struct usb_device } /* - * Grab the USB device enumeration SX-lock serialization is - * achieved when multiple threads are involved: + * Serialize access to this function: */ - do_unlock = usbd_enum_lock(udev); - - /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! - */ - usbd_sr_unlock(udev); + do_unlock = usbd_ctrl_lock(udev); hr_func = usbd_get_hr_func(udev); @@ -713,10 +706,8 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - usbd_sr_lock(udev); - if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/11/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/11/sys/dev/usb/usb_transfer.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_transfer.c Mon Sep 12 10:14:30 2016 (r305733) @@ -953,7 +953,7 @@ usbd_transfer_setup(struct usb_device *u return (error); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); refcount = 0; info = NULL; @@ -1274,7 +1274,7 @@ done: error = parm->err; if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/11/sys/dev/usb/usb_util.c ============================================================================== --- stable/11/sys/dev/usb/usb_util.c Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/dev/usb/usb_util.c Mon Sep 12 10:14:30 2016 (r305733) @@ -98,7 +98,7 @@ device_set_usb_desc(device_t dev) } /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_p = (char *)udev->scratch.data; @@ -115,7 +115,7 @@ device_set_usb_desc(device_t dev) } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); device_set_desc_copy(dev, temp_p); device_printf(dev, "<%s> on %s\n", temp_p, Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Sep 12 08:32:06 2016 (r305732) +++ stable/11/sys/sys/param.h Mon Sep 12 10:14:30 2016 (r305733) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Sep 12 10:17:27 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 801E0BD6DE4; Mon, 12 Sep 2016 10:17:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id 576961C6; Mon, 12 Sep 2016 10:17:27 +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 u8CAHQJi014745; Mon, 12 Sep 2016 10:17:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CAHPeG014734; Mon, 12 Sep 2016 10:17:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609121017.u8CAHPeG014734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Sep 2016 10:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305734 - in stable/10/sys: dev/usb dev/usb/template sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 10:17:27 -0000 Author: hselasky Date: Mon Sep 12 10:17:25 2016 New Revision: 305734 URL: https://svnweb.freebsd.org/changeset/base/305734 Log: MFC r305421: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@ Modified: stable/10/sys/dev/usb/template/usb_template.c stable/10/sys/dev/usb/usb_device.c stable/10/sys/dev/usb/usb_device.h stable/10/sys/dev/usb/usb_generic.c stable/10/sys/dev/usb/usb_request.c stable/10/sys/dev/usb/usb_transfer.c stable/10/sys/dev/usb/usb_util.c stable/10/sys/sys/param.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/10/sys/dev/usb/template/usb_template.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/template/usb_template.c Mon Sep 12 10:17:25 2016 (r305734) @@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev, return (0); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); uts = udev->scratch.temp_setup; @@ -1324,7 +1324,7 @@ done: if (error) usb_temp_unsetup(udev); if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/10/sys/dev/usb/usb_device.c ============================================================================== --- stable/10/sys/dev/usb/usb_device.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_device.c Mon Sep 12 10:17:25 2016 (r305734) @@ -1588,6 +1588,7 @@ usb_alloc_device(device_t parent_dev, st /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); + sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); cv_init(&udev->ctrlreq_cv, "WCTRL"); cv_init(&udev->ref_cv, "UGONE"); @@ -1773,7 +1774,7 @@ usb_alloc_device(device_t parent_dev, st */ /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); scratch_ptr = udev->scratch.data; @@ -1824,7 +1825,7 @@ usb_alloc_device(device_t parent_dev, st } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; @@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev, sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); + sx_destroy(&udev->ctrl_sx); cv_destroy(&udev->ctrlreq_cv); cv_destroy(&udev->ref_cv); @@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic uint8_t do_unlock; /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_ptr = (char *)udev->scratch.data; temp_size = sizeof(udev->scratch.data); @@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); } /* @@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u } /* + * The following function is used to serialize access to USB control + * transfers and the USB scratch area. If the lock is already grabbed + * this function returns zero. Else a value of one is returned. + */ +uint8_t +usbd_ctrl_lock(struct usb_device *udev) +{ + if (sx_xlocked(&udev->ctrl_sx)) + return (0); + sx_xlock(&udev->ctrl_sx); + + /* + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_unlock(udev); + return (1); +} + +void +usbd_ctrl_unlock(struct usb_device *udev) +{ + sx_xunlock(&udev->ctrl_sx); + + /* + * Restore the suspend and resume lock after we have unlocked + * the USB control transfer lock to avoid LOR: + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_lock(udev); +} + +/* * The following function is used to set the per-interface specific * plug and play information. The string referred to by the pnpinfo * argument can safely be freed after calling this function. The Modified: stable/10/sys/dev/usb/usb_device.h ============================================================================== --- stable/10/sys/dev/usb/usb_device.h Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_device.h Mon Sep 12 10:17:25 2016 (r305734) @@ -162,7 +162,7 @@ struct usb_temp_setup { /* * The scratch area for USB devices. Access to this structure is - * protected by the enumeration SX lock. + * protected by the control SX lock. */ union usb_device_scratch { struct usb_hw_ep_scratch hw_ep_scratch[1]; @@ -183,6 +183,7 @@ struct usb_device { struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; + struct sx ctrl_sx; struct mtx device_mtx; struct cv ctrlreq_cv; struct cv ref_cv; @@ -320,6 +321,8 @@ uint8_t usbd_enum_lock_sig(struct usb_de void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); +uint8_t usbd_ctrl_lock(struct usb_device *); +void usbd_ctrl_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); #if USB_HAVE_TT_SUPPORT Modified: stable/10/sys/dev/usb/usb_generic.c ============================================================================== --- stable/10/sys/dev/usb/usb_generic.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_generic.c Mon Sep 12 10:17:25 2016 (r305734) @@ -715,16 +715,16 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } -/* - * This function is called having the enumeration SX locked which - * protects the scratch area used. - */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr; uint16_t size; int error; + uint8_t do_unlock; + + /* Protect scratch area */ + do_unlock = usbd_ctrl_lock(f->udev); ptr = f->udev->scratch.data; size = sizeof(f->udev->scratch.data); @@ -745,6 +745,9 @@ ugen_get_sdesc(struct usb_fifo *f, struc error = copyout(ptr, ugd->ugd_data, size); } + if (do_unlock) + usbd_ctrl_unlock(f->udev); + return (error); } Modified: stable/10/sys/dev/usb/usb_request.c ============================================================================== --- stable/10/sys/dev/usb/usb_request.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_request.c Mon Sep 12 10:17:25 2016 (r305734) @@ -460,16 +460,9 @@ usbd_do_request_flags(struct usb_device } /* - * Grab the USB device enumeration SX-lock serialization is - * achieved when multiple threads are involved: + * Serialize access to this function: */ - do_unlock = usbd_enum_lock(udev); - - /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! - */ - usbd_sr_unlock(udev); + do_unlock = usbd_ctrl_lock(udev); hr_func = usbd_get_hr_func(udev); @@ -713,10 +706,8 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - usbd_sr_lock(udev); - if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/10/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/10/sys/dev/usb/usb_transfer.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_transfer.c Mon Sep 12 10:17:25 2016 (r305734) @@ -953,7 +953,7 @@ usbd_transfer_setup(struct usb_device *u return (error); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); refcount = 0; info = NULL; @@ -1274,7 +1274,7 @@ done: error = parm->err; if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/10/sys/dev/usb/usb_util.c ============================================================================== --- stable/10/sys/dev/usb/usb_util.c Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/dev/usb/usb_util.c Mon Sep 12 10:17:25 2016 (r305734) @@ -98,7 +98,7 @@ device_set_usb_desc(device_t dev) } /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_p = (char *)udev->scratch.data; @@ -115,7 +115,7 @@ device_set_usb_desc(device_t dev) } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); device_set_desc_copy(dev, temp_p); device_printf(dev, "<%s> on %s\n", temp_p, Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Mon Sep 12 10:14:30 2016 (r305733) +++ stable/10/sys/sys/param.h Mon Sep 12 10:17:25 2016 (r305734) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1003507 /* Master, propagated to newvers */ +#define __FreeBSD_version 1003508 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Sep 12 10:20:46 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F88CBD6EA5; Mon, 12 Sep 2016 10:20:46 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0D7373B3; Mon, 12 Sep 2016 10:20:45 +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 u8CAKjBp015393; Mon, 12 Sep 2016 10:20:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CAKiYE015383; Mon, 12 Sep 2016 10:20:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609121020.u8CAKiYE015383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Sep 2016 10:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r305735 - in stable/9/sys: dev/usb dev/usb/template sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 10:20:46 -0000 Author: hselasky Date: Mon Sep 12 10:20:44 2016 New Revision: 305735 URL: https://svnweb.freebsd.org/changeset/base/305735 Log: MFC r305421: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@ Modified: stable/9/sys/dev/usb/template/usb_template.c stable/9/sys/dev/usb/usb_device.c stable/9/sys/dev/usb/usb_device.h stable/9/sys/dev/usb/usb_generic.c stable/9/sys/dev/usb/usb_request.c stable/9/sys/dev/usb/usb_transfer.c stable/9/sys/dev/usb/usb_util.c stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Modified: stable/9/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/9/sys/dev/usb/template/usb_template.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/template/usb_template.c Mon Sep 12 10:20:44 2016 (r305735) @@ -1240,7 +1240,7 @@ usb_temp_setup(struct usb_device *udev, return (0); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); uts = udev->scratch.temp_setup; @@ -1319,7 +1319,7 @@ done: if (error) usb_temp_unsetup(udev); if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_device.c Mon Sep 12 10:20:44 2016 (r305735) @@ -1555,6 +1555,7 @@ usb_alloc_device(device_t parent_dev, st /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); + sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); cv_init(&udev->ctrlreq_cv, "WCTRL"); cv_init(&udev->ref_cv, "UGONE"); @@ -1740,7 +1741,7 @@ usb_alloc_device(device_t parent_dev, st */ /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); scratch_ptr = udev->scratch.data; @@ -1791,7 +1792,7 @@ usb_alloc_device(device_t parent_dev, st } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; @@ -2158,6 +2159,7 @@ usb_free_device(struct usb_device *udev, sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); + sx_destroy(&udev->ctrl_sx); cv_destroy(&udev->ctrlreq_cv); cv_destroy(&udev->ref_cv); @@ -2321,7 +2323,7 @@ usbd_set_device_strings(struct usb_devic uint8_t do_unlock; /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_ptr = (char *)udev->scratch.data; temp_size = sizeof(udev->scratch.data); @@ -2381,7 +2383,7 @@ usbd_set_device_strings(struct usb_devic } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); } /* @@ -2788,6 +2790,40 @@ usbd_enum_is_locked(struct usb_device *u } /* + * The following function is used to serialize access to USB control + * transfers and the USB scratch area. If the lock is already grabbed + * this function returns zero. Else a value of one is returned. + */ +uint8_t +usbd_ctrl_lock(struct usb_device *udev) +{ + if (sx_xlocked(&udev->ctrl_sx)) + return (0); + sx_xlock(&udev->ctrl_sx); + + /* + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_unlock(udev); + return (1); +} + +void +usbd_ctrl_unlock(struct usb_device *udev) +{ + sx_xunlock(&udev->ctrl_sx); + + /* + * Restore the suspend and resume lock after we have unlocked + * the USB control transfer lock to avoid LOR: + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_lock(udev); +} + +/* * The following function is used to set the per-interface specific * plug and play information. The string referred to by the pnpinfo * argument can safely be freed after calling this function. The Modified: stable/9/sys/dev/usb/usb_device.h ============================================================================== --- stable/9/sys/dev/usb/usb_device.h Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_device.h Mon Sep 12 10:20:44 2016 (r305735) @@ -162,7 +162,7 @@ struct usb_temp_setup { /* * The scratch area for USB devices. Access to this structure is - * protected by the enumeration SX lock. + * protected by the control SX lock. */ union usb_device_scratch { struct usb_hw_ep_scratch hw_ep_scratch[1]; @@ -183,6 +183,7 @@ struct usb_device { struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; + struct sx ctrl_sx; struct mtx device_mtx; struct cv ctrlreq_cv; struct cv ref_cv; @@ -308,6 +309,8 @@ uint8_t usbd_enum_lock_sig(struct usb_de void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); +uint8_t usbd_ctrl_lock(struct usb_device *); +void usbd_ctrl_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); #if USB_HAVE_TT_SUPPORT Modified: stable/9/sys/dev/usb/usb_generic.c ============================================================================== --- stable/9/sys/dev/usb/usb_generic.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_generic.c Mon Sep 12 10:20:44 2016 (r305735) @@ -706,16 +706,16 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } -/* - * This function is called having the enumeration SX locked which - * protects the scratch area used. - */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr; uint16_t size; int error; + uint8_t do_unlock; + + /* Protect scratch area */ + do_unlock = usbd_ctrl_lock(f->udev); ptr = f->udev->scratch.data; size = sizeof(f->udev->scratch.data); @@ -736,6 +736,9 @@ ugen_get_sdesc(struct usb_fifo *f, struc error = copyout(ptr, ugd->ugd_data, size); } + if (do_unlock) + usbd_ctrl_unlock(f->udev); + return (error); } Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_request.c Mon Sep 12 10:20:44 2016 (r305735) @@ -453,16 +453,9 @@ usbd_do_request_flags(struct usb_device } /* - * Grab the USB device enumeration SX-lock serialization is - * achieved when multiple threads are involved: + * Serialize access to this function: */ - do_unlock = usbd_enum_lock(udev); - - /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! - */ - usbd_sr_unlock(udev); + do_unlock = usbd_ctrl_lock(udev); hr_func = usbd_get_hr_func(udev); @@ -706,10 +699,8 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - usbd_sr_lock(udev); - if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/9/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/9/sys/dev/usb/usb_transfer.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_transfer.c Mon Sep 12 10:20:44 2016 (r305735) @@ -872,7 +872,7 @@ usbd_transfer_setup(struct usb_device *u return (error); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); refcount = 0; info = NULL; @@ -1171,7 +1171,7 @@ done: error = parm->err; if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/9/sys/dev/usb/usb_util.c ============================================================================== --- stable/9/sys/dev/usb/usb_util.c Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/dev/usb/usb_util.c Mon Sep 12 10:20:44 2016 (r305735) @@ -94,7 +94,7 @@ device_set_usb_desc(device_t dev) } /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_p = (char *)udev->scratch.data; @@ -111,7 +111,7 @@ device_set_usb_desc(device_t dev) } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); device_set_desc_copy(dev, temp_p); device_printf(dev, "<%s> on %s\n", temp_p, Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Mon Sep 12 10:17:25 2016 (r305734) +++ stable/9/sys/sys/param.h Mon Sep 12 10:20:44 2016 (r305735) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 903510 /* Master, propagated to newvers */ +#define __FreeBSD_version 903511 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Sep 12 10:23:26 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A25D2BD800C; Mon, 12 Sep 2016 10:23:26 +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 mx1.freebsd.org (Postfix) with ESMTPS id 701519AE; Mon, 12 Sep 2016 10:23:26 +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 u8CANPE1019201; Mon, 12 Sep 2016 10:23:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CANOhq019191; Mon, 12 Sep 2016 10:23:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609121023.u8CANOhq019191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 12 Sep 2016 10:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r305736 - in stable/8/sys: dev/usb dev/usb/template sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 10:23:26 -0000 Author: hselasky Date: Mon Sep 12 10:23:24 2016 New Revision: 305736 URL: https://svnweb.freebsd.org/changeset/base/305736 Log: MFC r305421: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device". The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved. Bump the FreeBSD version while at it to force recompilation of all USB kernel modules. Found by: avos@ Modified: stable/8/sys/dev/usb/template/usb_template.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_generic.c stable/8/sys/dev/usb/usb_request.c stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usb_util.c stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/dev/usb/template/usb_template.c ============================================================================== --- stable/8/sys/dev/usb/template/usb_template.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/template/usb_template.c Mon Sep 12 10:23:24 2016 (r305736) @@ -1240,7 +1240,7 @@ usb_temp_setup(struct usb_device *udev, return (0); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); uts = udev->scratch.temp_setup; @@ -1319,7 +1319,7 @@ done: if (error) usb_temp_unsetup(udev); if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_device.c Mon Sep 12 10:23:24 2016 (r305736) @@ -1550,6 +1550,7 @@ usb_alloc_device(device_t parent_dev, st /* initialise our SX-lock */ sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); + sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); cv_init(&udev->ctrlreq_cv, "WCTRL"); cv_init(&udev->ref_cv, "UGONE"); @@ -1735,7 +1736,7 @@ usb_alloc_device(device_t parent_dev, st */ /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); scratch_ptr = udev->scratch.data; @@ -1786,7 +1787,7 @@ usb_alloc_device(device_t parent_dev, st } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); /* assume 100mA bus powered for now. Changed when configured. */ udev->power = USB_MIN_POWER; @@ -2148,6 +2149,7 @@ usb_free_device(struct usb_device *udev, sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); + sx_destroy(&udev->ctrl_sx); cv_destroy(&udev->ctrlreq_cv); cv_destroy(&udev->ref_cv); @@ -2311,7 +2313,7 @@ usbd_set_device_strings(struct usb_devic uint8_t do_unlock; /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_ptr = (char *)udev->scratch.data; temp_size = sizeof(udev->scratch.data); @@ -2371,7 +2373,7 @@ usbd_set_device_strings(struct usb_devic } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); } /* @@ -2853,6 +2855,40 @@ usbd_enum_is_locked(struct usb_device *u } /* + * The following function is used to serialize access to USB control + * transfers and the USB scratch area. If the lock is already grabbed + * this function returns zero. Else a value of one is returned. + */ +uint8_t +usbd_ctrl_lock(struct usb_device *udev) +{ + if (sx_xlocked(&udev->ctrl_sx)) + return (0); + sx_xlock(&udev->ctrl_sx); + + /* + * We need to allow suspend and resume at this point, else the + * control transfer will timeout if the device is suspended! + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_unlock(udev); + return (1); +} + +void +usbd_ctrl_unlock(struct usb_device *udev) +{ + sx_xunlock(&udev->ctrl_sx); + + /* + * Restore the suspend and resume lock after we have unlocked + * the USB control transfer lock to avoid LOR: + */ + if (usbd_enum_is_locked(udev)) + usbd_sr_lock(udev); +} + +/* * The following function is used to set the per-interface specific * plug and play information. The string referred to by the pnpinfo * argument can safely be freed after calling this function. The Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_device.h Mon Sep 12 10:23:24 2016 (r305736) @@ -162,7 +162,7 @@ struct usb_temp_setup { /* * The scratch area for USB devices. Access to this structure is - * protected by the enumeration SX lock. + * protected by the control SX lock. */ union usb_device_scratch { struct usb_hw_ep_scratch hw_ep_scratch[1]; @@ -183,6 +183,7 @@ struct usb_device { struct usb_udev_msg cs_msg[2]; struct sx enum_sx; struct sx sr_sx; + struct sx ctrl_sx; struct mtx device_mtx; struct cv ctrlreq_cv; struct cv ref_cv; @@ -309,6 +310,8 @@ uint8_t usbd_enum_lock_sig(struct usb_de void usbd_enum_unlock(struct usb_device *); void usbd_sr_lock(struct usb_device *); void usbd_sr_unlock(struct usb_device *); +uint8_t usbd_ctrl_lock(struct usb_device *); +void usbd_ctrl_unlock(struct usb_device *); uint8_t usbd_enum_is_locked(struct usb_device *); #if USB_HAVE_TT_SUPPORT Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_generic.c Mon Sep 12 10:23:24 2016 (r305736) @@ -706,16 +706,16 @@ ugen_get_cdesc(struct usb_fifo *f, struc return (error); } -/* - * This function is called having the enumeration SX locked which - * protects the scratch area used. - */ static int ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) { void *ptr; uint16_t size; int error; + uint8_t do_unlock; + + /* Protect scratch area */ + do_unlock = usbd_ctrl_lock(f->udev); ptr = f->udev->scratch.data; size = sizeof(f->udev->scratch.data); @@ -736,6 +736,9 @@ ugen_get_sdesc(struct usb_fifo *f, struc error = copyout(ptr, ugd->ugd_data, size); } + if (do_unlock) + usbd_ctrl_unlock(f->udev); + return (error); } Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_request.c Mon Sep 12 10:23:24 2016 (r305736) @@ -453,16 +453,9 @@ usbd_do_request_flags(struct usb_device } /* - * Grab the USB device enumeration SX-lock serialization is - * achieved when multiple threads are involved: + * Serialize access to this function: */ - do_unlock = usbd_enum_lock(udev); - - /* - * We need to allow suspend and resume at this point, else the - * control transfer will timeout if the device is suspended! - */ - usbd_sr_unlock(udev); + do_unlock = usbd_ctrl_lock(udev); hr_func = usbd_get_hr_func(udev); @@ -706,10 +699,8 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - usbd_sr_lock(udev); - if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); if ((mtx != NULL) && (mtx != &Giant)) mtx_lock(mtx); Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_transfer.c Mon Sep 12 10:23:24 2016 (r305736) @@ -872,7 +872,7 @@ usbd_transfer_setup(struct usb_device *u return (error); /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); refcount = 0; info = NULL; @@ -1170,7 +1170,7 @@ done: error = parm->err; if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); return (error); } Modified: stable/8/sys/dev/usb/usb_util.c ============================================================================== --- stable/8/sys/dev/usb/usb_util.c Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/dev/usb/usb_util.c Mon Sep 12 10:23:24 2016 (r305736) @@ -119,7 +119,7 @@ device_set_usb_desc(device_t dev) } /* Protect scratch area */ - do_unlock = usbd_enum_lock(udev); + do_unlock = usbd_ctrl_lock(udev); temp_p = (char *)udev->scratch.data; @@ -136,7 +136,7 @@ device_set_usb_desc(device_t dev) } if (do_unlock) - usbd_enum_unlock(udev); + usbd_ctrl_unlock(udev); device_set_desc_copy(dev, temp_p); device_printf(dev, "<%s> on %s\n", temp_p, Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Mon Sep 12 10:20:44 2016 (r305735) +++ stable/8/sys/sys/param.h Mon Sep 12 10:23:24 2016 (r305736) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 804508 /* Master, propagated to newvers */ +#define __FreeBSD_version 804509 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Sep 12 16:28:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC926BD7B33; Mon, 12 Sep 2016 16:28:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A882BA01; Mon, 12 Sep 2016 16:28:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CGSWrH096756; Mon, 12 Sep 2016 16:28:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CGSW9E096747; Mon, 12 Sep 2016 16:28:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201609121628.u8CGSW9E096747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 12 Sep 2016 16:28: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: r305741 - in stable/11/usr.sbin/pw: . tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 16:28:33 -0000 Author: asomers Date: Mon Sep 12 16:28:32 2016 New Revision: 305741 URL: https://svnweb.freebsd.org/changeset/base/305741 Log: MFC r302778 pw should sanitize the argument of -w. Otherwise, it will silently disable the login for the selected account if the argument is unrecognizable. usr.sbin/pw/pw.h usr.sbin/pw/pw_conf.c usr.sbin/pw/pw_user.c Use separate rules to validate boolean parameters and passwd parameters. Error out if a password parameter cannot be parsed. usr.sbin/pw/tests/Makefile usr.sbin/pw/tests/crypt.c usr.sbin/pw/tests/pw_useradd.sh usr.sbin/pw/tests/pw_usermod.sh Add tests for the validation. Also, enhance existing password-related tests to actually validate that the correct hash is written to master.passwd. Added: stable/11/usr.sbin/pw/tests/crypt.c - copied unchanged from r302778, head/usr.sbin/pw/tests/crypt.c Modified: stable/11/usr.sbin/pw/pw.h stable/11/usr.sbin/pw/pw_conf.c stable/11/usr.sbin/pw/pw_user.c stable/11/usr.sbin/pw/tests/Makefile stable/11/usr.sbin/pw/tests/pw_useradd.sh stable/11/usr.sbin/pw/tests/pw_usermod.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/pw.h ============================================================================== --- stable/11/usr.sbin/pw/pw.h Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/pw.h Mon Sep 12 16:28:32 2016 (r305741) @@ -93,6 +93,7 @@ int groupadd(struct userconf *, char *na int nis_update(void); int boolean_val(char const * str, int dflt); +int passwd_val(char const * str, int dflt); char const *boolean_str(int val); char *newstr(char const * p); Modified: stable/11/usr.sbin/pw/pw_conf.c ============================================================================== --- stable/11/usr.sbin/pw/pw_conf.c Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/pw_conf.c Mon Sep 12 16:28:32 2016 (r305741) @@ -186,6 +186,22 @@ boolean_val(char const * str, int dflt) for (i = 0; boolfalse[i]; i++) if (strcmp(str, boolfalse[i]) == 0) return 0; + } + return dflt; +} + +int +passwd_val(char const * str, int dflt) +{ + if ((str = unquote(str)) != NULL) { + int i; + + for (i = 0; booltrue[i]; i++) + if (strcmp(str, booltrue[i]) == 0) + return 1; + for (i = 0; boolfalse[i]; i++) + if (strcmp(str, boolfalse[i]) == 0) + return 0; /* * Special cases for defaultpassword @@ -194,6 +210,8 @@ boolean_val(char const * str, int dflt) return -1; if (strcmp(str, "none") == 0) return -2; + + errx(1, "Invalid value for default password"); } return dflt; } @@ -258,7 +276,7 @@ read_userconfig(char const * file) #endif switch (i) { case _UC_DEFAULTPWD: - config.default_password = boolean_val(q, 1); + config.default_password = passwd_val(q, 1); break; case _UC_REUSEUID: config.reuse_uids = boolean_val(q, 0); Modified: stable/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/pw_user.c Mon Sep 12 16:28:32 2016 (r305741) @@ -1315,7 +1315,7 @@ pw_user_add(int argc, char **argv, char mix_config(cmdcnf, cnf); if (default_passwd) - cmdcnf->default_password = boolean_val(default_passwd, + cmdcnf->default_password = passwd_val(default_passwd, cnf->default_password); if (genconf) { if (name != NULL) @@ -1717,7 +1717,7 @@ pw_user_mod(int argc, char **argv, char if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); - cnf->default_password = boolean_val(passwd, + cnf->default_password = passwd_val(passwd, cnf->default_password); pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun); edited = true; Modified: stable/11/usr.sbin/pw/tests/Makefile ============================================================================== --- stable/11/usr.sbin/pw/tests/Makefile Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/tests/Makefile Mon Sep 12 16:28:32 2016 (r305741) @@ -2,6 +2,11 @@ PACKAGE= tests +BINDIR= ${TESTSDIR} + +PROGS+= crypt +LIBADD+= crypt + ATF_TESTS_SH= pw_etcdir \ pw_lock \ pw_config \ Copied: stable/11/usr.sbin/pw/tests/crypt.c (from r302778, head/usr.sbin/pw/tests/crypt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/usr.sbin/pw/tests/crypt.c Mon Sep 12 16:28:32 2016 (r305741, copy of r302778, head/usr.sbin/pw/tests/crypt.c) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2016 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +int main(int argc, char** argv) +{ + char *salt, *pass, *hash; + + if (argc < 3) + errx(1, "Usage: crypt "); + salt = argv[1]; + pass = argv[2]; + + hash = crypt(pass, salt); + printf("%s", hash); + return (hash == NULL ? 1 : 0); +} Modified: stable/11/usr.sbin/pw/tests/pw_useradd.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_useradd.sh Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/tests/pw_useradd.sh Mon Sep 12 16:28:32 2016 (r305741) @@ -235,9 +235,12 @@ atf_test_case user_add_password_from_h user_add_password_from_h_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -h 0 <<-EOF - $(echo test) + atf_check -s exit:0 ${PW} useradd foo -h 0 <<-EOF + $(echo mypassword) EOF + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "mypassword" } atf_test_case user_add_R @@ -325,17 +328,47 @@ user_add_already_exists_body() { ${PW} useradd foo } +atf_test_case user_add_w_error +user_add_w_error_body() { + populate_etc_skel + + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} useradd foo -w invalid_value +} + +atf_test_case user_add_w_no +user_add_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_none +user_add_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_random +user_add_w_random_body() { + populate_etc_skel + + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + atf_test_case user_add_w_yes user_add_w_yes_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd - atf_check -s exit:0 ${PW} usermod foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" } atf_test_case user_add_with_pw_conf @@ -380,6 +413,10 @@ atf_init_test_cases() { atf_add_test_case user_add_uid_too_large atf_add_test_case user_add_bad_shell atf_add_test_case user_add_already_exists + atf_add_test_case user_add_w_error + atf_add_test_case user_add_w_no + atf_add_test_case user_add_w_none + atf_add_test_case user_add_w_random atf_add_test_case user_add_w_yes atf_add_test_case user_add_with_pw_conf } Modified: stable/11/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_usermod.sh Mon Sep 12 16:13:27 2016 (r305740) +++ stable/11/usr.sbin/pw/tests/pw_usermod.sh Mon Sep 12 16:28:32 2016 (r305741) @@ -157,8 +157,9 @@ user_mod_h_body() { atf_check -s exit:0 ${PW} usermod foo -h 0 <<- EOF $(echo a) EOF - atf_check -s exit:0 -o not-match:"^foo:\*:.*" \ - grep "^foo" ${HOME}/master.passwd + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "a" atf_check -s exit:0 ${PW} usermod foo -h - <<- EOF $(echo b) EOF @@ -203,6 +204,56 @@ user_mod_uid_body() { atf_check -s exit:0 ${PW} usermod foo -u 5000 } +atf_test_case user_mod_w_error +user_mod_w_error_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} usermod foo -w invalid_value +} + +atf_test_case user_mod_w_no +user_mod_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_none +user_mod_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_random +user_mod_w_random_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + password=`${PW} usermod foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + +atf_test_case user_mod_w_yes +user_mod_w_yes_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w yes + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "foo" +} + + atf_init_test_cases() { atf_add_test_case user_mod atf_add_test_case user_mod_noupdate @@ -219,4 +270,9 @@ atf_init_test_cases() { atf_add_test_case user_mod_H atf_add_test_case user_mod_renamehome atf_add_test_case user_mod_uid + atf_add_test_case user_mod_w_error + atf_add_test_case user_mod_w_no + atf_add_test_case user_mod_w_none + atf_add_test_case user_mod_w_random + atf_add_test_case user_mod_w_yes } From owner-svn-src-stable@freebsd.org Mon Sep 12 16:36:46 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2075BBD7D9E; Mon, 12 Sep 2016 16:36:46 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E50DFF02; Mon, 12 Sep 2016 16:36:45 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CGajVV000648; Mon, 12 Sep 2016 16:36:45 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CGajKm000647; Mon, 12 Sep 2016 16:36:45 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201609121636.u8CGajKm000647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 12 Sep 2016 16:36:45 +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: r305742 - stable/11/etc/periodic/daily X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 16:36:46 -0000 Author: asomers Date: Mon Sep 12 16:36:44 2016 New Revision: 305742 URL: https://svnweb.freebsd.org/changeset/base/305742 Log: MFC r304162 Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour 24 hours is too long. Periodic scripts are executed serially, so when combined with the sleep in 410.pkg-audit periodic could actually take more than 24 hours and block the next invocation. Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd ============================================================================== --- stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Sep 12 16:28:32 2016 (r305741) +++ stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Sep 12 16:36:44 2016 (r305742) @@ -16,7 +16,7 @@ case "$daily_ntpd_leapfile_enable" in case "$daily_ntpd_avoid_congestion" in [Yy][Ee][Ss]) # Avoid dogpiling - (sleep $(jot -r 1 0 86400); service ntpd onefetch) & + (sleep $(jot -r 1 0 3600); service ntpd onefetch) & ;; *) service ntpd onefetch From owner-svn-src-stable@freebsd.org Mon Sep 12 16:55:17 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88BA6BD844B; Mon, 12 Sep 2016 16:55:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57F8A2A1; Mon, 12 Sep 2016 16:55:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CGtGnS009012; Mon, 12 Sep 2016 16:55:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CGtGCm009011; Mon, 12 Sep 2016 16:55:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201609121655.u8CGtGCm009011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 12 Sep 2016 16:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305746 - stable/10/etc/periodic/daily X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 16:55:17 -0000 Author: asomers Date: Mon Sep 12 16:55:16 2016 New Revision: 305746 URL: https://svnweb.freebsd.org/changeset/base/305746 Log: MFC r304162 Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour 24 hours is too long. Periodic scripts are executed serially, so when combined with the sleep in 410.pkg-audit periodic could actually take more than 24 hours and block the next invocation. Modified: stable/10/etc/periodic/daily/480.leapfile-ntpd Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/periodic/daily/480.leapfile-ntpd ============================================================================== --- stable/10/etc/periodic/daily/480.leapfile-ntpd Mon Sep 12 16:46:14 2016 (r305745) +++ stable/10/etc/periodic/daily/480.leapfile-ntpd Mon Sep 12 16:55:16 2016 (r305746) @@ -16,7 +16,7 @@ case "$daily_ntpd_leapfile_enable" in case "$daily_ntpd_avoid_congestion" in [Yy][Ee][Ss]) # Avoid dogpiling - (sleep $(jot -r 1 0 86400); service ntpd onefetch) & + (sleep $(jot -r 1 0 3600); service ntpd onefetch) & ;; *) service ntpd onefetch From owner-svn-src-stable@freebsd.org Mon Sep 12 17:02:24 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2580BBD870B; Mon, 12 Sep 2016 17:02:24 +0000 (UTC) (envelope-from gnn@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 mx1.freebsd.org (Postfix) with ESMTPS id EBF67A4B; Mon, 12 Sep 2016 17:02:23 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CH2Nvj012841; Mon, 12 Sep 2016 17:02:23 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CH2NlB012840; Mon, 12 Sep 2016 17:02:23 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201609121702.u8CH2NlB012840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Mon, 12 Sep 2016 17:02:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305747 - stable/11/cddl/lib/libdtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 17:02:24 -0000 Author: gnn Date: Mon Sep 12 17:02:22 2016 New Revision: 305747 URL: https://svnweb.freebsd.org/changeset/base/305747 Log: MFC: 304825 Unlike Solaris, in FreeBSD p_args can be 0 so check for that instead of walking down to ar_args blindly. Reported by: Amanda Strnad Reviewed by: markj, jhb Sponsored by: DARPA, AFRL Modified: stable/11/cddl/lib/libdtrace/psinfo.d Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/lib/libdtrace/psinfo.d ============================================================================== --- stable/11/cddl/lib/libdtrace/psinfo.d Mon Sep 12 16:55:16 2016 (r305746) +++ stable/11/cddl/lib/libdtrace/psinfo.d Mon Sep 12 17:02:22 2016 (r305747) @@ -59,7 +59,7 @@ translator psinfo_t < struct proc *T > { pr_gid = T->p_ucred->cr_rgid; pr_egid = T->p_ucred->cr_groups[0]; pr_addr = 0; - pr_psargs = (T->p_args->ar_args == 0) ? "" : + pr_psargs = (T->p_args == 0) ? "" : memstr(T->p_args->ar_args, ' ', T->p_args->ar_length); pr_arglen = T->p_args->ar_length; pr_jailid = T->p_ucred->cr_prison->pr_id; From owner-svn-src-stable@freebsd.org Mon Sep 12 17:05:43 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3AD8BD87DB; Mon, 12 Sep 2016 17:05:43 +0000 (UTC) (envelope-from gnn@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 mx1.freebsd.org (Postfix) with ESMTPS id 6F4D7CEB; Mon, 12 Sep 2016 17:05:43 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CH5gpR013165; Mon, 12 Sep 2016 17:05:42 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CH5geS013164; Mon, 12 Sep 2016 17:05:42 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201609121705.u8CH5geS013164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Mon, 12 Sep 2016 17:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305748 - stable/10/cddl/lib/libdtrace X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 17:05:43 -0000 Author: gnn Date: Mon Sep 12 17:05:42 2016 New Revision: 305748 URL: https://svnweb.freebsd.org/changeset/base/305748 Log: MFC: 304825 Unlike Solaris, in FreeBSD p_args can be 0 so check for that instead of walking down to ar_args blindly. Reported by: Amanda Strnad Reviewed by: markj, jhb Sponsored by: DARPA, AFRL Modified: stable/10/cddl/lib/libdtrace/psinfo.d Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/lib/libdtrace/psinfo.d ============================================================================== --- stable/10/cddl/lib/libdtrace/psinfo.d Mon Sep 12 17:02:22 2016 (r305747) +++ stable/10/cddl/lib/libdtrace/psinfo.d Mon Sep 12 17:05:42 2016 (r305748) @@ -57,7 +57,7 @@ translator psinfo_t < struct proc *T > { pr_gid = T->p_ucred->cr_rgid; pr_egid = T->p_ucred->cr_groups[0]; pr_addr = 0; - pr_psargs = (T->p_args->ar_args == 0) ? "" : + pr_psargs = (T->p_args == 0) ? "" : memstr(T->p_args->ar_args, ' ', T->p_args->ar_length); pr_arglen = T->p_args->ar_length; pr_jailid = T->p_ucred->cr_prison->pr_id; From owner-svn-src-stable@freebsd.org Mon Sep 12 17:35:47 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48E77BD82D1; Mon, 12 Sep 2016 17:35:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2150590A; Mon, 12 Sep 2016 17:35:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CHZk6n025470; Mon, 12 Sep 2016 17:35:46 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CHZjmL025463; Mon, 12 Sep 2016 17:35:45 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201609121735.u8CHZjmL025463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 12 Sep 2016 17:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305750 - in stable/10/usr.sbin/pw: . tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 17:35:47 -0000 Author: asomers Date: Mon Sep 12 17:35:45 2016 New Revision: 305750 URL: https://svnweb.freebsd.org/changeset/base/305750 Log: MFC r302778 pw should sanitize the argument of -w. Otherwise, it will silently disable the login for the selected account if the argument is unrecognizable. usr.sbin/pw/pw.h usr.sbin/pw/pw_conf.c usr.sbin/pw/pw_user.c Use separate rules to validate boolean parameters and passwd parameters. Error out if a password parameter cannot be parsed. usr.sbin/pw/tests/Makefile usr.sbin/pw/tests/crypt.c usr.sbin/pw/tests/pw_useradd.sh usr.sbin/pw/tests/pw_usermod.sh Add tests for the validation. Also, enhance existing password-related tests to actually validate that the correct hash is written to master.passwd. Added: stable/10/usr.sbin/pw/tests/crypt.c - copied unchanged from r302778, head/usr.sbin/pw/tests/crypt.c Modified: stable/10/usr.sbin/pw/pw.h stable/10/usr.sbin/pw/pw_conf.c stable/10/usr.sbin/pw/pw_user.c stable/10/usr.sbin/pw/tests/Makefile stable/10/usr.sbin/pw/tests/pw_useradd.sh stable/10/usr.sbin/pw/tests/pw_usermod.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw.h ============================================================================== --- stable/10/usr.sbin/pw/pw.h Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/pw.h Mon Sep 12 17:35:45 2016 (r305750) @@ -93,6 +93,7 @@ int groupadd(struct userconf *, char *na int nis_update(void); int boolean_val(char const * str, int dflt); +int passwd_val(char const * str, int dflt); char const *boolean_str(int val); char *newstr(char const * p); Modified: stable/10/usr.sbin/pw/pw_conf.c ============================================================================== --- stable/10/usr.sbin/pw/pw_conf.c Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/pw_conf.c Mon Sep 12 17:35:45 2016 (r305750) @@ -186,6 +186,22 @@ boolean_val(char const * str, int dflt) for (i = 0; boolfalse[i]; i++) if (strcmp(str, boolfalse[i]) == 0) return 0; + } + return dflt; +} + +int +passwd_val(char const * str, int dflt) +{ + if ((str = unquote(str)) != NULL) { + int i; + + for (i = 0; booltrue[i]; i++) + if (strcmp(str, booltrue[i]) == 0) + return 1; + for (i = 0; boolfalse[i]; i++) + if (strcmp(str, boolfalse[i]) == 0) + return 0; /* * Special cases for defaultpassword @@ -194,6 +210,8 @@ boolean_val(char const * str, int dflt) return -1; if (strcmp(str, "none") == 0) return -2; + + errx(1, "Invalid value for default password"); } return dflt; } @@ -258,7 +276,7 @@ read_userconfig(char const * file) #endif switch (i) { case _UC_DEFAULTPWD: - config.default_password = boolean_val(q, 1); + config.default_password = passwd_val(q, 1); break; case _UC_REUSEUID: config.reuse_uids = boolean_val(q, 0); Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/pw_user.c Mon Sep 12 17:35:45 2016 (r305750) @@ -1317,7 +1317,7 @@ pw_user_add(int argc, char **argv, char mix_config(cmdcnf, cnf); if (default_passwd) - cmdcnf->default_password = boolean_val(default_passwd, + cmdcnf->default_password = passwd_val(default_passwd, cnf->default_password); if (genconf) { if (name != NULL) @@ -1719,7 +1719,7 @@ pw_user_mod(int argc, char **argv, char if (lc == NULL || login_setcryptfmt(lc, "sha512", NULL) == NULL) warn("setting crypt(3) format"); login_close(lc); - cnf->default_password = boolean_val(passwd, + cnf->default_password = passwd_val(passwd, cnf->default_password); pwd->pw_passwd = pw_password(cnf, pwd->pw_name, dryrun); edited = true; Modified: stable/10/usr.sbin/pw/tests/Makefile ============================================================================== --- stable/10/usr.sbin/pw/tests/Makefile Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/tests/Makefile Mon Sep 12 17:35:45 2016 (r305750) @@ -2,6 +2,11 @@ TESTSDIR= ${TESTSBASE}/usr.sbin/pw +BINDIR= ${TESTSDIR} + +PROGS+= crypt +LDADD+= -lcrypt + ATF_TESTS_SH= pw_etcdir \ pw_lock \ pw_config \ Copied: stable/10/usr.sbin/pw/tests/crypt.c (from r302778, head/usr.sbin/pw/tests/crypt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/pw/tests/crypt.c Mon Sep 12 17:35:45 2016 (r305750, copy of r302778, head/usr.sbin/pw/tests/crypt.c) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2016 Spectra Logic Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include + +int main(int argc, char** argv) +{ + char *salt, *pass, *hash; + + if (argc < 3) + errx(1, "Usage: crypt "); + salt = argv[1]; + pass = argv[2]; + + hash = crypt(pass, salt); + printf("%s", hash); + return (hash == NULL ? 1 : 0); +} Modified: stable/10/usr.sbin/pw/tests/pw_useradd.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_useradd.sh Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/tests/pw_useradd.sh Mon Sep 12 17:35:45 2016 (r305750) @@ -235,9 +235,12 @@ atf_test_case user_add_password_from_h user_add_password_from_h_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -h 0 <<-EOF - $(echo test) + atf_check -s exit:0 ${PW} useradd foo -h 0 <<-EOF + $(echo mypassword) EOF + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "mypassword" } atf_test_case user_add_R @@ -325,17 +328,47 @@ user_add_already_exists_body() { ${PW} useradd foo } +atf_test_case user_add_w_error +user_add_w_error_body() { + populate_etc_skel + + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} useradd foo -w invalid_value +} + +atf_test_case user_add_w_no +user_add_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_none +user_add_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_add_w_random +user_add_w_random_body() { + populate_etc_skel + + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + atf_test_case user_add_w_yes user_add_w_yes_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd - atf_check -s exit:0 ${PW} usermod foo -w yes - atf_check -s exit:0 \ - -o match:'^foo:\$.*' \ - grep "^foo" ${HOME}/master.passwd + password=`${PW} useradd foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" } atf_test_case user_add_with_pw_conf @@ -380,6 +413,10 @@ atf_init_test_cases() { atf_add_test_case user_add_uid_too_large atf_add_test_case user_add_bad_shell atf_add_test_case user_add_already_exists + atf_add_test_case user_add_w_error + atf_add_test_case user_add_w_no + atf_add_test_case user_add_w_none + atf_add_test_case user_add_w_random atf_add_test_case user_add_w_yes atf_add_test_case user_add_with_pw_conf } Modified: stable/10/usr.sbin/pw/tests/pw_usermod.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_usermod.sh Mon Sep 12 17:29:20 2016 (r305749) +++ stable/10/usr.sbin/pw/tests/pw_usermod.sh Mon Sep 12 17:35:45 2016 (r305750) @@ -157,8 +157,9 @@ user_mod_h_body() { atf_check -s exit:0 ${PW} usermod foo -h 0 <<- EOF $(echo a) EOF - atf_check -s exit:0 -o not-match:"^foo:\*:.*" \ - grep "^foo" ${HOME}/master.passwd + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "a" atf_check -s exit:0 ${PW} usermod foo -h - <<- EOF $(echo b) EOF @@ -203,6 +204,56 @@ user_mod_uid_body() { atf_check -s exit:0 ${PW} usermod foo -u 5000 } +atf_test_case user_mod_w_error +user_mod_w_error_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:1 -e match:"pw: Invalid value for default password" \ + ${PW} usermod foo -w invalid_value +} + +atf_test_case user_mod_w_no +user_mod_w_no_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w no + atf_check -s exit:0 -o match:"^foo:\*" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_none +user_mod_w_none_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w none + atf_check -s exit:0 -o match:"^foo::" grep "^foo:" $HOME/master.passwd +} + +atf_test_case user_mod_w_random +user_mod_w_random_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + password=`${PW} usermod foo -w random | cat` + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "$password" +} + +atf_test_case user_mod_w_yes +user_mod_w_yes_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -w yes + passhash=`awk -F ':' '/^foo:/ {print $2}' $HOME/master.passwd` + atf_check -s exit:0 -o inline:$passhash \ + $(atf_get_srcdir)/crypt $passhash "foo" +} + + atf_init_test_cases() { atf_add_test_case user_mod atf_add_test_case user_mod_noupdate @@ -219,4 +270,9 @@ atf_init_test_cases() { atf_add_test_case user_mod_H atf_add_test_case user_mod_renamehome atf_add_test_case user_mod_uid + atf_add_test_case user_mod_w_error + atf_add_test_case user_mod_w_no + atf_add_test_case user_mod_w_none + atf_add_test_case user_mod_w_random + atf_add_test_case user_mod_w_yes } From owner-svn-src-stable@freebsd.org Mon Sep 12 22:07:01 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2A13BD70D7; Mon, 12 Sep 2016 22:07:01 +0000 (UTC) (envelope-from mm@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 mx1.freebsd.org (Postfix) with ESMTPS id 7337689E; Mon, 12 Sep 2016 22:07:01 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CM70Qh029676; Mon, 12 Sep 2016 22:07:00 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CM70Lv029670; Mon, 12 Sep 2016 22:07:00 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201609122207.u8CM70Lv029670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 12 Sep 2016 22:07:00 +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: r305754 - in stable/11: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 22:07:01 -0000 Author: mm Date: Mon Sep 12 22:07:00 2016 New Revision: 305754 URL: https://svnweb.freebsd.org/changeset/base/305754 Log: MFC r305422: Sync libarchive with vendor Vendor issues fixed: PR #777: Multiple bugfixes for setup_acls() This includes a bugfix for a bug that caused ACLs not to be read properly for files and directories inside subdirectories and as a result not being stored or being incorrectly stored in tar archives. Added: stable/11/contrib/libarchive/README.md - copied unchanged from r305422, head/contrib/libarchive/README.md Deleted: stable/11/contrib/libarchive/README Modified: stable/11/contrib/libarchive/libarchive/archive_acl.c stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c stable/11/lib/libarchive/config_freebsd.h Directory Properties: stable/11/ (props changed) Copied: stable/11/contrib/libarchive/README.md (from r305422, head/contrib/libarchive/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/libarchive/README.md Mon Sep 12 22:07:00 2016 (r305754, copy of r305422, head/contrib/libarchive/README.md) @@ -0,0 +1,222 @@ +# Welcome to libarchive! + +The libarchive project develops a portable, efficient C library that +can read and write streaming archives in a variety of formats. It +also includes implementations of the common `tar`, `cpio`, and `zcat` +command-line tools that use the libarchive library. + +## Questions? Issues? + +* http://www.libarchive.org is the home for ongoing + libarchive development, including documentation, + and links to the libarchive mailing lists. +* To report an issue, use the issue tracker at + https://github.com/libarchive/libarchive/issues +* To submit an enhancement to libarchive, please + submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls + +## Contents of the Distribution + +This distribution bundle includes the following major components: + +* **libarchive**: a library for reading and writing streaming archives +* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive +* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality +* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such +* **examples**: Some small example programs that you may find useful. +* **examples/minitar**: a compact sample demonstrating use of libarchive. +* **contrib**: Various items sent to me by third parties; please contact the authors with any questions. + +The top-level directory contains the following information files: + +* **NEWS** - highlights of recent changes +* **COPYING** - what you can do with this +* **INSTALL** - installation instructions +* **README** - this file +* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL +* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`). + +The following files in the top-level directory are used by the 'configure' script: +* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers +* `Makefile.in`, `config.h.in` - templates used by configure script + +## Documentation + +In addition to the informational articles and documentation +in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki), +the distribution also includes a number of manual pages: + + * bsdtar.1 explains the use of the bsdtar program + * bsdcpio.1 explains the use of the bsdcpio program + * bsdcat.1 explains the use of the bsdcat program + * libarchive.3 gives an overview of the library as a whole + * archive_read.3, archive_write.3, archive_write_disk.3, and + archive_read_disk.3 provide detailed calling sequences for the read + and write APIs + * archive_entry.3 details the "struct archive_entry" utility class + * archive_internals.3 provides some insight into libarchive's + internal structure and operation. + * libarchive-formats.5 documents the file formats supported by the library + * cpio.5, mtree.5, and tar.5 provide detailed information about these + popular archive formats, including hard-to-find details about + modern cpio and tar variants. + +The manual pages above are provided in the 'doc' directory in +a number of different formats. + +You should also read the copious comments in `archive.h` and the +source code for the sample programs for more details. Please let us +know about any errors or omissions you find. + +## Supported Formats + +Currently, the library automatically detects and reads the following fomats: + * Old V7 tar archives + * POSIX ustar + * GNU tar format (including GNU long filenames, long link names, and sparse files) + * Solaris 9 extended tar format (including ACLs) + * POSIX pax interchange format + * POSIX octet-oriented cpio + * SVR4 ASCII cpio + * POSIX octet-oriented cpio + * Binary cpio (big-endian or little-endian) + * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) + * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) + * GNU and BSD 'ar' archives + * 'mtree' format + * 7-Zip archives + * Microsoft CAB format + * LHA and LZH archives + * RAR archives (with some limitations due to RAR's proprietary status) + * XAR archives + +The library also detects and handles any of the following before evaluating the archive: + * uuencoded files + * files with RPM wrapper + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +The library can create archives in any of the following formats: + * POSIX ustar + * POSIX pax interchange format + * "restricted" pax format, which will create ustar archives except for + entries that require pax extensions (for long filenames, ACLs, etc). + * Old GNU tar format + * Old V7 tar format + * POSIX octet-oriented cpio + * SVR4 "newc" cpio + * shar archives + * ZIP archives (with uncompressed or "deflate" compressed entries) + * GNU and BSD 'ar' archives + * 'mtree' format + * ISO9660 format + * 7-Zip archives + * XAR archives + +When creating archives, the result can be filtered with any of the following: + * uuencode + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +## Notes about the Library Design + +The following notes address many of the most common +questions we are asked about libarchive: + +* This is a heavily stream-oriented system. That means that + it is optimized to read or write the archive in a single + pass from beginning to end. For example, this allows + libarchive to process archives too large to store on disk + by processing them on-the-fly as they are read from or + written to a network or tape drive. This also makes + libarchive useful for tools that need to produce + archives on-the-fly (such as webservers that provide + archived contents of a users account). + +* In-place modification and random access to the contents + of an archive are not directly supported. For some formats, + this is not an issue: For example, tar.gz archives are not + designed for random access. In some other cases, libarchive + can re-open an archive and scan it from the beginning quickly + enough to provide the needed abilities even without true + random access. Of course, some applications do require true + random access; those applications should consider alternatives + to libarchive. + +* The library is designed to be extended with new compression and + archive formats. The only requirement is that the format be + readable or writable as a stream and that each archive entry be + independent. There are articles on the libarchive Wiki explaining + how to extend libarchive. + +* On read, compression and format are always detected automatically. + +* The same API is used for all formats; in particular, it's very + easy for software using libarchive to transparently handle + any of libarchive's archiving formats. + +* Libarchive's automatic support for decompression can be used + without archiving by explicitly selecting the "raw" and "empty" + formats. + +* I've attempted to minimize static link pollution. If you don't + explicitly invoke a particular feature (such as support for a + particular compression or format), it won't get pulled in to + statically-linked programs. In particular, if you don't explicitly + enable a particular compression or decompression support, you won't + need to link against the corresponding compression or decompression + libraries. This also reduces the size of statically-linked + binaries in environments where that matters. + +* The library is generally _thread safe_ depending on the platform: + it does not define any global variables of its own. However, some + platforms do not provide fully thread-safe versions of key C library + functions. On those platforms, libarchive will use the non-thread-safe + functions. Patches to improve this are of great interest to us. + +* In particular, libarchive's modules to read or write a directory + tree do use `chdir()` to optimize the directory traversals. This + can cause problems for programs that expect to do disk access from + multiple threads. Of course, those modules are completely + optional and you can use the rest of libarchive without them. + +* The library is _not_ thread aware, however. It does no locking + or thread management of any kind. If you create a libarchive + object and need to access it from multiple threads, you will + need to provide your own locking. + +* On read, the library accepts whatever blocks you hand it. + Your read callback is free to pass the library a byte at a time + or mmap the entire archive and give it to the library at once. + On write, the library always produces correctly-blocked output. + +* The object-style approach allows you to have multiple archive streams + open at once. bsdtar uses this in its "@archive" extension. + +* The archive itself is read/written using callback functions. + You can read an archive directly from an in-memory buffer or + write it to a socket, if you wish. There are some utility + functions to provide easy-to-use "open file," etc, capabilities. + +* The read/write APIs are designed to allow individual entries + to be read or written to any data source: You can create + a block of data in memory and add it to a tar archive without + first writing a temporary file. You can also read an entry from + an archive and write the data directly to a socket. If you want + to read/write entries to disk, there are convenience functions to + make this especially easy. + +* Note: The "pax interchange format" is a POSIX standard extended tar + format that should be used when the older _ustar_ format is not + appropriate. It has many advantages over other tar formats + (including the legacy GNU tar format) and is widely supported by + current tar implementations. + Modified: stable/11/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_acl.c Mon Sep 12 19:31:14 2016 (r305753) +++ stable/11/contrib/libarchive/libarchive/archive_acl.c Mon Sep 12 22:07:00 2016 (r305754) @@ -707,10 +707,11 @@ archive_acl_text_l(struct archive_acl *a if (r != 0) return (-1); *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { id = ap->id; - else + } else { id = -1; + } append_entry(&p, NULL, ap->tag, name, ap->permset, id); count++; Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 12 19:31:14 2016 (r305753) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 12 22:07:00 2016 (r305754) @@ -419,12 +419,32 @@ setup_acls(struct archive_read_disk *a, if (accpath == NULL) accpath = archive_entry_pathname(entry); + if (*fd < 0 && a->tree != NULL) { + if (a->follow_symlinks || + archive_entry_filetype(entry) != AE_IFLNK) + *fd = a->open_on_current_dir(a->tree, + accpath, O_RDONLY | O_NONBLOCK); + if (*fd < 0) { + if (a->tree_enter_working_dir(a->tree) != 0) { + archive_set_error(&a->archive, errno, + "Couldn't access %s", accpath); + return (ARCHIVE_FAILED); + } + } + } + archive_entry_acl_clear(entry); + acl = NULL; + #ifdef ACL_TYPE_NFS4 /* Try NFS4 ACL first. */ if (*fd >= 0) +#if HAVE_ACL_GET_FD_NP + acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4); +#else acl = acl_get_fd(*fd); +#endif #if HAVE_ACL_GET_LINK_NP else if (!a->follow_symlinks) acl = acl_get_link_np(accpath, ACL_TYPE_NFS4); @@ -437,12 +457,19 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_NFS4); + #if HAVE_ACL_IS_TRIVIAL_NP - /* Ignore "trivial" ACLs that just mirror the file mode. */ - acl_is_trivial_np(acl, &r); - if (r) { - acl_free(acl); - acl = NULL; + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (r) { + acl_free(acl); + acl = NULL; + /* + * Simultaneous NFSv4 and POSIX.1e ACLs for the same + * entry are not allowed, so we should return here + */ + return (ARCHIVE_OK); + } } #endif if (acl != NULL) { @@ -450,7 +477,7 @@ setup_acls(struct archive_read_disk *a, acl_free(acl); return (ARCHIVE_OK); } -#endif +#endif /* ACL_TYPE_NFS4 */ /* Retrieve access ACL from file. */ if (*fd >= 0) @@ -467,10 +494,22 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_ACCESS); + +#if HAVE_ACL_IS_TRIVIAL_NP + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + if (r) { + acl_free(acl); + acl = NULL; + } + } +#endif + if (acl != NULL) { translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); acl_free(acl); + acl = NULL; } /* Only directories can have default ACLs. */ Modified: stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 12 19:31:14 2016 (r305753) +++ stable/11/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 12 22:07:00 2016 (r305754) @@ -1504,10 +1504,19 @@ setup_current_filesystem(struct archive_ struct tree *t = a->tree; struct statfs sfs; #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC) -# if defined(HAVE_STRUCT_VFSCONF) - struct vfsconf vfc; -# else +/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make + * this accurate; some platforms have both and we need the one that's + * used by getvfsbyname() + * + * Then the following would become: + * #if defined(GETVFSBYNAME_ARG_TYPE) + * GETVFSBYNAME_ARG_TYPE vfc; + * #endif + */ +# if defined(HAVE_STRUCT_XVFSCONF) struct xvfsconf vfc; +# else + struct vfsconf vfc; # endif #endif int r, xr = 0; Modified: stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 12 19:31:14 2016 (r305753) +++ stable/11/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 12 22:07:00 2016 (r305754) @@ -70,15 +70,9 @@ set_acls(struct archive_entry *ae, struc } static int -acl_match(acl_entry_t aclent, struct myacl_t *myacl) -{ - gid_t g, *gp; - uid_t u, *up; - acl_tag_t tag_type; - acl_permset_t opaque_ps; +acl_entry_get_perm(acl_entry_t aclent) { int permset = 0; - - acl_get_tag_type(aclent, &tag_type); + acl_permset_t opaque_ps; /* translate the silly opaque permset to a bitmap */ acl_get_permset(aclent, &opaque_ps); @@ -88,10 +82,61 @@ acl_match(acl_entry_t aclent, struct mya permset |= ARCHIVE_ENTRY_ACL_WRITE; if (acl_get_perm_np(opaque_ps, ACL_READ)) permset |= ARCHIVE_ENTRY_ACL_READ; + return permset; +} + +#if 0 +static int +acl_get_specific_entry(acl_t acl, acl_tag_t requested_tag_type, int requested_tag) { + int entry_id = ACL_FIRST_ENTRY; + acl_entry_t acl_entry; + acl_tag_t acl_tag_type; + + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* If this matches, return perm mask */ + acl_get_tag_type(acl_entry, &acl_tag_type); + if (acl_tag_type == requested_tag_type) { + switch (acl_tag_type) { + case ACL_USER_OBJ: + if ((uid_t)requested_tag == *(uid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_GROUP_OBJ: + if ((gid_t)requested_tag == *(gid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_USER: + case ACL_GROUP: + case ACL_OTHER: + return acl_entry_get_perm(acl_entry); + default: + failure("Unexpected ACL tag type"); + assert(0); + } + } + - if (permset != myacl->permset) + } + return -1; +} +#endif + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + gid_t g, *gp; + uid_t u, *up; + acl_tag_t tag_type; + + if (myacl->permset != acl_entry_get_perm(aclent)) return (0); + acl_get_tag_type(aclent, &tag_type); switch (tag_type) { case ACL_USER_OBJ: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); @@ -190,7 +235,7 @@ compare_acls(acl_t acl, struct myacl_t * * Verify ACL restore-to-disk. This test is FreeBSD-specific. */ -DEFINE_TEST(test_acl_freebsd_posix1e) +DEFINE_TEST(test_acl_freebsd_posix1e_restore) { #if !defined(__FreeBSD__) skipping("FreeBSD-specific ACL restore test"); @@ -263,3 +308,111 @@ DEFINE_TEST(test_acl_freebsd_posix1e) acl_free(acl); #endif } + +/* + * Verify ACL reaed-from-disk. This test is FreeBSD-specific. + */ +DEFINE_TEST(test_acl_freebsd_posix1e_read) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL read test"); +#elif __FreeBSD__ < 5 + skipping("ACL read supported only on FreeBSD 5.0 and later"); +#else + struct archive *a; + struct archive_entry *ae; + int n, fd; + const char *acl1_text, *acl2_text; + acl_t acl1, acl2; + + /* + * Manually construct a directory and two files with + * different ACLs. This also serves to verify that ACLs + * are supported on the local filesystem. + */ + + /* Create a test file f1 with acl1 */ + acl1_text = "user::rwx,group::rwx,other::rwx,user:1:rw-,group:15:r-x,mask::rwx"; + acl1 = acl_from_text(acl1_text); + assert((void *)acl1 != NULL); + fd = open("f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl1); + return; + } + n = acl_set_fd(fd, acl1); + acl_free(acl1); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + assertMakeDir("d", 0700); + + /* + * Create file d/f1 with acl2 + * + * This differs from acl1 in the u:1: and g:15: permissions. + * + * This file deliberately has the same name but a different ACL. + * Github Issue #777 explains how libarchive's directory traversal + * did not always correctly enter directories before attempting + * to read ACLs, resulting in reading the ACL from a like-named + * file in the wrong directory. + */ + acl2_text = "user::rwx,group::rwx,other::---,user:1:r--,group:15:r--,mask::rwx"; + acl2 = acl_from_text(acl2_text); + assert((void *)acl2 != NULL); + fd = open("d/f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl2); + return; + } + n = acl_set_fd(fd, acl2); + acl_free(acl2); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + /* Create a read-from-disk object. */ + assert(NULL != (a = archive_read_disk_new())); + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, ".")); + assert(NULL != (ae = archive_entry_new())); + + /* Walk the dir until we see both of the files */ + while (ARCHIVE_OK == archive_read_next_header2(a, ae)) { + archive_read_disk_descend(a); + if (strcmp(archive_entry_pathname(ae), "./f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl1_text); + + } else if (strcmp(archive_entry_pathname(ae), "./d/f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl2_text); + } + } + + archive_free(a); +#endif +} Modified: stable/11/lib/libarchive/config_freebsd.h ============================================================================== --- stable/11/lib/libarchive/config_freebsd.h Mon Sep 12 19:31:14 2016 (r305753) +++ stable/11/lib/libarchive/config_freebsd.h Mon Sep 12 22:07:00 2016 (r305754) @@ -30,6 +30,7 @@ /* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_FD_NP 1 #define HAVE_ACL_GET_LINK_NP 1 #define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 @@ -45,6 +46,7 @@ #define HAVE_EXTATTR_LIST_FILE 1 #define HAVE_EXTATTR_SET_FD 1 #define HAVE_EXTATTR_SET_FILE 1 +#define HAVE_STRUCT_XVFSCONF 1 #define HAVE_SYS_ACL_H 1 #define HAVE_SYS_EXTATTR_H 1 #endif From owner-svn-src-stable@freebsd.org Mon Sep 12 22:07:37 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50AACBD713B; Mon, 12 Sep 2016 22:07:37 +0000 (UTC) (envelope-from mm@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 mx1.freebsd.org (Postfix) with ESMTPS id 21B7B9ED; Mon, 12 Sep 2016 22:07:37 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8CM7aSL029754; Mon, 12 Sep 2016 22:07:36 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8CM7ZaV029748; Mon, 12 Sep 2016 22:07:35 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201609122207.u8CM7ZaV029748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Mon, 12 Sep 2016 22:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305755 - in stable/10: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2016 22:07:37 -0000 Author: mm Date: Mon Sep 12 22:07:35 2016 New Revision: 305755 URL: https://svnweb.freebsd.org/changeset/base/305755 Log: MFC r305422: Sync libarchive with vendor Vendor issues fixed: PR #777: Multiple bugfixes for setup_acls() This includes a bugfix for a bug that caused ACLs not to be read properly for files and directories inside subdirectories and as a result not being stored or being incorrectly stored in tar archives. Added: stable/10/contrib/libarchive/README.md - copied unchanged from r305422, head/contrib/libarchive/README.md Deleted: stable/10/contrib/libarchive/README Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c stable/10/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c stable/10/lib/libarchive/config_freebsd.h Directory Properties: stable/10/ (props changed) Copied: stable/10/contrib/libarchive/README.md (from r305422, head/contrib/libarchive/README.md) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/README.md Mon Sep 12 22:07:35 2016 (r305755, copy of r305422, head/contrib/libarchive/README.md) @@ -0,0 +1,222 @@ +# Welcome to libarchive! + +The libarchive project develops a portable, efficient C library that +can read and write streaming archives in a variety of formats. It +also includes implementations of the common `tar`, `cpio`, and `zcat` +command-line tools that use the libarchive library. + +## Questions? Issues? + +* http://www.libarchive.org is the home for ongoing + libarchive development, including documentation, + and links to the libarchive mailing lists. +* To report an issue, use the issue tracker at + https://github.com/libarchive/libarchive/issues +* To submit an enhancement to libarchive, please + submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls + +## Contents of the Distribution + +This distribution bundle includes the following major components: + +* **libarchive**: a library for reading and writing streaming archives +* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive +* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality +* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such +* **examples**: Some small example programs that you may find useful. +* **examples/minitar**: a compact sample demonstrating use of libarchive. +* **contrib**: Various items sent to me by third parties; please contact the authors with any questions. + +The top-level directory contains the following information files: + +* **NEWS** - highlights of recent changes +* **COPYING** - what you can do with this +* **INSTALL** - installation instructions +* **README** - this file +* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL +* **configure** - configuration script, see INSTALL for details. If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`). + +The following files in the top-level directory are used by the 'configure' script: +* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers +* `Makefile.in`, `config.h.in` - templates used by configure script + +## Documentation + +In addition to the informational articles and documentation +in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki), +the distribution also includes a number of manual pages: + + * bsdtar.1 explains the use of the bsdtar program + * bsdcpio.1 explains the use of the bsdcpio program + * bsdcat.1 explains the use of the bsdcat program + * libarchive.3 gives an overview of the library as a whole + * archive_read.3, archive_write.3, archive_write_disk.3, and + archive_read_disk.3 provide detailed calling sequences for the read + and write APIs + * archive_entry.3 details the "struct archive_entry" utility class + * archive_internals.3 provides some insight into libarchive's + internal structure and operation. + * libarchive-formats.5 documents the file formats supported by the library + * cpio.5, mtree.5, and tar.5 provide detailed information about these + popular archive formats, including hard-to-find details about + modern cpio and tar variants. + +The manual pages above are provided in the 'doc' directory in +a number of different formats. + +You should also read the copious comments in `archive.h` and the +source code for the sample programs for more details. Please let us +know about any errors or omissions you find. + +## Supported Formats + +Currently, the library automatically detects and reads the following fomats: + * Old V7 tar archives + * POSIX ustar + * GNU tar format (including GNU long filenames, long link names, and sparse files) + * Solaris 9 extended tar format (including ACLs) + * POSIX pax interchange format + * POSIX octet-oriented cpio + * SVR4 ASCII cpio + * POSIX octet-oriented cpio + * Binary cpio (big-endian or little-endian) + * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) + * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) + * GNU and BSD 'ar' archives + * 'mtree' format + * 7-Zip archives + * Microsoft CAB format + * LHA and LZH archives + * RAR archives (with some limitations due to RAR's proprietary status) + * XAR archives + +The library also detects and handles any of the following before evaluating the archive: + * uuencoded files + * files with RPM wrapper + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +The library can create archives in any of the following formats: + * POSIX ustar + * POSIX pax interchange format + * "restricted" pax format, which will create ustar archives except for + entries that require pax extensions (for long filenames, ACLs, etc). + * Old GNU tar format + * Old V7 tar format + * POSIX octet-oriented cpio + * SVR4 "newc" cpio + * shar archives + * ZIP archives (with uncompressed or "deflate" compressed entries) + * GNU and BSD 'ar' archives + * 'mtree' format + * ISO9660 format + * 7-Zip archives + * XAR archives + +When creating archives, the result can be filtered with any of the following: + * uuencode + * gzip compression + * bzip2 compression + * compress/LZW compression + * lzma, lzip, and xz compression + * lz4 compression + * lzop compression + +## Notes about the Library Design + +The following notes address many of the most common +questions we are asked about libarchive: + +* This is a heavily stream-oriented system. That means that + it is optimized to read or write the archive in a single + pass from beginning to end. For example, this allows + libarchive to process archives too large to store on disk + by processing them on-the-fly as they are read from or + written to a network or tape drive. This also makes + libarchive useful for tools that need to produce + archives on-the-fly (such as webservers that provide + archived contents of a users account). + +* In-place modification and random access to the contents + of an archive are not directly supported. For some formats, + this is not an issue: For example, tar.gz archives are not + designed for random access. In some other cases, libarchive + can re-open an archive and scan it from the beginning quickly + enough to provide the needed abilities even without true + random access. Of course, some applications do require true + random access; those applications should consider alternatives + to libarchive. + +* The library is designed to be extended with new compression and + archive formats. The only requirement is that the format be + readable or writable as a stream and that each archive entry be + independent. There are articles on the libarchive Wiki explaining + how to extend libarchive. + +* On read, compression and format are always detected automatically. + +* The same API is used for all formats; in particular, it's very + easy for software using libarchive to transparently handle + any of libarchive's archiving formats. + +* Libarchive's automatic support for decompression can be used + without archiving by explicitly selecting the "raw" and "empty" + formats. + +* I've attempted to minimize static link pollution. If you don't + explicitly invoke a particular feature (such as support for a + particular compression or format), it won't get pulled in to + statically-linked programs. In particular, if you don't explicitly + enable a particular compression or decompression support, you won't + need to link against the corresponding compression or decompression + libraries. This also reduces the size of statically-linked + binaries in environments where that matters. + +* The library is generally _thread safe_ depending on the platform: + it does not define any global variables of its own. However, some + platforms do not provide fully thread-safe versions of key C library + functions. On those platforms, libarchive will use the non-thread-safe + functions. Patches to improve this are of great interest to us. + +* In particular, libarchive's modules to read or write a directory + tree do use `chdir()` to optimize the directory traversals. This + can cause problems for programs that expect to do disk access from + multiple threads. Of course, those modules are completely + optional and you can use the rest of libarchive without them. + +* The library is _not_ thread aware, however. It does no locking + or thread management of any kind. If you create a libarchive + object and need to access it from multiple threads, you will + need to provide your own locking. + +* On read, the library accepts whatever blocks you hand it. + Your read callback is free to pass the library a byte at a time + or mmap the entire archive and give it to the library at once. + On write, the library always produces correctly-blocked output. + +* The object-style approach allows you to have multiple archive streams + open at once. bsdtar uses this in its "@archive" extension. + +* The archive itself is read/written using callback functions. + You can read an archive directly from an in-memory buffer or + write it to a socket, if you wish. There are some utility + functions to provide easy-to-use "open file," etc, capabilities. + +* The read/write APIs are designed to allow individual entries + to be read or written to any data source: You can create + a block of data in memory and add it to a tar archive without + first writing a temporary file. You can also read an entry from + an archive and write the data directly to a socket. If you want + to read/write entries to disk, there are convenience functions to + make this especially easy. + +* Note: The "pax interchange format" is a POSIX standard extended tar + format that should be used when the older _ustar_ format is not + appropriate. It has many advantages over other tar formats + (including the legacy GNU tar format) and is widely supported by + current tar implementations. + Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_acl.c Mon Sep 12 22:07:00 2016 (r305754) +++ stable/10/contrib/libarchive/libarchive/archive_acl.c Mon Sep 12 22:07:35 2016 (r305755) @@ -707,10 +707,11 @@ archive_acl_text_l(struct archive_acl *a if (r != 0) return (-1); *p++ = separator; - if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) + if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) { id = ap->id; - else + } else { id = -1; + } append_entry(&p, NULL, ap->tag, name, ap->permset, id); count++; Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 12 22:07:00 2016 (r305754) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Mon Sep 12 22:07:35 2016 (r305755) @@ -419,12 +419,32 @@ setup_acls(struct archive_read_disk *a, if (accpath == NULL) accpath = archive_entry_pathname(entry); + if (*fd < 0 && a->tree != NULL) { + if (a->follow_symlinks || + archive_entry_filetype(entry) != AE_IFLNK) + *fd = a->open_on_current_dir(a->tree, + accpath, O_RDONLY | O_NONBLOCK); + if (*fd < 0) { + if (a->tree_enter_working_dir(a->tree) != 0) { + archive_set_error(&a->archive, errno, + "Couldn't access %s", accpath); + return (ARCHIVE_FAILED); + } + } + } + archive_entry_acl_clear(entry); + acl = NULL; + #ifdef ACL_TYPE_NFS4 /* Try NFS4 ACL first. */ if (*fd >= 0) +#if HAVE_ACL_GET_FD_NP + acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4); +#else acl = acl_get_fd(*fd); +#endif #if HAVE_ACL_GET_LINK_NP else if (!a->follow_symlinks) acl = acl_get_link_np(accpath, ACL_TYPE_NFS4); @@ -437,12 +457,19 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_NFS4); + #if HAVE_ACL_IS_TRIVIAL_NP - /* Ignore "trivial" ACLs that just mirror the file mode. */ - acl_is_trivial_np(acl, &r); - if (r) { - acl_free(acl); - acl = NULL; + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (r) { + acl_free(acl); + acl = NULL; + /* + * Simultaneous NFSv4 and POSIX.1e ACLs for the same + * entry are not allowed, so we should return here + */ + return (ARCHIVE_OK); + } } #endif if (acl != NULL) { @@ -450,7 +477,7 @@ setup_acls(struct archive_read_disk *a, acl_free(acl); return (ARCHIVE_OK); } -#endif +#endif /* ACL_TYPE_NFS4 */ /* Retrieve access ACL from file. */ if (*fd >= 0) @@ -467,10 +494,22 @@ setup_acls(struct archive_read_disk *a, #endif else acl = acl_get_file(accpath, ACL_TYPE_ACCESS); + +#if HAVE_ACL_IS_TRIVIAL_NP + /* Ignore "trivial" ACLs that just mirror the file mode. */ + if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) { + if (r) { + acl_free(acl); + acl = NULL; + } + } +#endif + if (acl != NULL) { translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS); acl_free(acl); + acl = NULL; } /* Only directories can have default ACLs. */ Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 12 22:07:00 2016 (r305754) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Mon Sep 12 22:07:35 2016 (r305755) @@ -1504,10 +1504,19 @@ setup_current_filesystem(struct archive_ struct tree *t = a->tree; struct statfs sfs; #if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC) -# if defined(HAVE_STRUCT_VFSCONF) - struct vfsconf vfc; -# else +/* TODO: configure should set GETVFSBYNAME_ARG_TYPE to make + * this accurate; some platforms have both and we need the one that's + * used by getvfsbyname() + * + * Then the following would become: + * #if defined(GETVFSBYNAME_ARG_TYPE) + * GETVFSBYNAME_ARG_TYPE vfc; + * #endif + */ +# if defined(HAVE_STRUCT_XVFSCONF) struct xvfsconf vfc; +# else + struct vfsconf vfc; # endif #endif int r, xr = 0; Modified: stable/10/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 12 22:07:00 2016 (r305754) +++ stable/10/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c Mon Sep 12 22:07:35 2016 (r305755) @@ -70,15 +70,9 @@ set_acls(struct archive_entry *ae, struc } static int -acl_match(acl_entry_t aclent, struct myacl_t *myacl) -{ - gid_t g, *gp; - uid_t u, *up; - acl_tag_t tag_type; - acl_permset_t opaque_ps; +acl_entry_get_perm(acl_entry_t aclent) { int permset = 0; - - acl_get_tag_type(aclent, &tag_type); + acl_permset_t opaque_ps; /* translate the silly opaque permset to a bitmap */ acl_get_permset(aclent, &opaque_ps); @@ -88,10 +82,61 @@ acl_match(acl_entry_t aclent, struct mya permset |= ARCHIVE_ENTRY_ACL_WRITE; if (acl_get_perm_np(opaque_ps, ACL_READ)) permset |= ARCHIVE_ENTRY_ACL_READ; + return permset; +} + +#if 0 +static int +acl_get_specific_entry(acl_t acl, acl_tag_t requested_tag_type, int requested_tag) { + int entry_id = ACL_FIRST_ENTRY; + acl_entry_t acl_entry; + acl_tag_t acl_tag_type; + + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* If this matches, return perm mask */ + acl_get_tag_type(acl_entry, &acl_tag_type); + if (acl_tag_type == requested_tag_type) { + switch (acl_tag_type) { + case ACL_USER_OBJ: + if ((uid_t)requested_tag == *(uid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_GROUP_OBJ: + if ((gid_t)requested_tag == *(gid_t *)(acl_get_qualifier(acl_entry))) { + return acl_entry_get_perm(acl_entry); + } + break; + case ACL_USER: + case ACL_GROUP: + case ACL_OTHER: + return acl_entry_get_perm(acl_entry); + default: + failure("Unexpected ACL tag type"); + assert(0); + } + } + - if (permset != myacl->permset) + } + return -1; +} +#endif + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + gid_t g, *gp; + uid_t u, *up; + acl_tag_t tag_type; + + if (myacl->permset != acl_entry_get_perm(aclent)) return (0); + acl_get_tag_type(aclent, &tag_type); switch (tag_type) { case ACL_USER_OBJ: if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); @@ -190,7 +235,7 @@ compare_acls(acl_t acl, struct myacl_t * * Verify ACL restore-to-disk. This test is FreeBSD-specific. */ -DEFINE_TEST(test_acl_freebsd_posix1e) +DEFINE_TEST(test_acl_freebsd_posix1e_restore) { #if !defined(__FreeBSD__) skipping("FreeBSD-specific ACL restore test"); @@ -263,3 +308,111 @@ DEFINE_TEST(test_acl_freebsd_posix1e) acl_free(acl); #endif } + +/* + * Verify ACL reaed-from-disk. This test is FreeBSD-specific. + */ +DEFINE_TEST(test_acl_freebsd_posix1e_read) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL read test"); +#elif __FreeBSD__ < 5 + skipping("ACL read supported only on FreeBSD 5.0 and later"); +#else + struct archive *a; + struct archive_entry *ae; + int n, fd; + const char *acl1_text, *acl2_text; + acl_t acl1, acl2; + + /* + * Manually construct a directory and two files with + * different ACLs. This also serves to verify that ACLs + * are supported on the local filesystem. + */ + + /* Create a test file f1 with acl1 */ + acl1_text = "user::rwx,group::rwx,other::rwx,user:1:rw-,group:15:r-x,mask::rwx"; + acl1 = acl_from_text(acl1_text); + assert((void *)acl1 != NULL); + fd = open("f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl1); + return; + } + n = acl_set_fd(fd, acl1); + acl_free(acl1); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + assertMakeDir("d", 0700); + + /* + * Create file d/f1 with acl2 + * + * This differs from acl1 in the u:1: and g:15: permissions. + * + * This file deliberately has the same name but a different ACL. + * Github Issue #777 explains how libarchive's directory traversal + * did not always correctly enter directories before attempting + * to read ACLs, resulting in reading the ACL from a like-named + * file in the wrong directory. + */ + acl2_text = "user::rwx,group::rwx,other::---,user:1:r--,group:15:r--,mask::rwx"; + acl2 = acl_from_text(acl2_text); + assert((void *)acl2 != NULL); + fd = open("d/f1", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + if (!assert(fd >= 0)) { + acl_free(acl2); + return; + } + n = acl_set_fd(fd, acl2); + acl_free(acl2); + if (n != 0 && errno == EOPNOTSUPP) { + close(fd); + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + if (n != 0 && errno == EINVAL) { + close(fd); + skipping("This filesystem does not support POSIX.1e ACLs"); + return; + } + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + + /* Create a read-from-disk object. */ + assert(NULL != (a = archive_read_disk_new())); + assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, ".")); + assert(NULL != (ae = archive_entry_new())); + + /* Walk the dir until we see both of the files */ + while (ARCHIVE_OK == archive_read_next_header2(a, ae)) { + archive_read_disk_descend(a); + if (strcmp(archive_entry_pathname(ae), "./f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl1_text); + + } else if (strcmp(archive_entry_pathname(ae), "./d/f1") == 0) { + assertEqualString(archive_entry_acl_text(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), acl2_text); + } + } + + archive_free(a); +#endif +} Modified: stable/10/lib/libarchive/config_freebsd.h ============================================================================== --- stable/10/lib/libarchive/config_freebsd.h Mon Sep 12 22:07:00 2016 (r305754) +++ stable/10/lib/libarchive/config_freebsd.h Mon Sep 12 22:07:35 2016 (r305755) @@ -28,6 +28,7 @@ /* FreeBSD 5.0 and later have ACL and extattr support. */ #if __FreeBSD__ > 4 #define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_FD_NP 1 #define HAVE_ACL_GET_LINK_NP 1 #define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ACL_INIT 1 @@ -43,6 +44,7 @@ #define HAVE_EXTATTR_LIST_FILE 1 #define HAVE_EXTATTR_SET_FD 1 #define HAVE_EXTATTR_SET_FILE 1 +#define HAVE_STRUCT_XVFSCONF 1 #define HAVE_SYS_ACL_H 1 #define HAVE_SYS_EXTATTR_H 1 #endif From owner-svn-src-stable@freebsd.org Tue Sep 13 05:22:09 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2938BD831D; Tue, 13 Sep 2016 05:22:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE490BF1; Tue, 13 Sep 2016 05:22:09 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8D5M8nc095171; Tue, 13 Sep 2016 05:22:08 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8D5M8Md095170; Tue, 13 Sep 2016 05:22:08 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201609130522.u8D5M8Md095170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Tue, 13 Sep 2016 05:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305759 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 05:22:10 -0000 Author: lwhsu (ports committer) Date: Tue Sep 13 05:22:08 2016 New Revision: 305759 URL: https://svnweb.freebsd.org/changeset/base/305759 Log: MFC r303935 Only remove empty directories before packaging. This preserves files are intentionally empty, most of them are in tests.txz Reviewed by: bdrewery Modified: stable/10/Makefile.inc1 Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Tue Sep 13 02:18:29 2016 (r305758) +++ stable/10/Makefile.inc1 Tue Sep 13 05:22:08 2016 (r305759) @@ -882,7 +882,7 @@ distributeworld installworld: _installch ${IMAKEENV} rm -rf ${INSTALLTMP} .if make(distributeworld) .for dist in ${EXTRA_DISTRIBUTIONS} - find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete + find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -type d -empty -delete .endfor .if defined(NO_ROOT) .for dist in base ${EXTRA_DISTRIBUTIONS} From owner-svn-src-stable@freebsd.org Tue Sep 13 05:48:00 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84DCDBD8A1B; Tue, 13 Sep 2016 05:48:00 +0000 (UTC) (envelope-from avos@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 mx1.freebsd.org (Postfix) with ESMTPS id 464E0BE3; Tue, 13 Sep 2016 05:48:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8D5lxB3003240; Tue, 13 Sep 2016 05:47:59 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8D5lxE5003238; Tue, 13 Sep 2016 05:47:59 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609130547.u8D5lxE5003238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 13 Sep 2016 05:47:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305762 - stable/11/sys/dev/iwm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 05:48:00 -0000 Author: avos Date: Tue Sep 13 05:47:59 2016 New Revision: 305762 URL: https://svnweb.freebsd.org/changeset/base/305762 Log: MFC r305470: iwm: fix scanning for hidden SSIDs. Setup SSIDs in scan command so firmware will send direct probe request(s) while scanning. Tested by: dbkirk@gmail.com PR: 211519 Modified: stable/11/sys/dev/iwm/if_iwm_scan.c stable/11/sys/dev/iwm/if_iwmreg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iwm/if_iwm_scan.c ============================================================================== --- stable/11/sys/dev/iwm/if_iwm_scan.c Tue Sep 13 05:41:13 2016 (r305761) +++ stable/11/sys/dev/iwm/if_iwm_scan.c Tue Sep 13 05:47:59 2016 (r305762) @@ -265,6 +265,7 @@ iwm_mvm_lmac_scan_fill_channels(struct i struct iwm_scan_channel_cfg_lmac *chan, int n_ssids) { struct ieee80211com *ic = &sc->sc_ic; + struct ieee80211_scan_state *ss = ic->ic_scan; struct ieee80211_channel *c; uint8_t nchan; int j; @@ -292,10 +293,11 @@ iwm_mvm_lmac_scan_fill_channels(struct i chan->iter_count = htole16(1); chan->iter_interval = htole32(0); chan->flags = htole32(IWM_UNIFIED_SCAN_CHANNEL_PARTIAL); -#if 0 /* makes scanning while associated less useful */ - if (n_ssids != 0) - chan->flags |= htole32(1 << 1); /* select SSID 0 */ -#endif + chan->flags |= htole32(IWM_SCAN_CHANNEL_NSSIDS(n_ssids)); + /* XXX IEEE80211_SCAN_NOBCAST flag is never set. */ + if (!IEEE80211_IS_CHAN_PASSIVE(c) && + (!(ss->ss_flags & IEEE80211_SCAN_NOBCAST) || n_ssids != 0)) + chan->flags |= htole32(IWM_SCAN_CHANNEL_TYPE_ACTIVE); chan++; nchan++; } @@ -334,11 +336,7 @@ iwm_mvm_umac_scan_fill_channels(struct i chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0); chan->iter_count = 1; chan->iter_interval = htole16(0); - chan->flags = htole32(0); -#if 0 /* makes scanning while associated less useful */ - if (n_ssids != 0) - chan->flags = htole32(1 << 0); /* select SSID 0 */ -#endif + chan->flags = htole32(IWM_SCAN_CHANNEL_UMAC_NSSIDS(n_ssids)); chan++; nchan++; } @@ -355,13 +353,11 @@ iwm_mvm_fill_probe_req(struct iwm_softc struct ieee80211_rateset *rs; size_t remain = sizeof(preq->buf); uint8_t *frm, *pos; - int ssid_len = 0; - const uint8_t *ssid = NULL; memset(preq, 0, sizeof(*preq)); /* Ensure enough space for header and SSID IE. */ - if (remain < sizeof(*wh) + 2 + ssid_len) + if (remain < sizeof(*wh) + 2) return ENOBUFS; /* @@ -378,7 +374,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc *(uint16_t *)&wh->i_seq[0] = 0; /* filled by HW */ frm = (uint8_t *)(wh + 1); - frm = ieee80211_add_ssid(frm, ssid, ssid_len); + frm = ieee80211_add_ssid(frm, NULL, 0); /* Tell the firmware where the MAC header is. */ preq->mac_header.offset = 0; @@ -544,11 +540,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) .data = { NULL, }, .flags = IWM_CMD_SYNC, }; + struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; struct iwm_scan_req_umac *req; struct iwm_scan_req_umac_tail *tail; size_t req_len; - int ssid_len = 0; - const uint8_t *ssid = NULL; + uint8_t i, nssid; int ret; req_len = sizeof(struct iwm_scan_req_umac) + @@ -577,8 +573,9 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH); req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH); + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); req->n_channels = iwm_mvm_umac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_umac *)req->data, ssid_len != 0); + (struct iwm_scan_channel_cfg_umac *)req->data, nssid); req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL | IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE | @@ -589,15 +586,19 @@ iwm_mvm_umac_scan(struct iwm_softc *sc) sc->sc_capa_n_scan_channels); /* Check if we're doing an active directed scan. */ - if (ssid_len != 0) { - tail->direct_scan[0].id = IEEE80211_ELEMID_SSID; - tail->direct_scan[0].len = ssid_len; - memcpy(tail->direct_scan[0].ssid, ssid, ssid_len); + for (i = 0; i < nssid; i++) { + tail->direct_scan[i].id = IEEE80211_ELEMID_SSID; + tail->direct_scan[i].len = MIN(ss->ss_ssid[i].len, + IEEE80211_NWID_LEN); + memcpy(tail->direct_scan[i].ssid, ss->ss_ssid[i].ssid, + tail->direct_scan[i].len); + /* XXX debug */ + } + if (nssid != 0) { req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT); - } else { + } else req->general_flags |= htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE); - } if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) @@ -631,11 +632,11 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) .data = { NULL, }, .flags = IWM_CMD_SYNC, }; + struct ieee80211_scan_state *ss = sc->sc_ic.ic_scan; struct iwm_scan_req_lmac *req; size_t req_len; + uint8_t i, nssid; int ret; - int ssid_len = 0; - const uint8_t *ssid = NULL; IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n"); @@ -668,11 +669,6 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL | IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE | IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL); - if (ssid_len == 0) - req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); - else - req->scan_flags |= - htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED); @@ -698,15 +694,23 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc) req->tx_cmd[1].sta_id = sc->sc_aux_sta.sta_id; /* Check if we're doing an active directed scan. */ - if (ssid_len != 0) { - req->direct_scan[0].id = IEEE80211_ELEMID_SSID; - req->direct_scan[0].len = ssid_len; - memcpy(req->direct_scan[0].ssid, ssid, ssid_len); + nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX); + for (i = 0; i < nssid; i++) { + req->direct_scan[i].id = IEEE80211_ELEMID_SSID; + req->direct_scan[i].len = MIN(ss->ss_ssid[i].len, + IEEE80211_NWID_LEN); + memcpy(req->direct_scan[i].ssid, ss->ss_ssid[i].ssid, + req->direct_scan[i].len); + /* XXX debug */ } + if (nssid != 0) { + req->scan_flags |= + htole32(IWM_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION); + } else + req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAG_PASSIVE); req->n_channels = iwm_mvm_lmac_scan_fill_channels(sc, - (struct iwm_scan_channel_cfg_lmac *)req->data, - ssid_len != 0); + (struct iwm_scan_channel_cfg_lmac *)req->data, nssid); ret = iwm_mvm_fill_probe_req(sc, (struct iwm_scan_probe_req *)(req->data + Modified: stable/11/sys/dev/iwm/if_iwmreg.h ============================================================================== --- stable/11/sys/dev/iwm/if_iwmreg.h Tue Sep 13 05:41:13 2016 (r305761) +++ stable/11/sys/dev/iwm/if_iwmreg.h Tue Sep 13 05:47:59 2016 (r305762) @@ -4766,6 +4766,7 @@ struct iwm_scd_txq_cfg_rsp { /* Masks for iwm_scan_channel.type flags */ #define IWM_SCAN_CHANNEL_TYPE_ACTIVE (1 << 0) +#define IWM_SCAN_CHANNEL_NSSIDS(x) (((1 << (x)) - 1) << 1) #define IWM_SCAN_CHANNEL_NARROW_BAND (1 << 22) /* Max number of IEs for direct SSID scans in a command */ @@ -5580,6 +5581,8 @@ enum iwm_umac_scan_general_flags { */ struct iwm_scan_channel_cfg_umac { uint32_t flags; +#define IWM_SCAN_CHANNEL_UMAC_NSSIDS(x) ((1 << (x)) - 1) + uint8_t channel_num; uint8_t iter_count; uint16_t iter_interval; From owner-svn-src-stable@freebsd.org Tue Sep 13 07:15:40 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D67FBD8466; Tue, 13 Sep 2016 07:15:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3D6C9AF; Tue, 13 Sep 2016 07:15:39 +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 u8D7Fd5F036691; Tue, 13 Sep 2016 07:15:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8D7FdBV036690; Tue, 13 Sep 2016 07:15:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609130715.u8D7FdBV036690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 13 Sep 2016 07:15:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305764 - stable/11/sys/cddl/compat/opensolaris/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 07:15:40 -0000 Author: mav Date: Tue Sep 13 07:15:39 2016 New Revision: 305764 URL: https://svnweb.freebsd.org/changeset/base/305764 Log: MFC r305679: Switch random_get_pseudo_bytes() shim to arc4rand(). Our shim for Solaris random_get_bytes() uses read_random(), that looks reasonable, since it guaranties reliably seeded random data. On the other side Solaris random_get_pseudo_bytes() does not provide this guarantie, and its original Solaris implementation is equivalent to our arc4rand(), using software crypto without stressing slower hardware RNG. Modified: stable/11/sys/cddl/compat/opensolaris/sys/random.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/compat/opensolaris/sys/random.h ============================================================================== --- stable/11/sys/cddl/compat/opensolaris/sys/random.h Tue Sep 13 05:54:31 2016 (r305763) +++ stable/11/sys/cddl/compat/opensolaris/sys/random.h Tue Sep 13 07:15:39 2016 (r305764) @@ -32,6 +32,6 @@ #include_next #define random_get_bytes(p, s) read_random((p), (int)(s)) -#define random_get_pseudo_bytes(p, s) read_random((p), (int)(s)) +#define random_get_pseudo_bytes(p, s) arc4rand((p), (int)(s), 0) #endif /* !_OPENSOLARIS_SYS_RANDOM_H_ */ From owner-svn-src-stable@freebsd.org Tue Sep 13 09:25:39 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 384FBBD70D0; Tue, 13 Sep 2016 09:25:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0A9A17DE; Tue, 13 Sep 2016 09:25:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8D9Pcld086442; Tue, 13 Sep 2016 09:25:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8D9PcHB086441; Tue, 13 Sep 2016 09:25:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609130925.u8D9PcHB086441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 13 Sep 2016 09:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305765 - stable/10/sys/cddl/compat/opensolaris/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 09:25:39 -0000 Author: mav Date: Tue Sep 13 09:25:38 2016 New Revision: 305765 URL: https://svnweb.freebsd.org/changeset/base/305765 Log: MFC r305679: Switch random_get_pseudo_bytes() shim to arc4rand(). Our shim for Solaris random_get_bytes() uses read_random(), that looks reasonable, since it guaranties reliably seeded random data. On the other side Solaris random_get_pseudo_bytes() does not provide this guarantie, and its original Solaris implementation is equivalent to our arc4rand(), using software crypto without stressing slower hardware RNG. Modified: stable/10/sys/cddl/compat/opensolaris/sys/random.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/compat/opensolaris/sys/random.h ============================================================================== --- stable/10/sys/cddl/compat/opensolaris/sys/random.h Tue Sep 13 07:15:39 2016 (r305764) +++ stable/10/sys/cddl/compat/opensolaris/sys/random.h Tue Sep 13 09:25:38 2016 (r305765) @@ -32,6 +32,6 @@ #include_next #define random_get_bytes(p, s) read_random((p), (int)(s)) -#define random_get_pseudo_bytes(p, s) read_random((p), (int)(s)) +#define random_get_pseudo_bytes(p, s) arc4rand((p), (int)(s), 0) #endif /* !_OPENSOLARIS_SYS_RANDOM_H_ */ From owner-svn-src-stable@freebsd.org Tue Sep 13 14:14:41 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CE24BD9EB7; Tue, 13 Sep 2016 14:14:41 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id CEFF5FE9; Tue, 13 Sep 2016 14:14:40 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DEEe6g095483; Tue, 13 Sep 2016 14:14:40 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DEEeZc095482; Tue, 13 Sep 2016 14:14:40 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609131414.u8DEEeZc095482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 13 Sep 2016 14:14:40 +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: r305768 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 14:14:41 -0000 Author: andrew Date: Tue Sep 13 14:14:39 2016 New Revision: 305768 URL: https://svnweb.freebsd.org/changeset/base/305768 Log: MFC 305767: Add a warning about a known erratum we have observed on ThunderX pass 1.1. As this is evaluation hardware with only a few users, and there is a lack of information add a warning when booting on this hardware. Modified: stable/11/sys/arm64/arm64/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/identcpu.c ============================================================================== --- stable/11/sys/arm64/arm64/identcpu.c Tue Sep 13 14:10:49 2016 (r305767) +++ stable/11/sys/arm64/arm64/identcpu.c Tue Sep 13 14:14:39 2016 (r305768) @@ -179,6 +179,28 @@ print_cpu_features(u_int cpu) } printf("\n"); + /* + * There is a hardware errata where, if one CPU is performing a TLB + * invalidation while another is performing a store-exclusive the + * store-exclusive may return the wrong status. A workaround seems + * to be to use an IPI to invalidate on each CPU, however given the + * limited number of affected units (pass 1.1 is the evaluation + * hardware revision), and the lack of information from Cavium + * this has not been implemented. + * + * At the time of writing this the only information is from: + * https://lkml.org/lkml/2016/8/4/722 + */ + /* + * XXX: CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 on it's own also + * triggers on pass 2.0+. + */ + if (cpu == 0 && CPU_VAR(PCPU_GET(midr)) == 0 && + CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) + printf("WARNING: ThunderX Pass 1.1 detected.\nThis has known " + "hardware bugs that may cause the incorrect operation of " + "atomic operations.\n"); + if (cpu != 0 && cpu_print_regs == 0) return; From owner-svn-src-stable@freebsd.org Tue Sep 13 16:22:51 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8569BD991C; Tue, 13 Sep 2016 16:22:51 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 98218F6E; Tue, 13 Sep 2016 16:22:51 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DGMoLl046837; Tue, 13 Sep 2016 16:22:50 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DGMoru046833; Tue, 13 Sep 2016 16:22:50 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609131622.u8DGMoru046833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 13 Sep 2016 16:22:50 +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: r305773 - in stable/11/sys: arm64/arm64 arm64/include conf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 16:22:52 -0000 Author: andrew Date: Tue Sep 13 16:22:50 2016 New Revision: 305773 URL: https://svnweb.freebsd.org/changeset/base/305773 Log: MFC 305771, 305772: Fix the arm64 kernel build when DDB is disabled, debug_monitor.c depends on DDB, and is unused when it's disabled. Modified: stable/11/sys/arm64/arm64/db_trace.c stable/11/sys/arm64/arm64/debug_monitor.c stable/11/sys/arm64/include/debug_monitor.h stable/11/sys/conf/files.arm64 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/db_trace.c ============================================================================== --- stable/11/sys/arm64/arm64/db_trace.c Tue Sep 13 16:20:31 2016 (r305772) +++ stable/11/sys/arm64/arm64/db_trace.c Tue Sep 13 16:22:50 2016 (r305773) @@ -27,6 +27,8 @@ * SUCH DAMAGE. */ +#include "opt_ddb.h" + #include __FBSDID("$FreeBSD$"); #include Modified: stable/11/sys/arm64/arm64/debug_monitor.c ============================================================================== --- stable/11/sys/arm64/arm64/debug_monitor.c Tue Sep 13 16:20:31 2016 (r305772) +++ stable/11/sys/arm64/arm64/debug_monitor.c Tue Sep 13 16:22:50 2016 (r305773) @@ -27,6 +27,8 @@ * SUCH DAMAGE. */ +#include "opt_ddb.h" + #include __FBSDID("$FreeBSD$"); Modified: stable/11/sys/arm64/include/debug_monitor.h ============================================================================== --- stable/11/sys/arm64/include/debug_monitor.h Tue Sep 13 16:20:31 2016 (r305772) +++ stable/11/sys/arm64/include/debug_monitor.h Tue Sep 13 16:22:50 2016 (r305773) @@ -32,7 +32,7 @@ #ifndef _MACHINE_DEBUG_MONITOR_H_ #define _MACHINE_DEBUG_MONITOR_H_ -#ifdef KDB +#ifdef DDB #include Modified: stable/11/sys/conf/files.arm64 ============================================================================== --- stable/11/sys/conf/files.arm64 Tue Sep 13 16:20:31 2016 (r305772) +++ stable/11/sys/conf/files.arm64 Tue Sep 13 16:22:50 2016 (r305773) @@ -20,7 +20,7 @@ arm64/arm64/cpufunc_asm.S standard arm64/arm64/db_disasm.c optional ddb arm64/arm64/db_interface.c optional ddb arm64/arm64/db_trace.c optional ddb -arm64/arm64/debug_monitor.c optional kdb +arm64/arm64/debug_monitor.c optional ddb arm64/arm64/disassem.c optional ddb arm64/arm64/dump_machdep.c standard arm64/arm64/elf_machdep.c standard From owner-svn-src-stable@freebsd.org Tue Sep 13 17:21:34 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27249BD9CF8; Tue, 13 Sep 2016 17:21:34 +0000 (UTC) (envelope-from jhb@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 mx1.freebsd.org (Postfix) with ESMTPS id DF440E55; Tue, 13 Sep 2016 17:21:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DHLXfg068935; Tue, 13 Sep 2016 17:21:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DHLXgj068934; Tue, 13 Sep 2016 17:21:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201609131721.u8DHLXgj068934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 13 Sep 2016 17:21:33 +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: r305776 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 17:21:34 -0000 Author: jhb Date: Tue Sep 13 17:21:32 2016 New Revision: 305776 URL: https://svnweb.freebsd.org/changeset/base/305776 Log: MFC 305624: Document PCI_HP and PCI_IOV kernel options and various tunables in pci(4). Describe PCI-related kernel options for HotPlug and SR-IOV support in the pci(4) manual page. While here, add a section describing the various tunables supported by the PCI bus driver as well. Modified: stable/11/share/man/man4/pci.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/pci.4 ============================================================================== --- stable/11/share/man/man4/pci.4 Tue Sep 13 16:33:33 2016 (r305775) +++ stable/11/share/man/man4/pci.4 Tue Sep 13 17:21:32 2016 (r305776) @@ -24,21 +24,47 @@ .\" .\" $FreeBSD$ .\" -.Dd January 3, 2008 +.Dd September 8, 2016 .Dt PCI 4 .Os .Sh NAME .Nm pci -.Nd generic PCI driver +.Nd generic PCI bus driver .Sh SYNOPSIS +To compile the PCI bus driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent .Cd device pci +.Ed +.Pp +To compile in support for Single Root I/O Virtualization +.Pq SR-IOV : +.Bd -ragged -offset indent +.Cd options PCI_IOV +.Ed +.Pp +To compile in support for native PCI-express HotPlug: +.Bd -ragged -offset indent +.Cd options PCI_HP +.Ed .Sh DESCRIPTION The .Nm -driver provides a way for userland programs to read and write +driver provides support for +.Tn PCI +devices in the kernel and limited access to +.Tn PCI +devices for userland. +.Pp +The +.Nm +driver provides a +.Pa /dev/pci +character device that can be used by userland programs to read and write .Tn PCI configuration registers. -It also provides a way for userland programs to get a list of all +Programs can also use this device to get a list of all .Tn PCI devices, or all .Tn PCI @@ -73,14 +99,13 @@ children when .Tn PCI client drivers are dynamically loaded at runtime. -.Sh KERNEL CONFIGURATION -The -.Nm -device is included in the kernel as described in the SYNOPSIS section. The .Nm -driver cannot be built as a -.Xr kld 4 . +driver also includes support for PCI-PCI bridges, +various platform-specific Host-PCI bridges, +and basic support for +.Tn PCI +VGA adapters. .Sh IOCTLS The following .Xr ioctl 2 @@ -310,6 +335,164 @@ reading registers, above, also apply to .Tn PCI configuration registers. .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel, or stored in +.Xr loader.conf 5 . +The current value of these tunables can be examined at runtime via +.Xr sysctl 8 +nodes of the same name. +Unless otherwise specified, +each of these tunables is a boolean that can be enabled by setting the +tunable to a non-zero value. +.Bl -tag -width indent +.It Va hw.pci.clear_bars Pq Defaults to 0 +Ignore any firmware-assigned memory and I/O port resources. +This forces the +.Tn PCI +bus driver to allocate resource ranges for memory and I/O port resources +from scratch. +.It Va hw.pci.clear_buses Pq Defaults to 0 +Ignore any firmware-assigned bus number registers in PCI-PCI bridges. +This forces the +.Tn PCI +bus driver and PCI-PCI bridge driver to allocate bus numbers for secondary +buses behind PCI-PCI bridges. +.It Va hw.pci.clear_pcib Pq Defaults to 0 +Ignore any firmware-assigned memory and I/O port resource windows in PCI-PCI +bridges. +This forces the PCI-PCI bridge driver to allocate memory and I/O port resources +for resource windows from scratch. +.Pp +By default the PCI-PCI bridge driver will allocate windows that +contain the firmware-assigned resources devices behind the bridge. +In addition, the PCI-PCI bridge driver will suballocate from existing window +regions when possible to satisfy a resource request. +As a result, +both +.Va hw.pci.clear_bars +and +.Va hw.pci.clear_pcib +must be enabled to fully ignore firmware-supplied resource assignments. +.It Va hw.pci.default_vgapci_unit Pq Defaults to -1 +By default, +the first +.Tn PCI +VGA adapter encountered by the system is assumed to be the boot display device. +This tunable can be set to choose a specific VGA adapter by specifying the +unit number of the associated +.Va vgapci Ns Ar X +device. +.It Va hw.pci.do_power_nodriver Pq Defaults to 0 +Place devices into a low power state +.Pq D3 +when a suitable device driver is not found. +Can be set to one of the following values: +.Bl -tag -width indent +.It 3 +Powers down all +.Tn PCI +devices without a device driver. +.It 2 +Powers down most devices without a device driver. +PCI devices with the display, memory, and base peripheral device classes +are not powered down. +.It 1 +Similar to a setting of 2 except that storage controllers are also not +powered down. +.It 0 +All devices are left fully powered. +.El +.Pp +A +.Tn PCI +device must support power management to be powered down. +Placing a device into a low power state may not reduce power consumption. +.It Va hw.pci.do_power_resume Pq Defaults to 1 +Place +.Tn PCI +devices into the fully powered state when resuming either the system or an +individual device. +Setting this to zero is discouraged as the system will not attempt to power +up non-powered PCI devices after a suspend. +.It Va hw.pci.do_power_suspend Pq Defaults to 1 +Place +.Tn PCI +devices into a low power state when suspending either the system or individual +devices. +Normally the D3 state is used as the low power state, +but firmware may override the desired power state during a system suspend. +.It Va hw.pci.enable_ari Pq Defaults to 1 +Enable support for PCI-express Alternative RID Interpretation. +This is often used in conjunction with SR-IOV. +.It Va hw.pci.enable_io_modes Pq Defaults to 1 +Enable memory or I/O port decoding in a PCI device's command register if it has +firmware-assigned memory or I/O port resources. +The firmware +.Pq BIOS +in some systems does not enable memory or I/O port decoding for some devices +even when it has assigned resources to the device. +This enables decoding for such resources during bus probe. +.It Va hw.pci.enable_msi Pq Defaults to 1 +Enable support for Message Signalled Interrupts +.Pq MSI . +MSI interrupts can be disabled by setting this tunable to 0. +.It Va hw.pci.enable_msix Pq Defaults to 1 +Enable support for extended Message Signalled Interrupts +.Pq MSI-X . +MSI-X interrupts can be disabled by setting this tunable to 0. +.It Va hw.pci.enable_pcie_hp Pq Defaults to 1 +Enable support for native PCI-express HotPlug. +.It Va hw.pci.honor_msi_blacklist Pq Defaults to 1 +MSI and MSI-X interrupts are disabled for certain chipsets known to have +broken MSI and MSI-X implementations when this tunable is set. +It can be set to zero to permit use of MSI and MSI-X interrupts if the +chipset match is a false positive. +.It Va hw.pci.iov_max_config Pq Defaults to 1MB +The maximum amount of memory permitted for the configuration parameters +used when creating Virtual Functions via SR-IOV. +This tunable can also be changed at runtime via +.Xr sysctl 8 . +.It Va hw.pci.realloc_bars Pq Defaults to 0 +Attempt to allocate a new resource range during the initial device scan +for any memory or I/O port resources with firmware-assigned ranges that +conflict with another active resource. +.It Va hw.pci.usb_early_takeover Pq Defaults to 1 on Tn amd64 and Tn i386 +Disable legacy device emulation of USB devices during the initial device +scan. +Set this tunable to zero to use USB devices via legacy emulation when +using a custom kernel without USB controller drivers. +.It Va hw.pci...INT

.irq +These tunables can be used to override the interrupt routing for legacy +PCI INTx interrupts. +Unlike other tunables in this list, +these do not have corresponding sysctl nodes. +The tunable name includes the address of the PCI device as well as the +pin of the desired INTx IRQ to override: +.Bl -tag -width indent +.It +The domain +.Pq or segment +of the PCI device in decimal. +.It +The bus address of the PCI device in decimal. +.It +The slot of the PCI device in decimal. +.It

+The interrupt pin of the PCI slot to override. +One of +.Ql A , +.Ql B , +.Ql C , +or +.Ql D . +.El +.Pp +The value of the tunable is the raw IRQ value to use for the INTx interrupt +pin identified by the tunable name. +Mapping of IRQ values to platform interrupt sources is machine dependent. +.El .Sh FILES .Bl -tag -width /dev/pci -compact .It Pa /dev/pci From owner-svn-src-stable@freebsd.org Tue Sep 13 19:01:59 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93C82BD9E75; Tue, 13 Sep 2016 19:01:59 +0000 (UTC) (envelope-from will@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 mx1.freebsd.org (Postfix) with ESMTPS id 63DCE1D4; Tue, 13 Sep 2016 19:01:59 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DJ1weM010822; Tue, 13 Sep 2016 19:01:58 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DJ1wjo010821; Tue, 13 Sep 2016 19:01:58 GMT (envelope-from will@FreeBSD.org) Message-Id: <201609131901.u8DJ1wjo010821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Tue, 13 Sep 2016 19:01: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: r305779 - stable/11/sys/boot/efi/loader X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 19:01:59 -0000 Author: will Date: Tue Sep 13 19:01:58 2016 New Revision: 305779 URL: https://svnweb.freebsd.org/changeset/base/305779 Log: MFC r305484: loader.efi: Bump the staging size to 64M. This is required on my system, which loads nvidia, vmm, and zfs, and 48M is no longer enough for that. nvidia-driver's recent update increased its size by several megabytes. Modified: stable/11/sys/boot/efi/loader/copy.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/loader/copy.c ============================================================================== --- stable/11/sys/boot/efi/loader/copy.c Tue Sep 13 18:16:15 2016 (r305778) +++ stable/11/sys/boot/efi/loader/copy.c Tue Sep 13 19:01:58 2016 (r305779) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" #ifndef EFI_STAGING_SIZE -#define EFI_STAGING_SIZE 48 +#define EFI_STAGING_SIZE 64 #endif #define STAGE_PAGES EFI_SIZE_TO_PAGES((EFI_STAGING_SIZE) * 1024 * 1024) From owner-svn-src-stable@freebsd.org Tue Sep 13 19:56:36 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D78CBD7704; Tue, 13 Sep 2016 19:56:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1637EA0; Tue, 13 Sep 2016 19:56:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DJuZEL031494; Tue, 13 Sep 2016 19:56:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DJuZpY031493; Tue, 13 Sep 2016 19:56:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609131956.u8DJuZpY031493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Sep 2016 19:56:35 +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: r305780 - stable/11/sys/arm/arm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 19:56:36 -0000 Author: markj Date: Tue Sep 13 19:56:34 2016 New Revision: 305780 URL: https://svnweb.freebsd.org/changeset/base/305780 Log: MFC r305425: Remove an unreachable return statement from ARM's minidumpsys(). Modified: stable/11/sys/arm/arm/minidump_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/arm/minidump_machdep.c ============================================================================== --- stable/11/sys/arm/arm/minidump_machdep.c Tue Sep 13 19:01:58 2016 (r305779) +++ stable/11/sys/arm/arm/minidump_machdep.c Tue Sep 13 19:56:34 2016 (r305780) @@ -369,7 +369,6 @@ fail: else printf("\n** DUMP FAILED (ERROR %d) **\n", error); return (error); - return (0); } void From owner-svn-src-stable@freebsd.org Tue Sep 13 19:59:30 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA970BD78ED; Tue, 13 Sep 2016 19:59:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6CD61D4; Tue, 13 Sep 2016 19:59:30 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8DJxUXB031725; Tue, 13 Sep 2016 19:59:30 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8DJxU03031724; Tue, 13 Sep 2016 19:59:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201609131959.u8DJxU03031724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 13 Sep 2016 19:59: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: r305781 - stable/11/share/dtrace X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 19:59:31 -0000 Author: markj Date: Tue Sep 13 19:59:29 2016 New Revision: 305781 URL: https://svnweb.freebsd.org/changeset/base/305781 Log: MFC r305363: Remove redefinitions of some kernel types from mbuf.d. Modified: stable/11/share/dtrace/mbuf.d Directory Properties: stable/11/ (props changed) Modified: stable/11/share/dtrace/mbuf.d ============================================================================== --- stable/11/share/dtrace/mbuf.d Tue Sep 13 19:56:34 2016 (r305780) +++ stable/11/share/dtrace/mbuf.d Tue Sep 13 19:59:29 2016 (r305781) @@ -26,7 +26,6 @@ * $FreeBSD$ * * Translators and flags for the mbuf structure. FreeBSD specific code. - * */ #pragma D depends_on module kernel @@ -110,89 +109,6 @@ inline string mbufflags_string[uint32_t flags & M_PROTO12 ? "M_PROTO12" : "none" ; -/* - * Packet tag structure (see below for details). - */ -typedef struct m_tag { - u_int16_t m_tag_id; /* Tag ID */ - u_int16_t m_tag_len; /* Length of data */ - u_int32_t m_tag_cookie; /* ABI/Module ID */ -} m_tag_t; - -/* - * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set. - * Size ILP32: 48 - * LP64: 56 - * Compile-time assertions in uipc_mbuf.c test these values to ensure that - * they are correct. - */ -typedef struct pkthdr { -/* struct ifnet *rcvif; */ /* rcv interface */ - int32_t len; /* total packet length */ - - /* Layer crossing persistent information. */ - uint32_t flowid; /* packet's 4-tuple system */ - uint64_t csum_flags; /* checksum and offload features */ - uint16_t fibnum; /* this packet should use this fib */ - uint8_t cosqos; /* class/quality of service */ - uint8_t rsstype; /* hash type */ -} pkthdr_t; - -/* - * Description of external storage mapped into mbuf; valid only if M_EXT is - * set. - * Size ILP32: 28 - * LP64: 48 - * Compile-time assertions in uipc_mbuf.c test these values to ensure that - * they are correct. - */ -typedef struct m_ext { - volatile u_int *ext_cnt; /* pointer to ref count info */ - caddr_t ext_buf; /* start of buffer */ - uint32_t ext_size; /* size of buffer, for ext_free */ - uint32_t ext_type:8, /* type of external storage */ - ext_flags:24; /* external storage mbuf flags */ - void *ext_arg1; /* optional argument pointer */ - void *ext_arg2; /* optional argument pointer */ -} m_ext_t; - -/* - * The core of the mbuf object along with some shortcut defines for practical - * purposes. - */ -struct mbuf { - uintptr_t mbuf_addr; - /* - * Header present at the beginning of every mbuf. - * Size ILP32: 24 - * LP64: 32 - * Compile-time assertions in uipc_mbuf.c test these values to ensure - * that they are correct. - */ - caddr_t m_data; /* location of data */ - int32_t m_len; /* amount of data in this mbuf */ - uint32_t m_type:8, /* type of data in this mbuf */ - m_flags:24; /* flags; see below */ - /* - * A set of optional headers (packet header, external storage header) - * and internal data storage. Historically, these arrays were sized - * to MHLEN (space left after a packet header) and MLEN (space left - * after only a regular mbuf header); they are now variable size in - * order to support future work on variable-size mbufs. - */ - /* union { */ - /* struct { */ - /* struct pkthdr m_pkthdr; */ - /* union { */ - /* struct m_ext m_ext; */ - /* char m_pktdat[0]; */ - /* }; */ - /* }; */ - /* char m_dat[0]; */ - /* }; */ - char *m_dat; -}; - typedef struct mbufinfo { uintptr_t mbuf_addr; caddr_t m_data; From owner-svn-src-stable@freebsd.org Wed Sep 14 09:10:33 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4385DBDAD7D; Wed, 14 Sep 2016 09:10:33 +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 mx1.freebsd.org (Postfix) with ESMTPS id EC950982; Wed, 14 Sep 2016 09:10:32 +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 u8E9AWr7034384; Wed, 14 Sep 2016 09:10:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8E9AWYX034383; Wed, 14 Sep 2016 09:10:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609140910.u8E9AWYX034383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 14 Sep 2016 09:10: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: r305797 - stable/11/sys/dev/ahci X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 09:10:33 -0000 Author: mav Date: Wed Sep 14 09:10:31 2016 New Revision: 305797 URL: https://svnweb.freebsd.org/changeset/base/305797 Log: MFC r305536: Fix channel initialization in FBS mode. Due to reading initialized variable, FIS receive area was always allocated as 256 bytes, suitable for command-based switching, instead of 4096 bytes, required for FIS-based switching. This caused memory corruption in case of port multipliers used on FBS-capable HBAs (Marvell). Modified: stable/11/sys/dev/ahci/ahci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci.c Wed Sep 14 08:59:13 2016 (r305796) +++ stable/11/sys/dev/ahci/ahci.c Wed Sep 14 09:10:31 2016 (r305797) @@ -715,6 +715,21 @@ ahci_ch_attach(device_t dev) if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE))) return (ENXIO); + ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); + version = ATA_INL(ctlr->r_mem, AHCI_VS); + if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) + ch->chcaps |= AHCI_P_CMD_FBSCP; + if (ch->caps2 & AHCI_CAP2_SDS) + ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); + if (bootverbose) { + device_printf(dev, "Caps:%s%s%s%s%s%s\n", + (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", + (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", + (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", + (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", + (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", + (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); + } ahci_dmainit(dev); ahci_slotsalloc(dev); mtx_lock(&ch->mtx); @@ -733,21 +748,6 @@ ahci_ch_attach(device_t dev) error = ENXIO; goto err1; } - ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); - version = ATA_INL(ctlr->r_mem, AHCI_VS); - if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) - ch->chcaps |= AHCI_P_CMD_FBSCP; - if (ch->caps2 & AHCI_CAP2_SDS) - ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); - if (bootverbose) { - device_printf(dev, "Caps:%s%s%s%s%s%s\n", - (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", - (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", - (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", - (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", - (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", - (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); - } /* Create the device queue for our SIM. */ devq = cam_simq_alloc(ch->numslots); if (devq == NULL) { From owner-svn-src-stable@freebsd.org Wed Sep 14 09:11:04 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB412BDAE10; Wed, 14 Sep 2016 09:11:04 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6F7EEC10; Wed, 14 Sep 2016 09:11:04 +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 u8E9B3Z1035256; Wed, 14 Sep 2016 09:11:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8E9B3PG035255; Wed, 14 Sep 2016 09:11:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609140911.u8E9B3PG035255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 14 Sep 2016 09:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305798 - stable/10/sys/dev/ahci X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 09:11:04 -0000 Author: mav Date: Wed Sep 14 09:11:03 2016 New Revision: 305798 URL: https://svnweb.freebsd.org/changeset/base/305798 Log: MFC r305536: Fix channel initialization in FBS mode. Due to reading initialized variable, FIS receive area was always allocated as 256 bytes, suitable for command-based switching, instead of 4096 bytes, required for FIS-based switching. This caused memory corruption in case of MFC r305536: Fix channel initialization in FBS mode. Due to reading initialized variable, FIS receive area was always allocated as 256 bytes, suitable for command-based switching, instead of 4096 bytes, required for FIS-based switching. This caused memory corruption in case of port multipliers used on FBS-capable HBAs (Marvell). Modified: stable/10/sys/dev/ahci/ahci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ahci/ahci.c ============================================================================== --- stable/10/sys/dev/ahci/ahci.c Wed Sep 14 09:10:31 2016 (r305797) +++ stable/10/sys/dev/ahci/ahci.c Wed Sep 14 09:11:03 2016 (r305798) @@ -668,6 +668,21 @@ ahci_ch_attach(device_t dev) if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE))) return (ENXIO); + ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); + version = ATA_INL(ctlr->r_mem, AHCI_VS); + if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) + ch->chcaps |= AHCI_P_CMD_FBSCP; + if (ch->caps2 & AHCI_CAP2_SDS) + ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); + if (bootverbose) { + device_printf(dev, "Caps:%s%s%s%s%s%s\n", + (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", + (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", + (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", + (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", + (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", + (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); + } ahci_dmainit(dev); ahci_slotsalloc(dev); mtx_lock(&ch->mtx); @@ -686,21 +701,6 @@ ahci_ch_attach(device_t dev) error = ENXIO; goto err1; } - ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD); - version = ATA_INL(ctlr->r_mem, AHCI_VS); - if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS)) - ch->chcaps |= AHCI_P_CMD_FBSCP; - if (ch->caps2 & AHCI_CAP2_SDS) - ch->chscaps = ATA_INL(ch->r_mem, AHCI_P_DEVSLP); - if (bootverbose) { - device_printf(dev, "Caps:%s%s%s%s%s%s\n", - (ch->chcaps & AHCI_P_CMD_HPCP) ? " HPCP":"", - (ch->chcaps & AHCI_P_CMD_MPSP) ? " MPSP":"", - (ch->chcaps & AHCI_P_CMD_CPD) ? " CPD":"", - (ch->chcaps & AHCI_P_CMD_ESP) ? " ESP":"", - (ch->chcaps & AHCI_P_CMD_FBSCP) ? " FBSCP":"", - (ch->chscaps & AHCI_P_DEVSLP_DSP) ? " DSP":""); - } /* Create the device queue for our SIM. */ devq = cam_simq_alloc(ch->numslots); if (devq == NULL) { From owner-svn-src-stable@freebsd.org Wed Sep 14 09:12:50 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE568BDAF3D; Wed, 14 Sep 2016 09:12:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DBAEF69; Wed, 14 Sep 2016 09:12:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8E9CnTt037987; Wed, 14 Sep 2016 09:12:49 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8E9CnLo037986; Wed, 14 Sep 2016 09:12:49 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609140912.u8E9CnLo037986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 14 Sep 2016 09:12: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: r305799 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 09:12:50 -0000 Author: mav Date: Wed Sep 14 09:12:49 2016 New Revision: 305799 URL: https://svnweb.freebsd.org/changeset/base/305799 Log: MFC r305123: Fix kernel panic when inheriting properties without default. There are two writable hidden properties "iscsioptions" and "stmf_sbd_lu", that have no default string value. Attempt to unset them or replicate caused kernel panic. This simple bandaid seems fixes the problem nicely. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Wed Sep 14 09:11:03 2016 (r305798) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Wed Sep 14 09:12:49 2016 (r305799) @@ -54,6 +54,8 @@ dodefault(zfs_prop_t prop, int intsz, in return (SET_ERROR(ENOENT)); if (zfs_prop_get_type(prop) == PROP_TYPE_STRING) { + if (zfs_prop_default_string(prop) == NULL) + return (SET_ERROR(ENOENT)); if (intsz != 1) return (SET_ERROR(EOVERFLOW)); (void) strncpy(buf, zfs_prop_default_string(prop), From owner-svn-src-stable@freebsd.org Wed Sep 14 09:13:18 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8B70BDAF9B; Wed, 14 Sep 2016 09:13:18 +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 mx1.freebsd.org (Postfix) with ESMTPS id AB08B149; Wed, 14 Sep 2016 09:13:18 +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 u8E9DHpZ038061; Wed, 14 Sep 2016 09:13:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8E9DHPH038060; Wed, 14 Sep 2016 09:13:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201609140913.u8E9DHPH038060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 14 Sep 2016 09:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305800 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 09:13:19 -0000 Author: mav Date: Wed Sep 14 09:13:17 2016 New Revision: 305800 URL: https://svnweb.freebsd.org/changeset/base/305800 Log: MFC r305123: Fix kernel panic when inheriting properties without default. There are two writable hidden properties "iscsioptions" and "stmf_sbd_lu", that have no default string value. Attempt to unset them or replicate caused kernel panic. This simple bandaid seems fixes the problem nicely. Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Wed Sep 14 09:12:49 2016 (r305799) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c Wed Sep 14 09:13:17 2016 (r305800) @@ -54,6 +54,8 @@ dodefault(zfs_prop_t prop, int intsz, in return (SET_ERROR(ENOENT)); if (zfs_prop_get_type(prop) == PROP_TYPE_STRING) { + if (zfs_prop_default_string(prop) == NULL) + return (SET_ERROR(ENOENT)); if (intsz != 1) return (SET_ERROR(EOVERFLOW)); (void) strncpy(buf, zfs_prop_default_string(prop), From owner-svn-src-stable@freebsd.org Wed Sep 14 10:36:45 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91534BD974B; Wed, 14 Sep 2016 10:36:45 +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 mx1.freebsd.org (Postfix) with ESMTPS id 461991B27; Wed, 14 Sep 2016 10:36:45 +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 u8EAaiU1067932; Wed, 14 Sep 2016 10:36:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8EAaiQx067931; Wed, 14 Sep 2016 10:36:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609141036.u8EAaiQx067931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 14 Sep 2016 10:36:44 +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: r305802 - stable/11/sys/vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 10:36:45 -0000 Author: kib Date: Wed Sep 14 10:36:44 2016 New Revision: 305802 URL: https://svnweb.freebsd.org/changeset/base/305802 Log: MFC r305129: Make swapoff reliable. Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c ============================================================================== --- stable/11/sys/vm/swap_pager.c Wed Sep 14 09:17:00 2016 (r305801) +++ stable/11/sys/vm/swap_pager.c Wed Sep 14 10:36:44 2016 (r305802) @@ -1664,36 +1664,49 @@ static void swap_pager_swapoff(struct swdevt *sp) { struct swblock *swap; + vm_object_t locked_obj, object; + vm_pindex_t pindex; int i, j, retries; sx_assert(&swdev_syscall_lock, SA_XLOCKED); retries = 0; + locked_obj = NULL; full_rescan: mtx_lock(&swhash_mtx); for (i = 0; i <= swhash_mask; i++) { /* '<=' is correct here */ restart: for (swap = swhash[i]; swap != NULL; swap = swap->swb_hnext) { - vm_object_t object = swap->swb_object; - vm_pindex_t pindex = swap->swb_index; + object = swap->swb_object; + pindex = swap->swb_index; for (j = 0; j < SWAP_META_PAGES; ++j) { - if (swp_pager_isondev(swap->swb_pages[j], sp)) { - /* avoid deadlock */ + if (!swp_pager_isondev(swap->swb_pages[j], sp)) + continue; + if (locked_obj != object) { + if (locked_obj != NULL) + VM_OBJECT_WUNLOCK(locked_obj); + locked_obj = object; if (!VM_OBJECT_TRYWLOCK(object)) { - break; - } else { mtx_unlock(&swhash_mtx); - swp_pager_force_pagein(object, - pindex + j); - VM_OBJECT_WUNLOCK(object); + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); mtx_lock(&swhash_mtx); goto restart; } } + MPASS(locked_obj == object); + mtx_unlock(&swhash_mtx); + swp_pager_force_pagein(object, pindex + j); + mtx_lock(&swhash_mtx); + goto restart; } } } mtx_unlock(&swhash_mtx); + if (locked_obj != NULL) { + VM_OBJECT_WUNLOCK(locked_obj); + locked_obj = NULL; + } if (sp->sw_used) { /* * Objects may be locked or paging to the device being From owner-svn-src-stable@freebsd.org Wed Sep 14 10:51:07 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87380BD9A26; Wed, 14 Sep 2016 10:51:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3081E10EA; Wed, 14 Sep 2016 10:51:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8EAp6qb072649; Wed, 14 Sep 2016 10:51:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8EAp6oW072648; Wed, 14 Sep 2016 10:51:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609141051.u8EAp6oW072648@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 14 Sep 2016 10:51:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305803 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 10:51:07 -0000 Author: kib Date: Wed Sep 14 10:51:06 2016 New Revision: 305803 URL: https://svnweb.freebsd.org/changeset/base/305803 Log: MFC r305129: Make swapoff reliable. Modified: stable/10/sys/vm/swap_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/swap_pager.c ============================================================================== --- stable/10/sys/vm/swap_pager.c Wed Sep 14 10:36:44 2016 (r305802) +++ stable/10/sys/vm/swap_pager.c Wed Sep 14 10:51:06 2016 (r305803) @@ -1764,36 +1764,49 @@ static void swap_pager_swapoff(struct swdevt *sp) { struct swblock *swap; + vm_object_t locked_obj, object; + vm_pindex_t pindex; int i, j, retries; GIANT_REQUIRED; retries = 0; + locked_obj = NULL; full_rescan: mtx_lock(&swhash_mtx); for (i = 0; i <= swhash_mask; i++) { /* '<=' is correct here */ restart: for (swap = swhash[i]; swap != NULL; swap = swap->swb_hnext) { - vm_object_t object = swap->swb_object; - vm_pindex_t pindex = swap->swb_index; + object = swap->swb_object; + pindex = swap->swb_index; for (j = 0; j < SWAP_META_PAGES; ++j) { - if (swp_pager_isondev(swap->swb_pages[j], sp)) { - /* avoid deadlock */ + if (!swp_pager_isondev(swap->swb_pages[j], sp)) + continue; + if (locked_obj != object) { + if (locked_obj != NULL) + VM_OBJECT_WUNLOCK(locked_obj); + locked_obj = object; if (!VM_OBJECT_TRYWLOCK(object)) { - break; - } else { mtx_unlock(&swhash_mtx); - swp_pager_force_pagein(object, - pindex + j); - VM_OBJECT_WUNLOCK(object); + /* Depends on type-stability. */ + VM_OBJECT_WLOCK(object); mtx_lock(&swhash_mtx); goto restart; } } + MPASS(locked_obj == object); + mtx_unlock(&swhash_mtx); + swp_pager_force_pagein(object, pindex + j); + mtx_lock(&swhash_mtx); + goto restart; } } } mtx_unlock(&swhash_mtx); + if (locked_obj != NULL) { + VM_OBJECT_WUNLOCK(locked_obj); + locked_obj = NULL; + } if (sp->sw_used) { /* * Objects may be locked or paging to the device being From owner-svn-src-stable@freebsd.org Thu Sep 15 08:25:14 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF0FEBDC155; Thu, 15 Sep 2016 08:25:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F3341305; Thu, 15 Sep 2016 08:25:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8F8PDDK075097; Thu, 15 Sep 2016 08:25:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8PDiN075096; Thu, 15 Sep 2016 08:25:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609150825.u8F8PDiN075096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 15 Sep 2016 08:25:13 +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: r305825 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:25:14 -0000 Author: kib Date: Thu Sep 15 08:25:13 2016 New Revision: 305825 URL: https://svnweb.freebsd.org/changeset/base/305825 Log: MFC r305744: Fix typo in comment. Modified: stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Thu Sep 15 07:41:48 2016 (r305824) +++ stable/11/sys/x86/x86/identcpu.c Thu Sep 15 08:25:13 2016 (r305825) @@ -1725,7 +1725,7 @@ print_AMD_info(void) * As long as that bug pops up very rarely (intensive machine usage * on other operating systems generally generates one unexplainable * crash any 2 months) and as long as a model specific fix would be - * impratical at this stage, print out a warning string if the broken + * impractical at this stage, print out a warning string if the broken * model and family are identified. */ if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 && From owner-svn-src-stable@freebsd.org Thu Sep 15 08:27:00 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFB60BDC1D1; Thu, 15 Sep 2016 08:27:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9F8C214BC; Thu, 15 Sep 2016 08:27:00 +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 u8F8Qx65075210; Thu, 15 Sep 2016 08:26:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8QxH7075209; Thu, 15 Sep 2016 08:26:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609150826.u8F8QxH7075209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 15 Sep 2016 08:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305826 - stable/10/sys/x86/x86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:27:00 -0000 Author: kib Date: Thu Sep 15 08:26:59 2016 New Revision: 305826 URL: https://svnweb.freebsd.org/changeset/base/305826 Log: MFC r305744: Fix typo in comment. Modified: stable/10/sys/x86/x86/identcpu.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/x86/x86/identcpu.c ============================================================================== --- stable/10/sys/x86/x86/identcpu.c Thu Sep 15 08:25:13 2016 (r305825) +++ stable/10/sys/x86/x86/identcpu.c Thu Sep 15 08:26:59 2016 (r305826) @@ -1683,7 +1683,7 @@ print_AMD_info(void) * As long as that bug pops up very rarely (intensive machine usage * on other operating systems generally generates one unexplainable * crash any 2 months) and as long as a model specific fix would be - * impratical at this stage, print out a warning string if the broken + * impractical at this stage, print out a warning string if the broken * model and family are identified. */ if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 && From owner-svn-src-stable@freebsd.org Thu Sep 15 08:34:17 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD434BDC40A; Thu, 15 Sep 2016 08:34:17 +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 mx1.freebsd.org (Postfix) with ESMTPS id AD8551C0C; Thu, 15 Sep 2016 08:34:17 +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 u8F8YGOR079022; Thu, 15 Sep 2016 08:34:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8YGf7079021; Thu, 15 Sep 2016 08:34:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609150834.u8F8YGf7079021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Sep 2016 08:34: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: r305828 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:34:18 -0000 Author: hselasky Date: Thu Sep 15 08:34:16 2016 New Revision: 305828 URL: https://svnweb.freebsd.org/changeset/base/305828 Log: MFC r305590: Correctly map the USB mouse tilt delta values into buttons 5 and 6 instead of 3 and 4 which is used for the scroll wheel, according to X.org. PR: 170358 Modified: stable/11/sys/dev/usb/input/ums.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/ums.c ============================================================================== --- stable/11/sys/dev/usb/input/ums.c Thu Sep 15 08:30:47 2016 (r305827) +++ stable/11/sys/dev/usb/input/ums.c Thu Sep 15 08:34:16 2016 (r305828) @@ -288,9 +288,9 @@ ums_intr_callback(struct usb_xfer *xfer, /* translate T-axis into button presses until further */ if (dt > 0) - buttons |= 1UL << 3; + buttons |= 1UL << 5; else if (dt < 0) - buttons |= 1UL << 4; + buttons |= 1UL << 6; sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-stable@freebsd.org Thu Sep 15 08:35:47 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97F34BDC4C1; Thu, 15 Sep 2016 08:35:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id 67A061DE7; Thu, 15 Sep 2016 08:35:47 +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 u8F8ZkUE079147; Thu, 15 Sep 2016 08:35:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8ZkXw079146; Thu, 15 Sep 2016 08:35:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609150835.u8F8ZkXw079146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Sep 2016 08:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305829 - stable/10/sys/dev/usb/input X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:35:47 -0000 Author: hselasky Date: Thu Sep 15 08:35:46 2016 New Revision: 305829 URL: https://svnweb.freebsd.org/changeset/base/305829 Log: MFC r305590: Correctly map the USB mouse tilt delta values into buttons 5 and 6 instead of 3 and 4 which is used for the scroll wheel, according to X.org. PR: 170358 Modified: stable/10/sys/dev/usb/input/ums.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/input/ums.c ============================================================================== --- stable/10/sys/dev/usb/input/ums.c Thu Sep 15 08:34:16 2016 (r305828) +++ stable/10/sys/dev/usb/input/ums.c Thu Sep 15 08:35:46 2016 (r305829) @@ -288,9 +288,9 @@ ums_intr_callback(struct usb_xfer *xfer, /* translate T-axis into button presses until further */ if (dt > 0) - buttons |= 1UL << 3; + buttons |= 1UL << 5; else if (dt < 0) - buttons |= 1UL << 4; + buttons |= 1UL << 6; sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-stable@freebsd.org Thu Sep 15 08:37:21 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8384CBDC546; Thu, 15 Sep 2016 08:37:21 +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 mx1.freebsd.org (Postfix) with ESMTPS id 53E2F1F8C; Thu, 15 Sep 2016 08:37:21 +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 u8F8bKnx079269; Thu, 15 Sep 2016 08:37:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8bKdo079268; Thu, 15 Sep 2016 08:37:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609150837.u8F8bKdo079268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Sep 2016 08:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r305830 - stable/9/sys/dev/usb/input X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:37:21 -0000 Author: hselasky Date: Thu Sep 15 08:37:20 2016 New Revision: 305830 URL: https://svnweb.freebsd.org/changeset/base/305830 Log: MFC r305590: Correctly map the USB mouse tilt delta values into buttons 5 and 6 instead of 3 and 4 which is used for the scroll wheel, according to X.org. PR: 170358 Modified: stable/9/sys/dev/usb/input/ums.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/usb/input/ums.c ============================================================================== --- stable/9/sys/dev/usb/input/ums.c Thu Sep 15 08:35:46 2016 (r305829) +++ stable/9/sys/dev/usb/input/ums.c Thu Sep 15 08:37:20 2016 (r305830) @@ -288,9 +288,9 @@ ums_intr_callback(struct usb_xfer *xfer, /* translate T-axis into button presses until further */ if (dt > 0) - buttons |= 1UL << 3; + buttons |= 1UL << 5; else if (dt < 0) - buttons |= 1UL << 4; + buttons |= 1UL << 6; sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-stable@freebsd.org Thu Sep 15 08:38:54 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9B9ABDC5D9; Thu, 15 Sep 2016 08:38:54 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9BEE71139; Thu, 15 Sep 2016 08:38:54 +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 u8F8crGX079383; Thu, 15 Sep 2016 08:38:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8F8cr6L079382; Thu, 15 Sep 2016 08:38:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201609150838.u8F8cr6L079382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 15 Sep 2016 08:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r305831 - stable/8/sys/dev/usb/input X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 08:38:54 -0000 Author: hselasky Date: Thu Sep 15 08:38:53 2016 New Revision: 305831 URL: https://svnweb.freebsd.org/changeset/base/305831 Log: MFC r305590: Correctly map the USB mouse tilt delta values into buttons 5 and 6 instead of 3 and 4 which is used for the scroll wheel, according to X.org. PR: 170358 Modified: stable/8/sys/dev/usb/input/ums.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/input/ums.c ============================================================================== --- stable/8/sys/dev/usb/input/ums.c Thu Sep 15 08:37:20 2016 (r305830) +++ stable/8/sys/dev/usb/input/ums.c Thu Sep 15 08:38:53 2016 (r305831) @@ -288,9 +288,9 @@ ums_intr_callback(struct usb_xfer *xfer, /* translate T-axis into button presses until further */ if (dt > 0) - buttons |= 1UL << 3; + buttons |= 1UL << 5; else if (dt < 0) - buttons |= 1UL << 4; + buttons |= 1UL << 6; sc->sc_status.button = buttons; sc->sc_status.dx += dx; From owner-svn-src-stable@freebsd.org Thu Sep 15 17:22:37 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1696DBDAD97; Thu, 15 Sep 2016 17:22:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D76A57F8; Thu, 15 Sep 2016 17:22:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHMaoG081139; Thu, 15 Sep 2016 17:22:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHMa1b081138; Thu, 15 Sep 2016 17:22:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151722.u8FHMa1b081138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:22: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: r305837 - stable/11/contrib/elftoolchain/readelf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:22:37 -0000 Author: emaste Date: Thu Sep 15 17:22:35 2016 New Revision: 305837 URL: https://svnweb.freebsd.org/changeset/base/305837 Log: MFC r303674: readelf: report ARM program and section header types Modified: stable/11/contrib/elftoolchain/readelf/readelf.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/11/contrib/elftoolchain/readelf/readelf.c Thu Sep 15 17:05:54 2016 (r305836) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Thu Sep 15 17:22:35 2016 (r305837) @@ -343,7 +343,7 @@ static const char *note_type_openbsd(uns static const char *note_type_unknown(unsigned int nt); static const char *note_type_xen(unsigned int nt); static const char *option_kind(uint8_t kind); -static const char *phdr_type(unsigned int ptype); +static const char *phdr_type(unsigned int mach, unsigned int ptype); static const char *ppc_abi_fp(uint64_t fp); static const char *ppc_abi_vector(uint64_t vec); static void readelf_usage(int status); @@ -622,10 +622,24 @@ elf_ver(unsigned int ver) } static const char * -phdr_type(unsigned int ptype) +phdr_type(unsigned int mach, unsigned int ptype) { static char s_ptype[32]; + if (ptype >= PT_LOPROC && ptype <= PT_HIPROC) { + switch (mach) { + case EM_ARM: + switch (ptype) { + case PT_ARM_ARCHEXT: return "ARM_ARCHEXT"; + case PT_ARM_EXIDX: return "ARM_EXIDX"; + } + break; + } + snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x", + ptype - PT_LOPROC); + return (s_ptype); + } + switch (ptype) { case PT_NULL: return "NULL"; case PT_LOAD: return "LOAD"; @@ -639,10 +653,7 @@ phdr_type(unsigned int ptype) case PT_GNU_STACK: return "GNU_STACK"; case PT_GNU_RELRO: return "GNU_RELRO"; default: - if (ptype >= PT_LOPROC && ptype <= PT_HIPROC) - snprintf(s_ptype, sizeof(s_ptype), "LOPROC+%#x", - ptype - PT_LOPROC); - else if (ptype >= PT_LOOS && ptype <= PT_HIOS) + if (ptype >= PT_LOOS && ptype <= PT_HIOS) snprintf(s_ptype, sizeof(s_ptype), "LOOS+%#x", ptype - PT_LOOS); else @@ -659,6 +670,15 @@ section_type(unsigned int mach, unsigned if (stype >= SHT_LOPROC && stype <= SHT_HIPROC) { switch (mach) { + case EM_ARM: + switch (stype) { + case SHT_ARM_EXIDX: return "ARM_EXIDX"; + case SHT_ARM_PREEMPTMAP: return "ARM_PREEMPTMAP"; + case SHT_ARM_ATTRIBUTES: return "ARM_ATTRIBUTES"; + case SHT_ARM_DEBUGOVERLAY: return "ARM_DEBUGOVERLAY"; + case SHT_ARM_OVERLAYSECTION: return "ARM_OVERLAYSECTION"; + } + break; case EM_X86_64: switch (stype) { case SHT_X86_64_UNWIND: return "X86_64_UNWIND"; @@ -2273,9 +2293,10 @@ dump_phdr(struct readelf *re) #define PH_HDR "Type", "Offset", "VirtAddr", "PhysAddr", "FileSiz", \ "MemSiz", "Flg", "Align" -#define PH_CT phdr_type(phdr.p_type), (uintmax_t)phdr.p_offset, \ - (uintmax_t)phdr.p_vaddr, (uintmax_t)phdr.p_paddr, \ - (uintmax_t)phdr.p_filesz, (uintmax_t)phdr.p_memsz, \ +#define PH_CT phdr_type(re->ehdr.e_machine, phdr.p_type), \ + (uintmax_t)phdr.p_offset, (uintmax_t)phdr.p_vaddr, \ + (uintmax_t)phdr.p_paddr, (uintmax_t)phdr.p_filesz, \ + (uintmax_t)phdr.p_memsz, \ phdr.p_flags & PF_R ? 'R' : ' ', \ phdr.p_flags & PF_W ? 'W' : ' ', \ phdr.p_flags & PF_X ? 'E' : ' ', \ From owner-svn-src-stable@freebsd.org Thu Sep 15 17:23:15 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2FF1BDAE03; Thu, 15 Sep 2016 17:23:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C534995E; Thu, 15 Sep 2016 17:23:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHNFF3081221; Thu, 15 Sep 2016 17:23:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHNFeM081220; Thu, 15 Sep 2016 17:23:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151723.u8FHNFeM081220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:23:15 +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: r305838 - stable/11/contrib/elftoolchain/elfcopy X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:23:16 -0000 Author: emaste Date: Thu Sep 15 17:23:14 2016 New Revision: 305838 URL: https://svnweb.freebsd.org/changeset/base/305838 Log: MFC r304151: elfcopy: silence GCC 5.3 unitialized variable warning Although it's a false positive there is little cost to initializing it always. Modified: stable/11/contrib/elftoolchain/elfcopy/ascii.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/elfcopy/ascii.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:22:35 2016 (r305837) +++ stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:23:14 2016 (r305838) @@ -251,6 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp sec_index = 1; sec_addr = entry = 0; while (fgets(line, _LINE_BUFSZ, ifp) != NULL) { + sz = 0; /* Silence GCC 5.3 unintialized variable warning */ if (line[0] == '\r' || line[0] == '\n') continue; if (line[0] == '$' && line[1] == '$') { From owner-svn-src-stable@freebsd.org Thu Sep 15 17:24:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EA93BDAE92; Thu, 15 Sep 2016 17:24:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30E5EADB; Thu, 15 Sep 2016 17:24:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHOBO8081306; Thu, 15 Sep 2016 17:24:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHOBnd081304; Thu, 15 Sep 2016 17:24:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151724.u8FHOBnd081304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:24:11 +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: r305839 - stable/11/contrib/elftoolchain/libelftc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:24:12 -0000 Author: emaste Date: Thu Sep 15 17:24:11 2016 New Revision: 305839 URL: https://svnweb.freebsd.org/changeset/base/305839 Log: MFC r304160: elfcopy: add elf64-littleaarch64 output target support Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Thu Sep 15 17:23:14 2016 (r305838) +++ stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Thu Sep 15 17:24:11 2016 (r305839) @@ -89,6 +89,7 @@ Known descriptor names and their propert .It Li elf64-ia64-big Ta ELF Ta MSB Ta 64 .It Li elf64-ia64-little Ta ELF Ta LSB Ta 64 .It Li elf64-little Ta ELF Ta LSB Ta 64 +.It Li elf64-littleaarch64 Ta ELF Ta LSB Ta 64 .It Li elf64-littlemips Ta ELF Ta LSB Ta 64 .It Li elf64-powerpc Ta ELF Ta MSB Ta 64 .It Li elf64-powerpcle Ta ELF Ta LSB Ta 64 Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Thu Sep 15 17:23:14 2016 (r305838) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Thu Sep 15 17:24:11 2016 (r305839) @@ -250,6 +250,14 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf64-littleaarch64", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2LSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_AARCH64, + }, + + { .bt_name = "elf64-littlemips", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, From owner-svn-src-stable@freebsd.org Thu Sep 15 17:25:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B985BDB069; Thu, 15 Sep 2016 17:25:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19A59B0; Thu, 15 Sep 2016 17:25:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHPBFU081504; Thu, 15 Sep 2016 17:25:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHPBUp081503; Thu, 15 Sep 2016 17:25:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151725.u8FHPBUp081503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:25:11 +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: r305842 - stable/11/contrib/elftoolchain/elfcopy X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:25:12 -0000 Author: emaste Date: Thu Sep 15 17:25:11 2016 New Revision: 305842 URL: https://svnweb.freebsd.org/changeset/base/305842 Log: MFC r304191: elfcopy: correct comment typo (Missed in r305838) Modified: stable/11/contrib/elftoolchain/elfcopy/ascii.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/elfcopy/ascii.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:24:39 2016 (r305841) +++ stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:25:11 2016 (r305842) @@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp sec_index = 1; sec_addr = entry = 0; while (fgets(line, _LINE_BUFSZ, ifp) != NULL) { - sz = 0; /* Silence GCC 5.3 unintialized variable warning */ + sz = 0; /* Silence GCC 5.3 uninitialized variable warning */ if (line[0] == '\r' || line[0] == '\n') continue; if (line[0] == '$' && line[1] == '$') { From owner-svn-src-stable@freebsd.org Thu Sep 15 17:28:06 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 895FABDB171; Thu, 15 Sep 2016 17:28:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 541B45F4; Thu, 15 Sep 2016 17:28:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHS5cv081750; Thu, 15 Sep 2016 17:28:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHS3Ph081732; Thu, 15 Sep 2016 17:28:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151728.u8FHS3Ph081732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:28:03 +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: r305844 - in stable/11: contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/elfdump contrib/elftoolchain/libelf contrib/elftoolchain/libelftc contrib/elftoolch... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:28:06 -0000 Author: emaste Date: Thu Sep 15 17:28:03 2016 New Revision: 305844 URL: https://svnweb.freebsd.org/changeset/base/305844 Log: MFC r305130: Update to ELF Tool Chain r3490 Improvements include: * readelf: report all relocation types in rel/rela for MIPS N64 * readelf: add ELFOSABI_ARM_AEABI * elfdump: add ELFOSABI_ARM_AEABI and ELFOSABI_ARM * Add recent RISC-V relocations * elfcopy: use elftc_timestamp, to support SOURCE_DATE_EPOCH MFC r305155: readelf: silence GCC 4.2.1 uninitialized variable warning Sponsored by: The FreeBSD Foundation Added: stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.3 - copied unchanged from r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.3 stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.c - copied unchanged from r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.c Modified: stable/11/contrib/elftoolchain/common/elfdefinitions.h stable/11/contrib/elftoolchain/elfcopy/archive.c stable/11/contrib/elftoolchain/elfcopy/ascii.c stable/11/contrib/elftoolchain/elfcopy/pe.c stable/11/contrib/elftoolchain/elfdump/elfdump.c stable/11/contrib/elftoolchain/libelf/elf_flagdata.3 stable/11/contrib/elftoolchain/libelftc/Makefile stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c stable/11/contrib/elftoolchain/libelftc/libelftc.h stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c stable/11/contrib/elftoolchain/readelf/readelf.1 stable/11/contrib/elftoolchain/readelf/readelf.c stable/11/lib/libelftc/Makefile stable/11/lib/libelftc/elftc_version.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- stable/11/contrib/elftoolchain/common/elfdefinitions.h Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/common/elfdefinitions.h Thu Sep 15 17:28:03 2016 (r305844) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3455 2016-05-09 13:47:29Z emaste $ + * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $ */ /* @@ -2091,7 +2091,10 @@ _ELF_DEFINE_RELOC(R_RISCV_GNU_VTINHERIT, _ELF_DEFINE_RELOC(R_RISCV_GNU_VTENTRY, 42) \ _ELF_DEFINE_RELOC(R_RISCV_ALIGN, 43) \ _ELF_DEFINE_RELOC(R_RISCV_RVC_BRANCH, 44) \ -_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) +_ELF_DEFINE_RELOC(R_RISCV_RVC_JUMP, 45) \ +_ELF_DEFINE_RELOC(R_RISCV_RVC_LUI, 46) \ +_ELF_DEFINE_RELOC(R_RISCV_GPREL_I, 47) \ +_ELF_DEFINE_RELOC(R_RISCV_GPREL_S, 48) #define _ELF_DEFINE_SPARC_RELOCATIONS() \ _ELF_DEFINE_RELOC(R_SPARC_NONE, 0) \ Modified: stable/11/contrib/elftoolchain/elfcopy/archive.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/archive.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/elfcopy/archive.c Thu Sep 15 17:28:03 2016 (r305844) @@ -38,7 +38,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: archive.c 3287 2015-12-31 16:58:48Z emaste $"); +ELFTC_VCSID("$Id: archive.c 3490 2016-08-31 00:12:22Z emaste $"); #define _ARMAG_LEN 8 /* length of ar magic string */ #define _ARHDR_LEN 60 /* length of ar header */ @@ -440,6 +440,7 @@ ac_write_objs(struct elfcopy *ecp, int o struct archive *a; struct archive_entry *entry; struct ar_obj *obj; + time_t timestamp; int nr; if ((a = archive_write_new()) == NULL) @@ -450,7 +451,9 @@ ac_write_objs(struct elfcopy *ecp, int o /* Write the archive symbol table, even if it's empty. */ entry = archive_entry_new(); archive_entry_copy_pathname(entry, "/"); - archive_entry_set_mtime(entry, time(NULL), 0); + if (elftc_timestamp(×tamp) != 0) + err(EXIT_FAILURE, "elftc_timestamp"); + archive_entry_set_mtime(entry, timestamp, 0); archive_entry_set_size(entry, (ecp->s_cnt + 1) * sizeof(uint32_t) + ecp->s_sn_sz); AC(archive_write_header(a, entry)); Modified: stable/11/contrib/elftoolchain/elfcopy/ascii.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/elfcopy/ascii.c Thu Sep 15 17:28:03 2016 (r305844) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: ascii.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $"); static void append_data(struct section *s, const void *buf, size_t sz); static char hex_digit(uint8_t n); @@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp sec_index = 1; sec_addr = entry = 0; while (fgets(line, _LINE_BUFSZ, ifp) != NULL) { - sz = 0; /* Silence GCC 5.3 uninitialized variable warning */ + sz = 0; if (line[0] == '\r' || line[0] == '\n') continue; if (line[0] == '$' && line[1] == '$') { Modified: stable/11/contrib/elftoolchain/elfcopy/pe.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/pe.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/elfcopy/pe.c Thu Sep 15 17:28:03 2016 (r305844) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3477 2016-05-25 20:00:42Z kaiwang27 $"); +ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $"); /* Convert ELF object to Portable Executable (PE). */ void @@ -54,6 +54,7 @@ create_pe(struct elfcopy *ecp, int ifd, PE_Buffer *pb; const char *name; size_t indx; + time_t timestamp; int elferr; if (ecp->otf == ETF_EFI || ecp->oem == EM_X86_64) @@ -89,7 +90,9 @@ create_pe(struct elfcopy *ecp, int ifd, pch.ch_machine = IMAGE_FILE_MACHINE_UNKNOWN; break; } - pch.ch_timestamp = (uint32_t) time(NULL); + if (elftc_timestamp(×tamp) != 0) + err(EXIT_FAILURE, "elftc_timestamp"); + pch.ch_timestamp = (uint32_t) timestamp; if (pe_update_coff_header(pe, &pch) < 0) err(EXIT_FAILURE, "pe_update_coff_header() failed"); Modified: stable/11/contrib/elftoolchain/elfdump/elfdump.c ============================================================================== --- stable/11/contrib/elftoolchain/elfdump/elfdump.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/elfdump/elfdump.c Thu Sep 15 17:28:03 2016 (r305844) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3474 2016-05-17 20:44:53Z emaste $"); +ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -332,6 +332,8 @@ static const char *ei_abis[256] = { "ELFOSABI_IRIX", "ELFOSABI_FREEBSD", "ELFOSABI_TRU64", "ELFOSABI_MODESTO", "ELFOSABI_OPENBSD", [17] = "ELFOSABI_CLOUDABI", + [64] = "ELFOSABI_ARM_AEABI", + [97] = "ELFOSABI_ARM", [255] = "ELFOSABI_STANDALONE" }; Modified: stable/11/contrib/elftoolchain/libelf/elf_flagdata.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelf/elf_flagdata.3 Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelf/elf_flagdata.3 Thu Sep 15 17:28:03 2016 (r305844) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy $ +.\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $ .\" .Dd December 3, 2011 .Os @@ -208,16 +208,13 @@ was called without a program header bein .Xr elf 3 , .Xr elf32_newehdr 3 , .Xr elf32_newphdr 3 , -.Xr elf32_newshdr 3 , .Xr elf64_newehdr 3 , .Xr elf64_newphdr 3 , -.Xr elf64_newshdr 3 , .Xr elf_newdata 3 , .Xr elf_update 3 , .Xr gelf 3 , .Xr gelf_newehdr 3 , .Xr gelf_newphdr 3 , -.Xr gelf_newshdr 3 , .Xr gelf_update_dyn 3 , .Xr gelf_update_move 3 , .Xr gelf_update_rel 3 , Modified: stable/11/contrib/elftoolchain/libelftc/Makefile ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/Makefile Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/Makefile Thu Sep 15 17:28:03 2016 (r305844) @@ -1,4 +1,4 @@ -# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $ +# $Id: Makefile 3489 2016-08-31 00:12:15Z emaste $ TOP= ${.CURDIR}/.. @@ -10,6 +10,7 @@ SRCS= elftc_bfdtarget.c \ elftc_reloc_type_str.c \ elftc_set_timestamps.c \ elftc_string_table.c \ + elftc_timestamp.c \ elftc_version.c \ libelftc_bfdtarget.c \ libelftc_dem_arm.c \ Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Thu Sep 15 17:28:03 2016 (r305844) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elftc_bfd_find_target.3 3348 2016-01-18 14:18:50Z emaste $ +.\" $Id: elftc_bfd_find_target.3 3488 2016-08-24 18:15:57Z emaste $ .\" .Dd November 30, 2011 .Os Modified: stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c Thu Sep 15 17:28:03 2016 (r305844) @@ -545,6 +545,9 @@ elftc_reloc_type_str(unsigned int mach, case 43: return "R_RISCV_ALIGN"; case 44: return "R_RISCV_RVC_BRANCH"; case 45: return "R_RISCV_RVC_JUMP"; + case 46: return "R_RISCV_RVC_LUI"; + case 47: return "R_RISCV_GPREL_I"; + case 48: return "R_RISCV_GPREL_S"; } break; case EM_SPARC: Copied: stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.3 (from r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.3 Thu Sep 15 17:28:03 2016 (r305844, copy of r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.3) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. +.\" +.\" This documentation was written by Ed Maste under sponsorship of +.\" the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by the author and contributors ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. In no event shall the author or contributors be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $Id$ +.\" +.Dd August 24, 2016 +.Os +.Dt ELFTC_TIMESTAMP 3 +.Sh NAME +.Nm elftc_timestamp +.Nd return the current or environment-provided timestamp +.Sh LIBRARY +.Lb libelftc +.Sh SYNOPSIS +.In libelftc.h +.Ft int +.Fo elftc_timestamp +.Fa "time_t *timestamp" +.Fc +.Sh DESCRIPTION +The +.Fn elftc_timestamp +function returns a timestamp supplied by the +.Ev SOURCE_DATE_EPOCH +environment variable, or the current time provided by +.Xr time 3 +if the environment variable is not set. +.Pp +The +.Ar timestamp +argument specifies a pointer to the location where the timestamp will be +stored. +.Sh RETURN VALUE +Function +.Fn elftc_timestamp +returns 0 on success, and -1 in the event of an error. +.Sh ERRORS +The +.Fn elftc_timestamp +function may fail with the following errors: +.Bl -tag -width ".Bq Er ERANGE" +.It Bq Er EINVAL +.Ev SOURCE_DATE_EPOCH +contains invalid characters. +.It Bq Er ERANGE +.Ev SOURCE_DATE_EPOCH +specifies a negative value or a value that cannot be stored in a +time_t. +.El +The +.Fn elftc_timestamp +function may also fail for any of the reasons described in +.Xr strtoll 3 . +.Sh SEE ALSO +.Xr strtoll 3 , +.Xr time 3 Copied: stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.c (from r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/elftoolchain/libelftc/elftc_timestamp.c Thu Sep 15 17:28:03 2016 (r305844, copy of r305130, head/contrib/elftoolchain/libelftc/elftc_timestamp.c) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Ed Maste under sponsorship + * of the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include + +int +elftc_timestamp(time_t *timestamp) +{ + long long source_date_epoch; + char *env, *eptr; + + if ((env = getenv("SOURCE_DATE_EPOCH")) != NULL) { + errno = 0; + source_date_epoch = strtoll(env, &eptr, 10); + if (*eptr != '\0') + errno = EINVAL; + if (source_date_epoch < 0) + errno = ERANGE; + if (errno != 0) + return (-1); + *timestamp = source_date_epoch; + return (0); + } + *timestamp = time(NULL); + return (0); +} Modified: stable/11/contrib/elftoolchain/libelftc/libelftc.h ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc.h Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/libelftc.h Thu Sep 15 17:28:03 2016 (r305844) @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $ - * $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $ + * $Id: libelftc.h 3489 2016-08-31 00:12:15Z emaste $ */ #ifndef _LIBELFTC_H_ @@ -91,6 +91,7 @@ int elftc_string_table_remove(Elftc_Str const char *_string); const char *elftc_string_table_to_string(Elftc_String_Table *_table, size_t offset); +int elftc_timestamp(time_t *_timestamp); const char *elftc_version(void); #ifdef __cplusplus } Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Thu Sep 15 17:28:03 2016 (r305844) @@ -30,7 +30,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3309 2016-01-10 09:10:51Z kaiwang27 $"); +ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $"); struct _Elftc_Bfd_Target _libelftc_targets[] = { Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Thu Sep 15 17:28:03 2016 (r305844) @@ -36,7 +36,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3480 2016-07-24 23:38:41Z emaste $"); /** * @file cpp_demangle.c Modified: stable/11/contrib/elftoolchain/readelf/readelf.1 ============================================================================== --- stable/11/contrib/elftoolchain/readelf/readelf.1 Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/readelf/readelf.1 Thu Sep 15 17:28:03 2016 (r305844) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: readelf.1 3219 2015-05-24 23:42:34Z kaiwang27 $ +.\" $Id: readelf.1 3486 2016-08-22 14:10:05Z emaste $ .\" .Dd September 13, 2012 .Os @@ -43,12 +43,12 @@ .Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section .Op Fl r | Fl -relocs .Op Fl t | Fl -section-details -.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section .Op Fl v | Fl -version .Oo .Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc | .Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ... .Oc +.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section .Op Fl A | Fl -arch-specific .Op Fl D | Fl -use-dynamic .Op Fl H | Fl -help Modified: stable/11/contrib/elftoolchain/readelf/readelf.c ============================================================================== --- stable/11/contrib/elftoolchain/readelf/readelf.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Thu Sep 15 17:28:03 2016 (r305844) @@ -47,7 +47,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: readelf.c 3469 2016-05-15 23:16:09Z emaste $"); +ELFTC_VCSID("$Id: readelf.c 3484 2016-08-03 13:36:49Z emaste $"); /* Backwards compatability for older FreeBSD releases. */ #ifndef STB_GNU_UNIQUE @@ -440,6 +440,7 @@ elf_osabi(unsigned int abi) case ELFOSABI_OPENVMS: return "OpenVMS"; case ELFOSABI_NSK: return "NSK"; case ELFOSABI_CLOUDABI: return "CloudABI"; + case ELFOSABI_ARM_AEABI: return "ARM EABI"; case ELFOSABI_ARM: return "ARM"; case ELFOSABI_STANDALONE: return "StandAlone"; default: @@ -2787,6 +2788,8 @@ dump_rel(struct readelf *re, struct sect const char *symname; uint64_t symval; int i, len; + uint32_t type; + uint8_t type2, type3; if (s->link >= re->shnum) return; @@ -2796,8 +2799,8 @@ dump_rel(struct readelf *re, struct sect elftc_reloc_type_str(re->ehdr.e_machine, \ ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname #define REL_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \ - elftc_reloc_type_str(re->ehdr.e_machine, \ - ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname + elftc_reloc_type_str(re->ehdr.e_machine, type), \ + (uintmax_t)symval, symname printf("\nRelocation section (%s):\n", s->name); if (re->ec == ELFCLASS32) @@ -2823,12 +2826,37 @@ dump_rel(struct readelf *re, struct sect ELF64_R_TYPE(r.r_info)); printf("%8.8jx %8.8jx %-19.19s %8.8jx %s\n", REL_CT32); } else { + type = ELF64_R_TYPE(r.r_info); + if (re->ehdr.e_machine == EM_MIPS) { + type2 = (type >> 8) & 0xFF; + type3 = (type >> 16) & 0xFF; + type = type & 0xFF; + } else { + type2 = type3 = 0; + } if (re->options & RE_WW) printf("%16.16jx %16.16jx %-24.24s" " %16.16jx %s\n", REL_CT64); else printf("%12.12jx %12.12jx %-19.19s" " %16.16jx %s\n", REL_CT64); + if (re->ehdr.e_machine == EM_MIPS) { + if (re->options & RE_WW) { + printf("%32s: %s\n", "Type2", + elftc_reloc_type_str(EM_MIPS, + type2)); + printf("%32s: %s\n", "Type3", + elftc_reloc_type_str(EM_MIPS, + type3)); + } else { + printf("%24s: %s\n", "Type2", + elftc_reloc_type_str(EM_MIPS, + type2)); + printf("%24s: %s\n", "Type3", + elftc_reloc_type_str(EM_MIPS, + type3)); + } + } } } @@ -2843,6 +2871,8 @@ dump_rela(struct readelf *re, struct sec const char *symname; uint64_t symval; int i, len; + uint32_t type; + uint8_t type2, type3; if (s->link >= re->shnum) return; @@ -2853,8 +2883,8 @@ dump_rela(struct readelf *re, struct sec elftc_reloc_type_str(re->ehdr.e_machine, \ ELF32_R_TYPE(r.r_info)), (uintmax_t)symval, symname #define RELA_CT64 (uintmax_t)r.r_offset, (uintmax_t)r.r_info, \ - elftc_reloc_type_str(re->ehdr.e_machine, \ - ELF64_R_TYPE(r.r_info)), (uintmax_t)symval, symname + elftc_reloc_type_str(re->ehdr.e_machine, type), \ + (uintmax_t)symval, symname printf("\nRelocation section with addend (%s):\n", s->name); if (re->ec == ELFCLASS32) @@ -2881,6 +2911,14 @@ dump_rela(struct readelf *re, struct sec printf("%8.8jx %8.8jx %-19.19s %8.8jx %s", RELA_CT32); printf(" + %x\n", (uint32_t) r.r_addend); } else { + type = ELF64_R_TYPE(r.r_info); + if (re->ehdr.e_machine == EM_MIPS) { + type2 = (type >> 8) & 0xFF; + type3 = (type >> 16) & 0xFF; + type = type & 0xFF; + } else { + type2 = type3 = 0; + } if (re->options & RE_WW) printf("%16.16jx %16.16jx %-24.24s" " %16.16jx %s", RELA_CT64); @@ -2888,6 +2926,23 @@ dump_rela(struct readelf *re, struct sec printf("%12.12jx %12.12jx %-19.19s" " %16.16jx %s", RELA_CT64); printf(" + %jx\n", (uintmax_t) r.r_addend); + if (re->ehdr.e_machine == EM_MIPS) { + if (re->options & RE_WW) { + printf("%32s: %s\n", "Type2", + elftc_reloc_type_str(EM_MIPS, + type2)); + printf("%32s: %s\n", "Type3", + elftc_reloc_type_str(EM_MIPS, + type3)); + } else { + printf("%24s: %s\n", "Type2", + elftc_reloc_type_str(EM_MIPS, + type2)); + printf("%24s: %s\n", "Type3", + elftc_reloc_type_str(EM_MIPS, + type3)); + } + } } } Modified: stable/11/lib/libelftc/Makefile ============================================================================== --- stable/11/lib/libelftc/Makefile Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/lib/libelftc/Makefile Thu Sep 15 17:28:03 2016 (r305844) @@ -16,6 +16,7 @@ SRCS= elftc_bfdtarget.c elftc_reloc_type_str.c \ elftc_set_timestamps.c \ elftc_string_table.c \ + elftc_timestamp.c \ elftc_version.c \ libelftc_bfdtarget.c \ libelftc_dem_arm.c \ Modified: stable/11/lib/libelftc/elftc_version.c ============================================================================== --- stable/11/lib/libelftc/elftc_version.c Thu Sep 15 17:25:52 2016 (r305843) +++ stable/11/lib/libelftc/elftc_version.c Thu Sep 15 17:28:03 2016 (r305844) @@ -6,5 +6,5 @@ const char * elftc_version(void) { - return "elftoolchain r3477M"; + return "elftoolchain r3490M"; } From owner-svn-src-stable@freebsd.org Thu Sep 15 17:30:03 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60A93BDB227; Thu, 15 Sep 2016 17:30:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 173A580B; Thu, 15 Sep 2016 17:30:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHU2QL081888; Thu, 15 Sep 2016 17:30:02 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHU2Wi081886; Thu, 15 Sep 2016 17:30:02 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151730.u8FHU2Wi081886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:30: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: r305845 - in stable/11/sys/boot/efi: boot1 loader X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:30:03 -0000 Author: emaste Date: Thu Sep 15 17:30:01 2016 New Revision: 305845 URL: https://svnweb.freebsd.org/changeset/base/305845 Log: MFC r305160: Set UEFI boot loader PE/COFF timestamps to known value for reproducible builds Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/boot/efi/boot1/Makefile stable/11/sys/boot/efi/loader/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/efi/boot1/Makefile ============================================================================== --- stable/11/sys/boot/efi/boot1/Makefile Thu Sep 15 17:28:03 2016 (r305844) +++ stable/11/sys/boot/efi/boot1/Makefile Thu Sep 15 17:30:01 2016 (r305845) @@ -84,11 +84,15 @@ EFI_TARGET= efi-app-ia32 EFI_TARGET= binary .endif +# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 +# for build reproducibility. +SOURCE_DATE_EPOCH?=1451606400 boot1.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ fi + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame \ Modified: stable/11/sys/boot/efi/loader/Makefile ============================================================================== --- stable/11/sys/boot/efi/loader/Makefile Thu Sep 15 17:28:03 2016 (r305844) +++ stable/11/sys/boot/efi/loader/Makefile Thu Sep 15 17:30:01 2016 (r305845) @@ -128,11 +128,15 @@ EFI_TARGET= efi-app-ia32 EFI_TARGET= binary .endif +# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 +# for build reproducibility. +SOURCE_DATE_EPOCH?=1451606400 loader.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ fi + SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ From owner-svn-src-stable@freebsd.org Thu Sep 15 17:34:15 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C43E1BDB4D3; Thu, 15 Sep 2016 17:34:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 914DFCE9; Thu, 15 Sep 2016 17:34:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHYEnn085531; Thu, 15 Sep 2016 17:34:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHYEpl085530; Thu, 15 Sep 2016 17:34:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151734.u8FHYEpl085530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:34:14 +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: r305846 - stable/11/sys/dev/kbd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:34:15 -0000 Author: emaste Date: Thu Sep 15 17:34:14 2016 New Revision: 305846 URL: https://svnweb.freebsd.org/changeset/base/305846 Log: MFC r303335: apply some style(9) to kbd: make function name start in column 1 Modified: stable/11/sys/dev/kbd/kbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/kbd/kbd.c ============================================================================== --- stable/11/sys/dev/kbd/kbd.c Thu Sep 15 17:30:01 2016 (r305845) +++ stable/11/sys/dev/kbd/kbd.c Thu Sep 15 17:34:14 2016 (r305846) @@ -284,8 +284,8 @@ kbd_unregister(keyboard_t *kbd) } /* find a function table by the driver name */ -keyboard_switch_t -*kbd_get_switch(char *driver) +keyboard_switch_t * +kbd_get_switch(char *driver) { const keyboard_driver_t **list; const keyboard_driver_t *p; @@ -419,8 +419,8 @@ kbd_change_callback(keyboard_t *kbd, voi } /* get a keyboard structure */ -keyboard_t -*kbd_get_keyboard(int index) +keyboard_t * +kbd_get_keyboard(int index) { if ((index < 0) || (index >= keyboards)) return (NULL); @@ -1118,8 +1118,8 @@ fkey_change_ok(fkeytab_t *oldkey, fkeyar #endif /* get a pointer to the string associated with the given function key */ -u_char -*genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len) +u_char * +genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len) { if (kbd == NULL) return (NULL); @@ -1131,8 +1131,8 @@ u_char } /* diagnostic dump */ -static char -*get_kbd_type_name(int type) +static char * +get_kbd_type_name(int type) { static struct { int type; From owner-svn-src-stable@freebsd.org Thu Sep 15 17:36:44 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94775BDB646; Thu, 15 Sep 2016 17:36:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61188F99; Thu, 15 Sep 2016 17:36:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHahid085671; Thu, 15 Sep 2016 17:36:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHahvU085670; Thu, 15 Sep 2016 17:36:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151736.u8FHahvU085670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:36:43 +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: r305847 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:36:44 -0000 Author: emaste Date: Thu Sep 15 17:36:43 2016 New Revision: 305847 URL: https://svnweb.freebsd.org/changeset/base/305847 Log: MFC r303670: Add ELFOSABI_ARM_AEABI ELF OSABI constant Modified: stable/11/sys/sys/elf_common.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/elf_common.h ============================================================================== --- stable/11/sys/sys/elf_common.h Thu Sep 15 17:34:14 2016 (r305846) +++ stable/11/sys/sys/elf_common.h Thu Sep 15 17:36:43 2016 (r305847) @@ -171,6 +171,7 @@ typedef struct { #define ELFOSABI_AROS 15 /* Amiga Research OS */ #define ELFOSABI_FENIXOS 16 /* FenixOS */ #define ELFOSABI_CLOUDABI 17 /* Nuxi CloudABI */ +#define ELFOSABI_ARM_AEABI 64 /* ARM EABI */ #define ELFOSABI_ARM 97 /* ARM */ #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */ From owner-svn-src-stable@freebsd.org Thu Sep 15 17:37:32 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10C08BDB6CA; Thu, 15 Sep 2016 17:37:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D46A8179; Thu, 15 Sep 2016 17:37:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8FHbVbY085758; Thu, 15 Sep 2016 17:37:31 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8FHbUYL085756; Thu, 15 Sep 2016 17:37:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201609151737.u8FHbUYL085756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 15 Sep 2016 17:37: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: r305848 - in stable/11/sys: arm/include sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2016 17:37:32 -0000 Author: emaste Date: Thu Sep 15 17:37:30 2016 New Revision: 305848 URL: https://svnweb.freebsd.org/changeset/base/305848 Log: MFC r303677: Move/add ARM ELF PHDR types to elf_common.h Modified: stable/11/sys/arm/include/elf.h stable/11/sys/sys/elf_common.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/elf.h ============================================================================== --- stable/11/sys/arm/include/elf.h Thu Sep 15 17:36:43 2016 (r305847) +++ stable/11/sys/arm/include/elf.h Thu Sep 15 17:37:30 2016 (r305848) @@ -55,9 +55,6 @@ __ElfType(Auxinfo); #define ELF_MACHINE_OK(x) ((x) == EM_ARM) -/* Unwind info section type */ -#define PT_ARM_EXIDX (PT_LOPROC + 1) - /* * Relocation types. */ Modified: stable/11/sys/sys/elf_common.h ============================================================================== --- stable/11/sys/sys/elf_common.h Thu Sep 15 17:36:43 2016 (r305847) +++ stable/11/sys/sys/elf_common.h Thu Sep 15 17:37:30 2016 (r305848) @@ -511,6 +511,8 @@ typedef struct { #define PT_HISUNW 0x6fffffff #define PT_HIOS 0x6fffffff /* Last OS-specific. */ #define PT_LOPROC 0x70000000 /* First processor-specific type. */ +#define PT_ARM_ARCHEXT 0x70000000 /* ARM arch compat information. */ +#define PT_ARM_EXIDX 0x70000001 /* ARM exception unwind tables. */ #define PT_HIPROC 0x7fffffff /* Last processor-specific type. */ /* Values for p_flags. */ From owner-svn-src-stable@freebsd.org Fri Sep 16 00:14:27 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9000DBDC7A7; Fri, 16 Sep 2016 00:14:27 +0000 (UTC) (envelope-from hiren@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 mx1.freebsd.org (Postfix) with ESMTPS id 6C060B6C; Fri, 16 Sep 2016 00:14:27 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8G0EQXB036801; Fri, 16 Sep 2016 00:14:26 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8G0EQKU036798; Fri, 16 Sep 2016 00:14:26 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201609160014.u8G0EQKU036798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Fri, 16 Sep 2016 00:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r305853 - in stable/10: share/man/man4 sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 00:14:27 -0000 Author: hiren Date: Fri Sep 16 00:14:26 2016 New Revision: 305853 URL: https://svnweb.freebsd.org/changeset/base/305853 Log: MFC r301522 (by bz) Implement a `show panic` command to DDB which will helpfully print the panic string again if set, in case it scrolled out of the active window. This avoids having to remember the symbol name. Also add a show callout command to DDB in order to inspect some struct callout fields in case of panics in the callout code. This may help to see if there was memory corruption or to further ease debugging problems. No objection by: bz Modified: stable/10/share/man/man4/ddb.4 stable/10/sys/kern/kern_shutdown.c stable/10/sys/kern/kern_timeout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ddb.4 ============================================================================== --- stable/10/share/man/man4/ddb.4 Fri Sep 16 00:08:37 2016 (r305852) +++ stable/10/share/man/man4/ddb.4 Fri Sep 16 00:14:26 2016 (r305853) @@ -611,6 +611,13 @@ See the header file for more details on the exact meaning of the structure fields. .\" .Pp +.It Ic show Cm callout Ar addr +Show information about the callout structure +.Vt struct callout +present at +.Ar addr . +.\" +.Pp .It Ic show Cm cbstat Show brief information about the TTY subsystem. .\" @@ -839,6 +846,10 @@ option is specified the complete object is printed. .\" .Pp +.It Ic show Cm panic +Print the panic message if set. +.\" +.Pp .It Ic show Cm page Show statistics on VM pages. .\" Modified: stable/10/sys/kern/kern_shutdown.c ============================================================================== --- stable/10/sys/kern/kern_shutdown.c Fri Sep 16 00:08:37 2016 (r305852) +++ stable/10/sys/kern/kern_shutdown.c Fri Sep 16 00:14:26 2016 (r305853) @@ -1031,3 +1031,14 @@ mkdumpheader(struct kerneldumpheader *kd strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); kdh->parity = kerneldump_parity(kdh); } + +#ifdef DDB +DB_SHOW_COMMAND(panic, db_show_panic) +{ + + if (panicstr == NULL) + db_printf("panicstr not set\n"); + else + db_printf("panic: %s\n", panicstr); +} +#endif Modified: stable/10/sys/kern/kern_timeout.c ============================================================================== --- stable/10/sys/kern/kern_timeout.c Fri Sep 16 00:08:37 2016 (r305852) +++ stable/10/sys/kern/kern_timeout.c Fri Sep 16 00:14:26 2016 (r305853) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_callout_profiling.h" #include "opt_kdtrace.h" +#include "opt_ddb.h" #if defined(__arm__) #include "opt_timer.h" #endif @@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef DDB +#include +#include +#endif + #ifdef SMP #include #endif @@ -1576,3 +1582,34 @@ SYSCTL_PROC(_kern, OID_AUTO, callout_sta CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_callout_stat, "I", "Dump immediate statistic snapshot of the scheduled callouts"); + +#ifdef DDB +static void +_show_callout(struct callout *c) +{ + + db_printf("callout %p\n", c); +#define C_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, c->e); + db_printf(" &c_links = %p\n", &(c->c_links)); + C_DB_PRINTF("%" PRId64, c_time); + C_DB_PRINTF("%" PRId64, c_precision); + C_DB_PRINTF("%p", c_arg); + C_DB_PRINTF("%p", c_func); + C_DB_PRINTF("%p", c_lock); + C_DB_PRINTF("%#x", c_flags); + C_DB_PRINTF("%#x", c_iflags); + C_DB_PRINTF("%d", c_cpu); +#undef C_DB_PRINTF +} + +DB_SHOW_COMMAND(callout, db_show_callout) +{ + + if (!have_addr) { + db_printf("usage: show callout \n"); + return; + } + + _show_callout((struct callout *)addr); +} +#endif /* DDB */ From owner-svn-src-stable@freebsd.org Fri Sep 16 10:04:31 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FAC3BDC141; Fri, 16 Sep 2016 10:04:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6C4F912C; Fri, 16 Sep 2016 10:04:31 +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 u8GA4UbB059899; Fri, 16 Sep 2016 10:04:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GA4SUY059878; Fri, 16 Sep 2016 10:04:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609161004.u8GA4SUY059878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 16 Sep 2016 10:04:28 +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: r305866 - in stable/11: lib/libc lib/libc/aarch64/sys lib/libc/amd64/sys lib/libc/arm/sys lib/libc/i386/sys lib/libc/sys lib/libc/x86 sys/arm/arm sys/arm/include sys/arm64/arm64 sys/arm... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 10:04:31 -0000 Author: kib Date: Fri Sep 16 10:04:28 2016 New Revision: 305866 URL: https://svnweb.freebsd.org/changeset/base/305866 Log: MFC r304285: Implement userspace gettimeofday(2) with HPET timecounter. Added: stable/11/lib/libc/x86/ - copied from r304285, head/lib/libc/x86/ Deleted: stable/11/lib/libc/amd64/sys/__vdso_gettc.c stable/11/lib/libc/i386/sys/__vdso_gettc.c Modified: stable/11/lib/libc/Makefile stable/11/lib/libc/aarch64/sys/__vdso_gettc.c stable/11/lib/libc/amd64/sys/Makefile.inc stable/11/lib/libc/arm/sys/__vdso_gettc.c stable/11/lib/libc/i386/sys/Makefile.inc stable/11/lib/libc/sys/__vdso_gettimeofday.c stable/11/lib/libc/sys/trivial-vdso_tc.c stable/11/sys/arm/arm/generic_timer.c stable/11/sys/arm/arm/machdep.c stable/11/sys/arm/include/md_var.h stable/11/sys/arm/include/vdso.h stable/11/sys/arm64/arm64/machdep.c stable/11/sys/arm64/include/md_var.h stable/11/sys/arm64/include/vdso.h stable/11/sys/dev/acpica/acpi_hpet.c stable/11/sys/dev/acpica/acpi_hpet.h stable/11/sys/kern/kern_tc.c stable/11/sys/sys/timetc.h stable/11/sys/sys/vdso.h stable/11/sys/x86/include/vdso.h stable/11/sys/x86/x86/tsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/Makefile ============================================================================== --- stable/11/lib/libc/Makefile Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/Makefile Fri Sep 16 10:04:28 2016 (r305866) @@ -110,6 +110,9 @@ NOASM= ${LIBC_ARCH} == "mips" .include "${LIBC_SRCTOP}/softfloat/Makefile.inc" .endif +.if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64" +.include "${LIBC_SRCTOP}/x86/sys/Makefile.inc" +.endif .if ${MK_NIS} != "no" CFLAGS+= -DYP .include "${LIBC_SRCTOP}/yp/Makefile.inc" Modified: stable/11/lib/libc/aarch64/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/aarch64/sys/__vdso_gettc.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/aarch64/sys/__vdso_gettc.c Fri Sep 16 10:04:28 2016 (r305866) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libc_private.h" static inline uint64_t @@ -55,14 +56,15 @@ cp15_cntpct_get(void) } #pragma weak __vdso_gettc -u_int -__vdso_gettc(const struct vdso_timehands *th) +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) { - uint64_t val; + if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM) + return (ENOSYS); __asm __volatile("isb" : : : "memory"); - val = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get(); - return (val); + *tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get(); + return (0); } #pragma weak __vdso_gettimekeep Modified: stable/11/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- stable/11/lib/libc/amd64/sys/Makefile.inc Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/amd64/sys/Makefile.inc Fri Sep 16 10:04:28 2016 (r305866) @@ -2,7 +2,7 @@ # $FreeBSD$ SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \ - amd64_set_gsbase.c __vdso_gettc.c + amd64_set_gsbase.c MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \ sbrk.S setlogin.S sigreturn.S Modified: stable/11/lib/libc/arm/sys/__vdso_gettc.c ============================================================================== --- stable/11/lib/libc/arm/sys/__vdso_gettc.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/arm/sys/__vdso_gettc.c Fri Sep 16 10:04:28 2016 (r305866) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libc_private.h" #if __ARM_ARCH >= 6 @@ -58,11 +59,12 @@ cp15_cntpct_get(void) #endif #pragma weak __vdso_gettc -u_int -__vdso_gettc(const struct vdso_timehands *th) +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) { - uint64_t val; + if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM) + return (ENOSYS); #if __ARM_ARCH >= 6 /* * Userspace gettimeofday() is only enabled on ARMv7 CPUs, but @@ -70,11 +72,12 @@ __vdso_gettc(const struct vdso_timehands * armv7-a directive does not work. */ __asm __volatile(".word\t0xf57ff06f" : : : "memory"); /* isb */ - val = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get(); + *tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get(); + return (0); #else - val = 0; + *tc = 0; + return (ENOSYS); #endif - return (val); } #pragma weak __vdso_gettimekeep Modified: stable/11/lib/libc/i386/sys/Makefile.inc ============================================================================== --- stable/11/lib/libc/i386/sys/Makefile.inc Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/i386/sys/Makefile.inc Fri Sep 16 10:04:28 2016 (r305866) @@ -5,8 +5,7 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c .endif SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ - i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c \ - __vdso_gettc.c + i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \ sbrk.S setlogin.S sigreturn.S syscall.S Modified: stable/11/lib/libc/sys/__vdso_gettimeofday.c ============================================================================== --- stable/11/lib/libc/sys/__vdso_gettimeofday.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/sys/__vdso_gettimeofday.c Fri Sep 16 10:04:28 2016 (r305866) @@ -34,12 +34,16 @@ __FBSDID("$FreeBSD$"); #include #include "libc_private.h" -static u_int -tc_delta(const struct vdso_timehands *th) +static int +tc_delta(const struct vdso_timehands *th, u_int *delta) { + int error; + u_int tc; - return ((__vdso_gettc(th) - th->th_offset_count) & - th->th_counter_mask); + error = __vdso_gettc(th, &tc); + if (error == 0) + *delta = (tc - th->th_offset_count) & th->th_counter_mask; + return (error); } /* @@ -56,6 +60,8 @@ binuptime(struct bintime *bt, struct vds { struct vdso_timehands *th; uint32_t curr, gen; + u_int delta; + int error; do { if (!tk->tk_enabled) @@ -63,11 +69,14 @@ binuptime(struct bintime *bt, struct vds curr = atomic_load_acq_32(&tk->tk_current); th = &tk->tk_th[curr]; - if (th->th_algo != VDSO_TH_ALGO_1) - return (ENOSYS); gen = atomic_load_acq_32(&th->th_gen); *bt = th->th_offset; - bintime_addx(bt, th->th_scale * tc_delta(th)); + error = tc_delta(th, &delta); + if (error == EAGAIN) + continue; + if (error != 0) + return (error); + bintime_addx(bt, th->th_scale * delta); if (abs) bintime_add(bt, &th->th_boottime); Modified: stable/11/lib/libc/sys/trivial-vdso_tc.c ============================================================================== --- stable/11/lib/libc/sys/trivial-vdso_tc.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/lib/libc/sys/trivial-vdso_tc.c Fri Sep 16 10:04:28 2016 (r305866) @@ -32,11 +32,11 @@ __FBSDID("$FreeBSD$"); #include #pragma weak __vdso_gettc -u_int -__vdso_gettc(const struct vdso_timehands *th) +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) { - return (0); + return (ENOSYS); } #pragma weak __vdso_gettimekeep Modified: stable/11/sys/arm/arm/generic_timer.c ============================================================================== --- stable/11/sys/arm/arm/generic_timer.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm/arm/generic_timer.c Fri Sep 16 10:04:28 2016 (r305866) @@ -105,6 +105,10 @@ static struct resource_spec timer_spec[] { -1, 0 } }; +static uint32_t arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); +static void arm_tmr_do_delay(int usec, void *); + static timecounter_get_t arm_tmr_get_timecount; static struct timecounter arm_tmr_timecount = { @@ -114,6 +118,7 @@ static struct timecounter arm_tmr_timeco .tc_counter_mask = ~0u, .tc_frequency = 0, .tc_quality = 1000, + .tc_fill_vdso_timehands = arm_tmr_fill_vdso_timehands, }; #ifdef __arm__ @@ -128,10 +133,6 @@ static struct timecounter arm_tmr_timeco #define set_el1(x, val) WRITE_SPECIALREG(x ##_el1, val) #endif -static uint32_t arm_tmr_fill_vdso_timehands(struct vdso_timehands *vdso_th, - struct timecounter *tc); -static void arm_tmr_do_delay(int usec, void *); - static int get_freq(void) { @@ -412,8 +413,6 @@ arm_tmr_attach(device_t dev) } } - arm_cpu_fill_vdso_timehands = arm_tmr_fill_vdso_timehands; - arm_tmr_timecount.tc_frequency = sc->clkfreq; tc_init(&arm_tmr_timecount); @@ -535,7 +534,8 @@ arm_tmr_fill_vdso_timehands(struct vdso_ struct timecounter *tc) { + vdso_th->th_algo = VDSO_TH_ALGO_ARM_GENTIM; vdso_th->th_physical = arm_tmr_sc->physical; bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); - return (tc == &arm_tmr_timecount); + return (1); } Modified: stable/11/sys/arm/arm/machdep.c ============================================================================== --- stable/11/sys/arm/arm/machdep.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm/arm/machdep.c Fri Sep 16 10:04:28 2016 (r305866) @@ -1996,14 +1996,3 @@ initarm(struct arm_boot_params *abp) #endif /* __ARM_ARCH < 6 */ #endif /* FDT */ - -uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *, - struct timecounter *); - -uint32_t -cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc) -{ - - return (arm_cpu_fill_vdso_timehands != NULL ? - arm_cpu_fill_vdso_timehands(vdso_th, tc) : 0); -} Modified: stable/11/sys/arm/include/md_var.h ============================================================================== --- stable/11/sys/arm/include/md_var.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm/include/md_var.h Fri Sep 16 10:04:28 2016 (r305866) @@ -45,11 +45,6 @@ extern int (*_arm_bzero)(void *, int, in extern int _min_memcpy_size; extern int _min_bzero_size; -struct vdso_timehands; -struct timecounter; -extern uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *, - struct timecounter *); - #define DST_IS_USER 0x1 #define SRC_IS_USER 0x2 #define IS_PHYSICAL 0x4 Modified: stable/11/sys/arm/include/vdso.h ============================================================================== --- stable/11/sys/arm/include/vdso.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm/include/vdso.h Fri Sep 16 10:04:28 2016 (r305866) @@ -32,4 +32,6 @@ uint32_t th_physical; \ uint32_t th_res[7]; +#define VDSO_TH_ALGO_ARM_GENTIM VDSO_TH_ALGO_1 + #endif Modified: stable/11/sys/arm64/arm64/machdep.c ============================================================================== --- stable/11/sys/arm64/arm64/machdep.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm64/arm64/machdep.c Fri Sep 16 10:04:28 2016 (r305866) @@ -927,17 +927,6 @@ initarm(struct arm64_bootparams *abp) early_boot = 0; } -uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *, - struct timecounter *); - -uint32_t -cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc) -{ - - return (arm_cpu_fill_vdso_timehands != NULL ? - arm_cpu_fill_vdso_timehands(vdso_th, tc) : 0); -} - #ifdef DDB #include Modified: stable/11/sys/arm64/include/md_var.h ============================================================================== --- stable/11/sys/arm64/include/md_var.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm64/include/md_var.h Fri Sep 16 10:04:28 2016 (r305866) @@ -47,9 +47,4 @@ void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); int minidumpsys(struct dumperinfo *); -struct vdso_timehands; -struct timecounter; -extern uint32_t (*arm_cpu_fill_vdso_timehands)(struct vdso_timehands *, - struct timecounter *); - #endif /* !_MACHINE_MD_VAR_H_ */ Modified: stable/11/sys/arm64/include/vdso.h ============================================================================== --- stable/11/sys/arm64/include/vdso.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/arm64/include/vdso.h Fri Sep 16 10:04:28 2016 (r305866) @@ -32,4 +32,6 @@ uint32_t th_physical; \ uint32_t th_res[7]; +#define VDSO_TH_ALGO_ARM_GENTIM VDSO_TH_ALGO_1 + #endif /* !_MACHINE_VDSO_H_ */ Modified: stable/11/sys/dev/acpica/acpi_hpet.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_hpet.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/dev/acpica/acpi_hpet.c Fri Sep 16 10:04:28 2016 (r305866) @@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_compat.h" + #if defined(__amd64__) #define DEV_APIC #else @@ -47,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -141,6 +144,35 @@ hpet_get_timecount(struct timecounter *t return (bus_read_4(sc->mem_res, HPET_MAIN_COUNTER)); } +uint32_t +hpet_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc) +{ + struct hpet_softc *sc; + + sc = tc->tc_priv; + vdso_th->th_algo = VDSO_TH_ALGO_X86_HPET; + vdso_th->th_x86_shift = 0; + vdso_th->th_x86_hpet_idx = device_get_unit(sc->dev); + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (sc->mmap_allow != 0); +} + +#ifdef COMPAT_FREEBSD32 +uint32_t +hpet_vdso_timehands32(struct vdso_timehands32 *vdso_th32, + struct timecounter *tc) +{ + struct hpet_softc *sc; + + sc = tc->tc_priv; + vdso_th32->th_algo = VDSO_TH_ALGO_X86_HPET; + vdso_th32->th_x86_shift = 0; + vdso_th32->th_x86_hpet_idx = device_get_unit(sc->dev); + bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res)); + return (sc->mmap_allow != 0); +} +#endif + static void hpet_enable(struct hpet_softc *sc) { @@ -537,6 +569,10 @@ hpet_attach(device_t dev) sc->tc.tc_quality = 950, sc->tc.tc_frequency = sc->freq; sc->tc.tc_priv = sc; + sc->tc.tc_fill_vdso_timehands = hpet_vdso_timehands; +#ifdef COMPAT_FREEBSD32 + sc->tc.tc_fill_vdso_timehands32 = hpet_vdso_timehands32; +#endif tc_init(&sc->tc); } /* If not disabled - setup and announce event timers. */ Modified: stable/11/sys/dev/acpica/acpi_hpet.h ============================================================================== --- stable/11/sys/dev/acpica/acpi_hpet.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/dev/acpica/acpi_hpet.h Fri Sep 16 10:04:28 2016 (r305866) @@ -64,4 +64,15 @@ #define HPET_MIN_CYCLES 128 /* Period considered reliable. */ +#ifdef _KERNEL +struct timecounter; +struct vdso_timehands; +struct vdso_timehands32; + +uint32_t hpet_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); +uint32_t hpet_vdso_timehands32(struct vdso_timehands32 *vdso_th32, + struct timecounter *tc); +#endif + #endif /* !__ACPI_HPET_H__ */ Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/kern/kern_tc.c Fri Sep 16 10:04:28 2016 (r305866) @@ -6,11 +6,14 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (c) 2011, 2015, 2016 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by Julien Ridoux at the University * of Melbourne under sponsorship from the FreeBSD Foundation. + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. */ #include @@ -2134,13 +2137,16 @@ tc_fill_vdso_timehands(struct vdso_timeh uint32_t enabled; th = timehands; - vdso_th->th_algo = VDSO_TH_ALGO_1; vdso_th->th_scale = th->th_scale; vdso_th->th_offset_count = th->th_offset_count; vdso_th->th_counter_mask = th->th_counter->tc_counter_mask; vdso_th->th_offset = th->th_offset; vdso_th->th_boottime = th->th_boottime; - enabled = cpu_fill_vdso_timehands(vdso_th, th->th_counter); + if (th->th_counter->tc_fill_vdso_timehands != NULL) { + enabled = th->th_counter->tc_fill_vdso_timehands(vdso_th, + th->th_counter); + } else + enabled = 0; if (!vdso_th_enable) enabled = 0; return (enabled); @@ -2154,7 +2160,6 @@ tc_fill_vdso_timehands32(struct vdso_tim uint32_t enabled; th = timehands; - vdso_th32->th_algo = VDSO_TH_ALGO_1; *(uint64_t *)&vdso_th32->th_scale[0] = th->th_scale; vdso_th32->th_offset_count = th->th_offset_count; vdso_th32->th_counter_mask = th->th_counter->tc_counter_mask; @@ -2162,7 +2167,11 @@ tc_fill_vdso_timehands32(struct vdso_tim *(uint64_t *)&vdso_th32->th_offset.frac[0] = th->th_offset.frac; vdso_th32->th_boottime.sec = th->th_boottime.sec; *(uint64_t *)&vdso_th32->th_boottime.frac[0] = th->th_boottime.frac; - enabled = cpu_fill_vdso_timehands32(vdso_th32, th->th_counter); + if (th->th_counter->tc_fill_vdso_timehands32 != NULL) { + enabled = th->th_counter->tc_fill_vdso_timehands32(vdso_th32, + th->th_counter); + } else + enabled = 0; if (!vdso_th_enable) enabled = 0; return (enabled); Modified: stable/11/sys/sys/timetc.h ============================================================================== --- stable/11/sys/sys/timetc.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/sys/timetc.h Fri Sep 16 10:04:28 2016 (r305866) @@ -28,8 +28,14 @@ */ struct timecounter; +struct vdso_timehands; +struct vdso_timehands32; typedef u_int timecounter_get_t(struct timecounter *); typedef void timecounter_pps_t(struct timecounter *); +typedef uint32_t timecounter_fill_vdso_timehands_t(struct vdso_timehands *, + struct timecounter *); +typedef uint32_t timecounter_fill_vdso_timehands32_t(struct vdso_timehands32 *, + struct timecounter *); struct timecounter { timecounter_get_t *tc_get_timecount; @@ -68,6 +74,8 @@ struct timecounter { /* Pointer to the timecounter's private parts. */ struct timecounter *tc_next; /* Pointer to the next timecounter. */ + timecounter_fill_vdso_timehands_t *tc_fill_vdso_timehands; + timecounter_fill_vdso_timehands32_t *tc_fill_vdso_timehands32; }; extern struct timecounter *timecounter; Modified: stable/11/sys/sys/vdso.h ============================================================================== --- stable/11/sys/sys/vdso.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/sys/vdso.h Fri Sep 16 10:04:28 2016 (r305866) @@ -53,6 +53,7 @@ struct vdso_timekeep { #define VDSO_TK_VER_1 0x1 #define VDSO_TK_VER_CURR VDSO_TK_VER_1 #define VDSO_TH_ALGO_1 0x1 +#define VDSO_TH_ALGO_2 0x2 #ifndef _KERNEL @@ -62,7 +63,7 @@ struct timezone; int __vdso_clock_gettime(clockid_t clock_id, struct timespec *ts); int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz); -u_int __vdso_gettc(const struct vdso_timehands *vdso_th); +int __vdso_gettc(const struct vdso_timehands *vdso_th, u_int *tc); int __vdso_gettimekeep(struct vdso_timekeep **tk); #endif Modified: stable/11/sys/x86/include/vdso.h ============================================================================== --- stable/11/sys/x86/include/vdso.h Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/x86/include/vdso.h Fri Sep 16 10:04:28 2016 (r305866) @@ -1,7 +1,11 @@ /*- * Copyright 2012 Konstantin Belousov . + * Copyright 2016 The FreeBSD Foundation. * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -30,7 +34,11 @@ #define VDSO_TIMEHANDS_MD \ uint32_t th_x86_shift; \ - uint32_t th_res[7]; + uint32_t th_x86_hpet_idx; \ + uint32_t th_res[6]; + +#define VDSO_TH_ALGO_X86_TSC VDSO_TH_ALGO_1 +#define VDSO_TH_ALGO_X86_HPET VDSO_TH_ALGO_2 #ifdef _KERNEL #ifdef COMPAT_FREEBSD32 Modified: stable/11/sys/x86/x86/tsc.c ============================================================================== --- stable/11/sys/x86/x86/tsc.c Fri Sep 16 07:09:35 2016 (r305865) +++ stable/11/sys/x86/x86/tsc.c Fri Sep 16 10:04:28 2016 (r305866) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "cpufreq_if.h" @@ -93,14 +94,22 @@ static unsigned tsc_get_timecount_low_lf static unsigned tsc_get_timecount_mfence(struct timecounter *tc); static unsigned tsc_get_timecount_low_mfence(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); +static uint32_t x86_tsc_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); +#ifdef COMPAT_FREEBSD32 +static uint32_t x86_tsc_vdso_timehands32(struct vdso_timehands32 *vdso_th32, + struct timecounter *tc); +#endif static struct timecounter tsc_timecounter = { - tsc_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - ~0u, /* counter_mask */ - 0, /* frequency */ - "TSC", /* name */ - 800, /* quality (adjusted in code) */ + .tc_get_timecount = tsc_get_timecount, + .tc_counter_mask = ~0u, + .tc_name = "TSC", + .tc_quality = 800, /* adjusted in code */ + .tc_fill_vdso_timehands = x86_tsc_vdso_timehands, +#ifdef COMPAT_FREEBSD32 + .tc_fill_vdso_timehands32 = x86_tsc_vdso_timehands32, +#endif }; static void @@ -724,23 +733,27 @@ tsc_get_timecount_low_mfence(struct time return (tsc_get_timecount_low(tc)); } -uint32_t -cpu_fill_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc) +static uint32_t +x86_tsc_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc) { + vdso_th->th_algo = VDSO_TH_ALGO_X86_TSC; vdso_th->th_x86_shift = (int)(intptr_t)tc->tc_priv; + vdso_th->th_x86_hpet_idx = 0xffffffff; bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); - return (tc == &tsc_timecounter); + return (1); } #ifdef COMPAT_FREEBSD32 -uint32_t -cpu_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32, +static uint32_t +x86_tsc_vdso_timehands32(struct vdso_timehands32 *vdso_th32, struct timecounter *tc) { + vdso_th32->th_algo = VDSO_TH_ALGO_X86_TSC; vdso_th32->th_x86_shift = (int)(intptr_t)tc->tc_priv; + vdso_th32->th_x86_hpet_idx = 0xffffffff; bzero(vdso_th32->th_res, sizeof(vdso_th32->th_res)); - return (tc == &tsc_timecounter); + return (1); } #endif From owner-svn-src-stable@freebsd.org Fri Sep 16 12:12:01 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC729BDBC94; Fri, 16 Sep 2016 12:12:01 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id BC062EA; Fri, 16 Sep 2016 12:12:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCC115008892; Fri, 16 Sep 2016 12:12:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCC03F008891; Fri, 16 Sep 2016 12:12:00 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161212.u8GCC03F008891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:12:00 +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: r305878 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:12:02 -0000 Author: andrew Date: Fri Sep 16 12:12:00 2016 New Revision: 305878 URL: https://svnweb.freebsd.org/changeset/base/305878 Log: MFC 305605: Don't panic when we don't handle a userland exception, not all we may see are currently handled. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/trap.c ============================================================================== --- stable/11/sys/arm64/arm64/trap.c Fri Sep 16 11:57:48 2016 (r305877) +++ stable/11/sys/arm64/arm64/trap.c Fri Sep 16 12:12:00 2016 (r305878) @@ -394,9 +394,9 @@ do_el0_sync(struct trapframe *frame) userret(td, frame); break; default: - print_registers(frame); - panic("Unknown userland exception %x esr_el1 %lx\n", exception, - esr); + call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr); + userret(td, frame); + break; } } From owner-svn-src-stable@freebsd.org Fri Sep 16 12:17:03 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06F07BDBF09; Fri, 16 Sep 2016 12:17:03 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id BEEB07A0; Fri, 16 Sep 2016 12:17:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCH1en009117; Fri, 16 Sep 2016 12:17:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCH1ef009116; Fri, 16 Sep 2016 12:17:01 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161217.u8GCH1ef009116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:17:01 +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: r305879 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:17:03 -0000 Author: andrew Date: Fri Sep 16 12:17:01 2016 New Revision: 305879 URL: https://svnweb.freebsd.org/changeset/base/305879 Log: MFC 303744: Remove the pvh_global_lock lock from the arm64 pmap. It is unneeded on arm64 as invalidation will have completed before the pmap_invalidate_* functions have complete. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:12:00 2016 (r305878) +++ stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:17:01 2016 (r305879) @@ -218,8 +218,6 @@ vm_offset_t kernel_vm_end = 0; struct msgbuf *msgbufp = NULL; -static struct rwlock_padalign pvh_global_lock; - vm_paddr_t dmap_phys_base; /* The start of the dmap region */ vm_paddr_t dmap_phys_max; /* The limit of the dmap region */ vm_offset_t dmap_max_addr; /* The virtual address limit of the dmap */ @@ -671,11 +669,6 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offs kernel_pmap_store.pm_l0 = (pd_entry_t *)l0pt; PMAP_LOCK_INIT(kernel_pmap); - /* - * Initialize the global pv list lock. - */ - rw_init(&pvh_global_lock, "pmap pv global"); - /* Assume the address we were loaded to is a valid physical address */ min_pa = max_pa = KERNBASE - kern_delta; @@ -1404,9 +1397,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t if (lockp != NULL) { RELEASE_PV_LIST_LOCK(lockp); PMAP_UNLOCK(pmap); - rw_runlock(&pvh_global_lock); VM_WAIT; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); } @@ -1748,7 +1739,6 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv struct pv_chunk *pc; int idx, field, bit; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(atomic_add_long(&pv_entry_frees, 1)); PV_STAT(atomic_add_int(&pv_entry_spare, 1)); @@ -1805,7 +1795,6 @@ get_pv_entry(pmap_t pmap, struct rwlock struct pv_chunk *pc; vm_page_t m; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); PV_STAT(atomic_add_long(&pv_entry_allocs, 1)); retry: @@ -1873,7 +1862,6 @@ pmap_pvh_remove(struct md_page *pvh, pma { pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_LOCKED); TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) { if (pmap == PV_PMAP(pv) && va == pv->pv_va) { TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); @@ -1909,7 +1897,6 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm { pv_entry_t pv; - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); /* Pass NULL instead of the lock pointer to disable reclamation. */ if ((pv = get_pv_entry(pmap, NULL)) != NULL) { @@ -1978,7 +1965,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva anyvalid = 0; SLIST_INIT(&free); - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); lock = NULL; @@ -2057,7 +2043,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva rw_wunlock(lock); if (anyvalid) pmap_invalidate_all(pmap); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } @@ -2080,18 +2065,31 @@ pmap_remove_all(vm_page_t m) { pv_entry_t pv; pmap_t pmap; + struct rwlock *lock; pd_entry_t *pde, tpde; pt_entry_t *pte, tpte; struct spglist free; - int lvl; + int lvl, md_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); SLIST_INIT(&free); - rw_wlock(&pvh_global_lock); + lock = VM_PAGE_TO_PV_LIST_LOCK(m); +retry: + rw_wlock(lock); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); - PMAP_LOCK(pmap); + if (!PMAP_TRYLOCK(pmap)) { + md_gen = m->md.pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (md_gen != m->md.pv_gen) { + rw_wunlock(lock); + PMAP_UNLOCK(pmap); + goto retry; + } + } pmap_resident_count_dec(pmap, 1); pde = pmap_pde(pmap, pv->pv_va, &lvl); @@ -2126,7 +2124,7 @@ pmap_remove_all(vm_page_t m) PMAP_UNLOCK(pmap); } vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_wunlock(&pvh_global_lock); + rw_wunlock(lock); pmap_free_zero_pages(&free); } @@ -2241,7 +2239,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, mpte = NULL; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); if (va < VM_MAXUSER_ADDRESS) { @@ -2251,7 +2248,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); return (KERN_RESOURCE_SHORTAGE); } @@ -2433,7 +2429,6 @@ validate: if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); return (KERN_SUCCESS); } @@ -2465,7 +2460,6 @@ pmap_enter_object(pmap_t pmap, vm_offset mpte = NULL; m = m_start; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { va = start + ptoa(diff); @@ -2474,7 +2468,6 @@ pmap_enter_object(pmap_t pmap, vm_offset } if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2493,12 +2486,10 @@ pmap_enter_quick(pmap_t pmap, vm_offset_ struct rwlock *lock; lock = NULL; - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); (void)pmap_enter_quick_locked(pmap, va, m, prot, NULL, &lock); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2515,7 +2506,6 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); - rw_assert(&pvh_global_lock, RA_LOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); CTR2(KTR_PMAP, "pmap_enter_quick_locked: %p %lx", pmap, va); @@ -2644,9 +2634,7 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva vm_offset_t va_next; pd_entry_t *l0, *l1, *l2; pt_entry_t *l3; - boolean_t pv_lists_locked; - pv_lists_locked = FALSE; PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { l0 = pmap_l0(pmap, sva); @@ -2692,8 +2680,6 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva pmap->pm_stats.wired_count--; } } - if (pv_lists_locked) - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); } @@ -2837,7 +2823,6 @@ pmap_page_exists_quick(pmap_t pmap, vm_p KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_page_exists_quick: page %p is not managed", m)); rv = FALSE; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { @@ -2850,7 +2835,6 @@ pmap_page_exists_quick(pmap_t pmap, vm_p break; } rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (rv); } @@ -2871,7 +2855,6 @@ pmap_page_wired_mappings(vm_page_t m) if ((m->oflags & VPO_UNMANAGED) != 0) return (0); - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); restart: @@ -2894,7 +2877,6 @@ restart: PMAP_UNLOCK(pmap); } rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (count); } @@ -2932,7 +2914,6 @@ pmap_remove_pages(pmap_t pmap) lock = NULL; SLIST_INIT(&free); - rw_rlock(&pvh_global_lock); PMAP_LOCK(pmap); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { allfree = 1; @@ -3018,7 +2999,6 @@ pmap_remove_pages(pmap_t pmap) pmap_invalidate_all(pmap); if (lock != NULL) rw_wunlock(lock); - rw_runlock(&pvh_global_lock); PMAP_UNLOCK(pmap); pmap_free_zero_pages(&free); } @@ -3039,7 +3019,6 @@ pmap_page_test_mappings(vm_page_t m, boo boolean_t rv; rv = FALSE; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_rlock(lock); restart: @@ -3075,7 +3054,6 @@ restart: } out: rw_runlock(lock); - rw_runlock(&pvh_global_lock); return (rv); } @@ -3164,7 +3142,6 @@ pmap_remove_write(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(m->object); if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; - rw_rlock(&pvh_global_lock); lock = VM_PAGE_TO_PV_LIST_LOCK(m); retry_pv_loop: rw_wlock(lock); @@ -3196,7 +3173,6 @@ retry: } rw_wunlock(lock); vm_page_aflag_clear(m, PGA_WRITEABLE); - rw_runlock(&pvh_global_lock); } static __inline boolean_t @@ -3238,7 +3214,6 @@ pmap_ts_referenced(vm_page_t m) cleared = 0; pa = VM_PAGE_TO_PHYS(m); lock = PHYS_TO_PV_LIST_LOCK(pa); - rw_rlock(&pvh_global_lock); rw_wlock(lock); retry: not_cleared = 0; @@ -3307,7 +3282,6 @@ retry: not_cleared < PMAP_TS_REFERENCED_MAX); out: rw_wunlock(lock); - rw_runlock(&pvh_global_lock); pmap_free_zero_pages(&free); return (cleared + not_cleared); } From owner-svn-src-stable@freebsd.org Fri Sep 16 12:18:23 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0934BDBF9E; Fri, 16 Sep 2016 12:18:23 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id C117394F; Fri, 16 Sep 2016 12:18:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCIM4B009212; Fri, 16 Sep 2016 12:18:22 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCIMGX009211; Fri, 16 Sep 2016 12:18:22 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161218.u8GCIMGX009211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:18: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: r305880 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:18:24 -0000 Author: andrew Date: Fri Sep 16 12:18:22 2016 New Revision: 305880 URL: https://svnweb.freebsd.org/changeset/base/305880 Log: MFC 303903: Implement pmap_align_superpage on arm64 based on the amd64 implementation. This will be needed when superpage support is added. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:17:01 2016 (r305879) +++ stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:18:22 2016 (r305880) @@ -3490,6 +3490,20 @@ void pmap_align_superpage(vm_object_t object, vm_ooffset_t offset, vm_offset_t *addr, vm_size_t size) { + vm_offset_t superpage_offset; + + if (size < L2_SIZE) + return; + if (object != NULL && (object->flags & OBJ_COLORED) != 0) + offset += ptoa(object->pg_color); + superpage_offset = offset & L2_OFFSET; + if (size - ((L2_SIZE - superpage_offset) & L2_OFFSET) < L2_SIZE || + (*addr & L2_OFFSET) == superpage_offset) + return; + if ((*addr & L2_OFFSET) < superpage_offset) + *addr = (*addr & ~L2_OFFSET) + superpage_offset; + else + *addr = ((*addr + L2_OFFSET) & ~L2_OFFSET) + superpage_offset; } /** From owner-svn-src-stable@freebsd.org Fri Sep 16 12:20:43 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B5F9BDC072; Fri, 16 Sep 2016 12:20:43 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 5DD55BD5; Fri, 16 Sep 2016 12:20:43 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCKgMM009455; Fri, 16 Sep 2016 12:20:42 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCKg2E009454; Fri, 16 Sep 2016 12:20:42 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161220.u8GCKg2E009454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:20:42 +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: r305881 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:20:43 -0000 Author: andrew Date: Fri Sep 16 12:20:42 2016 New Revision: 305881 URL: https://svnweb.freebsd.org/changeset/base/305881 Log: MFC 303904: Uncomment the vm.kvm_size and vm.kvm_free sysctls. These work as expected so there is no reason to leave them commented out. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:18:22 2016 (r305880) +++ stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:20:42 2016 (r305881) @@ -1574,7 +1574,6 @@ pmap_release(pmap_t pmap) vm_page_free_zero(m); } -#if 0 static int kvm_size(SYSCTL_HANDLER_ARGS) { @@ -1594,7 +1593,6 @@ kvm_free(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD, 0, 0, kvm_free, "LU", "Amount of KVM free"); -#endif /* 0 */ /* * grow the number of kernel page table entries, if needed From owner-svn-src-stable@freebsd.org Fri Sep 16 12:36:12 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EC87BDC6AC; Fri, 16 Sep 2016 12:36:12 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 040DE6E0; Fri, 16 Sep 2016 12:36:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCaBRu016577; Fri, 16 Sep 2016 12:36:11 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCaB2u016575; Fri, 16 Sep 2016 12:36:11 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161236.u8GCaB2u016575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:36:11 +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: r305882 - in stable/11/sys/arm64: arm64 include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:36:12 -0000 Author: andrew Date: Fri Sep 16 12:36:11 2016 New Revision: 305882 URL: https://svnweb.freebsd.org/changeset/base/305882 Log: MFC 304004, 304596, 304598, 304599, 304600, 304604, 304620, 304685, 304687, 304688, 304689, 304746, 304749, 304750, 304806, 305071, 305191: Merge arm64 superpage support, however leave it disabled by default. MFC after: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/pmap.c stable/11/sys/arm64/arm64/trap.c stable/11/sys/arm64/include/pmap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:20:42 2016 (r305881) +++ stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:36:11 2016 (r305882) @@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include #include #include @@ -134,6 +135,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -176,6 +178,7 @@ __FBSDID("$FreeBSD$"); #endif #define pmap_l2_pindex(v) ((v) >> L2_SHIFT) +#define pa_to_pvh(pa) (&pv_table[pmap_l2_pindex(pa)]) #define NPV_LIST_LOCKS MAXCPU @@ -218,6 +221,14 @@ vm_offset_t kernel_vm_end = 0; struct msgbuf *msgbufp = NULL; +/* + * Data for the pv entry allocation mechanism. + * Updates to pv_invl_gen are protected by the pv_list_locks[] + * elements, but reads are not. + */ +static struct md_page *pv_table; +static struct md_page pv_dummy; + vm_paddr_t dmap_phys_base; /* The start of the dmap region */ vm_paddr_t dmap_phys_max; /* The limit of the dmap region */ vm_offset_t dmap_max_addr; /* The virtual address limit of the dmap */ @@ -229,6 +240,13 @@ CTASSERT((DMAP_MAX_ADDRESS & ~L0_OFFSET #define DMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> L0_SHIFT) extern pt_entry_t pagetable_dmap[]; +static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); + +static int superpages_enabled = 0; +SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &superpages_enabled, 0, + "Are large page mappings enabled?"); + /* * Data for the pv entry allocation mechanism */ @@ -243,6 +261,13 @@ static vm_page_t reclaim_pv_chunk(pmap_t static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); + +static int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); +static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode); +static pt_entry_t *pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_t va); +static pt_entry_t *pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, + vm_offset_t va, struct rwlock **lockp); +static pt_entry_t *pmap_demote_l2(pmap_t pmap, pt_entry_t *l2, vm_offset_t va); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte, struct rwlock **lockp); static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t sva, @@ -422,6 +447,13 @@ pmap_pte(pmap_t pmap, vm_offset_t va, in return (l3); } +static inline bool +pmap_superpages_enabled(void) +{ + + return (superpages_enabled != 0); +} + bool pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_t **l0, pd_entry_t **l1, pd_entry_t **l2, pt_entry_t **l3) @@ -477,6 +509,17 @@ pmap_l3_valid(pt_entry_t l3) return ((l3 & ATTR_DESCR_MASK) == L3_PAGE); } + +/* Is a level 1 or 2entry a valid block and cacheable */ +CTASSERT(L1_BLOCK == L2_BLOCK); +static __inline int +pmap_pte_valid_cacheable(pt_entry_t pte) +{ + + return (((pte & ATTR_DESCR_MASK) == L1_BLOCK) && + ((pte & ATTR_IDX_MASK) == ATTR_IDX(CACHED_MEMORY))); +} + static __inline int pmap_l3_valid_cacheable(pt_entry_t l3) { @@ -834,7 +877,13 @@ pmap_page_init(vm_page_t m) void pmap_init(void) { - int i; + vm_size_t s; + int i, pv_npg; + + /* + * Are large page mappings enabled? + */ + TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled); /* * Initialize the pv chunk list mutex. @@ -846,7 +895,38 @@ pmap_init(void) */ for (i = 0; i < NPV_LIST_LOCKS; i++) rw_init(&pv_list_locks[i], "pmap pv list"); -} + + /* + * Calculate the size of the pv head table for superpages. + */ + pv_npg = howmany(vm_phys_segs[vm_phys_nsegs - 1].end, L2_SIZE); + + /* + * Allocate memory for the pv head table for superpages. + */ + s = (vm_size_t)(pv_npg * sizeof(struct md_page)); + s = round_page(s); + pv_table = (struct md_page *)kmem_malloc(kernel_arena, s, + M_WAITOK | M_ZERO); + for (i = 0; i < pv_npg; i++) + TAILQ_INIT(&pv_table[i].pv_list); + TAILQ_INIT(&pv_dummy.pv_list); +} + +static SYSCTL_NODE(_vm_pmap, OID_AUTO, l2, CTLFLAG_RD, 0, + "2MB page mapping counters"); + +static u_long pmap_l2_demotions; +SYSCTL_ULONG(_vm_pmap_l2, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_l2_demotions, 0, "2MB page demotions"); + +static u_long pmap_l2_p_failures; +SYSCTL_ULONG(_vm_pmap_l2, OID_AUTO, p_failures, CTLFLAG_RD, + &pmap_l2_p_failures, 0, "2MB page promotion failures"); + +static u_long pmap_l2_promotions; +SYSCTL_ULONG(_vm_pmap_l2, OID_AUTO, promotions, CTLFLAG_RD, + &pmap_l2_promotions, 0, "2MB page promotions"); /* * Invalidate a single TLB entry. @@ -954,6 +1034,7 @@ vm_page_t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) { pt_entry_t *pte, tpte; + vm_offset_t off; vm_paddr_t pa; vm_page_t m; int lvl; @@ -975,9 +1056,21 @@ retry: tpte & ATTR_DESCR_MASK)); if (((tpte & ATTR_AP_RW_BIT) == ATTR_AP(ATTR_AP_RW)) || ((prot & VM_PROT_WRITE) == 0)) { - if (vm_page_pa_tryrelock(pmap, tpte & ~ATTR_MASK, &pa)) + switch(lvl) { + case 1: + off = va & L1_OFFSET; + break; + case 2: + off = va & L2_OFFSET; + break; + case 3: + default: + off = 0; + } + if (vm_page_pa_tryrelock(pmap, + (tpte & ~ATTR_MASK) | off, &pa)) goto retry; - m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); + m = PHYS_TO_VM_PAGE((tpte & ~ATTR_MASK) | off); vm_page_hold(m); } } @@ -1345,6 +1438,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_l0 = kernel_pmap->pm_l0; + pmap->pm_root.rt_root = 0; } int @@ -1366,6 +1460,7 @@ pmap_pinit(pmap_t pmap) if ((l0pt->flags & PG_ZERO) == 0) pagezero(pmap->pm_l0); + pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); return (1); @@ -1511,6 +1606,9 @@ pmap_alloc_l3(pmap_t pmap, vm_offset_t v { vm_pindex_t ptepindex; pd_entry_t *pde, tpde; +#ifdef INVARIANTS + pt_entry_t *pte; +#endif vm_page_t m; int lvl; @@ -1529,13 +1627,33 @@ retry: * and activate it. If we get a level 2 pde it will point to a level 3 * table. */ - if (lvl == 2) { + switch (lvl) { + case -1: + break; + case 0: +#ifdef INVARIANTS + pte = pmap_l0_to_l1(pde, va); + KASSERT(pmap_load(pte) == 0, + ("pmap_alloc_l3: TODO: l0 superpages")); +#endif + break; + case 1: +#ifdef INVARIANTS + pte = pmap_l1_to_l2(pde, va); + KASSERT(pmap_load(pte) == 0, + ("pmap_alloc_l3: TODO: l1 superpages")); +#endif + break; + case 2: tpde = pmap_load(pde); if (tpde != 0) { m = PHYS_TO_VM_PAGE(tpde & ~ATTR_MASK); m->wire_count++; return (m); } + break; + default: + panic("pmap_alloc_l3: Invalid level %d", lvl); } /* @@ -1566,6 +1684,8 @@ pmap_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); + KASSERT(vm_radix_is_empty(&pmap->pm_root), + ("pmap_release: pmap has reserved page table page(s)")); m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l0)); @@ -1850,6 +1970,68 @@ retry: } /* + * Ensure that the number of spare PV entries in the specified pmap meets or + * exceeds the given count, "needed". + * + * The given PV list lock may be released. + */ +static void +reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp) +{ + struct pch new_tail; + struct pv_chunk *pc; + int avail, free; + vm_page_t m; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT(lockp != NULL, ("reserve_pv_entries: lockp is NULL")); + + /* + * Newly allocated PV chunks must be stored in a private list until + * the required number of PV chunks have been allocated. Otherwise, + * reclaim_pv_chunk() could recycle one of these chunks. In + * contrast, these chunks must be added to the pmap upon allocation. + */ + TAILQ_INIT(&new_tail); +retry: + avail = 0; + TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { + bit_count((bitstr_t *)pc->pc_map, 0, + sizeof(pc->pc_map) * NBBY, &free); + if (free == 0) + break; + avail += free; + if (avail >= needed) + break; + } + for (; avail < needed; avail += _NPCPV) { + m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + VM_ALLOC_WIRED); + if (m == NULL) { + m = reclaim_pv_chunk(pmap, lockp); + if (m == NULL) + goto retry; + } + PV_STAT(atomic_add_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); + dump_add_page(m->phys_addr); + pc = (void *)PHYS_TO_DMAP(m->phys_addr); + pc->pc_pmap = pmap; + pc->pc_map[0] = PC_FREE0; + pc->pc_map[1] = PC_FREE1; + pc->pc_map[2] = PC_FREE2; + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + } + if (!TAILQ_EMPTY(&new_tail)) { + mtx_lock(&pv_chunks_mutex); + TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); + mtx_unlock(&pv_chunks_mutex); + } +} + +/* * First find and then remove the pv entry for the specified pmap and virtual * address from the specified pv list. Returns the pv entry if found and NULL * otherwise. This operation can be performed on pv lists for either 4KB or @@ -1871,6 +2053,74 @@ pmap_pvh_remove(struct md_page *pvh, pma } /* + * After demotion from a 2MB page mapping to 512 4KB page mappings, + * destroy the pv entry for the 2MB page mapping and reinstantiate the pv + * entries for each of the 4KB page mappings. + */ +static void +pmap_pv_demote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp) +{ + struct md_page *pvh; + struct pv_chunk *pc; + pv_entry_t pv; + vm_offset_t va_last; + vm_page_t m; + int bit, field; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT((pa & L2_OFFSET) == 0, + ("pmap_pv_demote_l2: pa is not 2mpage aligned")); + CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); + + /* + * Transfer the 2mpage's pv entry for this mapping to the first + * page's pv list. Once this transfer begins, the pv list lock + * must not be released until the last pv entry is reinstantiated. + */ + pvh = pa_to_pvh(pa); + va = va & ~L2_OFFSET; + pv = pmap_pvh_remove(pvh, pmap, va); + KASSERT(pv != NULL, ("pmap_pv_demote_l2: pv not found")); + m = PHYS_TO_VM_PAGE(pa); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); + m->md.pv_gen++; + /* Instantiate the remaining Ln_ENTRIES - 1 pv entries. */ + PV_STAT(atomic_add_long(&pv_entry_allocs, Ln_ENTRIES - 1)); + va_last = va + L2_SIZE - PAGE_SIZE; + for (;;) { + pc = TAILQ_FIRST(&pmap->pm_pvchunk); + KASSERT(pc->pc_map[0] != 0 || pc->pc_map[1] != 0 || + pc->pc_map[2] != 0, ("pmap_pv_demote_l2: missing spare")); + for (field = 0; field < _NPCM; field++) { + while (pc->pc_map[field]) { + bit = ffsl(pc->pc_map[field]) - 1; + pc->pc_map[field] &= ~(1ul << bit); + pv = &pc->pc_pventry[field * 64 + bit]; + va += PAGE_SIZE; + pv->pv_va = va; + m++; + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("pmap_pv_demote_l2: page %p is not managed", m)); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); + m->md.pv_gen++; + if (va == va_last) + goto out; + } + } + TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); + } +out: + if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 && pc->pc_map[2] == 0) { + TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); + } + PV_STAT(atomic_add_long(&pv_entry_count, Ln_ENTRIES - 1)); + PV_STAT(atomic_subtract_int(&pv_entry_spare, Ln_ENTRIES - 1)); +} + +/* * First find and then destroy the pv entry for the specified pmap and virtual * address. This operation can be performed on pv lists for either 4KB or 2MB * page mappings. @@ -1914,6 +2164,7 @@ static int pmap_remove_l3(pmap_t pmap, pt_entry_t *l3, vm_offset_t va, pd_entry_t l2e, struct spglist *free, struct rwlock **lockp) { + struct md_page *pvh; pt_entry_t old_l3; vm_page_t m; @@ -1934,6 +2185,12 @@ pmap_remove_l3(pmap_t pmap, pt_entry_t * vm_page_aflag_set(m, PGA_REFERENCED); CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) + vm_page_aflag_clear(m, PGA_WRITEABLE); + } } return (pmap_unuse_l3(pmap, va, l2e, free)); } @@ -2000,6 +2257,14 @@ pmap_remove(pmap_t pmap, vm_offset_t sva l3_paddr = pmap_load(l2); + if ((l3_paddr & ATTR_DESCR_MASK) == L2_BLOCK) { + /* TODO: Add pmap_remove_l2 */ + if (pmap_demote_l2_locked(pmap, l2, sva & ~L2_OFFSET, + &lock) == NULL) + continue; + l3_paddr = pmap_load(l2); + } + /* * Weed out invalid mappings. */ @@ -2061,28 +2326,56 @@ pmap_remove(pmap_t pmap, vm_offset_t sva void pmap_remove_all(vm_page_t m) { + struct md_page *pvh; pv_entry_t pv; pmap_t pmap; struct rwlock *lock; pd_entry_t *pde, tpde; pt_entry_t *pte, tpte; + vm_offset_t va; struct spglist free; - int lvl, md_gen; + int lvl, pvh_gen, md_gen; KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("pmap_remove_all: page %p is not managed", m)); SLIST_INIT(&free); lock = VM_PAGE_TO_PV_LIST_LOCK(m); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? &pv_dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); retry: rw_wlock(lock); + while ((pv = TAILQ_FIRST(&pvh->pv_list)) != NULL) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; + rw_wunlock(lock); + PMAP_LOCK(pmap); + rw_wlock(lock); + if (pvh_gen != pvh->pv_gen) { + rw_wunlock(lock); + PMAP_UNLOCK(pmap); + goto retry; + } + } + va = pv->pv_va; + pte = pmap_pte(pmap, va, &lvl); + KASSERT(pte != NULL, + ("pmap_remove_all: no page table entry found")); + KASSERT(lvl == 2, + ("pmap_remove_all: invalid pte level %d", lvl)); + + pmap_demote_l2_locked(pmap, pte, va, &lock); + PMAP_UNLOCK(pmap); + } while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { + pvh_gen = pvh->pv_gen; md_gen = m->md.pv_gen; rw_wunlock(lock); PMAP_LOCK(pmap); rw_wlock(lock); - if (md_gen != m->md.pv_gen) { + if (pvh_gen != pvh->pv_gen || md_gen != m->md.pv_gen) { rw_wunlock(lock); PMAP_UNLOCK(pmap); goto retry; @@ -2169,9 +2462,17 @@ pmap_protect(pmap_t pmap, vm_offset_t sv va_next = eva; l2 = pmap_l1_to_l2(l1, sva); - if (l2 == NULL || (pmap_load(l2) & ATTR_DESCR_MASK) != L2_TABLE) + if (pmap_load(l2) == 0) continue; + if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK) { + l3p = pmap_demote_l2(pmap, l2, sva); + if (l3p == NULL) + continue; + } + KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE, + ("pmap_protect: Invalid L2 entry after demotion")); + if (va_next > eva) va_next = eva; @@ -2194,6 +2495,194 @@ pmap_protect(pmap_t pmap, vm_offset_t sv } /* + * Inserts the specified page table page into the specified pmap's collection + * of idle page table pages. Each of a pmap's page table pages is responsible + * for mapping a distinct range of virtual addresses. The pmap's collection is + * ordered by this virtual address range. + */ +static __inline int +pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte) +{ + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + return (vm_radix_insert(&pmap->pm_root, mpte)); +} + +/* + * Looks for a page table page mapping the specified virtual address in the + * specified pmap's collection of idle page table pages. Returns NULL if there + * is no page table page corresponding to the specified virtual address. + */ +static __inline vm_page_t +pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va) +{ + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + return (vm_radix_lookup(&pmap->pm_root, pmap_l2_pindex(va))); +} + +/* + * Removes the specified page table page from the specified pmap's collection + * of idle page table pages. The specified page table page must be a member of + * the pmap's collection. + */ +static __inline void +pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte) +{ + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + vm_radix_remove(&pmap->pm_root, mpte->pindex); +} + +/* + * Performs a break-before-make update of a pmap entry. This is needed when + * either promoting or demoting pages to ensure the TLB doesn't get into an + * inconsistent state. + */ +static void +pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_entry_t newpte, + vm_offset_t va, vm_size_t size) +{ + register_t intr; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + + /* + * Ensure we don't get switched out with the page table in an + * inconsistent state. We also need to ensure no interrupts fire + * as they may make use of an address we are about to invalidate. + */ + intr = intr_disable(); + critical_enter(); + + /* Clear the old mapping */ + pmap_load_clear(pte); + PTE_SYNC(pte); + pmap_invalidate_range(pmap, va, va + size); + + /* Create the new mapping */ + pmap_load_store(pte, newpte); + PTE_SYNC(pte); + + critical_exit(); + intr_restore(intr); +} + +/* + * After promotion from 512 4KB page mappings to a single 2MB page mapping, + * replace the many pv entries for the 4KB page mappings by a single pv entry + * for the 2MB page mapping. + */ +static void +pmap_pv_promote_l2(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + struct rwlock **lockp) +{ + struct md_page *pvh; + pv_entry_t pv; + vm_offset_t va_last; + vm_page_t m; + + KASSERT((pa & L2_OFFSET) == 0, + ("pmap_pv_promote_l2: pa is not 2mpage aligned")); + CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa); + + /* + * Transfer the first page's pv entry for this mapping to the 2mpage's + * pv list. Aside from avoiding the cost of a call to get_pv_entry(), + * a transfer avoids the possibility that get_pv_entry() calls + * reclaim_pv_chunk() and that reclaim_pv_chunk() removes one of the + * mappings that is being promoted. + */ + m = PHYS_TO_VM_PAGE(pa); + va = va & ~L2_OFFSET; + pv = pmap_pvh_remove(&m->md, pmap, va); + KASSERT(pv != NULL, ("pmap_pv_promote_l2: pv not found")); + pvh = pa_to_pvh(pa); + TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); + pvh->pv_gen++; + /* Free the remaining NPTEPG - 1 pv entries. */ + va_last = va + L2_SIZE - PAGE_SIZE; + do { + m++; + va += PAGE_SIZE; + pmap_pvh_free(&m->md, pmap, va); + } while (va < va_last); +} + +/* + * Tries to promote the 512, contiguous 4KB page mappings that are within a + * single level 2 table entry to a single 2MB page mapping. For promotion + * to occur, two conditions must be met: (1) the 4KB page mappings must map + * aligned, contiguous physical memory and (2) the 4KB page mappings must have + * identical characteristics. + */ +static void +pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, + struct rwlock **lockp) +{ + pt_entry_t *firstl3, *l3, newl2, oldl3, pa; + vm_page_t mpte; + vm_offset_t sva; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + + sva = va & ~L2_OFFSET; + firstl3 = pmap_l2_to_l3(l2, sva); + newl2 = pmap_load(firstl3); + + /* Check the alingment is valid */ + if (((newl2 & ~ATTR_MASK) & L2_OFFSET) != 0) { + atomic_add_long(&pmap_l2_p_failures, 1); + CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" + " in pmap %p", va, pmap); + return; + } + + pa = newl2 + L2_SIZE - PAGE_SIZE; + for (l3 = firstl3 + NL3PG - 1; l3 > firstl3; l3--) { + oldl3 = pmap_load(l3); + if (oldl3 != pa) { + atomic_add_long(&pmap_l2_p_failures, 1); + CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" + " in pmap %p", va, pmap); + return; + } + pa -= PAGE_SIZE; + } + + /* + * Save the page table page in its current state until the L2 + * mapping the superpage is demoted by pmap_demote_l2() or + * destroyed by pmap_remove_l3(). + */ + mpte = PHYS_TO_VM_PAGE(pmap_load(l2) & ~ATTR_MASK); + KASSERT(mpte >= vm_page_array && + mpte < &vm_page_array[vm_page_array_size], + ("pmap_promote_l2: page table page is out of range")); + KASSERT(mpte->pindex == pmap_l2_pindex(va), + ("pmap_promote_l2: page table page's pindex is wrong")); + if (pmap_insert_pt_page(pmap, mpte)) { + atomic_add_long(&pmap_l2_p_failures, 1); + CTR2(KTR_PMAP, + "pmap_promote_l2: failure for va %#lx in pmap %p", va, + pmap); + return; + } + + if ((newl2 & ATTR_SW_MANAGED) != 0) + pmap_pv_promote_l2(pmap, va, newl2 & ~ATTR_MASK, lockp); + + newl2 &= ~ATTR_DESCR_MASK; + newl2 |= L2_BLOCK; + + pmap_update_entry(pmap, l2, newl2, sva, L2_SIZE); + + atomic_add_long(&pmap_l2_promotions, 1); + CTR2(KTR_PMAP, "pmap_promote_l2: success for va %#lx in pmap %p", va, + pmap); +} + +/* * Insert the given physical page (p) at * the specified virtual address (v) in the * target physical map with the protection requested. @@ -2212,7 +2701,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, struct rwlock *lock; pd_entry_t *pde; pt_entry_t new_l3, orig_l3; - pt_entry_t *l3; + pt_entry_t *l2, *l3; pv_entry_t pv; vm_paddr_t opa, pa, l1_pa, l2_pa, l3_pa; vm_page_t mpte, om, l1_m, l2_m, l3_m; @@ -2239,6 +2728,22 @@ pmap_enter(pmap_t pmap, vm_offset_t va, lock = NULL; PMAP_LOCK(pmap); + pde = pmap_pde(pmap, va, &lvl); + if (pde != NULL && lvl == 1) { + l2 = pmap_l1_to_l2(pde, va); + if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK && + (l3 = pmap_demote_l2_locked(pmap, l2, va & ~L2_OFFSET, + &lock)) != NULL) { + l3 = &l3[pmap_l3_index(va)]; + if (va < VM_MAXUSER_ADDRESS) { + mpte = PHYS_TO_VM_PAGE( + pmap_load(l2) & ~ATTR_MASK); + mpte->wire_count++; + } + goto havel3; + } + } + if (va < VM_MAXUSER_ADDRESS) { nosleep = (flags & PMAP_ENTER_NOSLEEP) != 0; mpte = pmap_alloc_l3(pmap, va, nosleep ? NULL : &lock); @@ -2257,7 +2762,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, l3 = pmap_l2_to_l3(pde, va); } else { - pde = pmap_pde(pmap, va, &lvl); /* * If we get a level 2 pde it must point to a level 3 entry * otherwise we will need to create the intermediate tables @@ -2320,6 +2824,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, l3 = pmap_l2_to_l3(pde, va); pmap_invalidate_page(pmap, va); } +havel3: om = NULL; orig_l3 = pmap_load(l3); @@ -2399,11 +2904,11 @@ pmap_enter(pmap_t pmap, vm_offset_t va, */ if (orig_l3 != 0) { validate: - orig_l3 = pmap_load_store(l3, new_l3); - PTE_SYNC(l3); + orig_l3 = pmap_load(l3); opa = orig_l3 & ~ATTR_MASK; if (opa != pa) { + pmap_update_entry(pmap, l3, new_l3, va, PAGE_SIZE); if ((orig_l3 & ATTR_SW_MANAGED) != 0) { om = PHYS_TO_VM_PAGE(opa); if (pmap_page_dirty(orig_l3)) @@ -2412,18 +2917,38 @@ validate: vm_page_aflag_set(om, PGA_REFERENCED); CHANGE_PV_LIST_LOCK_TO_PHYS(&lock, opa); pmap_pvh_free(&om->md, pmap, va); + if ((om->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&om->md.pv_list) && + ((om->flags & PG_FICTITIOUS) != 0 || + TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list))) + vm_page_aflag_clear(om, PGA_WRITEABLE); } - } else if (pmap_page_dirty(orig_l3)) { - if ((orig_l3 & ATTR_SW_MANAGED) != 0) + } else { + pmap_load_store(l3, new_l3); + PTE_SYNC(l3); + pmap_invalidate_page(pmap, va); + if (pmap_page_dirty(orig_l3) && + (orig_l3 & ATTR_SW_MANAGED) != 0) vm_page_dirty(m); } } else { pmap_load_store(l3, new_l3); - PTE_SYNC(l3); } + + PTE_SYNC(l3); pmap_invalidate_page(pmap, va); - if ((pmap != pmap_kernel()) && (pmap == &curproc->p_vmspace->vm_pmap)) - cpu_icache_sync_range(va, PAGE_SIZE); + + if (pmap != pmap_kernel()) { + if (pmap == &curproc->p_vmspace->vm_pmap) + cpu_icache_sync_range(va, PAGE_SIZE); + + if ((mpte == NULL || mpte->wire_count == NL3PG) && + pmap_superpages_enabled() && + (m->flags & PG_FICTITIOUS) == 0 && + vm_reserv_level_iffullpop(m) == 0) { + pmap_promote_l2(pmap, pde, va, &lock); + } + } if (lock != NULL) rw_wunlock(lock); @@ -2497,7 +3022,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ { struct spglist free; pd_entry_t *pde; - pt_entry_t *l3; + pt_entry_t *l2, *l3; vm_paddr_t pa; int lvl; @@ -2532,6 +3057,12 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ * attempt to allocate a page table page. If this * attempt fails, we don't retry. Instead, we give up. */ + if (lvl == 1) { + l2 = pmap_l1_to_l2(pde, va); + if ((pmap_load(l2) & ATTR_DESCR_MASK) == + L2_BLOCK) + return (NULL); + } if (lvl == 2 && pmap_load(pde) != 0) { mpte = PHYS_TO_VM_PAGE(pmap_load(pde) & ~ATTR_MASK); @@ -2589,7 +3120,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_ pmap_resident_count_inc(pmap, 1); pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) | - ATTR_AP(ATTR_AP_RW) | L3_PAGE; + ATTR_AP(ATTR_AP_RO) | L3_PAGE; /* * Now validate mapping with RO protection @@ -2659,6 +3190,14 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva if (pmap_load(l2) == 0) continue; + if ((pmap_load(l2) & ATTR_DESCR_MASK) == L2_BLOCK) { + l3 = pmap_demote_l2(pmap, l2, sva); + if (l3 == NULL) + continue; + } + KASSERT((pmap_load(l2) & ATTR_DESCR_MASK) == L2_TABLE, + ("pmap_unwire: Invalid l2 entry after demotion")); + if (va_next > eva) va_next = eva; for (l3 = pmap_l2_to_l3(l2, sva); sva != va_next; l3++, @@ -2813,6 +3352,7 @@ pmap_quick_remove_page(vm_offset_t addr) boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m) { + struct md_page *pvh; struct rwlock *lock; pv_entry_t pv; int loops = 0; @@ -2832,6 +3372,18 @@ pmap_page_exists_quick(pmap_t pmap, vm_p if (loops >= 16) break; } + if (!rv && loops < 16 && (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) { + if (PV_PMAP(pv) == pmap) { + rv = TRUE; + break; + } + loops++; + if (loops >= 16) + break; + } + } rw_runlock(lock); return (rv); } @@ -2846,10 +3398,11 @@ int pmap_page_wired_mappings(vm_page_t m) { struct rwlock *lock; + struct md_page *pvh; pmap_t pmap; pt_entry_t *pte; pv_entry_t pv; - int count, lvl, md_gen; + int count, lvl, md_gen, pvh_gen; if ((m->oflags & VPO_UNMANAGED) != 0) return (0); @@ -2874,6 +3427,29 @@ restart: count++; PMAP_UNLOCK(pmap); } + if ((m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) { + pmap = PV_PMAP(pv); + if (!PMAP_TRYLOCK(pmap)) { + md_gen = m->md.pv_gen; + pvh_gen = pvh->pv_gen; + rw_runlock(lock); + PMAP_LOCK(pmap); + rw_rlock(lock); + if (md_gen != m->md.pv_gen || + pvh_gen != pvh->pv_gen) { + PMAP_UNLOCK(pmap); + goto restart; + } + } + pte = pmap_pte(pmap, pv->pv_va, &lvl); + if (pte != NULL && + (pmap_load(pte) & ATTR_SW_WIRED) != 0) + count++; + PMAP_UNLOCK(pmap); + } + } rw_runlock(lock); return (count); } @@ -2900,8 +3476,9 @@ pmap_remove_pages(pmap_t pmap) pd_entry_t *pde; pt_entry_t *pte, tpte; struct spglist free; - vm_page_t m; + vm_page_t m, ml3, mt; pv_entry_t pv; + struct md_page *pvh; struct pv_chunk *pc, *npc; struct rwlock *lock; int64_t bit; @@ -2928,14 +3505,30 @@ pmap_remove_pages(pmap_t pmap) pde = pmap_pde(pmap, pv->pv_va, &lvl); KASSERT(pde != NULL, ("Attempting to remove an unmapped page")); - KASSERT(lvl == 2, - ("Invalid page directory level: %d", lvl)); - pte = pmap_l2_to_l3(pde, pv->pv_va); - KASSERT(pte != NULL, - ("Attempting to remove an unmapped page")); - - tpte = pmap_load(pte); + switch(lvl) { + case 1: + pte = pmap_l1_to_l2(pde, pv->pv_va); + tpte = pmap_load(pte); + KASSERT((tpte & ATTR_DESCR_MASK) == + L2_BLOCK, + ("Attempting to remove an invalid " + "block: %lx", tpte)); + tpte = pmap_load(pte); + break; + case 2: + pte = pmap_l2_to_l3(pde, pv->pv_va); + tpte = pmap_load(pte); + KASSERT((tpte & ATTR_DESCR_MASK) == + L3_PAGE, + ("Attempting to remove an invalid " + "page: %lx", tpte)); + break; + default: + panic( + "Invalid page directory level: %d", + lvl); + } /* * We cannot remove wired pages from a process' mapping at this time @@ -2958,10 +3551,17 @@ pmap_remove_pages(pmap_t pmap) ("pmap_remove_pages: bad pte %#jx", (uintmax_t)tpte)); - /* XXX: assumes tpte is level 3 */ - if (pmap_is_current(pmap) && - pmap_l3_valid_cacheable(tpte)) - cpu_dcache_wb_range(pv->pv_va, L3_SIZE); + if (pmap_is_current(pmap)) { + if (lvl == 2 && + pmap_l3_valid_cacheable(tpte)) { + cpu_dcache_wb_range(pv->pv_va, + L3_SIZE); + } else if (lvl == 1 && + pmap_pte_valid_cacheable(tpte)) { + cpu_dcache_wb_range(pv->pv_va, + L2_SIZE); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Sep 16 12:39:22 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C36C1BDC740; Fri, 16 Sep 2016 12:39:22 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 7845E8C9; Fri, 16 Sep 2016 12:39:22 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCdLmP016725; Fri, 16 Sep 2016 12:39:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCdL56016724; Fri, 16 Sep 2016 12:39:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161239.u8GCdL56016724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:39: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: r305883 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:39:22 -0000 Author: andrew Date: Fri Sep 16 12:39:21 2016 New Revision: 305883 URL: https://svnweb.freebsd.org/changeset/base/305883 Log: MFC 305545: Only call cpu_icache_sync_range when inserting an executable page. If the page is non-executable the contents of the i-cache are unimportant so this call is just adding unneeded overhead when inserting pages. While doing research using gem5 with an O3 pipeline and 1k/32k/1M iTLB/L1 iCache/L2 Bjoern Zeeb (bz@) observed a fairly high rate of calls into arm64_icache_sync_range() from pmap_enter() along with a high number of instruction fetches and iTLB/iCache hits. Limiting the calls to arm64_icache_sync_range() to only executable pages, we observe the iTLB and iCache Hit going down by about 43%. These numbers are quite misleading when looked at alone as at the same time instructions retired were reduced by 19.2% and instruction fetches were reduced by 38.8%. Overall this reduced the runtime of the test program by 22.4%. On Juno hardware, in steady-state, running the same test, using the cycle count to determine runtime, we do see a reduction of up to 28.9% in runtime. While these numbers certainly depend on the program executed, we expect an overall performance improvement. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:36:11 2016 (r305882) +++ stable/11/sys/arm64/arm64/pmap.c Fri Sep 16 12:39:21 2016 (r305883) @@ -2939,8 +2939,9 @@ validate: pmap_invalidate_page(pmap, va); if (pmap != pmap_kernel()) { - if (pmap == &curproc->p_vmspace->vm_pmap) - cpu_icache_sync_range(va, PAGE_SIZE); + if (pmap == &curproc->p_vmspace->vm_pmap && + (prot & VM_PROT_EXECUTE) != 0) + cpu_icache_sync_range(va, PAGE_SIZE); if ((mpte == NULL || mpte->wire_count == NL3PG) && pmap_superpages_enabled() && From owner-svn-src-stable@freebsd.org Fri Sep 16 12:42:37 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C69BDBDC8BB; Fri, 16 Sep 2016 12:42:37 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 98934C7A; Fri, 16 Sep 2016 12:42:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCga7E020267; Fri, 16 Sep 2016 12:42:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCgaqF020266; Fri, 16 Sep 2016 12:42:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161242.u8GCgaqF020266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:42: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: r305884 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:42:37 -0000 Author: andrew Date: Fri Sep 16 12:42:36 2016 New Revision: 305884 URL: https://svnweb.freebsd.org/changeset/base/305884 Log: MFC 305546: When synchronising the instruction and data caches we only need to clean the data cache to the point of unification. This is the point where the two caches are unified to a single unified cache so cleaning past here is just extra unneeded work. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/cpufunc_asm.S Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/cpufunc_asm.S ============================================================================== --- stable/11/sys/arm64/arm64/cpufunc_asm.S Fri Sep 16 12:39:21 2016 (r305883) +++ stable/11/sys/arm64/arm64/cpufunc_asm.S Fri Sep 16 12:42:36 2016 (r305884) @@ -151,5 +151,5 @@ END(arm64_idcache_wbinv_range) * void arm64_icache_sync_range(vm_offset_t, vm_size_t) */ ENTRY(arm64_icache_sync_range) - cache_handle_range dcop = cvac, ic = 1, icop = ivau + cache_handle_range dcop = cvau, ic = 1, icop = ivau END(arm64_icache_sync_range) From owner-svn-src-stable@freebsd.org Fri Sep 16 12:48:59 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85639BDC9B0; Fri, 16 Sep 2016 12:48:59 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 4E150E6F; Fri, 16 Sep 2016 12:48:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GCmwbc020543; Fri, 16 Sep 2016 12:48:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GCmwuN020542; Fri, 16 Sep 2016 12:48:58 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161248.u8GCmwuN020542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 12:48: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: r305885 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:48:59 -0000 Author: andrew Date: Fri Sep 16 12:48:58 2016 New Revision: 305885 URL: https://svnweb.freebsd.org/changeset/base/305885 Log: MFC 305128: Also handle instruction traps. We might hit these when the page we are executing is being promoted to a superpage. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/trap.c ============================================================================== --- stable/11/sys/arm64/arm64/trap.c Fri Sep 16 12:42:36 2016 (r305884) +++ stable/11/sys/arm64/arm64/trap.c Fri Sep 16 12:48:58 2016 (r305885) @@ -282,6 +282,7 @@ do_el1h_sync(struct trapframe *frame) print_registers(frame); printf(" esr: %.8lx\n", esr); panic("VFP exception in the kernel"); + case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); intr_enable(); From owner-svn-src-stable@freebsd.org Fri Sep 16 12:50:46 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6133FBDCA3D; Fri, 16 Sep 2016 12:50:46 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from kif.fubar.geek.nz (kif.fubar.geek.nz [178.62.119.249]) by mx1.freebsd.org (Postfix) with ESMTP id 322A5FF5; Fri, 16 Sep 2016 12:50:45 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from zapp (global-5-141.nat-2.net.cam.ac.uk [131.111.5.141]) by kif.fubar.geek.nz (Postfix) with ESMTPSA id 8C8D2D78FE; Fri, 16 Sep 2016 12:50:39 +0000 (UTC) Date: Fri, 16 Sep 2016 13:50:36 +0100 From: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r305885 - stable/11/sys/arm64/arm64 Message-ID: <20160916135036.27b6e885@zapp> In-Reply-To: <201609161248.u8GCmwuN020542@repo.freebsd.org> References: <201609161248.u8GCmwuN020542@repo.freebsd.org> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 12:50:46 -0000 On Fri, 16 Sep 2016 12:48:58 +0000 (UTC) Andrew Turner wrote: > Author: andrew > Date: Fri Sep 16 12:48:58 2016 > New Revision: 305885 > URL: https://svnweb.freebsd.org/changeset/base/305885 > > Log: > MFC 305128: > Also handle instruction traps. We might hit these when the page we > are executing is being promoted to a superpage. We don't promote kernel pages that this change is handling, however it was merged for completeness. Andrew From owner-svn-src-stable@freebsd.org Fri Sep 16 13:00:56 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C77DBDCC67; Fri, 16 Sep 2016 13:00:56 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id 5E6E6779; Fri, 16 Sep 2016 13:00:56 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8GD0tlB024487; Fri, 16 Sep 2016 13:00:55 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8GD0tHN024486; Fri, 16 Sep 2016 13:00:55 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201609161300.u8GD0tHN024486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 16 Sep 2016 13:00:55 +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: r305886 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Sep 2016 13:00:56 -0000 Author: andrew Date: Fri Sep 16 13:00:55 2016 New Revision: 305886 URL: https://svnweb.freebsd.org/changeset/base/305886 Log: MFC 305607: Trap msr/mrs instructions. These are privileged arm64 instructions and shouldn't normally be used. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/arm64/arm64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/trap.c ============================================================================== --- stable/11/sys/arm64/arm64/trap.c Fri Sep 16 12:48:58 2016 (r305885) +++ stable/11/sys/arm64/arm64/trap.c Fri Sep 16 13:00:55 2016 (r305886) @@ -388,6 +388,10 @@ do_el0_sync(struct trapframe *frame) call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr); userret(td, frame); break; + case EXCP_MSR: + call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr); + userret(td, frame); + break; case EXCP_SOFTSTP_EL0: td->td_frame->tf_spsr &= ~PSR_SS; td->td_pcb->pcb_flags &= ~PCB_SINGLE_STEP; From owner-svn-src-stable@freebsd.org Sat Sep 17 16:45:58 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 772B4BDE97E; Sat, 17 Sep 2016 16:45:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41CA0146A; Sat, 17 Sep 2016 16:45:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8HGjvbX061435; Sat, 17 Sep 2016 16:45:57 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8HGjvDq061432; Sat, 17 Sep 2016 16:45:57 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201609171645.u8HGjvDq061432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 17 Sep 2016 16:45:57 +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: r305901 - stable/11/sys/boot/powerpc/boot1.chrp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2016 16:45:58 -0000 Author: jhibbits Date: Sat Sep 17 16:45:57 2016 New Revision: 305901 URL: https://svnweb.freebsd.org/changeset/base/305901 Log: MFC r305894: Increase the boot1 file size on the HFS boot image. The boot1.elf is too fat for 30k, it's now 32k on powerpc64, and 34k on powerpc. Without this, boot1 will fail with odd behaviors. Modified: stable/11/sys/boot/powerpc/boot1.chrp/Makefile.hfs stable/11/sys/boot/powerpc/boot1.chrp/generate-hfs.sh stable/11/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/powerpc/boot1.chrp/Makefile.hfs ============================================================================== --- stable/11/sys/boot/powerpc/boot1.chrp/Makefile.hfs Sat Sep 17 16:03:33 2016 (r305900) +++ stable/11/sys/boot/powerpc/boot1.chrp/Makefile.hfs Sat Sep 17 16:45:57 2016 (r305901) @@ -1,4 +1,4 @@ # This file autogenerated by generate-hfs.sh - DO NOT EDIT # $FreeBSD$ -BOOTINFO_OFFSET=0x58 +BOOTINFO_OFFSET=0x9c BOOT1_OFFSET=0x1c Modified: stable/11/sys/boot/powerpc/boot1.chrp/generate-hfs.sh ============================================================================== --- stable/11/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Sat Sep 17 16:03:33 2016 (r305900) +++ stable/11/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Sat Sep 17 16:45:57 2016 (r305901) @@ -15,7 +15,7 @@ HFS_SIZE=1600 #Size in 512-byte blocks of the produced image CHRPBOOT_SIZE=2k -BOOT1_SIZE=30k +BOOT1_SIZE=64k # Generate 800K HFS image OUTPUT_FILE=hfs.tmpl Modified: stable/11/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu ============================================================================== --- stable/11/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu Sat Sep 17 16:03:33 2016 (r305900) +++ stable/11/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu Sat Sep 17 16:45:57 2016 (r305901) @@ -2,17 +2,17 @@ HFS template boot filesystem created by DO NOT EDIT $FreeBSD$ begin 644 hfs.tmpl.bz2 -M0EIH.3%!62936?(HJX\``"]_]?___O)20>!4M2$>0#MUW$1$``$!$``"2!`( -M4EG``>G*VV3"22334_2(/*>ID,@``:#U&"-#(!IZ0`)$HIY0>B-#(/4T```& -M@R:`&@``<:,F1A&(!A-!@$T&@9,FC)D,(#!4E-*--31ZAB!DT!ID:#$81HT& -M@9-!Z::C:E=SZCC1((92M^1Q@3&>="[<2FD((A[AT#`[('#?MSV(S,>HOI'#2,"EJ0PU5).T`PX,54O,RTW8-",N1`R>?SL"+?Q51[H]# -MJ1C5"]BDBF1UJ!Y`J$WTC]QAFZ%Q21$J,I&0,0?9?DPU!Z>$9.380JJCO$Q8 -MXZTX)GQCCGNC%G1BIDBHTK#J9N0,M[85QC:.'>]#,GPRAALU*=)2`$ND22<. --VK/^+N2*<*$AY%%7'@`` +M0EIH.3%!629365^MV6L``"]__O___M)20>!0O2$>0#MUW$!$``%%$``@``!` +M!`!R2<`![@H2"2A2-Z)-HC]4`:`-``T:&@&@#0/TTH<`PC":8A@$`R`&$:9, +MF$8"&AP#",)IB&`0#(`81IDR81@(:")0HT*>4,:0TT`:!ZC0/*/4/1&@;4>H +M&@RYG-FL-,\=C91FTSS@99`O+OA;*$ZN3-&UF`W@#SP:;MVF_EN,-]P$ZN2B +M=";7YHA7VT!#<@,B`H*?S#?Q;CUJ8H8+9:E)+4"L7'CL5&D.IO4;H98%^4@[ +M9`*L&1``5*0#A(EB8BH`S'1O^N +M)Y6'!#N:*:JYTEX\:%'"?.G$FCP8TM_0/ND`^IG3[ +M.QUEDP&P>3+Z442Q!:S.A1>00]'X'D%)UX9QZ>$Q?(808QB-4%9BBTL"L(BB +MEJ*'HH820Q$'%G':JF.:>$U4H`0S`:GSZM-C5BNX(2&$B"J*45`"4FEZ__%W +))%.%"07ZW9:P ` end