From owner-svn-src-stable@freebsd.org Sun Apr 30 06:14:59 2017 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 734FFD56128; Sun, 30 Apr 2017 06:14:59 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4035919F5; Sun, 30 Apr 2017 06:14:59 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U6EwiO096940; Sun, 30 Apr 2017 06:14:58 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U6EwPT096938; Sun, 30 Apr 2017 06:14:58 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704300614.v3U6EwPT096938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Apr 2017 06:14: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: r317602 - stable/11/sys/compat/linux 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, 30 Apr 2017 06:14:59 -0000 Author: dchagin Date: Sun Apr 30 06:14:57 2017 New Revision: 317602 URL: https://svnweb.freebsd.org/changeset/base/317602 Log: MFC r317323: Add Evdev ioctl handler to the Linuxulator. PR: 218627 Modified: stable/11/sys/compat/linux/linux_ioctl.c stable/11/sys/compat/linux/linux_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.c Sun Apr 30 05:56:57 2017 (r317601) +++ stable/11/sys/compat/linux/linux_ioctl.c Sun Apr 30 06:14:57 2017 (r317602) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #ifdef COMPAT_LINUX32 @@ -83,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -110,6 +112,7 @@ static linux_ioctl_function_t linux_ioct static linux_ioctl_function_t linux_ioctl_v4l2; static linux_ioctl_function_t linux_ioctl_special; static linux_ioctl_function_t linux_ioctl_fbsd_usb; +static linux_ioctl_function_t linux_ioctl_evdev; static struct linux_ioctl_handler cdrom_handler = { linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; @@ -139,6 +142,8 @@ static struct linux_ioctl_handler video2 { linux_ioctl_v4l2, LINUX_IOCTL_VIDEO2_MIN, LINUX_IOCTL_VIDEO2_MAX }; static struct linux_ioctl_handler fbsd_usb = { linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX }; +static struct linux_ioctl_handler evdev_handler = +{ linux_ioctl_evdev, LINUX_IOCTL_EVDEV_MIN, LINUX_IOCTL_EVDEV_MAX }; DATA_SET(linux_ioctl_handler_set, cdrom_handler); DATA_SET(linux_ioctl_handler_set, vfat_handler); @@ -154,6 +159,7 @@ DATA_SET(linux_ioctl_handler_set, sg_han DATA_SET(linux_ioctl_handler_set, video_handler); DATA_SET(linux_ioctl_handler_set, video2_handler); DATA_SET(linux_ioctl_handler_set, fbsd_usb); +DATA_SET(linux_ioctl_handler_set, evdev_handler); struct handler_element { @@ -3573,6 +3579,65 @@ linux_ioctl_fbsd_usb(struct thread *td, } /* + * Some evdev ioctls must be translated. + * - EVIOCGMTSLOTS is a IOC_READ ioctl on Linux although it has input data + * (must be IOC_INOUT on FreeBSD). + * - On Linux, EVIOCGRAB, EVIOCREVOKE and EVIOCRMFF are defined as _IOW with + * an int argument. You don't pass an int pointer to the ioctl(), however, + * but just the int directly. On FreeBSD, they are defined as _IOWINT for + * this to work. + */ +static int +linux_ioctl_evdev(struct thread *td, struct linux_ioctl_args *args) +{ + cap_rights_t rights; + struct file *fp; + clockid_t clock; + int error; + + args->cmd = SETDIR(args->cmd); + + switch (args->cmd) { + case (EVIOCGRAB & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCGRAB; + break; + case (EVIOCREVOKE & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCREVOKE; + break; + case (EVIOCRMFF & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCRMFF; + break; + case EVIOCSCLOCKID: { + error = copyin(PTRIN(args->arg), &clock, sizeof(clock)); + if (error != 0) + return (error); + if (clock & ~(LINUX_IOCTL_EVDEV_CLK)) + return (EINVAL); + error = linux_to_native_clockid(&clock, clock); + if (error != 0) + return (error); + + error = fget(td, args->fd, + cap_rights_init(&rights, CAP_IOCTL), &fp); + if (error != 0) + return (error); + + error = fo_ioctl(fp, EVIOCSCLOCKID, &clock, td->td_ucred, td); + fdrop(fp, td); + return (error); + } + default: + break; + } + + if (IOCBASECMD(args->cmd) == + ((EVIOCGMTSLOTS(0) & ~IOC_DIRMASK) | IOC_OUT)) + args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_INOUT; + + return (sys_ioctl(td, (struct ioctl_args *)args)); +} + +/* * main ioctl syscall function */ Modified: stable/11/sys/compat/linux/linux_ioctl.h ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.h Sun Apr 30 05:56:57 2017 (r317601) +++ stable/11/sys/compat/linux/linux_ioctl.h Sun Apr 30 06:14:57 2017 (r317602) @@ -749,7 +749,13 @@ */ #define LINUX_BTRFS_IOC_CLONE 0x9409 /* 0x40049409 */ - +/* + * Linux evdev ioctl min and max + */ +#define LINUX_IOCTL_EVDEV_MIN 0x4500 +#define LINUX_IOCTL_EVDEV_MAX 0x45ff +#define LINUX_IOCTL_EVDEV_CLK LINUX_CLOCK_REALTIME | \ + LINUX_CLOCK_MONOTONIC |LINUX_CLOCK_BOOTTIME /* * Pluggable ioctl handlers */ From owner-svn-src-stable@freebsd.org Sun Apr 30 06:15:58 2017 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 061AAD561C6; Sun, 30 Apr 2017 06:15:58 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CBC121B30; Sun, 30 Apr 2017 06:15:57 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U6FuQG097052; Sun, 30 Apr 2017 06:15:56 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U6FuXo097051; Sun, 30 Apr 2017 06:15:56 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704300615.v3U6FuXo097051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Apr 2017 06:15: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: r317603 - stable/11/sys/compat/linux 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, 30 Apr 2017 06:15:58 -0000 Author: dchagin Date: Sun Apr 30 06:15:56 2017 New Revision: 317603 URL: https://svnweb.freebsd.org/changeset/base/317603 Log: MFC r317324: Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME. Modified: stable/11/sys/compat/linux/linux_time.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_time.c ============================================================================== --- stable/11/sys/compat/linux/linux_time.c Sun Apr 30 06:14:57 2017 (r317602) +++ stable/11/sys/compat/linux/linux_time.c Sun Apr 30 06:15:56 2017 (r317603) @@ -207,8 +207,10 @@ linux_to_native_clockid(clockid_t *n, cl case LINUX_CLOCK_MONOTONIC_COARSE: *n = CLOCK_MONOTONIC_FAST; break; - case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_BOOTTIME: + *n = CLOCK_UPTIME; + break; + case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_REALTIME_ALARM: case LINUX_CLOCK_BOOTTIME_ALARM: case LINUX_CLOCK_SGI_CYCLE: From owner-svn-src-stable@freebsd.org Sun Apr 30 13:25:12 2017 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 5DC21D57133; Sun, 30 Apr 2017 13:25:12 +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 2D70CF4B; Sun, 30 Apr 2017 13:25:12 +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 v3UDPBVB075194; Sun, 30 Apr 2017 13:25:11 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UDPB1H075193; Sun, 30 Apr 2017 13:25:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704301325.v3UDPB1H075193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 30 Apr 2017 13: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: r317607 - stable/11/tools/build/mk 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, 30 Apr 2017 13:25:12 -0000 Author: dim Date: Sun Apr 30 13:25:10 2017 New Revision: 317607 URL: https://svnweb.freebsd.org/changeset/base/317607 Log: MFC r310889 (by jkim): Do not remove llvm-objdump. It is installed by default since r310840. MFC r311311 (by jkim): Remove llvm-objdump when Clang is disabled. It was missed in r310889. Submitted by: dim Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sun Apr 30 10:47:59 2017 (r317606) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sun Apr 30 13:25:10 2017 (r317607) @@ -1354,6 +1354,7 @@ OLD_FILES+=usr/bin/clang OLD_FILES+=usr/bin/clang++ OLD_FILES+=usr/bin/clang-cpp OLD_FILES+=usr/bin/clang-tblgen +OLD_FILES+=usr/bin/llvm-objdump OLD_FILES+=usr/bin/llvm-tblgen OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/4.0.0/include/sanitizer/asan_interface.h @@ -1498,7 +1499,6 @@ OLD_FILES+=usr/bin/llvm-lto2 OLD_FILES+=usr/bin/llvm-mc OLD_FILES+=usr/bin/llvm-modextract OLD_FILES+=usr/bin/llvm-nm -OLD_FILES+=usr/bin/llvm-objdump OLD_FILES+=usr/bin/llvm-pdbdump OLD_FILES+=usr/bin/llvm-ranlib OLD_FILES+=usr/bin/llvm-rtdyld From owner-svn-src-stable@freebsd.org Sun Apr 30 18:39:32 2017 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 A95D5D57E66; Sun, 30 Apr 2017 18:39:32 +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 704061AF7; Sun, 30 Apr 2017 18:39:32 +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 v3UIdVni005368; Sun, 30 Apr 2017 18:39:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UIdVcA005366; Sun, 30 Apr 2017 18:39:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201704301839.v3UIdVcA005366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 30 Apr 2017 18:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317609 - in stable/11/sys/dev/drm2: . i915 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, 30 Apr 2017 18:39:32 -0000 Author: markj Date: Sun Apr 30 18:39:31 2017 New Revision: 317609 URL: https://svnweb.freebsd.org/changeset/base/317609 Log: MFC r316749 (by cem): drm2: Add some missing PCIIDs for some Haswell systems PR: 218969 Modified: stable/11/sys/dev/drm2/drm_pciids.h stable/11/sys/dev/drm2/i915/i915_drv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/drm2/drm_pciids.h ============================================================================== --- stable/11/sys/dev/drm2/drm_pciids.h Sun Apr 30 16:12:23 2017 (r317608) +++ stable/11/sys/dev/drm2/drm_pciids.h Sun Apr 30 18:39:31 2017 (r317609) @@ -54,6 +54,7 @@ {0x8086, 0x0412, 0, "Intel Haswell (GT2 desktop)"}, \ {0x8086, 0x0416, 0, "Intel Haswell (GT2 mobile)"}, \ {0x8086, 0x041A, 0, "Intel Haswell (GT2 server)"}, \ + {0x8086, 0x041E, 0, "Intel Haswell (GT2 desktop)"}, \ {0x8086, 0x0422, 0, "Intel Haswell (GT2 desktop)"}, \ {0x8086, 0x0426, 0, "Intel Haswell (GT2 mobile)"}, \ {0x8086, 0x042A, 0, "Intel Haswell (GT2 server)"}, \ Modified: stable/11/sys/dev/drm2/i915/i915_drv.c ============================================================================== --- stable/11/sys/dev/drm2/i915/i915_drv.c Sun Apr 30 16:12:23 2017 (r317608) +++ stable/11/sys/dev/drm2/i915/i915_drv.c Sun Apr 30 18:39:31 2017 (r317609) @@ -380,6 +380,7 @@ static const struct intel_gfx_device_id INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */ INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */ + INTEL_VGA_DEVICE(0x041e, &intel_haswell_d_info), /* GT2 desktop */ INTEL_VGA_DEVICE(0x0422, &intel_haswell_d_info), /* GT2 desktop */ INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */ INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */ From owner-svn-src-stable@freebsd.org Mon May 1 00:42:33 2017 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 28487D45823; Mon, 1 May 2017 00:42:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 EC0F13D7; Mon, 1 May 2017 00:42:32 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v410gVhe057450; Mon, 1 May 2017 00:42:31 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v410gVSO057449; Mon, 1 May 2017 00:42:31 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705010042.v410gVSO057449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 1 May 2017 00:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317613 - stable/11/lib/libc/gen 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, 01 May 2017 00:42:33 -0000 Author: pfg Date: Mon May 1 00:42:31 2017 New Revision: 317613 URL: https://svnweb.freebsd.org/changeset/base/317613 Log: MFC r317372: scandir(3): promote arraysz to size_t to match numitems. The internal array size goes through a loop and is compared with numitems which at its limits makes can be unreachably higher than arraysz. Prevent an hypothetical overflow, and signed/unsigned comparison, by matching the types. Modified: stable/11/lib/libc/gen/scandir.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/scandir.c ============================================================================== --- stable/11/lib/libc/gen/scandir.c Sun Apr 30 22:38:15 2017 (r317612) +++ stable/11/lib/libc/gen/scandir.c Mon May 1 00:42:31 2017 (r317613) @@ -82,8 +82,7 @@ scandir(const char *dirname, struct dire #endif { struct dirent *d, *p, **names = NULL; - size_t numitems; - long arraysz; + size_t arraysz, numitems; DIR *dirp; if ((dirp = opendir(dirname)) == NULL) From owner-svn-src-stable@freebsd.org Mon May 1 01:36:59 2017 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 693A7D58C1C; Mon, 1 May 2017 01:36:59 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 327231765; Mon, 1 May 2017 01:36:59 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v411awLT078897; Mon, 1 May 2017 01:36:58 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v411atC9078866; Mon, 1 May 2017 01:36:55 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201705010136.v411atC9078866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 1 May 2017 01:36: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: r317618 - in stable/11: contrib/netbsd-tests/lib/libc/sys include lib/libc/include lib/libc/sys lib/libc/tests/sys lib/libthr/thread share/man/man3 sys/compat/freebsd32 sys/kern 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: Mon, 01 May 2017 01:36:59 -0000 Author: vangyzen Date: Mon May 1 01:36:54 2017 New Revision: 317618 URL: https://svnweb.freebsd.org/changeset/base/317618 Log: MFC r315526 Add clock_nanosleep() Add a clock_nanosleep() syscall, as specified by POSIX. Make nanosleep() a wrapper around it. Attach the clock_nanosleep test from NetBSD. Adjust it for the FreeBSD behavior of updating rmtp only when interrupted by a signal. I believe this to be POSIX-compliant, since POSIX mentions the rmtp parameter only in the paragraph about EINTR. This is also what Linux does. (NetBSD updates rmtp unconditionally.) Copy the whole nanosleep.2 man page from NetBSD because it is complete and closely resembles the POSIX description. Edit, polish, and reword it a bit, being sure to keep any relevant text from the FreeBSD page. Regenerate syscall files. Relnotes: yes Sponsored by: Dell EMC Added: stable/11/lib/libc/sys/clock_nanosleep.c - copied unchanged from r315526, head/lib/libc/sys/clock_nanosleep.c Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c stable/11/include/time.h stable/11/lib/libc/include/libc_private.h stable/11/lib/libc/include/namespace.h stable/11/lib/libc/include/un-namespace.h stable/11/lib/libc/sys/Makefile.inc stable/11/lib/libc/sys/Symbol.map stable/11/lib/libc/sys/interposing_table.c stable/11/lib/libc/sys/nanosleep.2 stable/11/lib/libc/tests/sys/Makefile stable/11/lib/libthr/thread/thr_private.h stable/11/lib/libthr/thread/thr_syscalls.c stable/11/share/man/man3/pthread_testcancel.3 stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/compat/freebsd32/freebsd32_proto.h stable/11/sys/compat/freebsd32/freebsd32_syscall.h stable/11/sys/compat/freebsd32/freebsd32_syscalls.c stable/11/sys/compat/freebsd32/freebsd32_sysent.c stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c stable/11/sys/compat/freebsd32/syscalls.master stable/11/sys/kern/init_sysent.c stable/11/sys/kern/kern_time.c stable/11/sys/kern/syscalls.c stable/11/sys/kern/syscalls.master stable/11/sys/kern/systrace_args.c stable/11/sys/sys/syscall.h stable/11/sys/sys/syscall.mk stable/11/sys/sys/syscallsubr.h stable/11/sys/sys/sysproto.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c Mon May 1 01:36:54 2017 (r317618) @@ -46,7 +46,11 @@ ATF_TC_BODY(clock_nanosleep_remain, tc) rqtp.tv_sec = 0; rqtp.tv_nsec = 0; rmtp.tv_sec = -1; rmtp.tv_nsec = -1; ATF_REQUIRE(clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, &rmtp) == 0); +#ifdef __FreeBSD__ + ATF_CHECK(rmtp.tv_sec == -1 && rmtp.tv_nsec == -1); +#else ATF_CHECK(rmtp.tv_sec == 0 && rmtp.tv_nsec == 0); +#endif ATF_REQUIRE(clock_gettime(CLOCK_REALTIME, &rqtp) == 0); rmtp.tv_sec = -1; rmtp.tv_nsec = -1; Modified: stable/11/include/time.h ============================================================================== --- stable/11/include/time.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/include/time.h Mon May 1 01:36:54 2017 (r317618) @@ -169,12 +169,12 @@ void tzset(void); int clock_getres(clockid_t, struct timespec *); int clock_gettime(clockid_t, struct timespec *); int clock_settime(clockid_t, const struct timespec *); -/* XXX missing: clock_nanosleep() */ int nanosleep(const struct timespec *, struct timespec *); #endif /* __POSIX_VISIBLE >= 199309 */ #if __POSIX_VISIBLE >= 200112 int clock_getcpuclockid(pid_t, clockid_t *); +int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); #endif #if __POSIX_VISIBLE >= 199506 Modified: stable/11/lib/libc/include/libc_private.h ============================================================================== --- stable/11/lib/libc/include/libc_private.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/include/libc_private.h Mon May 1 01:36:54 2017 (r317618) @@ -229,6 +229,7 @@ enum { INTERPOS_ppoll, INTERPOS_map_stacks_exec, INTERPOS_fdatasync, + INTERPOS_clock_nanosleep, INTERPOS_MAX }; @@ -318,6 +319,8 @@ int __sys_aio_suspend(const struct aioc int __sys_accept(int, struct sockaddr *, __socklen_t *); int __sys_accept4(int, struct sockaddr *, __socklen_t *, int); int __sys_clock_gettime(__clockid_t, struct timespec *ts); +int __sys_clock_nanosleep(__clockid_t, int, + const struct timespec *, struct timespec *); int __sys_close(int); int __sys_connect(int, const struct sockaddr *, __socklen_t); int __sys_fcntl(int, int, ...); Modified: stable/11/lib/libc/include/namespace.h ============================================================================== --- stable/11/lib/libc/include/namespace.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/include/namespace.h Mon May 1 01:36:54 2017 (r317618) @@ -56,6 +56,7 @@ #define bind _bind #define __cap_get_fd ___cap_get_fd #define __cap_set_fd ___cap_set_fd +#define clock_nanosleep _clock_nanosleep #define close _close #define connect _connect #define dup _dup Modified: stable/11/lib/libc/include/un-namespace.h ============================================================================== --- stable/11/lib/libc/include/un-namespace.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/include/un-namespace.h Mon May 1 01:36:54 2017 (r317618) @@ -37,6 +37,7 @@ #undef bind #undef __cap_get_fd #undef __cap_set_fd +#undef clock_nanosleep #undef close #undef connect #undef dup Modified: stable/11/lib/libc/sys/Makefile.inc ============================================================================== --- stable/11/lib/libc/sys/Makefile.inc Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/sys/Makefile.inc Mon May 1 01:36:54 2017 (r317618) @@ -34,6 +34,7 @@ INTERPOSED = \ accept \ accept4 \ aio_suspend \ + clock_nanosleep \ close \ connect \ fcntl \ @@ -349,6 +350,7 @@ MLINKS+=chown.2 fchown.2 \ chown.2 lchown.2 MLINKS+=clock_gettime.2 clock_getres.2 \ clock_gettime.2 clock_settime.2 +MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2 Modified: stable/11/lib/libc/sys/Symbol.map ============================================================================== --- stable/11/lib/libc/sys/Symbol.map Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/sys/Symbol.map Mon May 1 01:36:54 2017 (r317618) @@ -399,6 +399,7 @@ FBSD_1.4 { }; FBSD_1.5 { + clock_nanosleep; fdatasync; }; @@ -511,6 +512,7 @@ FBSDprivate_1.0 { __sys_clock_getres; _clock_gettime; __sys_clock_gettime; + __sys_clock_nanosleep; _clock_settime; __sys_clock_settime; _close; Copied: stable/11/lib/libc/sys/clock_nanosleep.c (from r315526, head/lib/libc/sys/clock_nanosleep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/sys/clock_nanosleep.c Mon May 1 01:36:54 2017 (r317618, copy of r315526, head/lib/libc/sys/clock_nanosleep.c) @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Eric van Gyzen + * Copyright (c) 2014 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: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), 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 COPYRIGHT HOLDER(S) ``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 COPYRIGHT HOLDER(S) 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +__weak_reference(__sys_clock_nanosleep, __clock_nanosleep); + +#pragma weak clock_nanosleep +int +clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, + struct timespec *rmtp) +{ + + return (((int (*)(clockid_t, int, const struct timespec *, + struct timespec *)) + __libc_interposing[INTERPOS_clock_nanosleep])(clock_id, flags, + rqtp, rmtp)); +} Modified: stable/11/lib/libc/sys/interposing_table.c ============================================================================== --- stable/11/lib/libc/sys/interposing_table.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/sys/interposing_table.c Mon May 1 01:36:54 2017 (r317618) @@ -80,6 +80,7 @@ interpos_func_t __libc_interposing[INTER SLOT(ppoll, __sys_ppoll), SLOT(map_stacks_exec, __libc_map_stacks_exec), SLOT(fdatasync, __sys_fdatasync), + SLOT(clock_nanosleep, __sys_clock_nanosleep), }; #undef SLOT Modified: stable/11/lib/libc/sys/nanosleep.2 ============================================================================== --- stable/11/lib/libc/sys/nanosleep.2 Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/sys/nanosleep.2 Mon May 1 01:36:54 2017 (r317618) @@ -1,5 +1,4 @@ -.\" $OpenBSD: nanosleep.2,v 1.1 1997/04/20 20:56:20 tholo Exp $ -.\" $NetBSD: nanosleep.2,v 1.1 1997/04/17 18:12:02 jtc Exp $ +.\" $NetBSD: nanosleep.2,v 1.23 2016/11/14 10:40:59 wiz Exp $ .\" .\" Copyright (c) 1986, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -31,51 +30,136 @@ .\" @(#)sleep.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 17, 1997 +.Dd March 17, 2017 .Dt NANOSLEEP 2 .Os .Sh NAME .Nm nanosleep -.Nd suspend process execution for an interval measured in nanoseconds +.Nd high resolution sleep .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In time.h .Ft int -.Fn nanosleep "const struct timespec *rqtp" "struct timespec *rmtp" +.Fo clock_nanosleep +.Fa "clockid_t clock_id" +.Fa "int flags" +.Fa "const struct timespec *rqtp" +.Fa "struct timespec *rmtp" +.Fc +.Ft int +.Fo nanosleep +.Fa "const struct timespec *rqtp" +.Fa "struct timespec *rmtp" +.Fc .Sh DESCRIPTION -The -.Fn nanosleep -system call -causes the calling thread to sleep until the time interval specified by +If the +.Dv TIMER_ABSTIME +flag is not set in the +.Fa flags +argument, then +.Fn clock_nanosleep +suspends execution of the calling thread until either the +time interval specified by the +.Fa rqtp +argument has elapsed, +or a signal is delivered to the calling process and its +action is to invoke a signal-catching function or to terminate the +process. +The clock used to measure the time is specified by the +.Fa clock_id +argument. +.Pp +If the +.Dv TIMER_ABSTIME +flag is set in the +.Fa flags +argument, then +.Fn clock_nanosleep +suspends execution of the calling thread until either the value +of the clock specified by the +.Fa clock_id +argument reaches the absolute time specified by the +.Fa rqtp +argument, +or a signal is delivered to the calling process and its +action is to invoke a signal-catching function or to terminate the +process. +If, at the time of the call, the time value specified by .Fa rqtp -has elapsed. -An unmasked signal will -cause it to terminate the sleep early, regardless of the +is less than or equal to the time value of the specified clock, then +.Fn clock_nanosleep +returns immediately and the calling thread is not suspended. +.Pp +The suspension time may be longer than requested due to the +scheduling of other activity by the system. +An unmasked signal will terminate the sleep early, regardless of the .Dv SA_RESTART value on the interrupting signal. -.Sh RETURN VALUES -If the +The +.Fa rqtp +and +.Fa rmtp +arguments can point to the same object. +.Pp +The following +.Fa clock_id +values are supported: +.Pp +.Bl -item -compact -offset indent +.It +CLOCK_MONOTONIC +.It +CLOCK_MONOTONIC_FAST +.It +CLOCK_MONOTONIC_PRECISE +.It +CLOCK_REALTIME +.It +CLOCK_REALTIME_FAST +.It +CLOCK_REALTIME_PRECISE +.It +CLOCK_SECOND +.It +CLOCK_UPTIME +.It +CLOCK_UPTIME_FAST +.It +CLOCK_UPTIME_PRECISE +.El +.Pp +The .Fn nanosleep -system call returns because the requested time has elapsed, the value -returned will be zero. +function behaves like +.Fn clock_nanosleep +with a +.Fa clock_id +argument of +.Dv CLOCK_REALTIME +and without the +.Dv TIMER_ABSTIME +flag in the +.Fa flags +argument. +.Sh RETURN VALUES +These functions return zero when the requested time has elapsed. .Pp -If the +If these functions return for any other reason, then +.Fn clock_nanosleep +will directly return the error number, and .Fn nanosleep -system call returns due to the delivery of a signal, the value returned -will be -1, and the global variable +will return \-1 with the global variable .Va errno -will be set to indicate the interruption. -If +set to indicate the error. +If a relative sleep is interrupted by a signal and .Fa rmtp is -.No non- Ns Dv NULL , +.Pf non- Dv NULL , the timespec structure it references is updated to contain the unslept amount (the request time minus the time actually slept). .Sh ERRORS -The -.Fn nanosleep -system call fails if: +These functions can fail with the following errors. .Bl -tag -width Er .It Bq Er EFAULT Either @@ -85,27 +169,32 @@ or points to memory that is not a valid part of the process address space. .It Bq Er EINTR -The -.Fn nanosleep -system call -was interrupted by the delivery of a signal. +The function was interrupted by the delivery of a signal. .It Bq Er EINVAL The .Fa rqtp -argument -specified a nanosecond value less than zero +argument specified a nanosecond value less than zero or greater than or equal to 1000 million. -.It Bq Er ENOSYS +.It Bq Er EINVAL The -.Fn nanosleep -system call -is not supported by this implementation. +.Fa flags +argument contained an invalid flag. +.It Bq Er EINVAL +The +.Fa clock_id +argument was +.Dv CLOCK_THREAD_CPUTIME_ID +or an unrecognized value. +.It Bq Er ENOTSUP +The +.Fa clock_id +argument was valid but not supported by this implementation of +.Fn clock_nanosleep . .El .Sh SEE ALSO -.Xr sigsuspend 2 , +.Xr clock_gettime 2 , +.Xr sigaction 2 , .Xr sleep 3 .Sh STANDARDS -The -.Fn nanosleep -system call conforms to -.St -p1003.1b-93 . +These functions conform to +.St -p1003.1-2008 . Modified: stable/11/lib/libc/tests/sys/Makefile ============================================================================== --- stable/11/lib/libc/tests/sys/Makefile Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libc/tests/sys/Makefile Mon May 1 01:36:54 2017 (r317618) @@ -12,6 +12,7 @@ NETBSD_ATF_TESTS_C+= access_test NETBSD_ATF_TESTS_C+= bind_test NETBSD_ATF_TESTS_C+= chroot_test NETBSD_ATF_TESTS_C+= clock_gettime_test +NETBSD_ATF_TESTS_C+= clock_nanosleep_test NETBSD_ATF_TESTS_C+= connect_test NETBSD_ATF_TESTS_C+= dup_test NETBSD_ATF_TESTS_C+= fsync_test Modified: stable/11/lib/libthr/thread/thr_private.h ============================================================================== --- stable/11/lib/libthr/thread/thr_private.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libthr/thread/thr_private.h Mon May 1 01:36:54 2017 (r317618) @@ -865,6 +865,8 @@ int __sys_sigwaitinfo(const sigset_t *se /* #include */ #ifdef _TIME_H_ +int __sys_clock_nanosleep(clockid_t, int, const struct timespec *, + struct timespec *); int __sys_nanosleep(const struct timespec *, struct timespec *); #endif Modified: stable/11/lib/libthr/thread/thr_syscalls.c ============================================================================== --- stable/11/lib/libthr/thread/thr_syscalls.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/lib/libthr/thread/thr_syscalls.c Mon May 1 01:36:54 2017 (r317618) @@ -260,6 +260,22 @@ __thr_msync(void *addr, size_t len, int } static int +__thr_clock_nanosleep(clockid_t clock_id, int flags, + const struct timespec *time_to_sleep, struct timespec *time_remaining) +{ + struct pthread *curthread; + int ret; + + curthread = _get_curthread(); + _thr_cancel_enter(curthread); + ret = __sys_clock_nanosleep(clock_id, flags, time_to_sleep, + time_remaining); + _thr_cancel_leave(curthread, 1); + + return (ret); +} + +static int __thr_nanosleep(const struct timespec *time_to_sleep, struct timespec *time_remaining) { @@ -668,6 +684,7 @@ __thr_interpose_libc(void) SLOT(ppoll); SLOT(map_stacks_exec); SLOT(fdatasync); + SLOT(clock_nanosleep); #undef SLOT *(__libc_interposing_slot( INTERPOS__pthread_mutex_init_calloc_cb)) = Modified: stable/11/share/man/man3/pthread_testcancel.3 ============================================================================== --- stable/11/share/man/man3/pthread_testcancel.3 Mon May 1 01:35:43 2017 (r317617) +++ stable/11/share/man/man3/pthread_testcancel.3 Mon May 1 01:36:54 2017 (r317618) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd February 17, 2017 +.Dd March 18, 2017 .Dt PTHREAD_TESTCANCEL 3 .Os .Sh NAME @@ -105,6 +105,7 @@ functions: .It Fn accept4 .It Fn aio_suspend .It Fn connect +.It Fn clock_nanosleep .It Fn close .It Fn creat .It Fn fcntl Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Mon May 1 01:36:54 2017 (r317618) @@ -129,6 +129,8 @@ CTASSERT(sizeof(struct sigaction32) == 2 static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count); static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count); +static int freebsd32_user_clock_nanosleep(struct thread *td, clockid_t clock_id, + int flags, const struct timespec32 *ua_rqtp, struct timespec32 *ua_rmtp); void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32) @@ -2226,28 +2228,48 @@ ofreebsd32_sigstack(struct thread *td, int freebsd32_nanosleep(struct thread *td, struct freebsd32_nanosleep_args *uap) { + + return (freebsd32_user_clock_nanosleep(td, CLOCK_REALTIME, + TIMER_RELTIME, uap->rqtp, uap->rmtp)); +} + +int +freebsd32_clock_nanosleep(struct thread *td, + struct freebsd32_clock_nanosleep_args *uap) +{ + int error; + + error = freebsd32_user_clock_nanosleep(td, uap->clock_id, uap->flags, + uap->rqtp, uap->rmtp); + return (kern_posix_error(td, error)); +} + +static int +freebsd32_user_clock_nanosleep(struct thread *td, clockid_t clock_id, + int flags, const struct timespec32 *ua_rqtp, struct timespec32 *ua_rmtp) +{ struct timespec32 rmt32, rqt32; struct timespec rmt, rqt; int error; - error = copyin(uap->rqtp, &rqt32, sizeof(rqt32)); + error = copyin(ua_rqtp, &rqt32, sizeof(rqt32)); if (error) return (error); CP(rqt32, rqt, tv_sec); CP(rqt32, rqt, tv_nsec); - if (uap->rmtp && - !useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE)) + if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 && + !useracc(ua_rmtp, sizeof(rmt32), VM_PROT_WRITE)) return (EFAULT); - error = kern_nanosleep(td, &rqt, &rmt); - if (error == EINTR && uap->rmtp) { + error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt); + if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) { int error2; CP(rmt, rmt32, tv_sec); CP(rmt, rmt32, tv_nsec); - error2 = copyout(&rmt32, uap->rmtp, sizeof(rmt32)); + error2 = copyout(&rmt32, ua_rmtp, sizeof(rmt32)); if (error2) error = error2; } Modified: stable/11/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_proto.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_proto.h Mon May 1 01:36:54 2017 (r317618) @@ -236,6 +236,12 @@ struct freebsd32_nanosleep_args { char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; }; +struct freebsd32_clock_nanosleep_args { + char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; + char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; +}; struct freebsd32_clock_getcpuclockid2_args { char id1_l_[PADL_(uint32_t)]; uint32_t id1; char id1_r_[PADR_(uint32_t)]; char id2_l_[PADL_(uint32_t)]; uint32_t id2; char id2_r_[PADR_(uint32_t)]; @@ -728,6 +734,7 @@ int freebsd32_ktimer_create(struct threa int freebsd32_ktimer_settime(struct thread *, struct freebsd32_ktimer_settime_args *); int freebsd32_ktimer_gettime(struct thread *, struct freebsd32_ktimer_gettime_args *); int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *); +int freebsd32_clock_nanosleep(struct thread *, struct freebsd32_clock_nanosleep_args *); int freebsd32_clock_getcpuclockid2(struct thread *, struct freebsd32_clock_getcpuclockid2_args *); int freebsd32_aio_read(struct thread *, struct freebsd32_aio_read_args *); int freebsd32_aio_write(struct thread *, struct freebsd32_aio_write_args *); @@ -1186,6 +1193,7 @@ int freebsd10_freebsd32_pipe(struct thre #define FREEBSD32_SYS_AUE_freebsd32_ktimer_settime AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_ktimer_gettime AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_nanosleep AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_clock_nanosleep AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_clock_getcpuclockid2 AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_read AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_write AUE_NULL Modified: stable/11/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_syscall.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_syscall.h Mon May 1 01:36:54 2017 (r317618) @@ -215,6 +215,7 @@ #define FREEBSD32_SYS_ffclock_getcounter 241 #define FREEBSD32_SYS_ffclock_setestimate 242 #define FREEBSD32_SYS_ffclock_getestimate 243 +#define FREEBSD32_SYS_freebsd32_clock_nanosleep 244 #define FREEBSD32_SYS_freebsd32_clock_getcpuclockid2 247 #define FREEBSD32_SYS_minherit 250 #define FREEBSD32_SYS_rfork 251 Modified: stable/11/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_syscalls.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_syscalls.c Mon May 1 01:36:54 2017 (r317618) @@ -254,7 +254,7 @@ const char *freebsd32_syscallnames[] = { "ffclock_getcounter", /* 241 = ffclock_getcounter */ "ffclock_setestimate", /* 242 = ffclock_setestimate */ "ffclock_getestimate", /* 243 = ffclock_getestimate */ - "#244", /* 244 = nosys */ + "freebsd32_clock_nanosleep", /* 244 = freebsd32_clock_nanosleep */ "#245", /* 245 = nosys */ "#246", /* 246 = nosys */ "freebsd32_clock_getcpuclockid2", /* 247 = freebsd32_clock_getcpuclockid2 */ Modified: stable/11/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_sysent.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_sysent.c Mon May 1 01:36:54 2017 (r317618) @@ -297,7 +297,7 @@ struct sysent freebsd32_sysent[] = { { AS(ffclock_getcounter_args), (sy_call_t *)sys_ffclock_getcounter, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 241 = ffclock_getcounter */ { AS(ffclock_setestimate_args), (sy_call_t *)sys_ffclock_setestimate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 242 = ffclock_setestimate */ { AS(ffclock_getestimate_args), (sy_call_t *)sys_ffclock_getestimate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 243 = ffclock_getestimate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 244 = nosys */ + { AS(freebsd32_clock_nanosleep_args), (sy_call_t *)freebsd32_clock_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 244 = freebsd32_clock_nanosleep */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 245 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 246 = nosys */ { AS(freebsd32_clock_getcpuclockid2_args), (sy_call_t *)freebsd32_clock_getcpuclockid2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 247 = freebsd32_clock_getcpuclockid2 */ Modified: stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/freebsd32_systrace_args.c Mon May 1 01:36:54 2017 (r317618) @@ -1260,6 +1260,16 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* freebsd32_clock_nanosleep */ + case 244: { + struct freebsd32_clock_nanosleep_args *p = params; + iarg[0] = p->clock_id; /* clockid_t */ + iarg[1] = p->flags; /* int */ + uarg[2] = (intptr_t) p->rqtp; /* const struct timespec32 * */ + uarg[3] = (intptr_t) p->rmtp; /* struct timespec32 * */ + *n_args = 4; + break; + } /* freebsd32_clock_getcpuclockid2 */ case 247: { struct freebsd32_clock_getcpuclockid2_args *p = params; @@ -5312,6 +5322,25 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* freebsd32_clock_nanosleep */ + case 244: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "int"; + break; + case 2: + p = "const struct timespec32 *"; + break; + case 3: + p = "struct timespec32 *"; + break; + default: + break; + }; + break; /* freebsd32_clock_getcpuclockid2 */ case 247: switch(ndx) { @@ -9651,6 +9680,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_clock_nanosleep */ + case 244: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* freebsd32_clock_getcpuclockid2 */ case 247: if (ndx == 0 || ndx == 1) Modified: stable/11/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/11/sys/compat/freebsd32/syscalls.master Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/compat/freebsd32/syscalls.master Mon May 1 01:36:54 2017 (r317618) @@ -462,7 +462,10 @@ struct ffclock_estimate *cest); } 243 AUE_NULL NOPROTO { int ffclock_getestimate( \ struct ffclock_estimate *cest); } -244 AUE_NULL UNIMPL nosys +244 AUE_NULL STD { int freebsd32_clock_nanosleep( \ + clockid_t clock_id, int flags, \ + const struct timespec32 *rqtp, \ + struct timespec32 *rmtp); } 245 AUE_NULL UNIMPL nosys 246 AUE_NULL UNIMPL nosys 247 AUE_NULL STD { int freebsd32_clock_getcpuclockid2(\ Modified: stable/11/sys/kern/init_sysent.c ============================================================================== --- stable/11/sys/kern/init_sysent.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/kern/init_sysent.c Mon May 1 01:36:54 2017 (r317618) @@ -290,7 +290,7 @@ struct sysent sysent[] = { { AS(ffclock_getcounter_args), (sy_call_t *)sys_ffclock_getcounter, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 241 = ffclock_getcounter */ { AS(ffclock_setestimate_args), (sy_call_t *)sys_ffclock_setestimate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 242 = ffclock_setestimate */ { AS(ffclock_getestimate_args), (sy_call_t *)sys_ffclock_getestimate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 243 = ffclock_getestimate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 244 = nosys */ + { AS(clock_nanosleep_args), (sy_call_t *)sys_clock_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 244 = clock_nanosleep */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 245 = nosys */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 246 = nosys */ { AS(clock_getcpuclockid2_args), (sy_call_t *)sys_clock_getcpuclockid2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 247 = clock_getcpuclockid2 */ Modified: stable/11/sys/kern/kern_time.c ============================================================================== --- stable/11/sys/kern/kern_time.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/kern/kern_time.c Mon May 1 01:36:54 2017 (r317618) @@ -86,6 +86,9 @@ static uma_zone_t itimer_zone = NULL; static int settime(struct thread *, struct timeval *); static void timevalfix(struct timeval *); +static int user_clock_nanosleep(struct thread *td, clockid_t clock_id, + int flags, const struct timespec *ua_rqtp, + struct timespec *ua_rmtp); static void itimer_start(void); static int itimer_init(void *, int, int); @@ -474,47 +477,95 @@ kern_clock_getres(struct thread *td, clo return (0); } +int +kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) +{ + + return (kern_clock_nanosleep(td, CLOCK_REALTIME, TIMER_RELTIME, rqt, + rmt)); +} + static uint8_t nanowait[MAXCPU]; int -kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) +kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, + const struct timespec *rqt, struct timespec *rmt) { - struct timespec ts; + struct timespec ts, now; sbintime_t sbt, sbtt, prec, tmp; time_t over; int error; + bool is_abs_real; if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) return (EINVAL); - if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) - return (0); - ts = *rqt; - if (ts.tv_sec > INT32_MAX / 2) { - over = ts.tv_sec - INT32_MAX / 2; - ts.tv_sec -= over; - } else - over = 0; - tmp = tstosbt(ts); - prec = tmp; - prec >>= tc_precexp; - if (TIMESEL(&sbt, tmp)) - sbt += tc_tick_sbt; - sbt += tmp; - error = tsleep_sbt(&nanowait[curcpu], PWAIT | PCATCH, "nanslp", - sbt, prec, C_ABSOLUTE); + if ((flags & ~TIMER_ABSTIME) != 0) + return (EINVAL); + switch (clock_id) { + case CLOCK_REALTIME: + case CLOCK_REALTIME_PRECISE: + case CLOCK_REALTIME_FAST: + case CLOCK_SECOND: + is_abs_real = (flags & TIMER_ABSTIME) != 0; + break; + case CLOCK_MONOTONIC: + case CLOCK_MONOTONIC_PRECISE: + case CLOCK_MONOTONIC_FAST: + case CLOCK_UPTIME: + case CLOCK_UPTIME_PRECISE: + case CLOCK_UPTIME_FAST: + is_abs_real = false; + break; + case CLOCK_VIRTUAL: + case CLOCK_PROF: + case CLOCK_PROCESS_CPUTIME_ID: + return (ENOTSUP); + case CLOCK_THREAD_CPUTIME_ID: + default: + return (EINVAL); + } + do { + ts = *rqt; + if ((flags & TIMER_ABSTIME) != 0) { + if (is_abs_real) + td->td_rtcgen = + atomic_load_acq_int(&rtc_generation); + error = kern_clock_gettime(td, clock_id, &now); + KASSERT(error == 0, ("kern_clock_gettime: %d", error)); + timespecsub(&ts, &now); + } + if (ts.tv_sec < 0 || (ts.tv_sec == 0 && ts.tv_nsec == 0)) { + error = EWOULDBLOCK; + break; + } + if (ts.tv_sec > INT32_MAX / 2) { + over = ts.tv_sec - INT32_MAX / 2; + ts.tv_sec -= over; + } else + over = 0; + tmp = tstosbt(ts); + prec = tmp; + prec >>= tc_precexp; + if (TIMESEL(&sbt, tmp)) + sbt += tc_tick_sbt; + sbt += tmp; + error = tsleep_sbt(&nanowait[curcpu], PWAIT | PCATCH, "nanslp", + sbt, prec, C_ABSOLUTE); + } while (error == 0 && is_abs_real && td->td_rtcgen == 0); + td->td_rtcgen = 0; if (error != EWOULDBLOCK) { + TIMESEL(&sbtt, tmp); + if (sbtt >= sbt) + return (0); if (error == ERESTART) error = EINTR; - TIMESEL(&sbtt, tmp); - if (rmt != NULL) { + if ((flags & TIMER_ABSTIME) == 0 && rmt != NULL) { ts = sbttots(sbt - sbtt); ts.tv_sec += over; if (ts.tv_sec < 0) timespecclear(&ts); *rmt = ts; } - if (sbtt >= sbt) - return (0); return (error); } return (0); @@ -530,21 +581,48 @@ struct nanosleep_args { int sys_nanosleep(struct thread *td, struct nanosleep_args *uap) { + + return (user_clock_nanosleep(td, CLOCK_REALTIME, TIMER_RELTIME, + uap->rqtp, uap->rmtp)); +} + +#ifndef _SYS_SYSPROTO_H_ +struct clock_nanosleep_args { + clockid_t clock_id; + int flags; + struct timespec *rqtp; + struct timespec *rmtp; +}; +#endif +/* ARGSUSED */ +int +sys_clock_nanosleep(struct thread *td, struct clock_nanosleep_args *uap) +{ + int error; + + error = user_clock_nanosleep(td, uap->clock_id, uap->flags, uap->rqtp, + uap->rmtp); + return (kern_posix_error(td, error)); +} + +static int +user_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, + const struct timespec *ua_rqtp, struct timespec *ua_rmtp) +{ struct timespec rmt, rqt; int error; - error = copyin(uap->rqtp, &rqt, sizeof(rqt)); + error = copyin(ua_rqtp, &rqt, sizeof(rqt)); if (error) return (error); - - if (uap->rmtp && - !useracc((caddr_t)uap->rmtp, sizeof(rmt), VM_PROT_WRITE)) - return (EFAULT); - error = kern_nanosleep(td, &rqt, &rmt); - if (error == EINTR && uap->rmtp) { + if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 && + !useracc(ua_rmtp, sizeof(rmt), VM_PROT_WRITE)) + return (EFAULT); + error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt); + if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) { int error2; - error2 = copyout(&rmt, uap->rmtp, sizeof(rmt)); + error2 = copyout(&rmt, ua_rmtp, sizeof(rmt)); if (error2) error = error2; } Modified: stable/11/sys/kern/syscalls.c ============================================================================== --- stable/11/sys/kern/syscalls.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/kern/syscalls.c Mon May 1 01:36:54 2017 (r317618) @@ -251,7 +251,7 @@ const char *syscallnames[] = { "ffclock_getcounter", /* 241 = ffclock_getcounter */ "ffclock_setestimate", /* 242 = ffclock_setestimate */ "ffclock_getestimate", /* 243 = ffclock_getestimate */ - "#244", /* 244 = nosys */ + "clock_nanosleep", /* 244 = clock_nanosleep */ "#245", /* 245 = nosys */ "#246", /* 246 = nosys */ "clock_getcpuclockid2", /* 247 = clock_getcpuclockid2 */ Modified: stable/11/sys/kern/syscalls.master ============================================================================== --- stable/11/sys/kern/syscalls.master Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/kern/syscalls.master Mon May 1 01:36:54 2017 (r317618) @@ -461,7 +461,9 @@ struct ffclock_estimate *cest); } 243 AUE_NULL STD { int ffclock_getestimate( \ struct ffclock_estimate *cest); } -244 AUE_NULL UNIMPL nosys +244 AUE_NULL STD { int clock_nanosleep(clockid_t clock_id, \ + int flags, const struct timespec *rqtp, \ + struct timespec *rmtp); } 245 AUE_NULL UNIMPL nosys 246 AUE_NULL UNIMPL nosys 247 AUE_NULL STD { int clock_getcpuclockid2(id_t id,\ Modified: stable/11/sys/kern/systrace_args.c ============================================================================== --- stable/11/sys/kern/systrace_args.c Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/kern/systrace_args.c Mon May 1 01:36:54 2017 (r317618) @@ -1290,6 +1290,16 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* clock_nanosleep */ + case 244: { + struct clock_nanosleep_args *p = params; + iarg[0] = p->clock_id; /* clockid_t */ + iarg[1] = p->flags; /* int */ + uarg[2] = (intptr_t) p->rqtp; /* const struct timespec * */ + uarg[3] = (intptr_t) p->rmtp; /* struct timespec * */ + *n_args = 4; + break; + } /* clock_getcpuclockid2 */ case 247: { struct clock_getcpuclockid2_args *p = params; @@ -5374,6 +5384,25 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; + /* clock_nanosleep */ + case 244: + switch(ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "int"; + break; + case 2: + p = "const struct timespec *"; + break; + case 3: + p = "struct timespec *"; + break; + default: + break; + }; + break; /* clock_getcpuclockid2 */ case 247: switch(ndx) { @@ -9628,6 +9657,11 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; + /* clock_nanosleep */ + case 244: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* clock_getcpuclockid2 */ case 247: if (ndx == 0 || ndx == 1) Modified: stable/11/sys/sys/syscall.h ============================================================================== --- stable/11/sys/sys/syscall.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/sys/syscall.h Mon May 1 01:36:54 2017 (r317618) @@ -219,6 +219,7 @@ #define SYS_ffclock_getcounter 241 #define SYS_ffclock_setestimate 242 #define SYS_ffclock_getestimate 243 +#define SYS_clock_nanosleep 244 #define SYS_clock_getcpuclockid2 247 #define SYS_ntp_gettime 248 #define SYS_minherit 250 Modified: stable/11/sys/sys/syscall.mk ============================================================================== --- stable/11/sys/sys/syscall.mk Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/sys/syscall.mk Mon May 1 01:36:54 2017 (r317618) @@ -159,6 +159,7 @@ MIASM = \ ffclock_getcounter.o \ ffclock_setestimate.o \ ffclock_getestimate.o \ + clock_nanosleep.o \ clock_getcpuclockid2.o \ ntp_gettime.o \ minherit.o \ Modified: stable/11/sys/sys/syscallsubr.h ============================================================================== --- stable/11/sys/sys/syscallsubr.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/sys/syscallsubr.h Mon May 1 01:36:54 2017 (r317618) @@ -83,6 +83,8 @@ int kern_clock_getres(struct thread *td, struct timespec *ts); int kern_clock_gettime(struct thread *td, clockid_t clock_id, struct timespec *ats); +int kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, + const struct timespec *rqtp, struct timespec *rmtp); int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats); int kern_close(struct thread *td, int fd); Modified: stable/11/sys/sys/sysproto.h ============================================================================== --- stable/11/sys/sys/sysproto.h Mon May 1 01:35:43 2017 (r317617) +++ stable/11/sys/sys/sysproto.h Mon May 1 01:36:54 2017 (r317618) @@ -698,6 +698,12 @@ struct ffclock_setestimate_args { struct ffclock_getestimate_args { char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)]; }; +struct clock_nanosleep_args { + char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)]; + char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)]; +}; struct clock_getcpuclockid2_args { char id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)]; char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)]; @@ -1942,6 +1948,7 @@ int sys_nanosleep(struct thread *, struc int sys_ffclock_getcounter(struct thread *, struct ffclock_getcounter_args *); int sys_ffclock_setestimate(struct thread *, struct ffclock_setestimate_args *); int sys_ffclock_getestimate(struct thread *, struct ffclock_getestimate_args *); +int sys_clock_nanosleep(struct thread *, struct clock_nanosleep_args *); int sys_clock_getcpuclockid2(struct thread *, struct clock_getcpuclockid2_args *); int sys_ntp_gettime(struct thread *, struct ntp_gettime_args *); int sys_minherit(struct thread *, struct minherit_args *); @@ -2713,6 +2720,7 @@ int freebsd10_pipe(struct thread *, stru #define SYS_AUE_ffclock_getcounter AUE_NULL #define SYS_AUE_ffclock_setestimate AUE_NULL #define SYS_AUE_ffclock_getestimate AUE_NULL +#define SYS_AUE_clock_nanosleep AUE_NULL #define SYS_AUE_clock_getcpuclockid2 AUE_NULL #define SYS_AUE_ntp_gettime AUE_NULL #define SYS_AUE_minherit AUE_MINHERIT *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Mon May 1 01:40:25 2017 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 95646D58CA6; Mon, 1 May 2017 01:40:25 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 66BD118F2; Mon, 1 May 2017 01:40:25 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v411eOr0079099; Mon, 1 May 2017 01:40:24 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v411eOsM079098; Mon, 1 May 2017 01:40:24 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201705010140.v411eOsM079098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 1 May 2017 01:40:24 +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: r317619 - stable/11/bin/dd 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, 01 May 2017 01:40:25 -0000 Author: vangyzen Date: Mon May 1 01:40:24 2017 New Revision: 317619 URL: https://svnweb.freebsd.org/changeset/base/317619 Log: MFC r316430 Fix indentation in dd(1) Quoting http://mdocml.bsd.lv/mdoc/details/width.html Do not use macros in the argument specifying the width, since that's not portable. While GNU troff can handle it, mandoc cannot. Sponsored by: Dell EMC Modified: stable/11/bin/dd/dd.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/dd/dd.1 ============================================================================== --- stable/11/bin/dd/dd.1 Mon May 1 01:36:54 2017 (r317618) +++ stable/11/bin/dd/dd.1 Mon May 1 01:40:24 2017 (r317619) @@ -32,7 +32,7 @@ .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd April 2, 2017 .Dt DD 1 .Os .Sh NAME @@ -54,7 +54,7 @@ displays the number of complete and part and truncated input records to the standard error output. .Pp The following operands are available: -.Bl -tag -width ".Cm of Ns = Ns Ar file" +.Bl -tag -width "of=file" .It Cm bs Ns = Ns Ar n Set both input and output block size to .Ar n @@ -164,7 +164,7 @@ bytes per second. Where .Cm value is one of the symbols from the following list. -.Bl -tag -width ".Cm noxfer" +.Bl -tag -width "noxfer" .It Cm noxfer Do not print the transfer statistics as the last line of status output. .It Cm none @@ -175,7 +175,7 @@ Error messages are shown; informational Where .Cm value is one of the symbols from the following list. -.Bl -tag -width ".Cm unblock" +.Bl -tag -width "unblock" .It Cm ascii , oldascii The same as the .Cm unblock @@ -459,4 +459,4 @@ subsystem might prevent the super-user f Instructions for temporarily disabling these protection mechanisms can be found in the .Xr geom 4 -manpage. +man page. From owner-svn-src-stable@freebsd.org Mon May 1 01:52:07 2017 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 4274CD581A1; Mon, 1 May 2017 01:52:07 +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 D4814647; Mon, 1 May 2017 01:52: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 v411q5MH085064; Mon, 1 May 2017 01:52:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v411q4l3085040; Mon, 1 May 2017 01:52:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705010152.v411q4l3085040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 1 May 2017 01:52:04 +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: r317623 - in stable/11: contrib/elftoolchain/addr2line contrib/elftoolchain/ar contrib/elftoolchain/common contrib/elftoolchain/cxxfilt contrib/elftoolchain/elfcopy contrib/elftoolchain... 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, 01 May 2017 01:52:07 -0000 Author: emaste Date: Mon May 1 01:52:03 2017 New Revision: 317623 URL: https://svnweb.freebsd.org/changeset/base/317623 Log: MFC r317075: Update ELF Tool Chain to upstream r3520 Highlights of changes between r3490 and r3520: - Improve C++ demangling - Improve compatibility with Binutils tools wrt. error messages - Handle additional types/sections/etc. in readelf and elfdump - addr2line, cxxfilt: use setvbuf to set line buffering for filter use Also MFC r317076, version bump. Sponsored by: The FreeBSD Foundation Added: stable/11/contrib/elftoolchain/ar/os.FreeBSD.mk - copied unchanged from r317075, head/contrib/elftoolchain/ar/os.FreeBSD.mk stable/11/contrib/elftoolchain/elfcopy/os.FreeBSD.mk - copied unchanged from r317075, head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk Modified: stable/11/contrib/elftoolchain/addr2line/addr2line.c stable/11/contrib/elftoolchain/common/elfdefinitions.h stable/11/contrib/elftoolchain/cxxfilt/cxxfilt.c stable/11/contrib/elftoolchain/elfcopy/main.c stable/11/contrib/elftoolchain/elfcopy/pe.c stable/11/contrib/elftoolchain/elfcopy/symbols.c stable/11/contrib/elftoolchain/elfdump/elfdump.c stable/11/contrib/elftoolchain/libdwarf/dwarf.h stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval.c stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 stable/11/contrib/elftoolchain/libdwarf/dwarf_dump.c stable/11/contrib/elftoolchain/libelf/gelf_newehdr.3 stable/11/contrib/elftoolchain/libelf/gelf_newphdr.3 stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c stable/11/contrib/elftoolchain/libelftc/libelftc_dem_arm.c stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c stable/11/contrib/elftoolchain/nm/nm.c stable/11/contrib/elftoolchain/readelf/readelf.c stable/11/contrib/elftoolchain/strings/strings.c stable/11/lib/libelftc/elftc_version.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/addr2line/addr2line.c ============================================================================== --- stable/11/contrib/elftoolchain/addr2line/addr2line.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/addr2line/addr2line.c Mon May 1 01:52:03 2017 (r317623) @@ -40,7 +40,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $"); struct Func { char *name; @@ -720,11 +720,11 @@ main(int argc, char **argv) if (argc > 0) for (i = 0; i < argc; i++) translate(dbg, e, argv[i]); - else - while (fgets(line, sizeof(line), stdin) != NULL) { + else { + setvbuf(stdout, NULL, _IOLBF, 0); + while (fgets(line, sizeof(line), stdin) != NULL) translate(dbg, e, line); - fflush(stdout); - } + } dwarf_finish(dbg, &de); Copied: stable/11/contrib/elftoolchain/ar/os.FreeBSD.mk (from r317075, head/contrib/elftoolchain/ar/os.FreeBSD.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/elftoolchain/ar/os.FreeBSD.mk Mon May 1 01:52:03 2017 (r317623, copy of r317075, head/contrib/elftoolchain/ar/os.FreeBSD.mk) @@ -0,0 +1,2 @@ +DPADD+= ${LIBBZ2} +LDADD+= -lbz2 Modified: stable/11/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- stable/11/contrib/elftoolchain/common/elfdefinitions.h Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/common/elfdefinitions.h Mon May 1 01:52:03 2017 (r317623) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3485 2016-08-18 13:38:52Z emaste $ + * $Id: elfdefinitions.h 3515 2017-01-24 22:04:22Z emaste $ */ /* @@ -153,6 +153,8 @@ _ELF_DEFINE_DT(DT_SUNW_FILTER, 0x60 "offset of string naming standard filtees") \ _ELF_DEFINE_DT(DT_SUNW_CAP, 0x60000010UL, \ "address of hardware capabilities section") \ +_ELF_DEFINE_DT(DT_SUNW_ASLR, 0x60000023UL, \ + "Address Space Layout Randomization flag") \ _ELF_DEFINE_DT(DT_HIOS, 0x6FFFF000UL, \ "end of OS-specific types") \ _ELF_DEFINE_DT(DT_VALRNGLO, 0x6FFFFD00UL, \ @@ -919,6 +921,12 @@ _ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E "Stack flags") \ _ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552UL, \ "Segment becomes read-only after relocation") \ +_ELF_DEFINE_PT(PT_OPENBSD_RANDOMIZE,0x65A3DBE6UL, \ + "Segment filled with random data") \ +_ELF_DEFINE_PT(PT_OPENBSD_WXNEEDED, 0x65A3DBE7UL, \ + "Program violates W^X") \ +_ELF_DEFINE_PT(PT_OPENBSD_BOOTDATA, 0x65A41BE6UL, \ + "Boot data") \ _ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFAUL, \ "A Solaris .SUNW_bss section") \ _ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFBUL, \ Modified: stable/11/contrib/elftoolchain/cxxfilt/cxxfilt.c ============================================================================== --- stable/11/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May 1 01:52:03 2017 (r317623) @@ -35,7 +35,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: cxxfilt.c 3454 2016-05-07 17:11:05Z kaiwang27 $"); +ELFTC_VCSID("$Id: cxxfilt.c 3499 2016-11-25 16:06:29Z emaste $"); #define STRBUFSZ 8192 @@ -175,6 +175,7 @@ main(int argc, char **argv) } else { p = 0; for (;;) { + setvbuf(stdout, NULL, _IOLBF, 0); c = fgetc(stdin); if (c == EOF || !(isalnum(c) || strchr(".$_", c))) { if (p > 0) { Modified: stable/11/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/main.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/elfcopy/main.c Mon May 1 01:52:03 2017 (r317623) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: main.c 3520 2017-04-17 01:47:52Z kaiwang27 $"); enum options { @@ -285,6 +285,7 @@ create_elf(struct elfcopy *ecp) size_t ishnum; ecp->flags |= SYMTAB_INTACT; + ecp->flags &= ~SYMTAB_EXIST; /* Create EHDR. */ if (gelf_getehdr(ecp->ein, &ieh) == NULL) @@ -499,6 +500,10 @@ free_elf(struct elfcopy *ecp) } } + ecp->symtab = NULL; + ecp->strtab = NULL; + ecp->shstrtab = NULL; + if (ecp->secndx != NULL) { free(ecp->secndx); ecp->secndx = NULL; Copied: stable/11/contrib/elftoolchain/elfcopy/os.FreeBSD.mk (from r317075, head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/elftoolchain/elfcopy/os.FreeBSD.mk Mon May 1 01:52:03 2017 (r317623, copy of r317075, head/contrib/elftoolchain/elfcopy/os.FreeBSD.mk) @@ -0,0 +1,4 @@ +.if !defined(LIBELF_AR) +DPADD+= ${LIBBZ2} +LDADD+= -lbz2 +.endif Modified: stable/11/contrib/elftoolchain/elfcopy/pe.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/pe.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/elfcopy/pe.c Mon May 1 01:52:03 2017 (r317623) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: pe.c 3490 2016-08-31 00:12:22Z emaste $"); +ELFTC_VCSID("$Id: pe.c 3508 2016-12-27 06:19:39Z kaiwang27 $"); /* Convert ELF object to Portable Executable (PE). */ void Modified: stable/11/contrib/elftoolchain/elfcopy/symbols.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/symbols.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/elfcopy/symbols.c Mon May 1 01:52:03 2017 (r317623) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: symbols.c 3446 2016-05-03 01:31:17Z emaste $"); +ELFTC_VCSID("$Id: symbols.c 3520 2017-04-17 01:47:52Z kaiwang27 $"); /* Backwards compatibility for systems with older ELF definitions. */ #ifndef STB_GNU_UNIQUE @@ -676,6 +676,8 @@ create_symtab(struct elfcopy *ecp) sy = ecp->symtab; st = ecp->strtab; + assert(sy != NULL && st != NULL); + /* * Set section index map for .symtab and .strtab. We need to set * these map because otherwise symbols which refer to .symtab and Modified: stable/11/contrib/elftoolchain/elfdump/elfdump.c ============================================================================== --- stable/11/contrib/elftoolchain/elfdump/elfdump.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/elfdump/elfdump.c Mon May 1 01:52:03 2017 (r317623) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3482 2016-08-02 18:47:00Z emaste $"); +ELFTC_VCSID("$Id: elfdump.c 3497 2016-10-17 20:57:22Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -223,9 +223,9 @@ d_tags(uint64_t tag) case 0x6ffffff0: return "DT_GNU_VERSYM"; /* 0x70000000 - 0x7fffffff processor-specific semantics */ case 0x70000000: return "DT_IA_64_PLT_RESERVE"; - case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; - case 0x7ffffffe: return "DT_SUNW_USED"; - case 0x7fffffff: return "DT_SUNW_FILTER"; + case DT_AUXILIARY: return "DT_AUXILIARY"; + case DT_USED: return "DT_USED"; + case DT_FILTER: return "DT_FILTER"; } snprintf(unknown_buf, sizeof(unknown_buf), Modified: stable/11/contrib/elftoolchain/libdwarf/dwarf.h ============================================================================== --- stable/11/contrib/elftoolchain/libdwarf/dwarf.h Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libdwarf/dwarf.h Mon May 1 01:52:03 2017 (r317623) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwarf.h 3052 2014-05-26 20:36:24Z kaiwang27 $ + * $Id: dwarf.h 3494 2016-09-20 17:16:13Z emaste $ */ #ifndef _DWARF_H_ @@ -208,6 +208,25 @@ #define DW_AT_lo_user 0x2000 #define DW_AT_hi_user 0x3fff +/* SGI/MIPS extensions. */ +#define DW_AT_MIPS_fde 0x2001 +#define DW_AT_MIPS_loop_begin 0x2002 +#define DW_AT_MIPS_tail_loop_begin 0x2003 +#define DW_AT_MIPS_epilog_begin 0x2004 +#define DW_AT_MIPS_loop_unroll_factor 0x2005 +#define DW_AT_MIPS_software_pipeline_depth 0x2006 +#define DW_AT_MIPS_linkage_name 0x2007 +#define DW_AT_MIPS_stride 0x2008 +#define DW_AT_MIPS_abstract_name 0x2009 +#define DW_AT_MIPS_clone_origin 0x200a +#define DW_AT_MIPS_has_inlines 0x200b +#define DW_AT_MIPS_stride_byte 0x200c +#define DW_AT_MIPS_stride_elem 0x200d +#define DW_AT_MIPS_ptr_dopetype 0x200e +#define DW_AT_MIPS_allocatable_dopetype 0x200f +#define DW_AT_MIPS_assumed_shape_dopetype 0x2010 +#define DW_AT_MIPS_assumed_size 0x2011 + /* GNU extensions. */ #define DW_AT_sf_names 0x2101 #define DW_AT_src_info 0x2102 @@ -505,6 +524,7 @@ #define DW_LANG_UPC 0x0012 #define DW_LANG_D 0x0013 #define DW_LANG_lo_user 0x8000 +#define DW_LANG_Mips_Assembler 0x8001 #define DW_LANG_hi_user 0xffff #define DW_ID_case_sensitive 0x00 Modified: stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval.c ============================================================================== --- stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval.c Mon May 1 01:52:03 2017 (r317623) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste $"); +ELFTC_VCSID("$Id: dwarf_attrval.c 3509 2016-12-29 03:58:41Z emaste $"); int dwarf_attrval_flag(Dwarf_Die die, Dwarf_Half attr, Dwarf_Bool *valp, Dwarf_Error *err) Modified: stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 ============================================================================== --- stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3 Mon May 1 01:52:03 2017 (r317623) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_attrval_signed.3 2980 2014-01-21 20:15:54Z kaiwang27 $ +.\" $Id: dwarf_attrval_signed.3 3509 2016-12-29 03:58:41Z emaste $ .\" .Dd December 26, 2016 .Os Modified: stable/11/contrib/elftoolchain/libdwarf/dwarf_dump.c ============================================================================== --- stable/11/contrib/elftoolchain/libdwarf/dwarf_dump.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libdwarf/dwarf_dump.c Mon May 1 01:52:03 2017 (r317623) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_dump.c 3052 2014-05-26 20:36:24Z kaiwang27 $"); +ELFTC_VCSID("$Id: dwarf_dump.c 3494 2016-09-20 17:16:13Z emaste $"); int dwarf_get_ACCESS_name(unsigned access, const char **s) @@ -262,6 +262,40 @@ dwarf_get_AT_name(unsigned attr, const c *s = "DW_AT_body_begin"; break; case DW_AT_body_end: *s = "DW_AT_body_end"; break; + case DW_AT_MIPS_fde: + *s = "DW_AT_MIPS_fde"; break; + case DW_AT_MIPS_loop_begin: + *s = "DW_AT_MIPS_loop_begin"; break; + case DW_AT_MIPS_tail_loop_begin: + *s = "DW_AT_MIPS_tail_loop_begin"; break; + case DW_AT_MIPS_epilog_begin: + *s = "DW_AT_MIPS_epilog_begin"; break; + case DW_AT_MIPS_loop_unroll_factor: + *s = "DW_AT_MIPS_loop_unroll_factor"; break; + case DW_AT_MIPS_software_pipeline_depth: + *s = "DW_AT_MIPS_software_pipeline_depth"; break; + case DW_AT_MIPS_linkage_name: + *s = "DW_AT_MIPS_linkage_name"; break; + case DW_AT_MIPS_stride: + *s = "DW_AT_MIPS_stride"; break; + case DW_AT_MIPS_abstract_name: + *s = "DW_AT_MIPS_abstract_name"; break; + case DW_AT_MIPS_clone_origin: + *s = "DW_AT_MIPS_clone_origin"; break; + case DW_AT_MIPS_has_inlines: + *s = "DW_AT_MIPS_has_inlines"; break; + case DW_AT_MIPS_stride_byte: + *s = "DW_AT_MIPS_stride_byte"; break; + case DW_AT_MIPS_stride_elem: + *s = "DW_AT_MIPS_stride_elem"; break; + case DW_AT_MIPS_ptr_dopetype: + *s = "DW_AT_MIPS_ptr_dopetype"; break; + case DW_AT_MIPS_allocatable_dopetype: + *s = "DW_AT_MIPS_allocatable_dopetype"; break; + case DW_AT_MIPS_assumed_shape_dopetype: + *s = "DW_AT_MIPS_assumed_shape_dopetype"; break; + case DW_AT_MIPS_assumed_size: + *s = "DW_AT_MIPS_assumed_size"; break; case DW_AT_GNU_vector: *s = "DW_AT_GNU_vector"; break; case DW_AT_GNU_guarded_by: @@ -756,6 +790,8 @@ dwarf_get_LANG_name(unsigned lang, const *s = "DW_LANG_D"; break; case DW_LANG_lo_user: *s = "DW_LANG_lo_user"; break; + case DW_LANG_Mips_Assembler: + *s = "DW_LANG_Mips_Assembler"; break; case DW_LANG_hi_user: *s = "DW_LANG_hi_user"; break; default: Modified: stable/11/contrib/elftoolchain/libelf/gelf_newehdr.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelf/gelf_newehdr.3 Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelf/gelf_newehdr.3 Mon May 1 01:52:03 2017 (r317623) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: gelf_newehdr.3 189 2008-07-20 10:38:08Z jkoshy $ +.\" $Id: gelf_newehdr.3 3500 2016-12-04 11:08:44Z jkoshy $ .\" .Dd October 22, 2007 .Os @@ -127,6 +127,15 @@ flag on ELF descriptor .Sh RETURN VALUES These functions return a pointer to a translated header descriptor if successful, or NULL on failure. +.Sh COMPATIBILITY +The +.Fn gelf_newehdr +function uses a type of +.Ft "void *" +for its returned value. +This differs from some other implementations of the ELF(3) API, which use an +.Ft "unsigned long" +return type. .Sh ERRORS These functions can fail with the following errors: .Bl -tag -width "[ELF_E_RESOURCE]" Modified: stable/11/contrib/elftoolchain/libelf/gelf_newphdr.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelf/gelf_newphdr.3 Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelf/gelf_newphdr.3 Mon May 1 01:52:03 2017 (r317623) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: gelf_newphdr.3 189 2008-07-20 10:38:08Z jkoshy $ +.\" $Id: gelf_newphdr.3 3500 2016-12-04 11:08:44Z jkoshy $ .\" .Dd October 22, 2007 .Os @@ -97,6 +97,15 @@ will no longer be valid. .Sh RETURN VALUES The functions a valid pointer if successful, or NULL in case an error was encountered. +.Sh COMPATIBILITY +The +.Fn gelf_newphdr +function uses a type of +.Ft "void *" +for its returned value. +This differs from some other implementations of the ELF(3) API, which use an +.Ft "unsigned long" +return type. .Sh ERRORS These functions may fail with the following errors: .Bl -tag -width "[ELF_E_RESOURCE]" Modified: stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Mon May 1 01:52:03 2017 (r317623) @@ -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 3488 2016-08-24 18:15:57Z emaste $ +.\" $Id: elftc_bfd_find_target.3 3516 2017-02-10 02:33:08Z emaste $ .\" .Dd November 30, 2011 .Os @@ -74,6 +74,7 @@ Known descriptor names and their propert .It Li elf32-littlearm Ta ELF Ta LSB Ta 32 .It Li elf32-littlemips Ta ELF Ta LSB Ta 32 .It Li elf32-powerpc Ta ELF Ta MSB Ta 32 +.It Li elf32-powerpc-freebsd Ta ELF Ta MSB Ta 32 .It Li elf32-powerpcle Ta ELF Ta LSB Ta 32 .It Li elf32-sh Ta ELF Ta MSB Ta 32 .It Li elf32-shl Ta ELF Ta LSB Ta 32 @@ -94,6 +95,7 @@ Known descriptor names and their propert .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-powerpc-freebsd Ta ELF Ta MSB Ta 64 .It Li elf64-powerpcle Ta ELF Ta LSB Ta 64 .It Li elf64-sh64 Ta ELF Ta MSB Ta 64 .It Li elf64-sh64l Ta ELF Ta LSB Ta 64 Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon May 1 01:52:03 2017 (r317623) @@ -30,7 +30,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3488 2016-08-24 18:15:57Z emaste $"); +ELFTC_VCSID("$Id: libelftc_bfdtarget.c 3516 2017-02-10 02:33:08Z emaste $"); struct _Elftc_Bfd_Target _libelftc_targets[] = { Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_dem_arm.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Mon May 1 01:52:03 2017 (r317623) @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_arm.c 3447 2016-05-03 13:32:23Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_arm.c 3513 2016-12-29 07:04:22Z kaiwang27 $"); /** * @file cpp_demangle_arm.c @@ -68,6 +68,7 @@ struct demangle_data { }; #define SIMPLE_HASH(x,y) (64 * x + y) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) #define CPP_DEMANGLE_ARM_TRY 128 static void dest_cstring(struct cstring *); @@ -137,7 +138,7 @@ cpp_demangle_ARM(const char *org) ++d.p; /* start argument types */ - if (vector_str_push(&d.vec, "(", 1) == false) + if (VEC_PUSH_STR(&d.vec, "(") == false) goto clean; for (;;) { @@ -169,21 +170,21 @@ cpp_demangle_ARM(const char *org) goto clean; if (d.ptr == true) { - if (vector_str_push(&d.vec, "*", 1) == false) + if (VEC_PUSH_STR(&d.vec, "*") == false) goto clean; d.ptr = false; } if (d.ref == true) { - if (vector_str_push(&d.vec, "&", 1) == false) + if (VEC_PUSH_STR(&d.vec, "&") == false) goto clean; d.ref = false; } if (d.cnst == true) { - if (vector_str_push(&d.vec, " const", 6) == false) + if (VEC_PUSH_STR(&d.vec, " const") == false) goto clean; d.cnst = false; @@ -210,7 +211,7 @@ cpp_demangle_ARM(const char *org) free(arg); - if (vector_str_push(&d.vec, ", ", 2) == false) + if (VEC_PUSH_STR(&d.vec, ", ") == false) goto clean; if (++try > CPP_DEMANGLE_ARM_TRY) @@ -218,7 +219,7 @@ cpp_demangle_ARM(const char *org) } /* end argument types */ - if (vector_str_push(&d.vec, ")", 1) == false) + if (VEC_PUSH_STR(&d.vec, ")") == false) goto clean; flat: @@ -323,11 +324,10 @@ push_CTDT(const char *s, size_t l, struc return (false); assert(v->size > 1); - if (vector_str_push(v, v->container[v->size - 2], - strlen(v->container[v->size - 2])) == false) + if (VEC_PUSH_STR(v, v->container[v->size - 2]) == false) return (false); - if (vector_str_push(v, "()", 2) == false) + if (VEC_PUSH_STR(v, "()") == false) return (false); return (true); @@ -429,7 +429,7 @@ read_func(struct demangle_data *d) if (read_class(d) == false) return (false); - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) return (false); } @@ -486,7 +486,7 @@ read_func_name(struct demangle_data *d) if (read_qual_name(d) == false) goto clean; - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) goto clean; if (vector_str_push(&d->vec, op_name, len) == false) @@ -508,7 +508,7 @@ read_func_name(struct demangle_data *d) if (read_class(d) == false) goto clean; - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) goto clean; if (vector_str_push(&d->vec, op_name, len) == false) @@ -553,7 +553,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.ptr == true) { - if (vector_str_push(&fptr.vec, "*", 1) == false) { + if (VEC_PUSH_STR(&fptr.vec, "*") == false) { dest_demangle_data(&fptr); return (false); @@ -563,7 +563,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.ref == true) { - if (vector_str_push(&fptr.vec, "&", 1) == false) { + if (VEC_PUSH_STR(&fptr.vec, "&") == false) { dest_demangle_data(&fptr); return (false); @@ -573,7 +573,7 @@ read_func_ptr(struct demangle_data *d) } if (fptr.cnst == true) { - if (vector_str_push(&fptr.vec, " const", 6) == false) { + if (VEC_PUSH_STR(&fptr.vec, " const") == false) { dest_demangle_data(&fptr); return (false); @@ -585,7 +585,7 @@ read_func_ptr(struct demangle_data *d) if (*fptr.p == '_') break; - if (vector_str_push(&fptr.vec, ", ", 2) == false) { + if (VEC_PUSH_STR(&fptr.vec, ", ") == false) { dest_demangle_data(&fptr); return (false); @@ -636,7 +636,7 @@ read_func_ptr(struct demangle_data *d) free(rtn_type); - if (vector_str_push(&d->vec, " (*)(", 5) == false) { + if (VEC_PUSH_STR(&d->vec, " (*)(") == false) { free(arg_type); return (false); @@ -650,7 +650,7 @@ read_func_ptr(struct demangle_data *d) free(arg_type); - return (vector_str_push(&d->vec, ")", 1)); + return (VEC_PUSH_STR(&d->vec, ")")); } static bool @@ -689,7 +689,7 @@ read_memptr(struct demangle_data *d) if (vector_str_push(&d->vec, mptr_str, len) == false) goto clean; - if (vector_str_push(&d->vec, "::*", 3) == false) + if (VEC_PUSH_STR(&d->vec, "::*") == false) goto clean; rtn = true; @@ -712,108 +712,102 @@ read_op(struct demangle_data *d) switch (SIMPLE_HASH(*(d->p), *(d->p+1))) { case SIMPLE_HASH('m', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator*", 9)); + return (VEC_PUSH_STR(&d->vec, "operator*")); case SIMPLE_HASH('d', 'v') : d->p += 2; - return (vector_str_push(&d->vec, "operator/", 9)); + return (VEC_PUSH_STR(&d->vec, "operator/")); case SIMPLE_HASH('m', 'd') : d->p += 2; - return (vector_str_push(&d->vec, "operator%", 9)); + return (VEC_PUSH_STR(&d->vec, "operator%")); case SIMPLE_HASH('p', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator+", 9)); + return (VEC_PUSH_STR(&d->vec, "operator+")); case SIMPLE_HASH('m', 'i') : d->p += 2; - return (vector_str_push(&d->vec, "operator-", 9)); + return (VEC_PUSH_STR(&d->vec, "operator-")); case SIMPLE_HASH('l', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator<<", 10)); + return (VEC_PUSH_STR(&d->vec, "operator<<")); case SIMPLE_HASH('r', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator>>", 10)); + return (VEC_PUSH_STR(&d->vec, "operator>>")); case SIMPLE_HASH('e', 'q') : d->p += 2; - return (vector_str_push(&d->vec, "operator==", 10)); + return (VEC_PUSH_STR(&d->vec, "operator==")); case SIMPLE_HASH('n', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator!=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator!=")); case SIMPLE_HASH('l', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator<", 9)); + return (VEC_PUSH_STR(&d->vec, "operator<")); case SIMPLE_HASH('g', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator>", 9)); + return (VEC_PUSH_STR(&d->vec, "operator>")); case SIMPLE_HASH('l', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator<=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator<=")); case SIMPLE_HASH('g', 'e') : d->p += 2; - return (vector_str_push(&d->vec, "operator>=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator>=")); case SIMPLE_HASH('a', 'd') : d->p += 2; if (*d->p == 'v') { ++d->p; - return (vector_str_push(&d->vec, "operator/=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator/=")); } else - return (vector_str_push(&d->vec, "operator&", 9)); + return (VEC_PUSH_STR(&d->vec, "operator&")); case SIMPLE_HASH('o', 'r') : d->p += 2; - return (vector_str_push(&d->vec, "operator|", 9)); + return (VEC_PUSH_STR(&d->vec, "operator|")); case SIMPLE_HASH('e', 'r') : d->p += 2; - return (vector_str_push(&d->vec, "operator^", 9)); + return (VEC_PUSH_STR(&d->vec, "operator^")); case SIMPLE_HASH('a', 'a') : d->p += 2; if (*d->p == 'd') { ++d->p; - return (vector_str_push(&d->vec, "operator&=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator&=")); } else - return (vector_str_push(&d->vec, "operator&&", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator&&")); case SIMPLE_HASH('o', 'o') : d->p += 2; - return (vector_str_push(&d->vec, "operator||", 10)); + return (VEC_PUSH_STR(&d->vec, "operator||")); case SIMPLE_HASH('n', 't') : d->p += 2; - return (vector_str_push(&d->vec, "operator!", 9)); + return (VEC_PUSH_STR(&d->vec, "operator!")); case SIMPLE_HASH('c', 'o') : d->p += 2; - return (vector_str_push(&d->vec, "operator~", 9)); + return (VEC_PUSH_STR(&d->vec, "operator~")); case SIMPLE_HASH('p', 'p') : d->p += 2; - return (vector_str_push(&d->vec, "operator++", 10)); + return (VEC_PUSH_STR(&d->vec, "operator++")); case SIMPLE_HASH('m', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator--", 10)); + return (VEC_PUSH_STR(&d->vec, "operator--")); case SIMPLE_HASH('a', 's') : d->p += 2; - return (vector_str_push(&d->vec, "operator=", 9)); + return (VEC_PUSH_STR(&d->vec, "operator=")); case SIMPLE_HASH('r', 'f') : d->p += 2; - return (vector_str_push(&d->vec, "operator->", 10)); + return (VEC_PUSH_STR(&d->vec, "operator->")); case SIMPLE_HASH('a', 'p') : /* apl */ if (*(d->p + 2) != 'l') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator+=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator+=")); case SIMPLE_HASH('a', 'm') : d->p += 2; if (*d->p == 'i') { ++d->p; - return (vector_str_push(&d->vec, "operator-=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator-=")); } else if (*d->p == 'u') { ++d->p; - return (vector_str_push(&d->vec, "operator*=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator*=")); } else if (*d->p == 'd') { ++d->p; - return (vector_str_push(&d->vec, "operator%=", - 10)); + return (VEC_PUSH_STR(&d->vec, "operator%=")); } return (false); @@ -823,40 +817,40 @@ read_op(struct demangle_data *d) return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator<<=", 11)); + return (VEC_PUSH_STR(&d->vec, "operator<<=")); case SIMPLE_HASH('a', 'r') : /* ars */ if (*(d->p + 2) != 's') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator>>=", 11)); + return (VEC_PUSH_STR(&d->vec, "operator>>=")); case SIMPLE_HASH('a', 'o') : /* aor */ if (*(d->p + 2) != 'r') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator|=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator|=")); case SIMPLE_HASH('a', 'e') : /* aer */ if (*(d->p + 2) != 'r') return (false); d->p += 3; - return (vector_str_push(&d->vec, "operator^=", 10)); + return (VEC_PUSH_STR(&d->vec, "operator^=")); case SIMPLE_HASH('c', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator,", 9)); + return (VEC_PUSH_STR(&d->vec, "operator,")); case SIMPLE_HASH('r', 'm') : d->p += 2; - return (vector_str_push(&d->vec, "operator->*", 11)); + return (VEC_PUSH_STR(&d->vec, "operator->*")); case SIMPLE_HASH('c', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "()", 2)); + return (VEC_PUSH_STR(&d->vec, "()")); case SIMPLE_HASH('v', 'c') : d->p += 2; - return (vector_str_push(&d->vec, "[]", 2)); + return (VEC_PUSH_STR(&d->vec, "[]")); case SIMPLE_HASH('c', 't') : d->p += 4; d->type = ENCODE_OP_CT; @@ -883,11 +877,10 @@ read_op(struct demangle_data *d) return (false); case SIMPLE_HASH('n', 'w') : d->p += 2; - return (vector_str_push(&d->vec, "operator new()", 14)); + return (VEC_PUSH_STR(&d->vec, "operator new()")); case SIMPLE_HASH('d', 'l') : d->p += 2; - return (vector_str_push(&d->vec, "operator delete()", - 17)); + return (VEC_PUSH_STR(&d->vec, "operator delete()")); case SIMPLE_HASH('o', 'p') : /* __op__ */ d->p += 2; @@ -962,13 +955,13 @@ read_op_user(struct demangle_data *d) if (vector_str_push(&d->vec, from_str, from_len) == false) goto clean; - if (vector_str_push(&d->vec, "::operator ", 11) == false) + if (VEC_PUSH_STR(&d->vec, "::operator ") == false) return (false); if (vector_str_push(&d->vec, to_str, to_len) == false) goto clean; - rtn = vector_str_push(&d->vec, "()", 2); + rtn = VEC_PUSH_STR(&d->vec, "()"); clean: free(to_str); free(from_str); @@ -1000,7 +993,7 @@ read_qual_name(struct demangle_data *d) if (read_class(d) == false) return (false); - if (vector_str_push(&d->vec, "::", 2) == false) + if (VEC_PUSH_STR(&d->vec, "::") == false) return (false); } @@ -1029,12 +1022,10 @@ read_subst(struct demangle_data *d) d->p = str; - if (vector_str_push(&d->vec, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false) return (-1); - if (vector_str_push(&d->arg, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false) return (-1); if (*d->p == '\0') @@ -1073,16 +1064,14 @@ read_subst_iter(struct demangle_data *d) d->p = str; for (i = 0; i < repeat ; ++i) { - if (vector_str_push(&d->vec, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->vec, d->arg.container[idx - 1]) == false) return (-1); - if (vector_str_push(&d->arg, d->arg.container[idx - 1], - strlen(d->arg.container[idx - 1])) == false) + if (VEC_PUSH_STR(&d->arg, d->arg.container[idx - 1]) == false) return (-1); if (i != repeat - 1 && - vector_str_push(&d->vec, ", ", 2) == false) + VEC_PUSH_STR(&d->vec, ", ") == false) return (-1); } @@ -1108,7 +1097,7 @@ read_type(struct demangle_data *d) case 'U' : ++d->p; - if (vector_str_push(&d->vec, "unsigned ", 9) == false) + if (VEC_PUSH_STR(&d->vec, "unsigned ") == false) return (false); break; @@ -1118,7 +1107,7 @@ read_type(struct demangle_data *d) if (*d->p == 'P') d->cnst = true; else { - if (vector_str_push(&d->vec, "const ", 6) == + if (VEC_PUSH_STR(&d->vec, "const ") == false) return (false); } @@ -1127,14 +1116,14 @@ read_type(struct demangle_data *d) case 'V' : ++d->p; - if (vector_str_push(&d->vec, "volatile ", 9) == false) + if (VEC_PUSH_STR(&d->vec, "volatile ") == false) return (false); break; case 'S' : ++d->p; - if (vector_str_push(&d->vec, "signed ", 7) == false) + if (VEC_PUSH_STR(&d->vec, "signed ") == false) return (false); break; @@ -1185,39 +1174,39 @@ read_type(struct demangle_data *d) case 'v' : ++d->p; - return (vector_str_push(&d->vec, "void", 4)); + return (VEC_PUSH_STR(&d->vec, "void")); case 'c' : ++d->p; - return (vector_str_push(&d->vec, "char", 4)); + return (VEC_PUSH_STR(&d->vec, "char")); case 's' : ++d->p; - return (vector_str_push(&d->vec, "short", 5)); + return (VEC_PUSH_STR(&d->vec, "short")); case 'i' : ++d->p; - return (vector_str_push(&d->vec, "int", 3)); + return (VEC_PUSH_STR(&d->vec, "int")); case 'l' : ++d->p; - return (vector_str_push(&d->vec, "long", 4)); + return (VEC_PUSH_STR(&d->vec, "long")); case 'f' : ++d->p; - return (vector_str_push(&d->vec, "float", 5)); + return (VEC_PUSH_STR(&d->vec, "float")); case 'd': ++d->p; - return (vector_str_push(&d->vec, "double", 6)); + return (VEC_PUSH_STR(&d->vec, "double")); case 'r': ++d->p; - return (vector_str_push(&d->vec, "long double", 11)); + return (VEC_PUSH_STR(&d->vec, "long double")); case 'e': ++d->p; - return (vector_str_push(&d->vec, "...", 3)); + return (VEC_PUSH_STR(&d->vec, "...")); default: return (false); }; Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Mon May 1 01:51:50 2017 (r317622) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Mon May 1 01:52:03 2017 (r317623) @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3447 2016-05-03 13:32:23Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3513 2016-12-29 07:04:22Z kaiwang27 $"); /** * @file cpp_demangle_gnu2.c @@ -66,6 +66,7 @@ struct demangle_data { }; #define SIMPLE_HASH(x,y) (64 * x + y) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) #define CPP_DEMANGLE_GNU2_TRY 128 static void dest_cstring(struct cstring *); @@ -126,7 +127,7 @@ cpp_demangle_gnu2(const char *org) if (push_CTDT("::~", 3, &d.vec) == false) goto clean; - if (vector_str_push(&d.vec, "(void)", 6) == false) + if (VEC_PUSH_STR(&d.vec, "(void)") == false) goto clean; goto flat; @@ -141,7 +142,7 @@ cpp_demangle_gnu2(const char *org) ++d.p; else if (*d.p == '\0') { if (d.class_name == true) { - if (vector_str_push(&d.vec, "(void)", 6) == false) + if (VEC_PUSH_STR(&d.vec, "(void)") == false) goto clean; goto flat; @@ -150,7 +151,7 @@ cpp_demangle_gnu2(const char *org) } /* start argument types */ - if (vector_str_push(&d.vec, "(", 1) == false) + if (VEC_PUSH_STR(&d.vec, "(") == false) goto clean; for (;;) { @@ -182,21 +183,21 @@ cpp_demangle_gnu2(const char *org) goto clean; if (d.ptr == true) { - if (vector_str_push(&d.vec, "*", 1) == false) + if (VEC_PUSH_STR(&d.vec, "*") == false) goto clean; d.ptr = false; } if (d.ref == true) { - if (vector_str_push(&d.vec, "&", 1) == false) + if (VEC_PUSH_STR(&d.vec, "&") == false) goto clean; d.ref = false; } if (d.cnst == true) { - if (vector_str_push(&d.vec, " const", 6) == false) + if (VEC_PUSH_STR(&d.vec, " const") == false) goto clean; d.cnst = false; @@ -223,7 +224,7 @@ cpp_demangle_gnu2(const char *org) free(arg); - if (vector_str_push(&d.vec, ", ", 2) == false) + if (VEC_PUSH_STR(&d.vec, ", ") == false) goto clean; if (++try > CPP_DEMANGLE_GNU2_TRY) @@ -231,10 +232,10 @@ cpp_demangle_gnu2(const char *org) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Mon May 1 06:03:09 2017 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 6E7F7D58DA8; Mon, 1 May 2017 06:03:09 +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 27CF815BD; Mon, 1 May 2017 06:03:09 +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 v41638wF089419; Mon, 1 May 2017 06:03:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41638tq089418; Mon, 1 May 2017 06:03:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705010603.v41638tq089418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 1 May 2017 06:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317633 - stable/11/lib/libc/gen 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, 01 May 2017 06:03:09 -0000 Author: mav Date: Mon May 1 06:03:07 2017 New Revision: 317633 URL: https://svnweb.freebsd.org/changeset/base/317633 Log: MFC r317064: Optimize pathologic case of telldir() for Samba. When application reads large directory, calling telldir() for each entry, like Samba does, it creates exponential performance drop as number of entries reach tenths to hundreds of thousands. It is caused by full search through the internal list, that never finds matches in that scenario, but creates O(n^2) delays. This patch optimizes that search, limiting it to entries of the same buffer, turning time closer to O(n) in case of linear directory scan. Modified: stable/11/lib/libc/gen/telldir.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/telldir.c ============================================================================== --- stable/11/lib/libc/gen/telldir.c Mon May 1 05:59:52 2017 (r317632) +++ stable/11/lib/libc/gen/telldir.c Mon May 1 06:03:07 2017 (r317633) @@ -52,15 +52,22 @@ __FBSDID("$FreeBSD$"); long telldir(DIR *dirp) { - struct ddloc *lp; + struct ddloc *lp, *flp; long idx; if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); + flp = NULL; LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { - if (lp->loc_seek == dirp->dd_seek && - lp->loc_loc == dirp->dd_loc) + if (lp->loc_seek == dirp->dd_seek) { + if (flp == NULL) + flp = lp; + if (lp->loc_loc == dirp->dd_loc) + break; + } else if (flp != NULL) { + lp = NULL; break; + } } if (lp == NULL) { lp = malloc(sizeof(struct ddloc)); @@ -72,7 +79,10 @@ telldir(DIR *dirp) lp->loc_index = dirp->dd_td->td_loccnt++; lp->loc_seek = dirp->dd_seek; lp->loc_loc = dirp->dd_loc; - LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + if (flp != NULL) + LIST_INSERT_BEFORE(flp, lp, loc_lqe); + else + LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); } idx = lp->loc_index; if (__isthreaded) From owner-svn-src-stable@freebsd.org Mon May 1 06:03:46 2017 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 14343D58EBA; Mon, 1 May 2017 06:03:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDB7D16BF; Mon, 1 May 2017 06:03:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4163i0T089497; Mon, 1 May 2017 06:03:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4163iiD089496; Mon, 1 May 2017 06:03:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705010603.v4163iiD089496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 1 May 2017 06:03:44 +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: r317634 - stable/10/lib/libc/gen 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, 01 May 2017 06:03:46 -0000 Author: mav Date: Mon May 1 06:03:44 2017 New Revision: 317634 URL: https://svnweb.freebsd.org/changeset/base/317634 Log: MFC r317064: Optimize pathologic case of telldir() for Samba. When application reads large directory, calling telldir() for each entry, like Samba does, it creates exponential performance drop as number of entries reach tenths to hundreds of thousands. It is caused by full search through the internal list, that never finds matches in that scenario, but creates O(n^2) delays. This patch optimizes that search, limiting it to entries of the same buffer, turning time closer to O(n) in case of linear directory scan. Modified: stable/10/lib/libc/gen/telldir.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/telldir.c ============================================================================== --- stable/10/lib/libc/gen/telldir.c Mon May 1 06:03:07 2017 (r317633) +++ stable/10/lib/libc/gen/telldir.c Mon May 1 06:03:44 2017 (r317634) @@ -53,15 +53,22 @@ long telldir(dirp) DIR *dirp; { - struct ddloc *lp; + struct ddloc *lp, *flp; long idx; if (__isthreaded) _pthread_mutex_lock(&dirp->dd_lock); + flp = NULL; LIST_FOREACH(lp, &dirp->dd_td->td_locq, loc_lqe) { - if (lp->loc_seek == dirp->dd_seek && - lp->loc_loc == dirp->dd_loc) + if (lp->loc_seek == dirp->dd_seek) { + if (flp == NULL) + flp = lp; + if (lp->loc_loc == dirp->dd_loc) + break; + } else if (flp != NULL) { + lp = NULL; break; + } } if (lp == NULL) { lp = malloc(sizeof(struct ddloc)); @@ -73,7 +80,10 @@ telldir(dirp) lp->loc_index = dirp->dd_td->td_loccnt++; lp->loc_seek = dirp->dd_seek; lp->loc_loc = dirp->dd_loc; - LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); + if (flp != NULL) + LIST_INSERT_BEFORE(flp, lp, loc_lqe); + else + LIST_INSERT_HEAD(&dirp->dd_td->td_locq, lp, loc_lqe); } idx = lp->loc_index; if (__isthreaded) From owner-svn-src-stable@freebsd.org Mon May 1 06:04:35 2017 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 D9844D58FC4; Mon, 1 May 2017 06:04:35 +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 A971A17B7; Mon, 1 May 2017 06:04:35 +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 v4164Y4N089580; Mon, 1 May 2017 06:04:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4164YKg089579; Mon, 1 May 2017 06:04:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705010604.v4164YKg089579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 1 May 2017 06:04:34 +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: r317635 - stable/11/sys/dev/isp 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, 01 May 2017 06:04:36 -0000 Author: mav Date: Mon May 1 06:04:34 2017 New Revision: 317635 URL: https://svnweb.freebsd.org/changeset/base/317635 Log: MFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP. Modified: stable/11/sys/dev/isp/isp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Mon May 1 06:03:44 2017 (r317634) +++ stable/11/sys/dev/isp/isp.c Mon May 1 06:04:34 2017 (r317635) @@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d fwt = isp->isp_fwattr; if (IS_24XX(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP2400_FW_ATTR_CLASS2) { fwt ^=ISP2400_FW_ATTR_CLASS2; @@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d } isp_prt(isp, ISP_LOGCONFIG, "%s", buf); } else if (IS_FC(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP_FW_ATTR_TMODE) { fwt ^=ISP_FW_ATTR_TMODE; From owner-svn-src-stable@freebsd.org Mon May 1 06:05:05 2017 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 F0CA1D5B04A; Mon, 1 May 2017 06:05:05 +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 C0E5218B2; Mon, 1 May 2017 06:05:05 +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 v41654gJ089661; Mon, 1 May 2017 06:05:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41654sm089660; Mon, 1 May 2017 06:05:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705010605.v41654sm089660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 1 May 2017 06:05:04 +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: r317636 - stable/10/sys/dev/isp 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, 01 May 2017 06:05:06 -0000 Author: mav Date: Mon May 1 06:05:04 2017 New Revision: 317636 URL: https://svnweb.freebsd.org/changeset/base/317636 Log: MFC r317356: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon May 1 06:04:34 2017 (r317635) +++ stable/10/sys/dev/isp/isp.c Mon May 1 06:05:04 2017 (r317636) @@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d fwt = isp->isp_fwattr; if (IS_24XX(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP2400_FW_ATTR_CLASS2) { fwt ^=ISP2400_FW_ATTR_CLASS2; @@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d } isp_prt(isp, ISP_LOGCONFIG, "%s", buf); } else if (IS_FC(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP_FW_ATTR_TMODE) { fwt ^=ISP_FW_ATTR_TMODE; From owner-svn-src-stable@freebsd.org Mon May 1 06:42:41 2017 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 34A91D5A559; Mon, 1 May 2017 06:42:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 1014BDBC; Mon, 1 May 2017 06:42:40 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v416geKj005620; Mon, 1 May 2017 06:42:40 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v416gdvU005618; Mon, 1 May 2017 06:42:39 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201705010642.v416gdvU005618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 1 May 2017 06:42: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: r317637 - stable/11/sys/compat/linux 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, 01 May 2017 06:42:41 -0000 Author: dchagin Date: Mon May 1 06:42:39 2017 New Revision: 317637 URL: https://svnweb.freebsd.org/changeset/base/317637 Log: MFC r316426: Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with the proper handling of the TIMER_ABSTIME flag. Modified: stable/11/sys/compat/linux/linux_time.c stable/11/sys/compat/linux/linux_timer.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_time.c ============================================================================== --- stable/11/sys/compat/linux/linux_time.c Mon May 1 06:05:04 2017 (r317636) +++ stable/11/sys/compat/linux/linux_time.c Mon May 1 06:42:39 2017 (r317637) @@ -231,6 +231,18 @@ linux_to_native_clockid(clockid_t *n, cl } int +linux_to_native_timerflags(int *nflags, int flags) +{ + + if (flags & ~LINUX_TIMER_ABSTIME) + return (EINVAL); + *nflags = 0; + if (flags & LINUX_TIMER_ABSTIME) + *nflags |= TIMER_ABSTIME; + return (0); +} + +int linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) { struct l_timespec lts; @@ -543,24 +555,26 @@ linux_clock_nanosleep(struct thread *td, struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; - int error, error2; + int error, error2, flags; + clockid_t clockid; LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which, args->flags, args->rqtp, args->rmtp); - if (args->flags != 0) { - /* XXX deal with TIMER_ABSTIME */ + error = linux_to_native_timerflags(&flags, args->flags); + if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_flags, args->flags); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL); - return (EINVAL); /* XXX deal with TIMER_ABSTIME */ + LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); + return (error); } - if (args->which != LINUX_CLOCK_REALTIME) { + error = linux_to_native_clockid(&clockid, args->which); + if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid, args->which); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL); - return (EINVAL); + LIN_SDT_PROBE1(time, linux_clock_settime, return, error); + return (error); } error = copyin(args->rqtp, &lrqts, sizeof(lrqts)); @@ -583,9 +597,9 @@ linux_clock_nanosleep(struct thread *td, LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); return (error); } - error = kern_nanosleep(td, &rqts, rmtp); - if (error == EINTR && args->rmtp != NULL) { - /* XXX. Not for TIMER_ABSTIME */ + error = kern_clock_nanosleep(td, clockid, flags, &rqts, rmtp); + if (error == EINTR && (flags & TIMER_ABSTIME) == 0 && + args->rmtp != NULL) { error2 = native_to_linux_timespec(&lrmts, rmtp); if (error2 != 0) return (error2); Modified: stable/11/sys/compat/linux/linux_timer.h ============================================================================== --- stable/11/sys/compat/linux/linux_timer.h Mon May 1 06:05:04 2017 (r317636) +++ stable/11/sys/compat/linux/linux_timer.h Mon May 1 06:42:39 2017 (r317637) @@ -72,6 +72,7 @@ #define LINUX_CPUCLOCK_PERTHREAD(clock) \ (((clock) & (clockid_t) LINUX_CPUCLOCK_PERTHREAD_MASK) != 0) +#define LINUX_TIMER_ABSTIME 0x01 #define L_SIGEV_SIGNAL 0 #define L_SIGEV_NONE 1 @@ -120,5 +121,6 @@ int native_to_linux_itimerspec(struct l_ struct itimerspec *); int linux_to_native_itimerspec(struct itimerspec *, struct l_itimerspec *); +int linux_to_native_timerflags(int *, int); #endif /* _LINUX_TIMER_H */ From owner-svn-src-stable@freebsd.org Mon May 1 12:41:12 2017 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 3F86DD581F3; Mon, 1 May 2017 12:41:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CA22156; Mon, 1 May 2017 12:41:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41CfBQF048444; Mon, 1 May 2017 12:41:11 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41CfBpt048442; Mon, 1 May 2017 12:41:11 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705011241.v41CfBpt048442@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 1 May 2017 12:41: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: r317646 - stable/11/lib/libc/tests/string 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, 01 May 2017 12:41:12 -0000 Author: bapt Date: Mon May 1 12:41:10 2017 New Revision: 317646 URL: https://svnweb.freebsd.org/changeset/base/317646 Log: MFC r302920 Add a regression test to make sure the Russian collation is actually working when importing collation support from Dragonfly/Illumos amdmi3@ tested the collation branch and reported an issue with Russian collation. John Marino fixed the issue in Dragonfly and I merged it back to FreeBSD. Now that Illumos is working on merging our fixes they (Lauri Tirkkonen) found issues with the commit that fixes the russian collation in UTF-8 that resulted in a crash with strxfrm(3) and the ISO-8859-5 locale (fixed in FreeBSD r302916). This small test was written to ensure we do not bring back the old issue with russian collation while fixing the other issue. Added: stable/11/lib/libc/tests/string/wcscoll_test.c - copied unchanged from r302920, head/lib/libc/tests/string/wcscoll_test.c Modified: stable/11/lib/libc/tests/string/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/string/Makefile ============================================================================== --- stable/11/lib/libc/tests/string/Makefile Mon May 1 12:25:37 2017 (r317645) +++ stable/11/lib/libc/tests/string/Makefile Mon May 1 12:41:10 2017 (r317646) @@ -6,6 +6,7 @@ ATF_TESTS_C+= stpncpy_test ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= wcscasecmp_test ATF_TESTS_C+= wcsnlen_test +ATF_TESTS_C+= wcscoll_test # TODO: popcount, stresep Copied: stable/11/lib/libc/tests/string/wcscoll_test.c (from r302920, head/lib/libc/tests/string/wcscoll_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/tests/string/wcscoll_test.c Mon May 1 12:41:10 2017 (r317646, copy of r302920, head/lib/libc/tests/string/wcscoll_test.c) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2016 Baptiste Daroussin + * 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 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +static int +cmp(const void *a, const void *b) +{ + const wchar_t wa[2] = { *(const wchar_t *)a, 0 }; + const wchar_t wb[2] = { *(const wchar_t *)b, 0 }; + + return (wcscoll(wa, wb)); +} + +ATF_TC_WITHOUT_HEAD(russian_collation); +ATF_TC_BODY(russian_collation, tc) +{ + wchar_t c[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё"; + wchar_t res[] = L"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяЯ"; + + ATF_CHECK_MSG(setlocale(LC_ALL, "ru_RU.UTF-8") != NULL, + "Fail to set locale to \"ru_RU.UTF-8\""); + qsort(c, wcslen(c), sizeof(wchar_t), cmp); + ATF_CHECK_MSG(wcscmp(c, res) == 0, + "Bad collation, expected: '%ls' got '%ls'", res, c); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, russian_collation); + + return (atf_no_error()); +} From owner-svn-src-stable@freebsd.org Mon May 1 12:42:07 2017 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 E05A8D5827C; Mon, 1 May 2017 12:42:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD5BF36E; Mon, 1 May 2017 12:42:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41Cg68k049258; Mon, 1 May 2017 12:42:06 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41Cg6aD049256; Mon, 1 May 2017 12:42:06 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705011242.v41Cg6aD049256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 1 May 2017 12:42: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: r317647 - in stable/11/lib/libc: string tests/string 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, 01 May 2017 12:42:08 -0000 Author: bapt Date: Mon May 1 12:42:06 2017 New Revision: 317647 URL: https://svnweb.freebsd.org/changeset/base/317647 Log: MFC r317034: Fix strcoll_l disagreeing with strxfrm by reworking the forward order case in wcscoll_l(). Illumos fixed this while grabbing back our patches: https://www.illumos.org/rb/r/402/ This does not 100% fix what postgresql folks reported as there is still a remaining issue: https://www.illumos.org/issues/7962, it improves the situation The initial issue was reported in postgresql mailing lists: https://www.postgresql.org/message-id/flat/111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com#111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com Submitted by: Yuri Pankov Obtained from: Illumos Modified: stable/11/lib/libc/string/wcscoll.c stable/11/lib/libc/tests/string/wcscoll_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/string/wcscoll.c ============================================================================== --- stable/11/lib/libc/string/wcscoll.c Mon May 1 12:41:10 2017 (r317646) +++ stable/11/lib/libc/string/wcscoll.c Mon May 1 12:42:06 2017 (r317647) @@ -1,5 +1,5 @@ /*- - * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2002 Tim J. Robbins * All rights reserved. * @@ -42,22 +42,22 @@ __FBSDID("$FreeBSD$"); int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2, locale_t locale) { - int len1, len2, pri1, pri2, ret; + int len1, len2, pri1, pri2; wchar_t *tr1 = NULL, *tr2 = NULL; int direc, pass; + int ret = wcscmp(ws1, ws2); FIX_LOCALE(locale); struct xlocale_collate *table = (struct xlocale_collate*)locale->components[XLC_COLLATE]; - if (table->__collate_load_error) - /* - * Locale has no special collating order or could not be - * loaded, do a fast binary comparison. - */ - return (wcscmp(ws1, ws2)); + if (table->__collate_load_error || ret == 0) + return (ret); - ret = 0; + if (*ws1 == 0 && *ws2 != 0) + return (-1); + if (*ws1 != 0 && *ws2 == 0) + return (1); /* * Once upon a time we had code to try to optimize this, but @@ -77,19 +77,19 @@ wcscoll_l(const wchar_t *ws1, const wcha const int32_t *st2 = NULL; const wchar_t *w1 = ws1; const wchar_t *w2 = ws2; - int check1, check2; /* special pass for UNDEFINED */ if (pass == table->info->directive_count) { - direc = DIRECTIVE_FORWARD | DIRECTIVE_UNDEFINED; + direc = DIRECTIVE_FORWARD; } else { direc = table->info->directive[pass]; } if (direc & DIRECTIVE_BACKWARD) { wchar_t *bp, *fp, c; + free(tr1); if ((tr1 = wcsdup(w1)) == NULL) - goto fail; + goto end; bp = tr1; fp = tr1 + wcslen(tr1) - 1; while (bp < fp) { @@ -97,8 +97,9 @@ wcscoll_l(const wchar_t *ws1, const wcha *bp++ = *fp; *fp-- = c; } + free(tr2); if ((tr2 = wcsdup(w2)) == NULL) - goto fail; + goto end; bp = tr2; fp = tr2 + wcslen(tr2) - 1; while (bp < fp) { @@ -111,6 +112,7 @@ wcscoll_l(const wchar_t *ws1, const wcha } if (direc & DIRECTIVE_POSITION) { + int check1, check2; while (*w1 && *w2) { pri1 = pri2 = 0; check1 = check2 = 1; @@ -120,7 +122,7 @@ wcscoll_l(const wchar_t *ws1, const wcha &pri1, pass, &st1); if (pri1 < 0) { errno = EINVAL; - goto fail; + goto end; } if (!pri1) { pri1 = COLLATE_MAX_PRIORITY; @@ -133,7 +135,7 @@ wcscoll_l(const wchar_t *ws1, const wcha &pri2, pass, &st2); if (pri2 < 0) { errno = EINVAL; - goto fail; + goto end; } if (!pri2) { pri2 = COLLATE_MAX_PRIORITY; @@ -149,58 +151,64 @@ wcscoll_l(const wchar_t *ws1, const wcha w1 += len1; w2 += len2; } + if (!*w1) { + if (*w2) { + ret = -(int)*w2; + goto end; + } + } else { + ret = *w1; + goto end; + } } else { - while (*w1 && *w2) { - pri1 = pri2 = 0; - check1 = check2 = 1; - while ((pri1 == pri2) && (check1 || check2)) { - while (check1 && *w1) { - _collate_lookup(table, w1, - &len1, &pri1, pass, &st1); - if (pri1 > 0) - break; - if (pri1 < 0) { - errno = EINVAL; - goto fail; - } - st1 = NULL; - w1 += 1; + int vpri1 = 0, vpri2 = 0; + while (*w1 || *w2 || st1 || st2) { + pri1 = 1; + while (*w1 || st1) { + _collate_lookup(table, w1, &len1, &pri1, + pass, &st1); + w1 += len1; + if (pri1 > 0) { + vpri1++; + break; } - check1 = (st1 != NULL); - while (check2 && *w2) { - _collate_lookup(table, w2, - &len2, &pri2, pass, &st2); - if (pri2 > 0) - break; - if (pri2 < 0) { - errno = EINVAL; - goto fail; - } - st2 = NULL; - w2 += 1; + + if (pri1 < 0) { + errno = EINVAL; + goto end; } - check2 = (st2 != NULL); - if (!pri1 || !pri2) + st1 = NULL; + } + pri2 = 1; + while (*w2 || st2) { + _collate_lookup(table, w2, &len2, &pri2, + pass, &st2); + w2 += len2; + if (pri2 > 0) { + vpri2++; break; + } + if (pri2 < 0) { + errno = EINVAL; + goto end; + } + st2 = NULL; } - if (!pri1 || !pri2) + if ((!pri1 || !pri2) && (vpri1 == vpri2)) break; if (pri1 != pri2) { ret = pri1 - pri2; goto end; } - w1 += len1; - w2 += len2; } - } - if (!*w1) { - if (*w2) { - ret = -(int)*w2; + if (vpri1 && !vpri2) { + ret = 1; + goto end; + } + if (!vpri1 && vpri2) { + ret = -1; goto end; } - } else { - ret = *w1; - goto end; } } ret = 0; @@ -210,10 +218,6 @@ end: free(tr2); return (ret); - -fail: - ret = wcscmp(ws1, ws2); - goto end; } int Modified: stable/11/lib/libc/tests/string/wcscoll_test.c ============================================================================== --- stable/11/lib/libc/tests/string/wcscoll_test.c Mon May 1 12:41:10 2017 (r317646) +++ stable/11/lib/libc/tests/string/wcscoll_test.c Mon May 1 12:42:06 2017 (r317647) @@ -1,5 +1,7 @@ /*- * Copyright (c) 2016 Baptiste Daroussin + * Copyright 2016 Tom Lane + * Copyright 2017 Nexenta Systems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,6 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include @@ -55,9 +59,98 @@ ATF_TC_BODY(russian_collation, tc) "Bad collation, expected: '%ls' got '%ls'", res, c); } +#define NSTRINGS 2000 +#define MAXSTRLEN 20 +#define MAXXFRMLEN (MAXSTRLEN * 20) + +typedef struct { + char sval[MAXSTRLEN]; + char xval[MAXXFRMLEN]; +} cstr; + +ATF_TC_WITHOUT_HEAD(strcoll_vs_strxfrm); +ATF_TC_BODY(strcoll_vs_strxfrm, tc) +{ + cstr data[NSTRINGS]; + char *curloc; + int i, j; + + curloc = setlocale(LC_ALL, "en_US.UTF-8"); + ATF_CHECK_MSG(curloc != NULL, "Fail to set locale"); + + /* Ensure new random() values on every run */ + srandom((unsigned int) time(NULL)); + + /* Generate random UTF8 strings of length less than MAXSTRLEN bytes */ + for (i = 0; i < NSTRINGS; i++) { + char *p; + int len; + +again: + p = data[i].sval; + len = 1 + (random() % (MAXSTRLEN - 1)); + while (len > 0) { + int c; + /* + * Generate random printable char in ISO8859-1 range. + * Bias towards producing a lot of spaces. + */ + + if ((random() % 16) < 3) { + c = ' '; + } else { + do { + c = random() & 0xFF; + } while (!((c >= ' ' && c <= 127) || + (c >= 0xA0 && c <= 0xFF))); + } + + if (c <= 127) { + *p++ = c; + len--; + } else { + if (len < 2) + break; + /* Poor man's utf8-ification */ + *p++ = 0xC0 + (c >> 6); + len--; + *p++ = 0x80 + (c & 0x3F); + len--; + } + } + *p = '\0'; + /* strxfrm() each string as we produce it */ + errno = 0; + ATF_CHECK_MSG(strxfrm(data[i].xval, data[i].sval, + MAXXFRMLEN) < MAXXFRMLEN, "strxfrm() result for %d-length " + " string exceeded %d bytes", (int)strlen(data[i].sval), + MAXXFRMLEN); + + /* + * Amend strxfrm() failing on certain characters to be fixed and + * test later + */ + if (errno != 0) + goto again; + } + + for (i = 0; i < NSTRINGS; i++) { + for (j = 0; j < NSTRINGS; j++) { + int sr = strcoll(data[i].sval, data[j].sval); + int sx = strcmp(data[i].xval, data[j].xval); + + ATF_CHECK_MSG(!((sr * sx < 0) || + (sr * sx == 0 && sr + sx != 0)), + "%s: diff for \"%s\" and \"%s\"", + curloc, data[i].sval, data[j].sval); + } + } +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, russian_collation); + ATF_TP_ADD_TC(tp, strcoll_vs_strxfrm); return (atf_no_error()); } From owner-svn-src-stable@freebsd.org Mon May 1 16:59:56 2017 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 44D1BD59371; Mon, 1 May 2017 16:59:56 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 14965112A; Mon, 1 May 2017 16:59:56 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41GxtRh061622; Mon, 1 May 2017 16:59:55 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41GxtWv061621; Mon, 1 May 2017 16:59:55 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705011659.v41GxtWv061621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 1 May 2017 16:59: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: r317653 - stable/11/usr.bin/getaddrinfo 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, 01 May 2017 16:59:56 -0000 Author: brooks Date: Mon May 1 16:59:54 2017 New Revision: 317653 URL: https://svnweb.freebsd.org/changeset/base/317653 Log: MFC r317385: Clean up Makefile. Prefer SRCTOP vs .CURDIR relative paths. Find libnetbsd using LIBADD infrastructure rather than manual hackery. Reviewed by: ngie, bapt Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/usr.bin/getaddrinfo/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/getaddrinfo/Makefile ============================================================================== --- stable/11/usr.bin/getaddrinfo/Makefile Mon May 1 16:56:34 2017 (r317652) +++ stable/11/usr.bin/getaddrinfo/Makefile Mon May 1 16:59:54 2017 (r317653) @@ -3,19 +3,15 @@ .include PROG= getaddrinfo +SRCS= getaddrinfo.c tables.h -CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd -LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd -LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a -DPADD+= ${LIBNETBSD} -LDADD+= ${LIBNETBSD} +CFLAGS+= -I${SRCTOP}/lib/libnetbsd -LIBADD+= util +LIBADD+= netbsd util -SYS_SOCKET_H?= ${.CURDIR}/../../sys/sys/socket.h +SYS_SOCKET_H?= ${SRCTOP}/sys/sys/socket.h -CFLAGS+= -I. -DPSRCS+= tables.h +CFLAGS+= -I${.OBJDIR} CLEANFILES+= tables.h tables.h: tables.awk ${SYS_SOCKET_H} LC_ALL=C awk -f ${.ALLSRC} > ${.TARGET} From owner-svn-src-stable@freebsd.org Mon May 1 17:02:53 2017 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 3B613D59590; Mon, 1 May 2017 17:02:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 0D0DB1779; Mon, 1 May 2017 17:02:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41H2qCA065362; Mon, 1 May 2017 17:02:52 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41H2qHb065361; Mon, 1 May 2017 17:02:52 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705011702.v41H2qHb065361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 1 May 2017 17:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317655 - stable/11/usr.sbin/ntp/sntp 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, 01 May 2017 17:02:53 -0000 Author: brooks Date: Mon May 1 17:02:51 2017 New Revision: 317655 URL: https://svnweb.freebsd.org/changeset/base/317655 Log: MFC r317388: Use the approved syntax to build no man pages. Sponsored by: DARPA, AFRL Modified: stable/11/usr.sbin/ntp/sntp/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ntp/sntp/Makefile ============================================================================== --- stable/11/usr.sbin/ntp/sntp/Makefile Mon May 1 17:01:00 2017 (r317654) +++ stable/11/usr.sbin/ntp/sntp/Makefile Mon May 1 17:02:51 2017 (r317655) @@ -5,7 +5,7 @@ .PATH: ${.CURDIR}/../../../contrib/ntp/sntp PROG= sntp -MK_MAN= no +MAN= SRCS= crypto.c kod_management.c log.c main.c networking.c \ sntp-opts.c sntp.c utilities.c From owner-svn-src-stable@freebsd.org Mon May 1 17:10:45 2017 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 50577D59751; Mon, 1 May 2017 17:10:45 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 04BA01B0D; Mon, 1 May 2017 17:10:44 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41HAhsE065731; Mon, 1 May 2017 17:10:43 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41HAhT3065730; Mon, 1 May 2017 17:10:43 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705011710.v41HAhT3065730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 1 May 2017 17:10: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: r317656 - stable/11/sys/dev/ieee488 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, 01 May 2017 17:10:45 -0000 Author: brooks Date: Mon May 1 17:10:43 2017 New Revision: 317656 URL: https://svnweb.freebsd.org/changeset/base/317656 Log: Partial, manual MFC of r317411: Remove directory made empty by IEEE488 removal. Deleted: stable/11/sys/dev/ieee488/ Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Tue May 2 01:30:48 2017 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 1BD65D595ED; Tue, 2 May 2017 01:30:48 +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 E1B19943; Tue, 2 May 2017 01:30:47 +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 v421Ukxc071132; Tue, 2 May 2017 01:30:46 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v421UkUH071131; Tue, 2 May 2017 01:30:46 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705020130.v421UkUH071131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 2 May 2017 01:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317664 - stable/11/sys/dev/hyperv/netvsc 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, 02 May 2017 01:30:48 -0000 Author: sephe Date: Tue May 2 01:30:46 2017 New Revision: 317664 URL: https://svnweb.freebsd.org/changeset/base/317664 Log: hyperv/hn: Enable sorted LRO (direct commit). This is a direct commit. Sorted LRO is much better than plain (linked list LRO), which hash LRO is not available on this branch. Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Tue May 2 01:03:59 2017 (r317663) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Tue May 2 01:30:46 2017 (r317664) @@ -487,7 +487,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_dept /* Enable sorted LRO, and the depth of the per-channel mbuf queue */ #if __FreeBSD_version >= 1100095 -static u_int hn_lro_mbufq_depth = 0; +static u_int hn_lro_mbufq_depth = 512; SYSCTL_UINT(_hw_hn, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, &hn_lro_mbufq_depth, 0, "Depth of LRO mbuf queue"); #endif From owner-svn-src-stable@freebsd.org Tue May 2 06:27:48 2017 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 7F3C2D5A505; Tue, 2 May 2017 06:27:48 +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 4F9431B6D; Tue, 2 May 2017 06:27:48 +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 v426Rlna095061; Tue, 2 May 2017 06:27:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v426Rls5095058; Tue, 2 May 2017 06:27:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705020627.v426Rls5095058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 2 May 2017 06:27:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317673 - 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: Tue, 02 May 2017 06:27:48 -0000 Author: mav Date: Tue May 2 06:27:46 2017 New Revision: 317673 URL: https://svnweb.freebsd.org/changeset/base/317673 Log: MFC r317080: Block FPDMA TRIM for ASMedia HBAs. Experiments show FPDMA TRIM command timeouts on ASMedia HBAs, while the same SSDs working fine on Intel HBAs. Modified: stable/11/sys/dev/ahci/ahci.c stable/11/sys/dev/ahci/ahci.h stable/11/sys/dev/ahci/ahci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci.c Tue May 2 06:16:35 2017 (r317672) +++ stable/11/sys/dev/ahci/ahci.c Tue May 2 06:27:46 2017 (r317673) @@ -2684,7 +2684,9 @@ ahciaction(struct cam_sim *sim, union cc if (ch->caps & AHCI_CAP_SPM) cpi->hba_inquiry |= PI_SATAPM; cpi->target_sprt = 0; - cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED | PIM_ATA_EXT; + cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED; + if ((ch->quirks & AHCI_Q_NOAUX) == 0) + cpi->hba_misc |= PIM_ATA_EXT; cpi->hba_eng_cnt = 0; if (ch->caps & AHCI_CAP_SPM) cpi->max_target = 15; Modified: stable/11/sys/dev/ahci/ahci.h ============================================================================== --- stable/11/sys/dev/ahci/ahci.h Tue May 2 06:16:35 2017 (r317672) +++ stable/11/sys/dev/ahci/ahci.h Tue May 2 06:27:46 2017 (r317673) @@ -599,6 +599,7 @@ enum ahci_err_type { #define AHCI_Q_RESTORE_CAP 0x00080000 #define AHCI_Q_NOMSIX 0x00100000 #define AHCI_Q_NOCCS 0x00400000 +#define AHCI_Q_NOAUX 0x00800000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -623,7 +624,8 @@ enum ahci_err_type { "\023FORCE_PI" \ "\024RESTORE_CAP" \ "\025NOMSIX" \ - "\027NOCCS" + "\027NOCCS" \ + "\030NOAUX" int ahci_attach(device_t dev); int ahci_detach(device_t dev); Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Tue May 2 06:16:35 2017 (r317672) +++ stable/11/sys/dev/ahci/ahci_pci.c Tue May 2 06:27:46 2017 (r317673) @@ -73,15 +73,15 @@ static const struct { {0x78021022, 0x00, "AMD Hudson-2", 0}, {0x78031022, 0x00, "AMD Hudson-2", 0}, {0x78041022, 0x00, "AMD Hudson-2", 0}, - {0x06011b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, - {0x06021b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS}, - {0x06111b21, 0x00, "ASMedia ASM1061", AHCI_Q_NOCCS}, - {0x06121b21, 0x00, "ASMedia ASM1062", AHCI_Q_NOCCS}, - {0x06201b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, - {0x06211b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, - {0x06221b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, - {0x06241b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, - {0x06251b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS}, + {0x06011b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06021b21, 0x00, "ASMedia ASM1060", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06111b21, 0x00, "ASMedia ASM1061", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06121b21, 0x00, "ASMedia ASM1062", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06201b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06211b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06221b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06241b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x06251b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, {0x26528086, 0x00, "Intel ICH6", AHCI_Q_NOFORCE}, {0x26538086, 0x00, "Intel ICH6M", AHCI_Q_NOFORCE}, {0x26818086, 0x00, "Intel ESB2", 0}, From owner-svn-src-stable@freebsd.org Tue May 2 19:29:32 2017 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 A087CD5B3DE; Tue, 2 May 2017 19:29:32 +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 7DCB11B10; Tue, 2 May 2017 19:29: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 v42JTVgP025023; Tue, 2 May 2017 19:29:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42JTVfA025021; Tue, 2 May 2017 19:29:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705021929.v42JTVfA025021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 2 May 2017 19:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317697 - 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: Tue, 02 May 2017 19:29:32 -0000 Author: mav Date: Tue May 2 19:29:31 2017 New Revision: 317697 URL: https://svnweb.freebsd.org/changeset/base/317697 Log: MFC r312979 (by loos): Do not update the lagg link layer address when destroying a lagg clone. This would enqueue an event to send the gratuitous arp on a dying lagg interface without any physical ports attached to it. Apart from that, the taskqueue_drain() on lagg_clone_destroy() runs too late, when the ifp data structure is already freed. Fix that too. Modified: stable/11/sys/net/if_lagg.c stable/11/sys/net/if_lagg.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_lagg.c ============================================================================== --- stable/11/sys/net/if_lagg.c Tue May 2 19:09:11 2017 (r317696) +++ stable/11/sys/net/if_lagg.c Tue May 2 19:29:31 2017 (r317697) @@ -539,12 +539,15 @@ lagg_clone_destroy(struct ifnet *ifp) EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach); /* Shutdown and remove lagg ports */ - while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL) + while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL) { + lp->lp_detaching = LAGG_CLONE_DESTROY; lagg_port_destroy(lp, 1); + } /* Unhook the aggregation protocol */ lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(sc); + taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); ifmedia_removeall(&sc->sc_media); ether_ifdetach(ifp); if_free(ifp); @@ -553,7 +556,6 @@ lagg_clone_destroy(struct ifnet *ifp) SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); - taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); LAGG_LOCK_DESTROY(sc); free(sc, M_DEVBUF); } @@ -891,7 +893,7 @@ lagg_port_destroy(struct lagg_port *lp, * Remove multicast addresses and interface flags from this port and * reset the MAC address, skip if the interface is being detached. */ - if (!lp->lp_detaching) { + if (lp->lp_detaching == 0) { lagg_ether_cmdmulti(lp, 0); lagg_setflags(lp, 0); lagg_port_lladdr(lp, lp->lp_lladdr, LAGG_LLQTYPE_PHYS); @@ -924,7 +926,8 @@ lagg_port_destroy(struct lagg_port *lp, bcopy(lp0->lp_lladdr, lladdr, ETHER_ADDR_LEN); } - lagg_lladdr(sc, lladdr); + if (lp->lp_detaching != LAGG_CLONE_DESTROY) + lagg_lladdr(sc, lladdr); /* Mark lp0 as new primary */ sc->sc_primary = lp0; @@ -939,7 +942,7 @@ lagg_port_destroy(struct lagg_port *lp, } /* Remove any pending lladdr changes from the queue */ - if (lp->lp_detaching) { + if (lp->lp_detaching != 0) { SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { if (llq->llq_ifp == ifp) { SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, @@ -1118,7 +1121,7 @@ lagg_port_ifdetach(void *arg __unused, s sc = lp->lp_softc; LAGG_WLOCK(sc); - lp->lp_detaching = 1; + lp->lp_detaching = LAGG_PORT_DETACH; lagg_port_destroy(lp, 1); LAGG_WUNLOCK(sc); } @@ -1603,7 +1606,7 @@ lagg_ether_cmdmulti(struct lagg_port *lp } else { while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) { SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries); - if (mc->mc_ifma && !lp->lp_detaching) + if (mc->mc_ifma && lp->lp_detaching == 0) if_delmulti_ifma(mc->mc_ifma); free(mc, M_DEVBUF); } Modified: stable/11/sys/net/if_lagg.h ============================================================================== --- stable/11/sys/net/if_lagg.h Tue May 2 19:09:11 2017 (r317696) +++ stable/11/sys/net/if_lagg.h Tue May 2 19:29:31 2017 (r317697) @@ -261,6 +261,8 @@ struct lagg_port { void *lh_cookie; /* if state hook */ void *lp_psc; /* protocol data */ int lp_detaching; /* ifnet is detaching */ +#define LAGG_PORT_DETACH 0x01 /* detach lagg port */ +#define LAGG_CLONE_DESTROY 0x02 /* destroy lagg clone */ SLIST_HEAD(__mclhd, lagg_mc) lp_mc_head; /* multicast addresses */ From owner-svn-src-stable@freebsd.org Tue May 2 19:30:07 2017 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 0DE43D5B491; Tue, 2 May 2017 19:30:07 +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 DF2481D87; Tue, 2 May 2017 19:30:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42JU59S025121; Tue, 2 May 2017 19:30:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42JU5iN025120; Tue, 2 May 2017 19:30:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705021930.v42JU5iN025120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 2 May 2017 19:30:05 +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: r317698 - 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: Tue, 02 May 2017 19:30:07 -0000 Author: mav Date: Tue May 2 19:30:05 2017 New Revision: 317698 URL: https://svnweb.freebsd.org/changeset/base/317698 Log: MFC r317253: Add interface reference counting to if_lagg. Using plain ifunit() looks like request for troubles. Modified: stable/11/sys/net/if_lagg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_lagg.c ============================================================================== --- stable/11/sys/net/if_lagg.c Tue May 2 19:29:31 2017 (r317697) +++ stable/11/sys/net/if_lagg.c Tue May 2 19:30:05 2017 (r317698) @@ -672,6 +672,7 @@ lagg_port_lladdr(struct lagg_port *lp, u if (llq == NULL) /* XXX what to do */ return; + if_ref(ifp); llq->llq_ifp = ifp; llq->llq_type = llq_type; bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); @@ -720,6 +721,7 @@ lagg_port_setlladdr(void *arg, int pendi EVENTHANDLER_INVOKE(iflladdr_event, ifp); CURVNET_RESTORE(); head = SLIST_NEXT(llq, llq_entries); + if_rele(ifp); free(llq, M_DEVBUF); } } @@ -794,6 +796,7 @@ lagg_port_create(struct lagg_softc *sc, lp->lp_output = ifp->if_output; ifp->if_output = lagg_port_output; + if_ref(ifp); lp->lp_ifp = ifp; lp->lp_softc = sc; @@ -947,6 +950,7 @@ lagg_port_destroy(struct lagg_port *lp, if (llq->llq_ifp == ifp) { SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, llq_entries); + if_rele(llq->llq_ifp); free(llq, M_DEVBUF); break; /* Only appears once */ } @@ -956,6 +960,7 @@ lagg_port_destroy(struct lagg_port *lp, if (lp->lp_ifflags) if_printf(ifp, "%s: lp_ifflags unclean\n", __func__); + if_rele(ifp); free(lp, M_DEVBUF); /* Update lagg capabilities */ @@ -1432,7 +1437,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCGLAGGPORT: if (rp->rp_portname[0] == '\0' || - (tpif = ifunit(rp->rp_portname)) == NULL) { + (tpif = ifunit_ref(rp->rp_portname)) == NULL) { error = EINVAL; break; } @@ -1442,18 +1447,20 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd lp->lp_softc != sc) { error = ENOENT; LAGG_RUNLOCK(sc, &tracker); + if_rele(tpif); break; } lagg_port2req(lp, rp); LAGG_RUNLOCK(sc, &tracker); + if_rele(tpif); break; case SIOCSLAGGPORT: error = priv_check(td, PRIV_NET_LAGG); if (error) break; if (rp->rp_portname[0] == '\0' || - (tpif = ifunit(rp->rp_portname)) == NULL) { + (tpif = ifunit_ref(rp->rp_portname)) == NULL) { error = EINVAL; break; } @@ -1480,13 +1487,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd LAGG_WLOCK(sc); error = lagg_port_create(sc, tpif); LAGG_WUNLOCK(sc); + if_rele(tpif); break; case SIOCSLAGGDELPORT: error = priv_check(td, PRIV_NET_LAGG); if (error) break; if (rp->rp_portname[0] == '\0' || - (tpif = ifunit(rp->rp_portname)) == NULL) { + (tpif = ifunit_ref(rp->rp_portname)) == NULL) { error = EINVAL; break; } @@ -1496,11 +1504,13 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd lp->lp_softc != sc) { error = ENOENT; LAGG_WUNLOCK(sc); + if_rele(tpif); break; } error = lagg_port_destroy(lp, 1); LAGG_WUNLOCK(sc); + if_rele(tpif); break; case SIOCSIFFLAGS: /* Set flags on ports too */ From owner-svn-src-stable@freebsd.org Tue May 2 19:30:43 2017 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 7CDFBD5B514; Tue, 2 May 2017 19:30:43 +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 4CD841F19; Tue, 2 May 2017 19:30:43 +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 v42JUgYH025203; Tue, 2 May 2017 19:30:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42JUgsT025202; Tue, 2 May 2017 19:30:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705021930.v42JUgsT025202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 2 May 2017 19:30: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: r317699 - 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: Tue, 02 May 2017 19:30:43 -0000 Author: mav Date: Tue May 2 19:30:42 2017 New Revision: 317699 URL: https://svnweb.freebsd.org/changeset/base/317699 Log: MFC r317279: Remove unneeded conditions. Modified: stable/11/sys/net/if_lagg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_lagg.c ============================================================================== --- stable/11/sys/net/if_lagg.c Tue May 2 19:30:05 2017 (r317698) +++ stable/11/sys/net/if_lagg.c Tue May 2 19:30:42 2017 (r317699) @@ -433,10 +433,8 @@ lagg_register_vlan(void *arg, struct ifn return; LAGG_RLOCK(sc, &tracker); - if (!SLIST_EMPTY(&sc->sc_ports)) { - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) - EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag); - } + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag); LAGG_RUNLOCK(sc, &tracker); } @@ -455,10 +453,8 @@ lagg_unregister_vlan(void *arg, struct i return; LAGG_RLOCK(sc, &tracker); - if (!SLIST_EMPTY(&sc->sc_ports)) { - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) - EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag); - } + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag); LAGG_RUNLOCK(sc, &tracker); } From owner-svn-src-stable@freebsd.org Tue May 2 22:57:28 2017 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 ACDB8D5B740; Tue, 2 May 2017 22:57:28 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89A0787C; Tue, 2 May 2017 22:57:28 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42MvRS8014212; Tue, 2 May 2017 22:57:27 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42MvRvo014209; Tue, 2 May 2017 22:57:27 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201705022257.v42MvRvo014209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 2 May 2017 22:57:27 +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: r317711 - stable/10/sys/dev/ixgbe 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, 02 May 2017 22:57:28 -0000 Author: erj Date: Tue May 2 22:57:27 2017 New Revision: 317711 URL: https://svnweb.freebsd.org/changeset/base/317711 Log: ixgbe(4): Fix build issue when compiling with netmap enabled Sponsored by: Intel Corporation Modified: stable/10/sys/dev/ixgbe/if_ixv.c stable/10/sys/dev/ixgbe/ixv_netmap.c stable/10/sys/dev/ixgbe/ixv_netmap.h Modified: stable/10/sys/dev/ixgbe/if_ixv.c ============================================================================== --- stable/10/sys/dev/ixgbe/if_ixv.c Tue May 2 22:14:55 2017 (r317710) +++ stable/10/sys/dev/ixgbe/if_ixv.c Tue May 2 22:57:27 2017 (r317711) @@ -484,7 +484,7 @@ ixv_attach(device_t dev) ixv_add_stats_sysctls(adapter); if (adapter->feat_en & IXGBE_FEATURE_NETMAP) - ixgbe_netmap_attach(adapter); + ixv_netmap_attach(adapter); INIT_DEBUGOUT("ixv_attach: end"); Modified: stable/10/sys/dev/ixgbe/ixv_netmap.c ============================================================================== --- stable/10/sys/dev/ixgbe/ixv_netmap.c Tue May 2 22:14:55 2017 (r317710) +++ stable/10/sys/dev/ixgbe/ixv_netmap.c Tue May 2 22:57:27 2017 (r317711) @@ -83,23 +83,23 @@ /* * device-specific sysctl variables: * - * ix_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. + * ixv_crcstrip: 0: keep CRC in rx frames (default), 1: strip it. * During regular operations the CRC is stripped, but on some * hardware reception of frames not multiple of 64 is slower, * so using crcstrip=0 helps in benchmarks. * - * ix_rx_miss, ix_rx_miss_bufs: + * ixv_rx_miss, ixv_rx_miss_bufs: * count packets that might be missed due to lost interrupts. */ SYSCTL_DECL(_dev_netmap); -static int ix_rx_miss, ix_rx_miss_bufs; -int ix_crcstrip; -SYSCTL_INT(_dev_netmap, OID_AUTO, ix_crcstrip, - CTLFLAG_RW, &ix_crcstrip, 0, "strip CRC on rx frames"); -SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss, - CTLFLAG_RW, &ix_rx_miss, 0, "potentially missed rx intr"); -SYSCTL_INT(_dev_netmap, OID_AUTO, ix_rx_miss_bufs, - CTLFLAG_RW, &ix_rx_miss_bufs, 0, "potentially missed rx intr bufs"); +static int ixv_rx_miss, ixv_rx_miss_bufs; +int ixv_crcstrip; +SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_crcstrip, + CTLFLAG_RW, &ixv_crcstrip, 0, "strip CRC on rx frames"); +SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss, + CTLFLAG_RW, &ixv_rx_miss, 0, "potentially missed rx intr"); +SYSCTL_INT(_dev_netmap, OID_AUTO, ixv_rx_miss_bufs, + CTLFLAG_RW, &ixv_rx_miss_bufs, 0, "potentially missed rx intr bufs"); static void @@ -123,7 +123,7 @@ set_crcstrip(struct ixgbe_hw *hw, int on /* hw requirements ... */ rxc &= ~IXGBE_RDRXCTL_RSCFRSTSIZE; rxc |= IXGBE_RDRXCTL_RSCACKC; - if (onoff && !ix_crcstrip) { + if (onoff && !ixv_crcstrip) { /* keep the crc. Fast rx */ hl &= ~IXGBE_HLREG0_RXCRCSTRP; rxc &= ~IXGBE_RDRXCTL_CRCSTRIP; @@ -145,7 +145,7 @@ set_crcstrip(struct ixgbe_hw *hw, int on * Only called on the first register or the last unregister. */ static int -ixgbe_netmap_reg(struct netmap_adapter *na, int onoff) +ixv_netmap_reg(struct netmap_adapter *na, int onoff) { struct ifnet *ifp = na->ifp; struct adapter *adapter = ifp->if_softc; @@ -182,7 +182,7 @@ ixgbe_netmap_reg(struct netmap_adapter * * methods should be handled by the individual drivers. */ static int -ixgbe_netmap_txsync(struct netmap_kring *kring, int flags) +ixv_netmap_txsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; struct ifnet *ifp = na->ifp; @@ -368,7 +368,7 @@ ixgbe_netmap_txsync(struct netmap_kring * of whether or not we received an interrupt. */ static int -ixgbe_netmap_rxsync(struct netmap_kring *kring, int flags) +ixv_netmap_rxsync(struct netmap_kring *kring, int flags) { struct netmap_adapter *na = kring->na; struct ifnet *ifp = na->ifp; @@ -407,7 +407,7 @@ ixgbe_netmap_rxsync(struct netmap_kring * rxr->next_to_check is set to 0 on a ring reinit */ if (netmap_no_pendintr || force_update) { - int crclen = (ix_crcstrip) ? 0 : 4; + int crclen = (ixv_crcstrip) ? 0 : 4; uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail) @@ -429,8 +429,8 @@ ixgbe_netmap_rxsync(struct netmap_kring if (n) { /* update the state variables */ if (netmap_no_pendintr && !force_update) { /* diagnostics */ - ix_rx_miss ++; - ix_rx_miss_bufs += n; + ixv_rx_miss ++; + ixv_rx_miss_bufs += n; } rxr->next_to_check = nic_i; kring->nr_hwtail = nm_i; @@ -499,7 +499,7 @@ ring_reset: * operate in standard mode. */ void -ixgbe_netmap_attach(struct adapter *adapter) +ixv_netmap_attach(struct adapter *adapter) { struct netmap_adapter na; @@ -509,9 +509,9 @@ ixgbe_netmap_attach(struct adapter *adap na.na_flags = NAF_BDG_MAYSLEEP; na.num_tx_desc = adapter->num_tx_desc; na.num_rx_desc = adapter->num_rx_desc; - na.nm_txsync = ixgbe_netmap_txsync; - na.nm_rxsync = ixgbe_netmap_rxsync; - na.nm_register = ixgbe_netmap_reg; + na.nm_txsync = ixv_netmap_txsync; + na.nm_rxsync = ixv_netmap_rxsync; + na.nm_register = ixv_netmap_reg; na.num_tx_rings = na.num_rx_rings = adapter->num_queues; netmap_attach(&na); } Modified: stable/10/sys/dev/ixgbe/ixv_netmap.h ============================================================================== --- stable/10/sys/dev/ixgbe/ixv_netmap.h Tue May 2 22:14:55 2017 (r317710) +++ stable/10/sys/dev/ixgbe/ixv_netmap.h Tue May 2 22:57:27 2017 (r317711) @@ -33,8 +33,8 @@ /*$FreeBSD$*/ -#ifndef _IXGBE_NETMAP_H_ -#define _IXGBE_NETMAP_H_ +#ifndef _IXV_NETMAP_H_ +#define _IXV_NETMAP_H_ #ifdef DEV_NETMAP @@ -42,18 +42,18 @@ #include #include -extern int ix_crcstrip; +extern int ixv_crcstrip; /* * ixgbe_netmap.c contains functions for netmap * support that extend the standard driver. See additional * comments in ixgbe_netmap.c. */ -void ixgbe_netmap_attach(struct adapter *adapter); +void ixv_netmap_attach(struct adapter *adapter); #else -#define ixgbe_netmap_attach(a) +#define ixv_netmap_attach(a) #define netmap_detach(a) #endif /* DEV_NETMAP */ -#endif /* _IXGBE_NETMAP_H_ */ +#endif /* _IXV_NETMAP_H_ */ From owner-svn-src-stable@freebsd.org Tue May 2 22:58:42 2017 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 91410D5B7E5; Tue, 2 May 2017 22:58:42 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) (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 5C07A9F8; Tue, 2 May 2017 22:58:41 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-oi0-f43.google.com with SMTP id b204so3902195oii.1; Tue, 02 May 2017 15:58:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eWrtCfgh66ncfUnX7bKFXXfmcysliwDHXMRh3/wAjQE=; b=ZgsVP11k1v97sTbEJW/yjI0U01EtH4clEmaIsQLZ0v687llkQhvmkAiGtaobcJPPfh PXfjV+ckLasFDYeh7FMbujH4o7VSjFTFfDaNvUzf/TkF7pO3bPkK2csw8fIYrgb4MnuI SIWeFKMUdzlErvq5OmdCQsMHH36tXXeTOMnR9RBJjR1dRMLP6+7NMJNLhGFEt04uNvVo lIGfqFGZRZYvJm67r+aMk/xASIHxzjxtS23ueUnQ4M4Rjab1VxUuMjGV2AnMWIFzc+v7 6urkyEnXq+XOjSlH6+bqpCHOrdUFL3f+7iMdbkeZwfBqtLT6x/Ftxbn3QXiW0HWGfAgd mseg== X-Gm-Message-State: AN3rC/4aopk2bNhoATSphgqB05nKXoiqn8DJ3yn0PrgaLSy04RGfd1ay Y2vRYGPTbUGEE44RTPs= X-Received: by 10.157.35.69 with SMTP id k5mr12164467otd.49.1493765915627; Tue, 02 May 2017 15:58:35 -0700 (PDT) Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com. [209.85.218.52]) by smtp.gmail.com with ESMTPSA id c126sm8919470oia.5.2017.05.02.15.58.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 15:58:35 -0700 (PDT) Received: by mail-oi0-f52.google.com with SMTP id w10so15892252oif.0; Tue, 02 May 2017 15:58:34 -0700 (PDT) X-Received: by 10.157.24.86 with SMTP id t22mr6859692ott.145.1493765914832; Tue, 02 May 2017 15:58:34 -0700 (PDT) MIME-Version: 1.0 References: <201703152120.v2FLKHUs052999@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Tue, 02 May 2017 22:58:24 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv To: Ngie Cooper , Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@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: Tue, 02 May 2017 22:58:42 -0000 I fixed the netmap build for amd64 at least with r317711. I'm running a tinderbox build on it now, though, so I'll see if that fixes it. On Fri, Apr 28, 2017 at 1:40 PM Eric Joyner wrote: > I notified Jeb (the original patch submitter) about that netmap symbol > issue, but we've both been distracted with other development. I'll work on > updating it. > > - Eric > > On Thu, Apr 27, 2017 at 3:06 PM Ngie Cooper wrote: > >> On Thu, Apr 27, 2017 at 1:07 PM, Ed Maste wrote: >> > On 15 March 2017 at 17:20, Eric Joyner wrote: >> >> Author: erj >> >> Date: Wed Mar 15 21:20:17 2017 >> >> New Revision: 315333 >> >> URL: https://svnweb.freebsd.org/changeset/base/315333 >> >> >> >> Log: >> >> ixgbe(4): Update to 3.2.11-k >> > >> > This broke tinderbox on many architectures: >> > >> > ia64 GENERIC and powerpc GENERIC64: >> > >> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no >> > previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes] >> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no >> > previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes] >> > >> > sparc64 LINT: >> > >> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning: >> > redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls] >> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning: >> > previous declaration of 'ix_crcstrip' was here >> > >> > amd64 LINT: >> > >> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0): >> > multiple definition of `ixgbe_netmap_attach' >> > >> ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0): >> > first defined here >> >> Hi Ed, >> >> It has to do with netmap(4) refactoring on head not being backported, >> in combination with ixgbe/ix being MFCed in a refactored state back to >> ^/stable/10 (it wasn't easy to backport due to PCI-IOV only being on >> ^/stable/10 -- I tried starting this work and failed because I lacked >> the hardware to test this out with). >> >> This has been known to be broken for almost two months -- a surgical >> fix should probably be applied to do what's required to make the >> symbol appear in the appropriate places, since this basically was a >> direct commit to ^/stable/10 in some regards. >> >> Thanks, >> -Ngie >> > From owner-svn-src-stable@freebsd.org Wed May 3 01:06:57 2017 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 7D418D5AA45; Wed, 3 May 2017 01:06:57 +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 552C9319; Wed, 3 May 2017 01:06:57 +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 v4316urc067493; Wed, 3 May 2017 01:06:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4316u18067492; Wed, 3 May 2017 01:06:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030106.v4316u18067492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 01:06: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: r317714 - 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: Wed, 03 May 2017 01:06:57 -0000 Author: emaste Date: Wed May 3 01:06:56 2017 New Revision: 317714 URL: https://svnweb.freebsd.org/changeset/base/317714 Log: MFC r317141: readelf: dump MIPS abiflags section This is not fully fleshed out but is sufficient to dump the SHT_MIPS_ABIFLAGS used in FreeBSD. Sponsored by: The FreeBSD Foundation 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 Tue May 2 23:31:39 2017 (r317713) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Wed May 3 01:06:56 2017 (r317714) @@ -296,6 +296,7 @@ static void dump_elf(struct readelf *re) static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab); static void dump_dynamic(struct readelf *re); static void dump_liblist(struct readelf *re); +static void dump_mips_abiflags(struct readelf *re, struct section *s); static void dump_mips_attributes(struct readelf *re, uint8_t *p, uint8_t *pe); static void dump_mips_odk_reginfo(struct readelf *re, uint8_t *p, size_t sz); static void dump_mips_options(struct readelf *re, struct section *s); @@ -325,6 +326,7 @@ static const char *dwarf_regname(struct static struct dumpop *find_dumpop(struct readelf *re, size_t si, const char *sn, int op, int t); static int get_ent_count(struct section *s, int *ent_count); +static int get_mips_register_size(uint8_t flag); static char *get_regoff_str(struct readelf *re, Dwarf_Half reg, Dwarf_Addr off); static const char *get_string(struct readelf *re, int strtab, size_t off); @@ -4105,6 +4107,10 @@ dump_mips_specific_info(struct readelf * } } + if (s->name != NULL && (!strcmp(s->name, ".MIPS.abiflags") || + (s->type == SHT_MIPS_ABIFLAGS))) + dump_mips_abiflags(re, s); + /* * Dump .reginfo if present (although it will be ignored by an OS if a * .MIPS.options section is present, according to SGI mips64 spec). @@ -4118,6 +4124,82 @@ dump_mips_specific_info(struct readelf * } static void +dump_mips_abiflags(struct readelf *re, struct section *s) +{ + Elf_Data *d; + uint8_t *p; + int elferr; + uint32_t isa_ext, ases, flags1, flags2; + uint16_t version; + uint8_t isa_level, isa_rev, gpr_size, cpr1_size, cpr2_size, fp_abi; + + if ((d = elf_rawdata(s->scn, NULL)) == NULL) { + elferr = elf_errno(); + if (elferr != 0) + warnx("elf_rawdata failed: %s", + elf_errmsg(elferr)); + return; + } + if (d->d_size != 24) { + warnx("invalid MIPS abiflags section size"); + return; + } + + p = d->d_buf; + version = re->dw_decode(&p, 2); + printf("MIPS ABI Flags Version: %u", version); + if (version != 0) { + printf(" (unknown)\n\n"); + return; + } + printf("\n\n"); + + isa_level = re->dw_decode(&p, 1); + isa_rev = re->dw_decode(&p, 1); + gpr_size = re->dw_decode(&p, 1); + cpr1_size = re->dw_decode(&p, 1); + cpr2_size = re->dw_decode(&p, 1); + fp_abi = re->dw_decode(&p, 1); + isa_ext = re->dw_decode(&p, 4); + ases = re->dw_decode(&p, 4); + flags1 = re->dw_decode(&p, 4); + flags2 = re->dw_decode(&p, 4); + + printf("ISA: "); + if (isa_rev <= 1) + printf("MIPS%u\n", isa_level); + else + printf("MIPS%ur%u\n", isa_level, isa_rev); + printf("GPR size: %d\n", get_mips_register_size(gpr_size)); + printf("CPR1 size: %d\n", get_mips_register_size(cpr1_size)); + printf("CPR2 size: %d\n", get_mips_register_size(cpr2_size)); + printf("FP ABI: "); + switch (fp_abi) { + case 3: + printf("Soft float"); + break; + default: + printf("%u", fp_abi); + break; + } + printf("\nISA Extension: %u\n", isa_ext); + printf("ASEs: %u\n", ases); + printf("FLAGS 1: %08x\n", flags1); + printf("FLAGS 2: %08x\n", flags2); +} + +static int +get_mips_register_size(uint8_t flag) +{ + switch (flag) { + case 0: return 0; + case 1: return 32; + case 2: return 64; + case 3: return 128; + default: return -1; + } +} +static void dump_mips_reginfo(struct readelf *re, struct section *s) { Elf_Data *d; From owner-svn-src-stable@freebsd.org Wed May 3 01:57:08 2017 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 1FC44D5BB07; Wed, 3 May 2017 01:57:08 +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 EE50812EE; Wed, 3 May 2017 01:57:07 +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 v431v6jJ088487; Wed, 3 May 2017 01:57:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v431v6qs088483; Wed, 3 May 2017 01:57:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030157.v431v6qs088483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 01:57: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: r317716 - stable/11/contrib/elftoolchain/libelf 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, 03 May 2017 01:57:08 -0000 Author: emaste Date: Wed May 3 01:57:06 2017 New Revision: 317716 URL: https://svnweb.freebsd.org/changeset/base/317716 Log: MFC libelf: Fix extended numbering r310136 (cem): libelf: Fix extended numbering detection Extended numbering is used for any of these fields overflowing. r310137 (cem): gelf_getphdr: Allow extended indices Needed for 'readelf -l' of extended phnum files. (Parity with GNU binutils.) Modified: stable/11/contrib/elftoolchain/libelf/gelf_phdr.c stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelf/gelf_phdr.c ============================================================================== --- stable/11/contrib/elftoolchain/libelf/gelf_phdr.c Wed May 3 01:46:39 2017 (r317715) +++ stable/11/contrib/elftoolchain/libelf/gelf_phdr.c Wed May 3 01:57:06 2017 (r317716) @@ -53,10 +53,17 @@ gelf_getphdr(Elf *e, int index, GElf_Phd Elf64_Ehdr *eh64; Elf32_Phdr *ep32; Elf64_Phdr *ep64; + size_t phnum; if (d == NULL || e == NULL || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) || - (e->e_kind != ELF_K_ELF) || index < 0) { + (e->e_kind != ELF_K_ELF) || index < 0 || + elf_getphdrnum(e, &phnum) < 0) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return (NULL); + } + + if ((size_t)index >= phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } @@ -66,11 +73,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phd ((ep32 = _libelf_getphdr(e, ELFCLASS32)) == NULL)) return (NULL); - if (index >= eh32->e_phnum) { - LIBELF_SET_ERROR(ARGUMENT, 0); - return (NULL); - } - ep32 += index; d->p_type = ep32->p_type; @@ -87,11 +89,6 @@ gelf_getphdr(Elf *e, int index, GElf_Phd (ep64 = _libelf_getphdr(e, ELFCLASS64)) == NULL) return (NULL); - if (index >= eh64->e_phnum) { - LIBELF_SET_ERROR(ARGUMENT, 0); - return (NULL); - } - ep64 += index; *d = *ep64; @@ -125,13 +122,15 @@ gelf_newphdr(Elf *e, size_t count) int gelf_update_phdr(Elf *e, int ndx, GElf_Phdr *s) { - int ec, phnum; + int ec; + size_t phnum; void *ehdr; Elf32_Phdr *ph32; Elf64_Phdr *ph64; if (s == NULL || e == NULL || e->e_kind != ELF_K_ELF || - ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { + ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) || + elf_getphdrnum(e, &phnum) < 0) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } @@ -144,12 +143,7 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); - if (ec == ELFCLASS32) - phnum = ((Elf32_Ehdr *) ehdr)->e_phnum; - else - phnum = ((Elf64_Ehdr *) ehdr)->e_phnum; - - if (ndx < 0 || ndx > phnum) { + if (ndx < 0 || (size_t)ndx > phnum) { LIBELF_SET_ERROR(ARGUMENT, 0); return (0); } Modified: stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c ============================================================================== --- stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c Wed May 3 01:46:39 2017 (r317715) +++ stable/11/contrib/elftoolchain/libelf/libelf_ehdr.c Wed May 3 01:57:06 2017 (r317716) @@ -170,10 +170,6 @@ _libelf_ehdr(Elf *e, int ec, int allocat (*xlator)((unsigned char*) ehdr, msz, e->e_rawfile, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); - /* - * If extended numbering is being used, read the correct - * number of sections and program header entries. - */ if (ec == ELFCLASS32) { phnum = ((Elf32_Ehdr *) ehdr)->e_phnum; shnum = ((Elf32_Ehdr *) ehdr)->e_shnum; @@ -193,12 +189,19 @@ _libelf_ehdr(Elf *e, int ec, int allocat return (NULL); } - if (shnum != 0 || shoff == 0LL) { /* not using extended numbering */ + /* + * If extended numbering is being used, read the correct + * number of sections and program header entries. + */ + if ((shnum == 0 && shoff != 0) || phnum == PN_XNUM || strndx == SHN_XINDEX) { + if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0) + return (NULL); + } else { + /* not using extended numbering */ e->e_u.e_elf.e_nphdr = phnum; e->e_u.e_elf.e_nscn = shnum; e->e_u.e_elf.e_strndx = strndx; - } else if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0) - return (NULL); + } return (ehdr); } From owner-svn-src-stable@freebsd.org Wed May 3 02:04:39 2017 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 AB88FD5BD72; Wed, 3 May 2017 02:04:39 +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 7AF1F17EA; Wed, 3 May 2017 02:04:39 +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 v4324cbS092439; Wed, 3 May 2017 02:04:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4324cqY092438; Wed, 3 May 2017 02:04:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030204.v4324cqY092438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02:04:38 +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: r317717 - stable/11/contrib/elftoolchain/strings 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, 03 May 2017 02:04:39 -0000 Author: emaste Date: Wed May 3 02:04:38 2017 New Revision: 317717 URL: https://svnweb.freebsd.org/changeset/base/317717 Log: MFC r312779: strings: avoid unnecessary trip through handle_file for stdin Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/elftoolchain/strings/strings.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/strings/strings.c ============================================================================== --- stable/11/contrib/elftoolchain/strings/strings.c Wed May 3 01:57:06 2017 (r317716) +++ stable/11/contrib/elftoolchain/strings/strings.c Wed May 3 02:04:38 2017 (r317717) @@ -189,7 +189,7 @@ main(int argc, char **argv) if (!min_len) min_len = 4; if (!*argv) - rc = handle_file("{standard input}"); + rc = find_strings("{standard input}", 0, 0); else while (*argv) { if (handle_file(*argv) != 0) rc = 1; @@ -205,13 +205,9 @@ handle_file(const char *name) if (name == NULL) return (1); - if (strcmp("{standard input}", name) != 0) { - if (freopen(name, "rb", stdin) == NULL) { - warnx("'%s': %s", name, strerror(errno)); - return (1); - } - } else { - return (find_strings(name, (off_t)0, (off_t)0)); + if (freopen(name, "rb", stdin) == NULL) { + warnx("'%s': %s", name, strerror(errno)); + return (1); } fd = fileno(stdin); From owner-svn-src-stable@freebsd.org Wed May 3 02:12:47 2017 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 02C99D5BF9D; Wed, 3 May 2017 02:12:47 +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 C877B1CFC; Wed, 3 May 2017 02:12:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v432CjML096513; Wed, 3 May 2017 02:12:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432CjF8096512; Wed, 3 May 2017 02:12:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030212.v432CjF8096512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02:12: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: r317718 - 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: Wed, 03 May 2017 02:12:47 -0000 Author: emaste Date: Wed May 3 02:12:45 2017 New Revision: 317718 URL: https://svnweb.freebsd.org/changeset/base/317718 Log: MFC r309547 (cem): readelf: Add support for extended program header numbers Add support for extended program header numbers to elftoolchain 'readelf -h'. 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 Wed May 3 02:04:38 2017 (r317717) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Wed May 3 02:12:45 2017 (r317718) @@ -2115,7 +2115,7 @@ dwarf_reg(unsigned int mach, unsigned in static void dump_ehdr(struct readelf *re) { - size_t shnum, shstrndx; + size_t phnum, shnum, shstrndx; int i; printf("ELF Header:\n"); @@ -2177,7 +2177,13 @@ dump_ehdr(struct readelf *re) re->ehdr.e_phentsize); /* e_phnum. */ - printf("%-37s%u\n", " Number of program headers:", re->ehdr.e_phnum); + printf("%-37s%u", " Number of program headers:", re->ehdr.e_phnum); + if (re->ehdr.e_phnum == PN_XNUM) { + /* Extended program header numbering is in use. */ + if (elf_getphnum(re->elf, &phnum)) + printf(" (%zu)", phnum); + } + putchar('\n'); /* e_shentsize. */ printf("%-37s%u (bytes)\n", " Size of section headers:", From owner-svn-src-stable@freebsd.org Wed May 3 02:19:46 2017 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 C231ED5A074; Wed, 3 May 2017 02:19:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 906561F2B; Wed, 3 May 2017 02:19:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v432JjC8096806; Wed, 3 May 2017 02:19:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432Jj9G096805; Wed, 3 May 2017 02:19:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030219.v432Jj9G096805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02:19: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: r317719 - 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: Wed, 03 May 2017 02:19:46 -0000 Author: emaste Date: Wed May 3 02:19:45 2017 New Revision: 317719 URL: https://svnweb.freebsd.org/changeset/base/317719 Log: MFC r309679 (cem): readelf -S: Include zero index and match binutils' no-name Include the SHN_UNDEF (zero) index special section in extended-attribute ELF files, like GNU binutils' readelf. Additionally, print "" for sections without names, like GNU binutils. 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 Wed May 3 02:12:45 2017 (r317718) +++ stable/11/contrib/elftoolchain/readelf/readelf.c Wed May 3 02:19:45 2017 (r317719) @@ -6643,13 +6643,14 @@ load_sections(struct readelf *re) } if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) { (void) elf_errno(); - name = "ERROR"; + name = ""; } if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) { - if ((elferr = elf_errno()) != 0) + if ((elferr = elf_errno()) != 0) { warnx("elf_ndxscn failed: %s", elf_errmsg(elferr)); - continue; + continue; + } } if (ndx >= re->shnum) { warnx("section index of '%s' out of range", name); From owner-svn-src-stable@freebsd.org Wed May 3 02:25:12 2017 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 98A26D5A38A; Wed, 3 May 2017 02: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 4C0B4672; Wed, 3 May 2017 02: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 v432PBY5000868; Wed, 3 May 2017 02:25:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432PBVC000867; Wed, 3 May 2017 02:25:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030225.v432PBVC000867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02: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: r317720 - 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: Wed, 03 May 2017 02:25:12 -0000 Author: emaste Date: Wed May 3 02:25:11 2017 New Revision: 317720 URL: https://svnweb.freebsd.org/changeset/base/317720 Log: MFC r307808: elfcopy: select mode by the end of the program name The mode of operation (elfcopy, mcs, or strip) is chosen based on the program name. Broaden this to allow a substring match at the end of the name to allow prefixes - for example, bsdstrip or aarch64-freebsd-strip. This improves use of these tools as drop-in replacements for GNU objcopy and strip, which are often built with a limited set of supported targets and installed with a target prefix for cross tools. Modified: stable/11/contrib/elftoolchain/elfcopy/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/main.c Wed May 3 02:19:45 2017 (r317719) +++ stable/11/contrib/elftoolchain/elfcopy/main.c Wed May 3 02:25:11 2017 (r317720) @@ -1536,6 +1536,22 @@ print_version(void) exit(EXIT_SUCCESS); } +/* + * Compare the ending of s with end. + */ +static int +strrcmp(const char *s, const char *end) +{ + size_t endlen, slen; + + slen = strlen(s); + endlen = strlen(end); + + if (slen >= endlen) + s += slen - endlen; + return (strcmp(s, end)); +} + int main(int argc, char **argv) { @@ -1569,12 +1585,16 @@ main(int argc, char **argv) if ((ecp->progname = ELFTC_GETPROGNAME()) == NULL) ecp->progname = "elfcopy"; - if (strcmp(ecp->progname, "strip") == 0) + if (strrcmp(ecp->progname, "strip") == 0) strip_main(ecp, argc, argv); - else if (strcmp(ecp->progname, "mcs") == 0) + else if (strrcmp(ecp->progname, "mcs") == 0) mcs_main(ecp, argc, argv); - else + else { + if (strrcmp(ecp->progname, "elfcopy") != 0 && + strrcmp(ecp->progname, "objcopy") != 0) + warnx("program mode not known, defaulting to elfcopy"); elfcopy_main(ecp, argc, argv); + } free_sec_add(ecp); free_sec_act(ecp); From owner-svn-src-stable@freebsd.org Wed May 3 02:30:59 2017 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 B648DD5A458; Wed, 3 May 2017 02:30:59 +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 85F19916; Wed, 3 May 2017 02:30:59 +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 v432Uwn8001138; Wed, 3 May 2017 02:30:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432UwSb001137; Wed, 3 May 2017 02:30:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030230.v432UwSb001137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02:30: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: r317721 - 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: Wed, 03 May 2017 02:30:59 -0000 Author: emaste Date: Wed May 3 02:30:58 2017 New Revision: 317721 URL: https://svnweb.freebsd.org/changeset/base/317721 Log: MFC r313411 (jhibbits): Add elf*-powerpc-freebsd targets to the elftoolchain target list FreeBSD uses the full target triple when generating embedded rootfs images (MFS_IMAGE= make option). Without this change objcopy errors out with: objcopy: elf64-poewrpc-freebsd: invalid target name Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c ============================================================================== --- stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed May 3 02:25:11 2017 (r317720) +++ stable/11/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Wed May 3 02:30:58 2017 (r317721) @@ -127,6 +127,15 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf32-powerpc-freebsd", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS32, + .bt_machine = EM_PPC, + .bt_osabi = ELFOSABI_FREEBSD, + }, + + { .bt_name = "elf32-powerpcle", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, @@ -290,6 +299,15 @@ struct _Elftc_Bfd_Target _libelftc_targe }, { + .bt_name = "elf64-powerpc-freebsd", + .bt_type = ETF_ELF, + .bt_byteorder = ELFDATA2MSB, + .bt_elfclass = ELFCLASS64, + .bt_machine = EM_PPC64, + .bt_osabi = ELFOSABI_FREEBSD, + }, + + { .bt_name = "elf64-powerpcle", .bt_type = ETF_ELF, .bt_byteorder = ELFDATA2LSB, From owner-svn-src-stable@freebsd.org Wed May 3 02:37:45 2017 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 8ADBFD5A6BD; Wed, 3 May 2017 02:37:45 +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 4EC2EF3; Wed, 3 May 2017 02:37:45 +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 v432biE2005137; Wed, 3 May 2017 02:37:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432bi7S005136; Wed, 3 May 2017 02:37:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705030237.v432bi7S005136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 02:37: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: r317722 - stable/11/contrib/elftoolchain/libelf 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, 03 May 2017 02:37:45 -0000 Author: emaste Date: Wed May 3 02:37:44 2017 New Revision: 317722 URL: https://svnweb.freebsd.org/changeset/base/317722 Log: MFC r316685: libelf: add an assert that msz is non-zero Reported by: Coverity CID: 976023 Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/elftoolchain/libelf/elf_update.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/libelf/elf_update.c ============================================================================== --- stable/11/contrib/elftoolchain/libelf/elf_update.c Wed May 3 02:30:58 2017 (r317721) +++ stable/11/contrib/elftoolchain/libelf/elf_update.c Wed May 3 02:37:44 2017 (r317722) @@ -808,6 +808,7 @@ _libelf_write_scn(Elf *e, unsigned char assert(d->d_buf != NULL); assert(d->d_version == e->e_version); + assert(msz != 0); assert(d->d_size % msz == 0); nobjects = (size_t) (d->d_size / msz); From owner-svn-src-stable@freebsd.org Wed May 3 09:25:28 2017 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 07D9DD596DB; Wed, 3 May 2017 09:25:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CDCFF38F; Wed, 3 May 2017 09:25:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v439PQtl072781; Wed, 3 May 2017 09:25:26 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v439PQlt072780; Wed, 3 May 2017 09:25:26 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201705030925.v439PQlt072780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 3 May 2017 09:25: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: r317733 - stable/11/sys/netipsec 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, 03 May 2017 09:25:28 -0000 Author: ae Date: Wed May 3 09:25:26 2017 New Revision: 317733 URL: https://svnweb.freebsd.org/changeset/base/317733 Log: MFC r317431: Fix SP refcount leak. PCB SP cache acquires extra reference, when SP is stored in the cache. Release this reference when PCB is destroyed in ipsec_delete_pcbpolicy(). In ipsec_copy_pcbpolicy() release reference to SP in case if sp_in or sp_out are not NULL. Reported by: Slawa Olhovchenkov Modified: stable/11/sys/netipsec/ipsec_pcb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netipsec/ipsec_pcb.c ============================================================================== --- stable/11/sys/netipsec/ipsec_pcb.c Wed May 3 09:23:13 2017 (r317732) +++ stable/11/sys/netipsec/ipsec_pcb.c Wed May 3 09:25:26 2017 (r317733) @@ -172,10 +172,10 @@ ipsec_delete_pcbpolicy(struct inpcb *inp if (inp->inp_sp == NULL) return (0); - if (inp->inp_sp->flags & INP_INBOUND_POLICY) + if (inp->inp_sp->sp_in != NULL) key_freesp(&inp->inp_sp->sp_in); - if (inp->inp_sp->flags & INP_OUTBOUND_POLICY) + if (inp->inp_sp->sp_out != NULL) key_freesp(&inp->inp_sp->sp_out); free(inp->inp_sp, M_IPSEC_INPCB); @@ -250,6 +250,8 @@ ipsec_copy_pcbpolicy(struct inpcb *old, if (sp == NULL) return (ENOBUFS); ipsec_setspidx_inpcb(new, &sp->spidx, IPSEC_DIR_INBOUND); + if (new->inp_sp->sp_in != NULL) + key_freesp(&new->inp_sp->sp_in); new->inp_sp->sp_in = sp; new->inp_sp->flags |= INP_INBOUND_POLICY; } @@ -258,6 +260,8 @@ ipsec_copy_pcbpolicy(struct inpcb *old, if (sp == NULL) return (ENOBUFS); ipsec_setspidx_inpcb(new, &sp->spidx, IPSEC_DIR_OUTBOUND); + if (new->inp_sp->sp_out != NULL) + key_freesp(&new->inp_sp->sp_out); new->inp_sp->sp_out = sp; new->inp_sp->flags |= INP_OUTBOUND_POLICY; } From owner-svn-src-stable@freebsd.org Wed May 3 09:52:12 2017 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 DB021D5B2C5; Wed, 3 May 2017 09:52:12 +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 A7A19662; Wed, 3 May 2017 09:52:12 +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 v439qBPD082255; Wed, 3 May 2017 09:52:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v439qBZR082254; Wed, 3 May 2017 09:52:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705030952.v439qBZR082254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 May 2017 09:52: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: r317734 - stable/11/lib/libc/gen 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, 03 May 2017 09:52:13 -0000 Author: kib Date: Wed May 3 09:52:11 2017 New Revision: 317734 URL: https://svnweb.freebsd.org/changeset/base/317734 Log: MFC r317436: getpagesize(3) cannot fail. Modified: stable/11/lib/libc/gen/getpagesize.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/getpagesize.c ============================================================================== --- stable/11/lib/libc/gen/getpagesize.c Wed May 3 09:25:26 2017 (r317733) +++ stable/11/lib/libc/gen/getpagesize.c Wed May 3 09:52:11 2017 (r317734) @@ -69,7 +69,7 @@ getpagesize(void) mib[1] = HW_PAGESIZE; size = sizeof value; if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1) - return (-1); + return (PAGE_SIZE); return (value); } From owner-svn-src-stable@freebsd.org Wed May 3 09:54:38 2017 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 7F8CAD5B363; Wed, 3 May 2017 09:54:38 +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 4C36D88C; Wed, 3 May 2017 09:54:38 +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 v439sbxm085151; Wed, 3 May 2017 09:54:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v439sb5D085150; Wed, 3 May 2017 09:54:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705030954.v439sb5D085150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 3 May 2017 09:54:37 +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: r317735 - stable/10/lib/libc/gen 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, 03 May 2017 09:54:38 -0000 Author: kib Date: Wed May 3 09:54:37 2017 New Revision: 317735 URL: https://svnweb.freebsd.org/changeset/base/317735 Log: MFC r317436: getpagesize(3) cannot fail. Modified: stable/10/lib/libc/gen/getpagesize.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/getpagesize.c ============================================================================== --- stable/10/lib/libc/gen/getpagesize.c Wed May 3 09:52:11 2017 (r317734) +++ stable/10/lib/libc/gen/getpagesize.c Wed May 3 09:54:37 2017 (r317735) @@ -69,7 +69,7 @@ getpagesize() mib[1] = HW_PAGESIZE; size = sizeof value; if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1) - return (-1); + return (PAGE_SIZE); return (value); } From owner-svn-src-stable@freebsd.org Wed May 3 17:12:55 2017 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 C051BD5CE78; Wed, 3 May 2017 17:12:55 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (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 930A9E74; Wed, 3 May 2017 17:12:55 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-io0-f178.google.com with SMTP id p24so12276642ioi.0; Wed, 03 May 2017 10:12:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EGquDYSRZV3OYwfeOTix+w7Dl12CHaDep/FE23O4LcU=; b=RoxNM01FXe4CIFJhX0yRdXPp/uBuCBAEVcv5JKvo6zzQgK+g/sTZh6cj75RjteXhPs sNcAbQ2a/5vMg7xFt5c2AVq0ZNdRI0tLsGgaNZJoVAec5RbdodENZSBRw1TYcvqd5zso AlEcI3Ax/MnTA4a/8YTKpezFAKT7fPurFIlLVgu52YrmaLiDSKeY1uNwkTswypBR16Oc mQG1/W6RS47zMl0z+XSPs98X3r/wclzjNN19J2SwSA5r+VkovCosORSR90GhSIcd3/Z1 J1BzYtVaYm3CVMqipbnVgWan/8K89W28tAhZdVVoLl2RiIYlKZMxSuNCgaQQ0ppUPfDe Wdvg== X-Gm-Message-State: AN3rC/46pU5O4GKXjRP5Ecu/6v8Qc1+cJYW6mWmEbzYtP+h9Q554qWTl bOP3yHoktedTbeJqLuOwLQ== X-Received: by 10.107.192.71 with SMTP id q68mr19264654iof.119.1493831569323; Wed, 03 May 2017 10:12:49 -0700 (PDT) Received: from mail-it0-f54.google.com (mail-it0-f54.google.com. [209.85.214.54]) by smtp.gmail.com with ESMTPSA id z85sm3104438ita.3.2017.05.03.10.12.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 10:12:49 -0700 (PDT) Received: by mail-it0-f54.google.com with SMTP id c15so74301706ith.0; Wed, 03 May 2017 10:12:48 -0700 (PDT) X-Received: by 10.202.220.213 with SMTP id t204mr12458633oig.193.1493831568395; Wed, 03 May 2017 10:12:48 -0700 (PDT) MIME-Version: 1.0 References: <201703152120.v2FLKHUs052999@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Wed, 03 May 2017 17:12:37 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv To: Ngie Cooper , Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@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: Wed, 03 May 2017 17:12:55 -0000 This fixes the amd64 LINT build error, but not the others. I'm looking at fixing the others now. On Tue, May 2, 2017 at 3:58 PM Eric Joyner wrote: > I fixed the netmap build for amd64 at least with r317711. I'm running a > tinderbox build on it now, though, so I'll see if that fixes it. > > On Fri, Apr 28, 2017 at 1:40 PM Eric Joyner wrote: > >> I notified Jeb (the original patch submitter) about that netmap symbol >> issue, but we've both been distracted with other development. I'll work on >> updating it. >> >> - Eric >> >> On Thu, Apr 27, 2017 at 3:06 PM Ngie Cooper >> wrote: >> >>> On Thu, Apr 27, 2017 at 1:07 PM, Ed Maste wrote: >>> > On 15 March 2017 at 17:20, Eric Joyner wrote: >>> >> Author: erj >>> >> Date: Wed Mar 15 21:20:17 2017 >>> >> New Revision: 315333 >>> >> URL: https://svnweb.freebsd.org/changeset/base/315333 >>> >> >>> >> Log: >>> >> ixgbe(4): Update to 3.2.11-k >>> > >>> > This broke tinderbox on many architectures: >>> > >>> > ia64 GENERIC and powerpc GENERIC64: >>> > >>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no >>> > previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes] >>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no >>> > previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes] >>> > >>> > sparc64 LINT: >>> > >>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning: >>> > redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls] >>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning: >>> > previous declaration of 'ix_crcstrip' was here >>> > >>> > amd64 LINT: >>> > >>> > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0): >>> > multiple definition of `ixgbe_netmap_attach' >>> > >>> ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0): >>> > first defined here >>> >>> Hi Ed, >>> >>> It has to do with netmap(4) refactoring on head not being backported, >>> in combination with ixgbe/ix being MFCed in a refactored state back to >>> ^/stable/10 (it wasn't easy to backport due to PCI-IOV only being on >>> ^/stable/10 -- I tried starting this work and failed because I lacked >>> the hardware to test this out with). >>> >>> This has been known to be broken for almost two months -- a surgical >>> fix should probably be applied to do what's required to make the >>> symbol appear in the appropriate places, since this basically was a >>> direct commit to ^/stable/10 in some regards. >>> >>> Thanks, >>> -Ngie >>> >> From owner-svn-src-stable@freebsd.org Wed May 3 23:41:11 2017 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 5154BD5C004; Wed, 3 May 2017 23:41:11 +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 08C5E9B3; Wed, 3 May 2017 23:41:10 +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 v43NfAfj032795; Wed, 3 May 2017 23:41:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43NfAwY032794; Wed, 3 May 2017 23:41:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705032341.v43NfAwY032794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 3 May 2017 23:41:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317780 - stable/11/sys/compat/linuxkpi/common/src 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, 03 May 2017 23:41:11 -0000 Author: markj Date: Wed May 3 23:41:09 2017 New Revision: 317780 URL: https://svnweb.freebsd.org/changeset/base/317780 Log: MFC r317148: Drop Giant before sleeping in linux_wait_for_{timeout_,}common(). Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 3 22:35:41 2017 (r317779) +++ stable/11/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 3 23:41:09 2017 (r317780) @@ -1096,28 +1096,38 @@ linux_complete_common(struct completion long linux_wait_for_common(struct completion *c, int flags) { + long error; + if (SCHEDULER_STOPPED()) return (0); + DROP_GIANT(); + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else flags = SLEEPQ_SLEEP; + error = 0; for (;;) { sleepq_lock(c); if (c->done) break; sleepq_add(c, NULL, "completion", flags, 0); if (flags & SLEEPQ_INTERRUPTIBLE) { - if (sleepq_wait_sig(c, 0) != 0) - return (-ERESTARTSYS); + if (sleepq_wait_sig(c, 0) != 0) { + error = -ERESTARTSYS; + goto intr; + } } else sleepq_wait(c, 0); } c->done--; sleepq_release(c); - return (0); +intr: + PICKUP_GIANT(); + + return (error); } /* @@ -1126,18 +1136,22 @@ linux_wait_for_common(struct completion long linux_wait_for_timeout_common(struct completion *c, long timeout, int flags) { - long end = jiffies + timeout; + long end = jiffies + timeout, error; + int ret; if (SCHEDULER_STOPPED()) return (0); + DROP_GIANT(); + if (flags != 0) flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; else flags = SLEEPQ_SLEEP; - for (;;) { - int ret; + error = 0; + ret = 0; + for (;;) { sleepq_lock(c); if (c->done) break; @@ -1150,16 +1164,20 @@ linux_wait_for_timeout_common(struct com if (ret != 0) { /* check for timeout or signal */ if (ret == EWOULDBLOCK) - return (0); + error = 0; else - return (-ERESTARTSYS); + error = -ERESTARTSYS; + goto intr; } } c->done--; sleepq_release(c); +intr: + PICKUP_GIANT(); + /* return how many jiffies are left */ - return (linux_timer_jiffies_until(end)); + return (ret != 0 ? error : linux_timer_jiffies_until(end)); } int From owner-svn-src-stable@freebsd.org Thu May 4 14:20:53 2017 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 CD6A4D5D1B4; Thu, 4 May 2017 14:20:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8F1C91987; Thu, 4 May 2017 14:20:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44EKqAX097331; Thu, 4 May 2017 14:20:52 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44EKqP9097329; Thu, 4 May 2017 14:20:52 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705041420.v44EKqP9097329@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 4 May 2017 14:20:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317792 - stable/11/sbin/camcontrol 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, 04 May 2017 14:20:53 -0000 Author: ken Date: Thu May 4 14:20:52 2017 New Revision: 317792 URL: https://svnweb.freebsd.org/changeset/base/317792 Log: MFC r317657: Fix camcontrol timestamp setting and update the man page. camcontrol timestamp -s would somtimes fail due to stack garbage. Zero out the timestamp parameters to fix it. Fix another nearby bug, and update the man page. sbin/camcontrol/timestamp.c: In set_timestamp(), bzero ts_p prior to creating the timestamp. Previously stack garbage could cause some tape drives to reject the timestamp. In set_timestamp(), check for failures from strptime(). sbin/camcontrol/camcontrol.8: Add the time argument to the -T option to camcontrol timestamp -s in the long description. Change the time/date format used in the camcontrol timestamp example to RFC 2822 format. This fixes a time zone issue with the original example by specifying the time zone as -0600. Otherwise, the time zone seems to default to standard time in the current locale, which makes the time, when reported back from the drive, 1 hour off from the intended setting. This also fixes a duplicate day of the week ("Wednesday Wed") in the previous example. Submitted by: Sam Klopsch Sponsored by: Spectra Logic Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/timestamp.c Modified: stable/11/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.8 Thu May 4 12:18:58 2017 (r317791) +++ stable/11/sbin/camcontrol/camcontrol.8 Thu May 4 14:20:52 2017 (r317792) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 17, 2017 +.Dd May 1, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -2488,7 +2488,7 @@ Specify the strptime format string, as d The time must also be specified with the .Fl T option. -.It Fl T +.It Fl T Ar time Provide the time in the format specified with the .Fl f option. @@ -2814,8 +2814,8 @@ drive .Pa ada0 . .Pp .Bd -literal -offset indent -camcontrol timestamp sa0 -s -f "%A %c" \e - -T "Wednesday Wed Oct 26 21:43:57 2016" +camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e + -T "Wed, 26 Oct 2016 21:43:57 -0600" .Ed .Pp Set the timestamp of drive Modified: stable/11/sbin/camcontrol/timestamp.c ============================================================================== --- stable/11/sbin/camcontrol/timestamp.c Thu May 4 12:18:58 2017 (r317791) +++ stable/11/sbin/camcontrol/timestamp.c Thu May 4 14:20:52 2017 (r317792) @@ -282,12 +282,18 @@ set_timestamp(struct cam_device *device, ts = (uint64_t) time_value; } else { bzero(&time_struct, sizeof(struct tm)); - strptime(timestamp_string, format_string, &time_struct); + if (strptime(timestamp_string, format_string, + &time_struct) == NULL) { + warnx("%s: strptime(3) failed", __func__); + error = 1; + goto bailout; + } time_value = mktime(&time_struct); ts = (uint64_t) time_value; } /* Convert time from seconds to milliseconds */ ts *= 1000; + bzero(&ts_p, sizeof(ts_p)); scsi_create_timestamp(ts_p.timestamp, ts); scsi_set_timestamp(&ccb->csio, From owner-svn-src-stable@freebsd.org Thu May 4 14:48:59 2017 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 093B1D5DACA; Thu, 4 May 2017 14:48:59 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B3350CC7; Thu, 4 May 2017 14:48:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44EmvRs007405; Thu, 4 May 2017 14:48:57 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44EmvfF007403; Thu, 4 May 2017 14:48:57 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705041448.v44EmvfF007403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 May 2017 14:48: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: r317793 - in stable/11: sys/dev/sound/pcm usr.bin/unexpand 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, 04 May 2017 14:48:59 -0000 Author: pfg Date: Thu May 4 14:48:57 2017 New Revision: 317793 URL: https://svnweb.freebsd.org/changeset/base/317793 Log: MFC r317583: Fix some cases where an index was used before its limits check. Obtained from: DragonFlyBSD (git 799ba435) Modified: stable/11/sys/dev/sound/pcm/feeder_matrix.c stable/11/usr.bin/unexpand/unexpand.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pcm/feeder_matrix.c ============================================================================== --- stable/11/sys/dev/sound/pcm/feeder_matrix.c Thu May 4 14:20:52 2017 (r317792) +++ stable/11/sys/dev/sound/pcm/feeder_matrix.c Thu May 4 14:48:57 2017 (r317793) @@ -750,8 +750,8 @@ feeder_matrix_oss_get_channel_order(stru tmpmap = 0x0000000000000000ULL; - for (i = 0; m->map[i].type != SND_CHN_T_MAX && - i < SND_CHN_OSS_MAX; i++) { + for (i = 0; i < SND_CHN_OSS_MAX && m->map[i].type != SND_CHN_T_MAX; + i++) { if ((1 << m->map[i].type) & ~SND_CHN_OSS_VALIDMASK) return (EINVAL); tmpmap |= Modified: stable/11/usr.bin/unexpand/unexpand.c ============================================================================== --- stable/11/usr.bin/unexpand/unexpand.c Thu May 4 14:20:52 2017 (r317792) +++ stable/11/usr.bin/unexpand/unexpand.c Thu May 4 14:48:57 2017 (r317793) @@ -132,8 +132,8 @@ tabify(const char *curfile) tabstops[0]; continue; } else { - for (n = 0; tabstops[n] - 1 < dcol && - n < nstops; n++) + for (n = 0; n < nstops && + tabstops[n] - 1 < dcol; n++) ; if (n < nstops - 1 && tabstops[n] - 1 < limit) { dcol = tabstops[n]; @@ -154,7 +154,7 @@ tabify(const char *curfile) tabstops[0]; } } else { - for (n = 0; tabstops[n] - 1 < ocol && n < nstops; n++) + for (n = 0; n < nstops && tabstops[n] - 1 < ocol; n++) ; while (ocol < dcol && n < nstops && ocol < limit) { putwchar('\t'); From owner-svn-src-stable@freebsd.org Thu May 4 14:50:27 2017 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 267D9D5DBA3; Thu, 4 May 2017 14:50:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 CCF30E34; Thu, 4 May 2017 14:50:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44EoPBx007523; Thu, 4 May 2017 14:50:25 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44EoPKi007521; Thu, 4 May 2017 14:50:25 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705041450.v44EoPKi007521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 May 2017 14:50: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: r317794 - in stable/10: sys/dev/sound/pcm usr.bin/unexpand 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, 04 May 2017 14:50:27 -0000 Author: pfg Date: Thu May 4 14:50:25 2017 New Revision: 317794 URL: https://svnweb.freebsd.org/changeset/base/317794 Log: MFC r317583: Fix some cases where an index was used before its limits check. Obtained from: DragonFlyBSD (git 799ba435) Modified: stable/10/sys/dev/sound/pcm/feeder_matrix.c stable/10/usr.bin/unexpand/unexpand.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sound/pcm/feeder_matrix.c ============================================================================== --- stable/10/sys/dev/sound/pcm/feeder_matrix.c Thu May 4 14:48:57 2017 (r317793) +++ stable/10/sys/dev/sound/pcm/feeder_matrix.c Thu May 4 14:50:25 2017 (r317794) @@ -750,8 +750,8 @@ feeder_matrix_oss_get_channel_order(stru tmpmap = 0x0000000000000000ULL; - for (i = 0; m->map[i].type != SND_CHN_T_MAX && - i < SND_CHN_OSS_MAX; i++) { + for (i = 0; i < SND_CHN_OSS_MAX && m->map[i].type != SND_CHN_T_MAX; + i++) { if ((1 << m->map[i].type) & ~SND_CHN_OSS_VALIDMASK) return (EINVAL); tmpmap |= Modified: stable/10/usr.bin/unexpand/unexpand.c ============================================================================== --- stable/10/usr.bin/unexpand/unexpand.c Thu May 4 14:48:57 2017 (r317793) +++ stable/10/usr.bin/unexpand/unexpand.c Thu May 4 14:50:25 2017 (r317794) @@ -132,8 +132,8 @@ tabify(const char *curfile) tabstops[0]; continue; } else { - for (n = 0; tabstops[n] - 1 < dcol && - n < nstops; n++) + for (n = 0; n < nstops && + tabstops[n] - 1 < dcol; n++) ; if (n < nstops - 1 && tabstops[n] - 1 < limit) { dcol = tabstops[n]; @@ -154,7 +154,7 @@ tabify(const char *curfile) tabstops[0]; } } else { - for (n = 0; tabstops[n] - 1 < ocol && n < nstops; n++) + for (n = 0; n < nstops && tabstops[n] - 1 < ocol; n++) ; while (ocol < dcol && n < nstops && ocol < limit) { putwchar('\t'); From owner-svn-src-stable@freebsd.org Thu May 4 14:54:23 2017 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 D459FD5DED2; Thu, 4 May 2017 14:54:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A058013DD; Thu, 4 May 2017 14:54:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44EsMEk011326; Thu, 4 May 2017 14:54:22 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44EsMMi011325; Thu, 4 May 2017 14:54:22 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705041454.v44EsMMi011325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 May 2017 14:54: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: r317795 - stable/11/usr.sbin/mixer 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, 04 May 2017 14:54:24 -0000 Author: pfg Date: Thu May 4 14:54:22 2017 New Revision: 317795 URL: https://svnweb.freebsd.org/changeset/base/317795 Log: MFC r317596: mixer(8): Prevent possible sscanf() overflow. Fix %s buffer sizes in sscanf(). Obtained from: DragonflyBSD (git dab952e2) Modified: stable/11/usr.sbin/mixer/mixer.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/mixer/mixer.c ============================================================================== --- stable/11/usr.sbin/mixer/mixer.c Thu May 4 14:50:25 2017 (r317794) +++ stable/11/usr.sbin/mixer/mixer.c Thu May 4 14:54:22 2017 (r317795) @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) { char mixer[PATH_MAX] = "/dev/mixer"; - char lstr[5], rstr[5]; + char lstr[8], rstr[8]; char *name, *eptr; int devmask = 0, recmask = 0, recsrc = 0, orecsrc; int dusage = 0, drecsrc = 0, sflag = 0, Sflag = 0; From owner-svn-src-stable@freebsd.org Thu May 4 14:55:08 2017 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 976D2D5DF84; Thu, 4 May 2017 14:55:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6792016BD; Thu, 4 May 2017 14:55:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44Et79R011427; Thu, 4 May 2017 14:55:07 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44Et7nn011426; Thu, 4 May 2017 14:55:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705041455.v44Et7nn011426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 May 2017 14:55: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: r317796 - stable/10/usr.sbin/mixer 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, 04 May 2017 14:55:08 -0000 Author: pfg Date: Thu May 4 14:55:07 2017 New Revision: 317796 URL: https://svnweb.freebsd.org/changeset/base/317796 Log: MFC r317596: mixer(8): Prevent possible sscanf() overflow. Fix %s buffer sizes in sscanf(). Obtained from: DragonflyBSD (git dab952e2) Modified: stable/10/usr.sbin/mixer/mixer.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mixer/mixer.c ============================================================================== --- stable/10/usr.sbin/mixer/mixer.c Thu May 4 14:54:22 2017 (r317795) +++ stable/10/usr.sbin/mixer/mixer.c Thu May 4 14:55:07 2017 (r317796) @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) { char mixer[PATH_MAX] = "/dev/mixer"; - char lstr[5], rstr[5]; + char lstr[8], rstr[8]; char *name, *eptr; int devmask = 0, recmask = 0, recsrc = 0, orecsrc; int dusage = 0, drecsrc = 0, sflag = 0, Sflag = 0; From owner-svn-src-stable@freebsd.org Thu May 4 15:00:11 2017 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 342C9D5E187; Thu, 4 May 2017 15:00:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 EAB481BD0; Thu, 4 May 2017 15:00:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44F09mV011947; Thu, 4 May 2017 15:00:09 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44F09rC011945; Thu, 4 May 2017 15:00:09 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705041500.v44F09rC011945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 4 May 2017 15:00:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317797 - stable/11/lib/libthread_db 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, 04 May 2017 15:00:11 -0000 Author: pfg Date: Thu May 4 15:00:09 2017 New Revision: 317797 URL: https://svnweb.freebsd.org/changeset/base/317797 Log: MFC r317200, r317201, r317216: libthread_db: unsign map_len and use reallocarray(3). Lengths are not negative, so map_len should be unsigned. Unsign the corresponding indexes too and bring a small use of reallocarray(3). Reorder the memset to be consistent with the reallocarray. Modified: stable/11/lib/libthread_db/libpthread_db.c stable/11/lib/libthread_db/libpthread_db.h Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libthread_db/libpthread_db.c ============================================================================== --- stable/11/lib/libthread_db/libpthread_db.c Thu May 4 14:55:07 2017 (r317796) +++ stable/11/lib/libthread_db/libpthread_db.c Thu May 4 15:00:09 2017 (r317797) @@ -74,7 +74,8 @@ pt_map_thread(const td_thragent_t *const { td_thragent_t *ta = __DECONST(td_thragent_t *, const_ta); struct pt_map *new; - int i, first = -1; + int first = -1; + unsigned int i; /* leave zero out */ for (i = 1; i < ta->map_len; ++i) { @@ -94,12 +95,12 @@ pt_map_thread(const td_thragent_t *const ta->map_len = 20; first = 1; } else { - new = realloc(ta->map, - sizeof(struct pt_map) * ta->map_len * 2); + new = reallocarray(ta->map, ta->map_len, + 2 * sizeof(struct pt_map)); if (new == NULL) return (-1); - memset(new + ta->map_len, '\0', sizeof(struct pt_map) * - ta->map_len); + memset(new + ta->map_len, '\0', ta->map_len * + sizeof(struct pt_map)); first = ta->map_len; ta->map = new; ta->map_len *= 2; @@ -226,7 +227,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta TDBG_FUNC(); - if (id < 0 || id >= ta->map_len || ta->map[id].type == PT_NONE) + if (id < 0 || id >= (long)ta->map_len || ta->map[id].type == PT_NONE) return (TD_NOTHR); ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt); @@ -1047,7 +1048,7 @@ pt_thr_sstep(const td_thrhandle_t *th, i static void pt_unmap_lwp(const td_thragent_t *ta, lwpid_t lwp) { - int i; + unsigned int i; for (i = 0; i < ta->map_len; ++i) { if (ta->map[i].type == PT_LWP && ta->map[i].lwp == lwp) { @@ -1061,7 +1062,7 @@ static int pt_validate(const td_thrhandle_t *th) { - if (th->th_tid < 0 || th->th_tid >= th->th_ta->map_len || + if (th->th_tid < 0 || th->th_tid >= (long)th->th_ta->map_len || th->th_ta->map[th->th_tid].type == PT_NONE) return (TD_NOTHR); return (TD_OK); Modified: stable/11/lib/libthread_db/libpthread_db.h ============================================================================== --- stable/11/lib/libthread_db/libpthread_db.h Thu May 4 14:55:07 2017 (r317796) +++ stable/11/lib/libthread_db/libpthread_db.h Thu May 4 15:00:09 2017 (r317797) @@ -77,7 +77,7 @@ struct td_thragent { int thread_off_sigmask; int thread_off_sigpend; struct pt_map *map; - int map_len; + unsigned int map_len; }; void pt_md_init(void); From owner-svn-src-stable@freebsd.org Fri May 5 03:38:42 2017 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 A606ED5D1B8; Fri, 5 May 2017 03:38:42 +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 75FE81818; Fri, 5 May 2017 03:38:42 +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 v453cfIb028766; Fri, 5 May 2017 03:38:41 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v453cfbD028765; Fri, 5 May 2017 03:38:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705050338.v453cfbD028765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 5 May 2017 03:38:41 +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: r317822 - stable/11/sys/dev/hyperv/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: Fri, 05 May 2017 03:38:42 -0000 Author: sephe Date: Fri May 5 03:38:41 2017 New Revision: 317822 URL: https://svnweb.freebsd.org/changeset/base/317822 Log: MFC 317821 hyperv/kbd: Channel read expects non-NULL channel argument. Sponsored by: Microsoft Modified: stable/11/sys/dev/hyperv/input/hv_kbd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/input/hv_kbd.c ============================================================================== --- stable/11/sys/dev/hyperv/input/hv_kbd.c Fri May 5 03:28:30 2017 (r317821) +++ stable/11/sys/dev/hyperv/input/hv_kbd.c Fri May 5 03:38:41 2017 (r317822) @@ -198,7 +198,7 @@ static void hvkbd_do_poll(hv_kbd_sc *sc, uint8_t wait) { while (!hv_kbd_prod_is_ready(sc)) { - hv_kbd_read_channel(NULL, sc); + hv_kbd_read_channel(sc->hs_chan, sc); if (!wait) break; } From owner-svn-src-stable@freebsd.org Fri May 5 06:00:33 2017 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 C7E26D5D254; Fri, 5 May 2017 06:00:33 +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 9797AEA6; Fri, 5 May 2017 06:00:33 +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 v4560WYJ086031; Fri, 5 May 2017 06:00:32 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4560WWG086030; Fri, 5 May 2017 06:00:32 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705050600.v4560WWG086030@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 5 May 2017 06:00:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317823 - stable/10/sys/dev/hyperv/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: Fri, 05 May 2017 06:00:33 -0000 Author: sephe Date: Fri May 5 06:00:32 2017 New Revision: 317823 URL: https://svnweb.freebsd.org/changeset/base/317823 Log: MFC 317821 hyperv/kbd: Channel read expects non-NULL channel argument. Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/input/hv_kbd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/input/hv_kbd.c ============================================================================== --- stable/10/sys/dev/hyperv/input/hv_kbd.c Fri May 5 03:38:41 2017 (r317822) +++ stable/10/sys/dev/hyperv/input/hv_kbd.c Fri May 5 06:00:32 2017 (r317823) @@ -198,7 +198,7 @@ static void hvkbd_do_poll(hv_kbd_sc *sc, uint8_t wait) { while (!hv_kbd_prod_is_ready(sc)) { - hv_kbd_read_channel(NULL, sc); + hv_kbd_read_channel(sc->hs_chan, sc); if (!wait) break; } From owner-svn-src-stable@freebsd.org Fri May 5 13:21:13 2017 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 3B584D541FD; Fri, 5 May 2017 13:21:13 +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 F25DB1A0B; Fri, 5 May 2017 13:21:12 +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 v45DLB6r065415; Fri, 5 May 2017 13:21:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45DLBPF065414; Fri, 5 May 2017 13:21:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705051321.v45DLBPF065414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 5 May 2017 13:21: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: r317825 - stable/11/sys/dev/mlx5/mlx5_en 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, 05 May 2017 13:21:13 -0000 Author: hselasky Date: Fri May 5 13:21:11 2017 New Revision: 317825 URL: https://svnweb.freebsd.org/changeset/base/317825 Log: MFC r317568: Improve sysadmin visibility of physical port error counters in the mlx5en driver. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri May 5 10:01:27 2017 (r317824) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri May 5 13:21:11 2017 (r317825) @@ -541,19 +541,33 @@ mlx5e_update_stats_work(struct work_stru s->tx_csum_offload = s->tx_packets - tx_offload_none; s->rx_csum_good = s->rx_packets - s->rx_csum_none; - /* Update per port counters */ + /* Get physical port counters */ mlx5e_update_pport_counters(priv); #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; - ifp->if_ierrors = s->rx_error_packets; + ifp->if_ierrors = s->rx_error_packets + + priv->stats.pport.alignment_err + + priv->stats.pport.check_seq_err + + priv->stats.pport.crc_align_errors + + priv->stats.pport.drop_events + + priv->stats.pport.in_range_len_errors + + priv->stats.pport.jabbers + + priv->stats.pport.out_of_range_len + + priv->stats.pport.oversize_pkts + + priv->stats.pport.symbol_err + + priv->stats.pport.too_long_errors + + priv->stats.pport.undersize_pkts + + priv->stats.pport.unsupported_op_rx; ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; ifp->if_ibytes = s->rx_bytes; ifp->if_obytes = s->tx_bytes; + ifp->if_collisions = + priv->stats.pport.collisions; #endif free_out: @@ -2359,7 +2373,19 @@ mlx5e_get_counter(struct ifnet *ifp, ift retval = priv->stats.vport.rx_packets; break; case IFCOUNTER_IERRORS: - retval = priv->stats.vport.rx_error_packets; + retval = priv->stats.vport.rx_error_packets + + priv->stats.pport.alignment_err + + priv->stats.pport.check_seq_err + + priv->stats.pport.crc_align_errors + + priv->stats.pport.drop_events + + priv->stats.pport.in_range_len_errors + + priv->stats.pport.jabbers + + priv->stats.pport.out_of_range_len + + priv->stats.pport.oversize_pkts + + priv->stats.pport.symbol_err + + priv->stats.pport.too_long_errors + + priv->stats.pport.undersize_pkts + + priv->stats.pport.unsupported_op_rx; break; case IFCOUNTER_IQDROPS: retval = priv->stats.vport.rx_out_of_buffer; @@ -2385,6 +2411,9 @@ mlx5e_get_counter(struct ifnet *ifp, ift case IFCOUNTER_OQDROPS: retval = priv->stats.vport.tx_queue_dropped; break; + case IFCOUNTER_COLLISIONS: + retval = priv->stats.pport.collisions; + break; default: retval = if_get_counter_default(ifp, cnt); break; From owner-svn-src-stable@freebsd.org Fri May 5 13:23:24 2017 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 8EA6CD542A1; Fri, 5 May 2017 13:23:24 +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 4F1DC1DB1; Fri, 5 May 2017 13:23:24 +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 v45DNNBp066293; Fri, 5 May 2017 13:23:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45DNNVT066292; Fri, 5 May 2017 13:23:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705051323.v45DNNVT066292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 5 May 2017 13:23:23 +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: r317826 - stable/10/sys/dev/mlx5/mlx5_en 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, 05 May 2017 13:23:24 -0000 Author: hselasky Date: Fri May 5 13:23:23 2017 New Revision: 317826 URL: https://svnweb.freebsd.org/changeset/base/317826 Log: MFC r317568: Improve sysadmin visibility of physical port error counters in the mlx5en driver. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri May 5 13:21:11 2017 (r317825) +++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Fri May 5 13:23:23 2017 (r317826) @@ -541,19 +541,33 @@ mlx5e_update_stats_work(struct work_stru s->tx_csum_offload = s->tx_packets - tx_offload_none; s->rx_csum_good = s->rx_packets - s->rx_csum_none; - /* Update per port counters */ + /* Get physical port counters */ mlx5e_update_pport_counters(priv); #if (__FreeBSD_version < 1100000) /* no get_counters interface in fbsd 10 */ ifp->if_ipackets = s->rx_packets; - ifp->if_ierrors = s->rx_error_packets; + ifp->if_ierrors = s->rx_error_packets + + priv->stats.pport.alignment_err + + priv->stats.pport.check_seq_err + + priv->stats.pport.crc_align_errors + + priv->stats.pport.drop_events + + priv->stats.pport.in_range_len_errors + + priv->stats.pport.jabbers + + priv->stats.pport.out_of_range_len + + priv->stats.pport.oversize_pkts + + priv->stats.pport.symbol_err + + priv->stats.pport.too_long_errors + + priv->stats.pport.undersize_pkts + + priv->stats.pport.unsupported_op_rx; ifp->if_iqdrops = s->rx_out_of_buffer; ifp->if_opackets = s->tx_packets; ifp->if_oerrors = s->tx_error_packets; ifp->if_snd.ifq_drops = s->tx_queue_dropped; ifp->if_ibytes = s->rx_bytes; ifp->if_obytes = s->tx_bytes; + ifp->if_collisions = + priv->stats.pport.collisions; #endif free_out: @@ -2366,7 +2380,19 @@ mlx5e_get_counter(struct ifnet *ifp, ift retval = priv->stats.vport.rx_packets; break; case IFCOUNTER_IERRORS: - retval = priv->stats.vport.rx_error_packets; + retval = priv->stats.vport.rx_error_packets + + priv->stats.pport.alignment_err + + priv->stats.pport.check_seq_err + + priv->stats.pport.crc_align_errors + + priv->stats.pport.drop_events + + priv->stats.pport.in_range_len_errors + + priv->stats.pport.jabbers + + priv->stats.pport.out_of_range_len + + priv->stats.pport.oversize_pkts + + priv->stats.pport.symbol_err + + priv->stats.pport.too_long_errors + + priv->stats.pport.undersize_pkts + + priv->stats.pport.unsupported_op_rx; break; case IFCOUNTER_IQDROPS: retval = priv->stats.vport.rx_out_of_buffer; @@ -2392,6 +2418,9 @@ mlx5e_get_counter(struct ifnet *ifp, ift case IFCOUNTER_OQDROPS: retval = priv->stats.vport.tx_queue_dropped; break; + case IFCOUNTER_COLLISIONS: + retval = priv->stats.pport.collisions; + break; default: retval = if_get_counter_default(ifp, cnt); break; From owner-svn-src-stable@freebsd.org Fri May 5 15:15:43 2017 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 667E2D5FF40; Fri, 5 May 2017 15:15:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 27F641F95; Fri, 5 May 2017 15:15:43 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45FFgcR012599; Fri, 5 May 2017 15:15:42 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45FFgV7012598; Fri, 5 May 2017 15:15:42 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705051515.v45FFgV7012598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 5 May 2017 15:15: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: r317831 - stable/11/tests/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: Fri, 05 May 2017 15:15:43 -0000 Author: brooks Date: Fri May 5 15:15:41 2017 New Revision: 317831 URL: https://svnweb.freebsd.org/changeset/base/317831 Log: MFC r317566: Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF). These commands take an int. The tests work by accident on little-endian, 64-bit systems. PR: 218919 Tested with: qemu-cheri and CheriBSD built for mips64 Reviewed by: asomers, ngie Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/tests/sys/kern/unix_seqpacket_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/tests/sys/kern/unix_seqpacket_test.c ============================================================================== --- stable/11/tests/sys/kern/unix_seqpacket_test.c Fri May 5 14:34:09 2017 (r317830) +++ stable/11/tests/sys/kern/unix_seqpacket_test.c Fri May 5 15:15:41 2017 (r317831) @@ -127,7 +127,7 @@ shutdown_send_sigpipe_handler(int __unus * Parameterized test function bodies */ static void -test_eagain(size_t sndbufsize, size_t rcvbufsize) +test_eagain(int sndbufsize, int rcvbufsize) { int i; int sv[2]; @@ -165,7 +165,7 @@ test_eagain(size_t sndbufsize, size_t rc } static void -test_sendrecv_symmetric_buffers(size_t bufsize, int blocking) { +test_sendrecv_symmetric_buffers(int bufsize, int blocking) { int s; int sv[2]; const ssize_t pktsize = bufsize / 2; @@ -209,7 +209,7 @@ test_sendrecv_symmetric_buffers(size_t b } static void -test_pipe_simulator(size_t sndbufsize, size_t rcvbufsize) +test_pipe_simulator(int sndbufsize, int rcvbufsize) { int num_sent, num_received; int sv[2]; @@ -341,7 +341,7 @@ test_pipe_reader(void* args) static void -test_pipe(size_t sndbufsize, size_t rcvbufsize) +test_pipe(int sndbufsize, int rcvbufsize) { test_pipe_thread_data_t writer_data, reader_data; pthread_t writer, reader; @@ -875,8 +875,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize); ATF_TC_BODY(emsgsize, tc) { int sv[2]; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 8192; + const int sndbufsize = 8192; + const int rcvbufsize = 8192; const size_t pktsize = (sndbufsize + rcvbufsize) * 2; char sndbuf[pktsize]; ssize_t ssize; @@ -904,8 +904,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize_nonblocking ATF_TC_BODY(emsgsize_nonblocking, tc) { int sv[2]; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 8192; + const int sndbufsize = 8192; + const int rcvbufsize = 8192; const size_t pktsize = (sndbufsize + rcvbufsize) * 2; char sndbuf[pktsize]; ssize_t ssize; @@ -962,8 +962,8 @@ ATF_TC_BODY(rcvbuf_oversized, tc) int i; int sv[2]; const ssize_t pktsize = 1024; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 131072; + const int sndbufsize = 8192; + const int rcvbufsize = 131072; const size_t geometric_mean_bufsize = 32768; const int numpkts = geometric_mean_bufsize / pktsize; char sndbuf[pktsize]; From owner-svn-src-stable@freebsd.org Fri May 5 16:19:55 2017 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 7B697D5F6DA; Fri, 5 May 2017 16:19:55 +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 55E7331D; Fri, 5 May 2017 16:19:55 +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 v45GJsPh041041; Fri, 5 May 2017 16:19:54 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45GJsUu041040; Fri, 5 May 2017 16:19:54 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705051619.v45GJsUu041040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 5 May 2017 16:19:54 +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: r317833 - 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: Fri, 05 May 2017 16:19:55 -0000 Author: asomers Date: Fri May 5 16:19:54 2017 New Revision: 317833 URL: https://svnweb.freebsd.org/changeset/base/317833 Log: MFC r316760: Fix vdev_geom_attach_by_guids for partitioned disks When opening a vdev whose path is unknown, vdev_geom must find a geom provider with a label whose guids match the desired vdev. However, due to partitioning, it is possible that two non-synonomous providers will share some labels. For example, if the first partition starts at the beginning of the drive, then ada0 and ada0p1 will share the first label. More troubling, if the last partition runs to the end of the drive, then ada0p3 and ada0 will share the last label. If vdev_geom opens ada0 when it should've opened ada0p3, then the pool won't be readable. If it opens ada0 when it should've opened ada0p1, then it will corrupt some other partition when it writes the 3rd and 4th labels. The easiest way to reproduce this problem is to install a mirrored root pool with the default partition layout, then swap the positions of the two boot drives and reboot. Whether the bug manifests depends on the order in which geom lists its providers, which is arbitrary. Fix this situation by modifying the search algorithm to prefer geom providers that have all four labels intact. If no such provider exists, then open whichever provider has the most. Reviewed by: mav Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10365 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri May 5 15:26:55 2017 (r317832) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri May 5 16:19:54 2017 (r317833) @@ -400,12 +400,17 @@ vdev_geom_io(struct g_consumer *cp, int kmem_free(bios, bios_size); } +/* + * Read the vdev config from a device. Return the number of valid labels that + * were found. The vdev config will be returned in config if and only if at + * least one valid label was found. + */ static int vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) { struct g_provider *pp; vdev_phys_t *vdev_lists[VDEV_LABELS]; - char *p, *buf; + char *buf; size_t buflen; uint64_t psize, state, txg; off_t offsets[VDEV_LABELS]; @@ -413,7 +418,7 @@ vdev_geom_read_config(struct g_consumer off_t sizes[VDEV_LABELS]; int cmds[VDEV_LABELS]; int errors[VDEV_LABELS]; - int l, len; + int l, nlabels; g_topology_assert_not(); @@ -444,6 +449,7 @@ vdev_geom_read_config(struct g_consumer VDEV_LABELS); /* Parse the labels */ + nlabels = 0; for (l = 0; l < VDEV_LABELS; l++) { if (errors[l] != 0) continue; @@ -469,14 +475,14 @@ vdev_geom_read_config(struct g_consumer continue; } - break; + nlabels++; } /* Free the label storage */ for (l = 0; l < VDEV_LABELS; l++) kmem_free(vdev_lists[l], size); - return (*config == NULL ? ENOENT : 0); + return (nlabels); } static void @@ -559,7 +565,7 @@ vdev_geom_read_pool_label(const char *na struct g_consumer *zcp; nvlist_t *vdev_cfg; uint64_t pool_guid; - int error; + int error, nlabels; DROP_GIANT(); g_topology_lock(); @@ -580,10 +586,10 @@ vdev_geom_read_pool_label(const char *na if (zcp == NULL) continue; g_topology_unlock(); - error = vdev_geom_read_config(zcp, &vdev_cfg); + nlabels = vdev_geom_read_config(zcp, &vdev_cfg); g_topology_lock(); vdev_geom_detach(zcp, B_TRUE); - if (error) + if (nlabels == 0) continue; ZFS_LOG(1, "successfully read vdev config"); @@ -599,9 +605,13 @@ vdev_geom_read_pool_label(const char *na } enum match { - NO_MATCH, - TOP_MATCH, - FULL_MATCH + NO_MATCH = 0, /* No matching labels found */ + TOPGUID_MATCH = 1, /* Labels match top guid, not vdev guid*/ + ZERO_MATCH = 1, /* Should never be returned */ + ONE_MATCH = 2, /* 1 label matching the vdev_guid */ + TWO_MATCH = 3, /* 2 label matching the vdev_guid */ + THREE_MATCH = 4, /* 3 label matching the vdev_guid */ + FULL_MATCH = 5 /* all labels match the vdev_guid */ }; static enum match @@ -610,6 +620,7 @@ vdev_attach_ok(vdev_t *vd, struct g_prov nvlist_t *config; uint64_t pool_guid, top_guid, vdev_guid; struct g_consumer *cp; + int nlabels; cp = vdev_geom_attach(pp, NULL); if (cp == NULL) { @@ -618,7 +629,8 @@ vdev_attach_ok(vdev_t *vd, struct g_prov return (NO_MATCH); } g_topology_unlock(); - if (vdev_geom_read_config(cp, &config) != 0) { + nlabels = vdev_geom_read_config(cp, &config); + if (nlabels == 0) { g_topology_lock(); vdev_geom_detach(cp, B_TRUE); ZFS_LOG(1, "Unable to read config from %s.", pp->name); @@ -653,10 +665,10 @@ vdev_attach_ok(vdev_t *vd, struct g_prov */ if (vdev_guid == vd->vdev_guid) { ZFS_LOG(1, "guids match for provider %s.", pp->name); - return (FULL_MATCH); + return (ZERO_MATCH + nlabels); } else if (top_guid == vd->vdev_guid && vd == vd->vdev_top) { ZFS_LOG(1, "top vdev guid match for provider %s.", pp->name); - return (TOP_MATCH); + return (TOPGUID_MATCH); } ZFS_LOG(1, "vdev guid mismatch for provider %s: %ju != %ju.", pp->name, (uintmax_t)vd->vdev_guid, (uintmax_t)vdev_guid); @@ -668,13 +680,15 @@ vdev_geom_attach_by_guids(vdev_t *vd) { struct g_class *mp; struct g_geom *gp; - struct g_provider *pp; + struct g_provider *pp, *best_pp; struct g_consumer *cp; - enum match m; + enum match match, best_match; g_topology_assert(); cp = NULL; + best_pp = NULL; + best_match = NO_MATCH; LIST_FOREACH(mp, &g_classes, class) { if (mp == &zfs_vdev_class) continue; @@ -682,26 +696,25 @@ vdev_geom_attach_by_guids(vdev_t *vd) if (gp->flags & G_GEOM_WITHER) continue; LIST_FOREACH(pp, &gp->provider, provider) { - m = vdev_attach_ok(vd, pp); - if (m == NO_MATCH) - continue; - if (cp != NULL) { - if (m == FULL_MATCH) - vdev_geom_detach(cp, B_TRUE); - else - continue; + match = vdev_attach_ok(vd, pp); + if (match > best_match) { + best_match = match; + best_pp = pp; } - cp = vdev_geom_attach(pp, vd); - if (cp == NULL) { - printf("ZFS WARNING: Unable to " - "attach to %s.\n", pp->name); - continue; - } - if (m == FULL_MATCH) - return (cp); + if (match == FULL_MATCH) + goto out; } } } + +out: + if (best_pp) { + cp = vdev_geom_attach(best_pp, vd); + if (cp == NULL) { + printf("ZFS WARNING: Unable to attach to %s.\n", + best_pp->name); + } + } return (cp); } From owner-svn-src-stable@freebsd.org Fri May 5 16:24:36 2017 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 D7029D5F8B0; Fri, 5 May 2017 16:24:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8BB0C9F8; Fri, 5 May 2017 16:24:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45GOZBT044778; Fri, 5 May 2017 16:24:35 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45GOZfN044777; Fri, 5 May 2017 16:24:35 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705051624.v45GOZfN044777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 5 May 2017 16:24: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: r317834 - stable/10/tests/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, 05 May 2017 16:24:37 -0000 Author: brooks Date: Fri May 5 16:24:35 2017 New Revision: 317834 URL: https://svnweb.freebsd.org/changeset/base/317834 Log: MFC r317566: Don't pass size_t arguments to setsockopt(SO_SNDBUF/SO_RCVBUF). These commands take an int. The tests work by accident on little-endian, 64-bit systems. PR: 218919 Tested with: qemu-cheri and CheriBSD built for mips64 Reviewed by: asomers, ngie Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/10/tests/sys/kern/unix_seqpacket_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/tests/sys/kern/unix_seqpacket_test.c ============================================================================== --- stable/10/tests/sys/kern/unix_seqpacket_test.c Fri May 5 16:19:54 2017 (r317833) +++ stable/10/tests/sys/kern/unix_seqpacket_test.c Fri May 5 16:24:35 2017 (r317834) @@ -127,7 +127,7 @@ shutdown_send_sigpipe_handler(int __unus * Parameterized test function bodies */ static void -test_eagain(size_t sndbufsize, size_t rcvbufsize) +test_eagain(int sndbufsize, int rcvbufsize) { int i; int sv[2]; @@ -165,7 +165,7 @@ test_eagain(size_t sndbufsize, size_t rc } static void -test_sendrecv_symmetric_buffers(size_t bufsize, int blocking) { +test_sendrecv_symmetric_buffers(int bufsize, int blocking) { int s; int sv[2]; const ssize_t pktsize = bufsize / 2; @@ -209,7 +209,7 @@ test_sendrecv_symmetric_buffers(size_t b } static void -test_pipe_simulator(size_t sndbufsize, size_t rcvbufsize) +test_pipe_simulator(int sndbufsize, int rcvbufsize) { int num_sent, num_received; int sv[2]; @@ -341,7 +341,7 @@ test_pipe_reader(void* args) static void -test_pipe(size_t sndbufsize, size_t rcvbufsize) +test_pipe(int sndbufsize, int rcvbufsize) { test_pipe_thread_data_t writer_data, reader_data; pthread_t writer, reader; @@ -825,8 +825,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize); ATF_TC_BODY(emsgsize, tc) { int sv[2]; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 8192; + const int sndbufsize = 8192; + const int rcvbufsize = 8192; const size_t pktsize = (sndbufsize + rcvbufsize) * 2; char sndbuf[pktsize]; ssize_t ssize; @@ -854,8 +854,8 @@ ATF_TC_WITHOUT_HEAD(emsgsize_nonblocking ATF_TC_BODY(emsgsize_nonblocking, tc) { int sv[2]; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 8192; + const int sndbufsize = 8192; + const int rcvbufsize = 8192; const size_t pktsize = (sndbufsize + rcvbufsize) * 2; char sndbuf[pktsize]; ssize_t ssize; @@ -912,8 +912,8 @@ ATF_TC_BODY(rcvbuf_oversized, tc) int i; int sv[2]; const ssize_t pktsize = 1024; - const size_t sndbufsize = 8192; - const size_t rcvbufsize = 131072; + const int sndbufsize = 8192; + const int rcvbufsize = 131072; const size_t geometric_mean_bufsize = 32768; const int numpkts = geometric_mean_bufsize / pktsize; char sndbuf[pktsize]; From owner-svn-src-stable@freebsd.org Fri May 5 17:28:50 2017 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 CAE11D5FDF8; Fri, 5 May 2017 17:28:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 9A9E71391; Fri, 5 May 2017 17:28:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45HSnl2069631; Fri, 5 May 2017 17:28:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45HSnUQ069630; Fri, 5 May 2017 17:28:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705051728.v45HSnUQ069630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 5 May 2017 17:28:49 +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: r317841 - stable/10/usr.sbin/ntp/sntp 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, 05 May 2017 17:28:50 -0000 Author: brooks Date: Fri May 5 17:28:49 2017 New Revision: 317841 URL: https://svnweb.freebsd.org/changeset/base/317841 Log: MFC r317388: Use the approved syntax to build no man pages. Sponsored by: DARPA, AFRL Modified: stable/10/usr.sbin/ntp/sntp/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ntp/sntp/Makefile ============================================================================== --- stable/10/usr.sbin/ntp/sntp/Makefile Fri May 5 17:23:57 2017 (r317840) +++ stable/10/usr.sbin/ntp/sntp/Makefile Fri May 5 17:28:49 2017 (r317841) @@ -5,7 +5,7 @@ .PATH: ${.CURDIR}/../../../contrib/ntp/sntp PROG= sntp -MK_MAN= no +MAN= SRCS= crypto.c kod_management.c log.c main.c networking.c \ sntp-opts.c sntp.c utilities.c From owner-svn-src-stable@freebsd.org Fri May 5 20:21:14 2017 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 EB475D5F222; Fri, 5 May 2017 20:21:14 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 BD050147E; Fri, 5 May 2017 20:21:14 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45KLD82039325; Fri, 5 May 2017 20:21:13 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45KLDuv039324; Fri, 5 May 2017 20:21:13 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705052021.v45KLDuv039324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 5 May 2017 20:21: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: r317850 - stable/11/sys/cam/scsi 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, 05 May 2017 20:21:15 -0000 Author: ken Date: Fri May 5 20:21:13 2017 New Revision: 317850 URL: https://svnweb.freebsd.org/changeset/base/317850 Log: MFC r317680: Add the SCSI SSC Manufacturer assigned serial number VPD page. This is current as of SSC-5r03. Submitted by: Sam Klopsch Sponsored by: Spectra Logic Modified: stable/11/sys/cam/scsi/scsi_sa.h Modified: stable/11/sys/cam/scsi/scsi_sa.h ============================================================================== --- stable/11/sys/cam/scsi/scsi_sa.h Fri May 5 20:06:49 2017 (r317849) +++ stable/11/sys/cam/scsi/scsi_sa.h Fri May 5 20:21:13 2017 (r317850) @@ -487,6 +487,19 @@ struct scsi_medium_type_data { }; /* + * Manufacturer-assigned Serial Number VPD page. + * Current as of SSC-5r03, 28 September 2016. + */ +struct scsi_vpd_mfg_serial_number +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1 + u_int8_t page_length[2]; + u_int8_t mfg_serial_num[]; +}; + +/* * Security Protocol Specific values for the Tape Data Encryption protocol * (0x20) used with SECURITY PROTOCOL IN. See below for values used with * SECURITY PROTOCOL OUT. Current as of SSC4r03. From owner-svn-src-stable@freebsd.org Fri May 5 20:25:32 2017 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 85787D5F45E; Fri, 5 May 2017 20:25:32 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5720C18D7; Fri, 5 May 2017 20:25:32 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45KPVGl043030; Fri, 5 May 2017 20:25:31 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45KPV5W043029; Fri, 5 May 2017 20:25:31 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705052025.v45KPV5W043029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 5 May 2017 20:25:31 +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: r317851 - stable/10/sys/cam/scsi 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, 05 May 2017 20:25:32 -0000 Author: ken Date: Fri May 5 20:25:31 2017 New Revision: 317851 URL: https://svnweb.freebsd.org/changeset/base/317851 Log: MFC r317680: Add the SCSI SSC Manufacturer assigned serial number VPD page. This is current as of SSC-5r03. Submitted by: Sam Klopsch Sponsored by: Spectra Logic Modified: stable/10/sys/cam/scsi/scsi_sa.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_sa.h ============================================================================== --- stable/10/sys/cam/scsi/scsi_sa.h Fri May 5 20:21:13 2017 (r317850) +++ stable/10/sys/cam/scsi/scsi_sa.h Fri May 5 20:25:31 2017 (r317851) @@ -487,6 +487,19 @@ struct scsi_medium_type_data { }; /* + * Manufacturer-assigned Serial Number VPD page. + * Current as of SSC-5r03, 28 September 2016. + */ +struct scsi_vpd_mfg_serial_number +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1 + u_int8_t page_length[2]; + u_int8_t mfg_serial_num[]; +}; + +/* * Security Protocol Specific values for the Tape Data Encryption protocol * (0x20) used with SECURITY PROTOCOL IN. See below for values used with * SECURITY PROTOCOL OUT. Current as of SSC4r03. From owner-svn-src-stable@freebsd.org Fri May 5 20:41:31 2017 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 0E950D5F935; Fri, 5 May 2017 20:41:31 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B6381363; Fri, 5 May 2017 20:41:30 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45KfT9T050412; Fri, 5 May 2017 20:41:29 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45KfT0j050411; Fri, 5 May 2017 20:41:29 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705052041.v45KfT0j050411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 5 May 2017 20:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317852 - stable/11 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, 05 May 2017 20:41:31 -0000 Author: ken Date: Fri May 5 20:41:29 2017 New Revision: 317852 URL: https://svnweb.freebsd.org/changeset/base/317852 Log: Add mergeinfo that should have been included in r317850. Original commit message for r317850: MFC r317680: Add the SCSI SSC Manufacturer assigned serial number VPD page. This is current as of SSC-5r03. Submitted by: Sam Klopsch Sponsored by: Spectra Logic Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Fri May 5 21:52:16 2017 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 1EBC0D5FAEC; Fri, 5 May 2017 21:52:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E104F1034; Fri, 5 May 2017 21:52:15 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45LqFrx077753; Fri, 5 May 2017 21:52:15 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45LqEV7077751; Fri, 5 May 2017 21:52:14 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201705052152.v45LqEV7077751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 5 May 2017 21:52: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: r317855 - stable/11/usr.sbin/daemon 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, 05 May 2017 21:52:16 -0000 Author: jilles Date: Fri May 5 21:52:14 2017 New Revision: 317855 URL: https://svnweb.freebsd.org/changeset/base/317855 Log: MFC r307769: daemon: Allow logging daemon stdout/stderr to file or syslog. There are various new options, documented in the man page, to send the daemon's standard output and/or standard error to a file or to syslog. Relnotes: yes Modified: stable/11/usr.sbin/daemon/daemon.8 stable/11/usr.sbin/daemon/daemon.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/11/usr.sbin/daemon/daemon.8 Fri May 5 21:29:28 2017 (r317854) +++ stable/11/usr.sbin/daemon/daemon.8 Fri May 5 21:52:14 2017 (r317855) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 2, 2016 +.Dd October 22, 2016 .Dt DAEMON 8 .Os .Sh NAME @@ -34,11 +34,16 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cfr +.Op Fl cfrS .Op Fl p Ar child_pidfile .Op Fl P Ar supervisor_pidfile .Op Fl t Ar title .Op Fl u Ar user +.Op Fl m Ar output_mask +.Op Fl o Ar output_file +.Op Fl s Ar syslog_priority +.Op Fl T Ar syslog_tag +.Op Fl s Ar syslog_facility .Ar command arguments ... .Sh DESCRIPTION The @@ -46,6 +51,8 @@ The utility detaches itself from the controlling terminal and executes the program specified by its arguments. Privileges may be lowered to the specified user. +The output of the daemonized process may be redirected to syslog and to a +log file. .Pp The options are as follows: .Bl -tag -width indent @@ -55,6 +62,19 @@ Change the current working directory to .It Fl f Redirect standard input, standard output and standard error to .Pa /dev/null . +.It Fl S +Enable syslog output. +This is implicitly applied if other syslog parameters are provided. +The default values are daemon, notice, and daemon for facility, priority, and +tag, respectively. +.It Fl o Ar output_file +Append output from the daemonized process to +.Pa output_file . +If the file does not exist, it is created with permissions 0600. +.It Fl m Ar output_mask +Redirect output from the child process stdout (1), stderr (2), or both (3). +This value specifies what is sent to syslog and the log file. +The default is 3. .It Fl p Ar child_pidfile Write the ID of the created process into the .Ar child_pidfile @@ -96,18 +116,37 @@ option is used or not. .It Fl r Supervise and restart the program if it has been terminated. .It Fl t Ar title -Process title for the daemon to make it easily identifiable. +Set the title for the daemon process. +The default is the daemonized invocation. .It Fl u Ar user Login name of the user to execute the program under. Requires adequate superuser privileges. +.It Fl s Ar syslog_priority +These priorities are accepted: emerg, alert, crit, err, warning, +notice, info, and debug. +The default is info. +.It Fl l Ar syslog_facility +These facilities are accepted: auth, authpriv, console, cron, daemon, +ftp, kern, lpr, mail, news, ntp, security, syslog, user, uucp, and +local0, ..., local7. +The default is daemon. +.It Fl T Ar syslog_tag +Set the tag which is appended to all syslog messages. +The default is daemon. .El .Pp -If the +If any of the options .Fl p , -.Fl P +.Fl P , +.Fl r , +.Fl o , +.Fl s , +.Fl T , +.Fl m , +.Fl S , or -.Fl r -option is specified the program is executed in a spawned child process. +.Fl l +are specified, the program is executed in a spawned child process. The .Nm waits until it terminates to keep the pid file(s) locked and removes them @@ -119,6 +158,13 @@ spawned process. Normally it will cause the child to exit, remove the pidfile(s) and then terminate. .Pp +If neither file or syslog output are selected, all output is redirected to the +.Nm +process and written to stdout. +The +.Fl f +option may be used to suppress the stdout output completely. +.Pp The .Fl P option is useful combined with the @@ -145,13 +191,21 @@ library routine, 2 if or .Ar supervisor_pidfile is requested, but cannot be opened, 3 if process is already running (pidfile -exists and is locked), -otherwise 0. +exists and is locked), 4 if +.Ar syslog_priority +is not accepted, 5 if +.Ar syslog_facility +is not accepted, 6 if +.Ar output_mask +is not within the accepted range, 7 if +.Ar output_file +cannot be opened for appending, and otherwise 0. .Sh DIAGNOSTICS -If the command cannot be executed, an error message is displayed on -standard error unless the +If the command cannot be executed, an error message is printed to +standard error. +The exact behavior depends on the logging parameters and the .Fl f -flag is specified. +flag. .Sh SEE ALSO .Xr setregid 2 , .Xr setreuid 2 , Modified: stable/11/usr.sbin/daemon/daemon.c ============================================================================== --- stable/11/usr.sbin/daemon/daemon.c Fri May 5 21:29:28 2017 (r317854) +++ stable/11/usr.sbin/daemon/daemon.c Fri May 5 21:52:14 2017 (r317855) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,25 +45,59 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#define SYSLOG_NAMES +#include +#include +#include + +#define LBUF_SIZE 4096 + +struct log_params { + int dosyslog; + int logpri; + int noclose; + int outfd; +}; -static void dummy_sighandler(int); static void restrict_process(const char *); -static int wait_child(pid_t pid, sigset_t *mask); +static void handle_term(int); +static void handle_chld(int); +static int listen_child(int, struct log_params *); +static int get_log_mapping(const char *, const CODE *); +static void open_pid_files(const char *, const char *, struct pidfh **, + struct pidfh **); +static void do_output(const unsigned char *, size_t, struct log_params *); +static void daemon_sleep(time_t, long); static void usage(void); +static volatile sig_atomic_t terminate = 0, child_gone = 0, pid = 0; + int main(int argc, char *argv[]) { - struct pidfh *ppfh, *pfh; - sigset_t mask, oldmask; - int ch, nochdir, noclose, restart, serrno; - const char *pidfile, *ppidfile, *title, *user; - pid_t otherpid, pid; - + const char *pidfile, *ppidfile, *title, *user, *outfn, *logtag; + int ch, nochdir, noclose, restart, dosyslog, child_eof; + sigset_t mask_susp, mask_orig, mask_read, mask_term; + struct log_params logpar; + int pfd[2] = { -1, -1 }, outfd = -1; + int stdmask, logpri, logfac; + struct pidfh *ppfh, *pfh; + char *p; + + memset(&logpar, 0, sizeof(logpar)); + stdmask = STDOUT_FILENO | STDERR_FILENO; + ppidfile = pidfile = user = NULL; nochdir = noclose = 1; + logpri = LOG_NOTICE; + logfac = LOG_DAEMON; + logtag = "daemon"; restart = 0; - ppidfile = pidfile = title = user = NULL; - while ((ch = getopt(argc, argv, "cfp:P:rt:u:")) != -1) { + dosyslog = 0; + outfn = NULL; + title = NULL; + while ((ch = getopt(argc, argv, "cfSp:P:ru:o:s:l:t:l:m:T:")) != -1) { switch (ch) { case 'c': nochdir = 0; @@ -70,6 +105,20 @@ main(int argc, char *argv[]) case 'f': noclose = 0; break; + case 'l': + logfac = get_log_mapping(optarg, facilitynames); + if (logfac == -1) + errx(5, "unrecognized syslog facility"); + dosyslog = 1; + break; + case 'm': + stdmask = strtol(optarg, &p, 10); + if (p == optarg || stdmask < 0 || stdmask > 3) + errx(6, "unrecognized listening mask"); + break; + case 'o': + outfn = optarg; + break; case 'p': pidfile = optarg; break; @@ -79,9 +128,22 @@ main(int argc, char *argv[]) case 'r': restart = 1; break; + case 's': + logpri = get_log_mapping(optarg, prioritynames); + if (logpri == -1) + errx(4, "unrecognized syslog priority"); + dosyslog = 1; + break; + case 'S': + dosyslog = 1; + break; case 't': title = optarg; break; + case 'T': + logtag = optarg; + dosyslog = 1; + break; case 'u': user = optarg; break; @@ -95,43 +157,30 @@ main(int argc, char *argv[]) if (argc == 0) usage(); + if (!title) + title = argv[0]; + + if (outfn) { + outfd = open(outfn, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0600); + if (outfd == -1) + err(7, "open"); + } + + if (dosyslog) + openlog(logtag, LOG_PID | LOG_NDELAY, logfac); + ppfh = pfh = NULL; /* * Try to open the pidfile before calling daemon(3), * to be able to report the error intelligently */ - if (pidfile != NULL) { - pfh = pidfile_open(pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - errx(3, "process already running, pid: %d", - otherpid); - } - err(2, "pidfile ``%s''", pidfile); - } - } - /* Do the same for actual daemon process. */ - if (ppidfile != NULL) { - ppfh = pidfile_open(ppidfile, 0600, &otherpid); - if (ppfh == NULL) { - serrno = errno; - pidfile_remove(pfh); - errno = serrno; - if (errno == EEXIST) { - errx(3, "process already running, pid: %d", - otherpid); - } - err(2, "ppidfile ``%s''", ppidfile); - } - } - + open_pid_files(pidfile, ppidfile, &pfh, &ppfh); if (daemon(nochdir, noclose) == -1) { warn("daemon"); goto exit; } /* Write out parent pidfile if needed. */ pidfile_write(ppfh); - /* * If the pidfile or restart option is specified the daemon * executes the command in a forked process and wait on child @@ -139,34 +188,50 @@ main(int argc, char *argv[]) * we don't want the monitoring daemon to be terminated * leaving the running process and the stale pidfile, so we * catch SIGTERM and forward it to the children expecting to - * get SIGCHLD eventually. + * get SIGCHLD eventually. We also must fork() to obtain a + * readable pipe with the child for writing to a log file + * and syslog. */ pid = -1; - if (pidfile != NULL || ppidfile != NULL || restart) { + if (pidfile || ppidfile || restart || outfd != -1 || dosyslog) { + struct sigaction act_term, act_chld; + + /* Avoid PID racing with SIGCHLD and SIGTERM. */ + memset(&act_term, 0, sizeof(act_term)); + act_term.sa_handler = handle_term; + sigemptyset(&act_term.sa_mask); + sigaddset(&act_term.sa_mask, SIGCHLD); + + memset(&act_chld, 0, sizeof(act_chld)); + act_chld.sa_handler = handle_chld; + sigemptyset(&act_chld.sa_mask); + sigaddset(&act_chld.sa_mask, SIGTERM); + + /* Block these when avoiding racing before sigsuspend(). */ + sigemptyset(&mask_susp); + sigaddset(&mask_susp, SIGTERM); + sigaddset(&mask_susp, SIGCHLD); + /* Block SIGTERM when we lack a valid child PID. */ + sigemptyset(&mask_term); + sigaddset(&mask_term, SIGTERM); /* - * Restore default action for SIGTERM in case the - * parent process decided to ignore it. + * When reading, we wish to avoid SIGCHLD. SIGTERM + * has to be caught, otherwise we'll be stuck until + * the read() returns - if it returns. */ - if (signal(SIGTERM, SIG_DFL) == SIG_ERR) { - warn("signal"); + sigemptyset(&mask_read); + sigaddset(&mask_read, SIGCHLD); + /* Block SIGTERM to avoid racing until we have forked. */ + if (sigprocmask(SIG_BLOCK, &mask_term, &mask_orig)) { + warn("sigprocmask"); goto exit; } - /* - * Because SIGCHLD is ignored by default, setup dummy handler - * for it, so we can mask it. - */ - if (signal(SIGCHLD, dummy_sighandler) == SIG_ERR) { - warn("signal"); + if (sigaction(SIGTERM, &act_term, NULL) == -1) { + warn("sigaction"); goto exit; } - /* - * Block interesting signals. - */ - sigemptyset(&mask); - sigaddset(&mask, SIGTERM); - sigaddset(&mask, SIGCHLD); - if (sigprocmask(SIG_SETMASK, &mask, &oldmask) == -1) { - warn("sigprocmask"); + if (sigaction(SIGCHLD, &act_chld, NULL) == -1) { + warn("sigaction"); goto exit; } /* @@ -175,56 +240,190 @@ main(int argc, char *argv[]) * not have superuser privileges. */ (void)madvise(NULL, 0, MADV_PROTECT); + logpar.outfd = outfd; + logpar.dosyslog = dosyslog; + logpar.logpri = logpri; + logpar.noclose = noclose; restart: + if (pipe(pfd)) + err(1, "pipe"); /* - * Spawn a child to exec the command, so in the parent - * we could wait for it to exit and remove pidfile. + * Spawn a child to exec the command. */ + child_gone = 0; pid = fork(); if (pid == -1) { warn("fork"); goto exit; + } else if (pid > 0) { + /* + * Unblock SIGTERM after we know we have a valid + * child PID to signal. + */ + if (sigprocmask(SIG_UNBLOCK, &mask_term, NULL)) { + warn("sigprocmask"); + goto exit; + } + close(pfd[1]); + pfd[1] = -1; } } if (pid <= 0) { - if (pid == 0) { - /* Restore old sigmask in the child. */ - if (sigprocmask(SIG_SETMASK, &oldmask, NULL) == -1) - err(1, "sigprocmask"); - } /* Now that we are the child, write out the pid. */ pidfile_write(pfh); if (user != NULL) restrict_process(user); - + /* + * When forking, the child gets the original sigmask, + * and dup'd pipes. + */ + if (pid == 0) { + close(pfd[0]); + if (sigprocmask(SIG_SETMASK, &mask_orig, NULL)) + err(1, "sigprogmask"); + if (stdmask & STDERR_FILENO) { + if (dup2(pfd[1], STDERR_FILENO) == -1) + err(1, "dup2"); + } + if (stdmask & STDOUT_FILENO) { + if (dup2(pfd[1], STDOUT_FILENO) == -1) + err(1, "dup2"); + } + if (pfd[1] != STDERR_FILENO && + pfd[1] != STDOUT_FILENO) + close(pfd[1]); + } execvp(argv[0], argv); - /* * execvp() failed -- report the error. The child is * now running, so the exit status doesn't matter. */ err(1, "%s", argv[0]); } - - if (title != NULL) - setproctitle("%s[%d]", title, pid); - else - setproctitle("%s[%d]", argv[0], pid); - if (wait_child(pid, &mask) == 0 && restart) { - sleep(1); + setproctitle("%s[%d]", title, (int)pid); + /* + * As we have closed the write end of pipe for parent process, + * we might detect the child's exit by reading EOF. The child + * might have closed its stdout and stderr, so we must wait for + * the SIGCHLD to ensure that the process is actually gone. + */ + child_eof = 0; + for (;;) { + /* + * We block SIGCHLD when listening, but SIGTERM we accept + * so the read() won't block if we wish to depart. + * + * Upon receiving SIGTERM, we have several options after + * sending the SIGTERM to our child: + * - read until EOF + * - read until EOF but only for a while + * - bail immediately + * + * We go for the third, as otherwise we have no guarantee + * that we won't block indefinitely if the child refuses + * to depart. To handle the second option, a different + * approach would be needed (procctl()?) + */ + if (child_gone && child_eof) { + break; + } else if (terminate) { + goto exit; + } else if (!child_eof) { + if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; + } + child_eof = !listen_child(pfd[0], &logpar); + if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; + } + } else { + if (sigprocmask(SIG_BLOCK, &mask_susp, NULL)) { + warn("sigprocmask"); + goto exit; + } + while (!terminate && !child_gone) + sigsuspend(&mask_orig); + if (sigprocmask(SIG_UNBLOCK, &mask_susp, NULL)) { + warn("sigprocmask"); + goto exit; + } + } + } + if (sigprocmask(SIG_BLOCK, &mask_term, NULL)) { + warn("sigprocmask"); + goto exit; + } + if (restart && !terminate) { + daemon_sleep(1, 0); + close(pfd[0]); + pfd[0] = -1; goto restart; } exit: + close(outfd); + close(pfd[0]); + close(pfd[1]); + if (dosyslog) + closelog(); pidfile_remove(pfh); pidfile_remove(ppfh); exit(1); /* If daemon(3) succeeded exit status does not matter. */ } static void -dummy_sighandler(int sig __unused) +daemon_sleep(time_t secs, long nsecs) { - /* Nothing to do. */ + struct timespec ts = { secs, nsecs }; + while (nanosleep(&ts, &ts) == -1) { + if (errno != EINTR) + err(1, "nanosleep"); + } +} + +static void +open_pid_files(const char *pidfile, const char *ppidfile, + struct pidfh **pfh, struct pidfh **ppfh) +{ + pid_t fpid; + int serrno; + + if (pidfile) { + *pfh = pidfile_open(pidfile, 0600, &fpid); + if (*pfh == NULL) { + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + fpid); + } + err(2, "pidfile ``%s''", pidfile); + } + } + /* Do the same for the actual daemon process. */ + if (ppidfile) { + *ppfh = pidfile_open(ppidfile, 0600, &fpid); + if (*ppfh == NULL) { + serrno = errno; + pidfile_remove(*pfh); + errno = serrno; + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + fpid); + } + err(2, "ppidfile ``%s''", ppidfile); + } + } +} + +static int +get_log_mapping(const char *str, const CODE *c) +{ + const CODE *cp; + for (cp = c; cp->c_name; cp++) + if (strcmp(cp->c_name, str) == 0) + return cp->c_val; + return -1; } static void @@ -240,34 +439,112 @@ restrict_process(const char *user) errx(1, "failed to set user environment"); } +/* + * We try to collect whole lines terminated by '\n'. Otherwise we collect a + * full buffer, and then output it. + * + * Return value of 0 is assumed to mean EOF or error, and 1 indicates to + * continue reading. + */ static int -wait_child(pid_t pid, sigset_t *mask) +listen_child(int fd, struct log_params *logpar) +{ + static unsigned char buf[LBUF_SIZE]; + static size_t bytes_read = 0; + int rv; + + assert(logpar); + assert(bytes_read < LBUF_SIZE - 1); + + rv = read(fd, buf + bytes_read, LBUF_SIZE - bytes_read - 1); + if (rv > 0) { + unsigned char *cp; + + bytes_read += rv; + assert(bytes_read <= LBUF_SIZE - 1); + /* Always NUL-terminate just in case. */ + buf[LBUF_SIZE - 1] = '\0'; + /* + * Chomp line by line until we run out of buffer. + * This does not take NUL characters into account. + */ + while ((cp = memchr(buf, '\n', bytes_read)) != NULL) { + size_t bytes_line = cp - buf + 1; + assert(bytes_line <= bytes_read); + do_output(buf, bytes_line, logpar); + bytes_read -= bytes_line; + memmove(buf, cp + 1, bytes_read); + } + /* Wait until the buffer is full. */ + if (bytes_read < LBUF_SIZE - 1) + return 1; + do_output(buf, bytes_read, logpar); + bytes_read = 0; + return 1; + } else if (rv == -1) { + /* EINTR should trigger another read. */ + if (errno == EINTR) { + return 1; + } else { + warn("read"); + return 0; + } + } + /* Upon EOF, we have to flush what's left of the buffer. */ + if (bytes_read > 0) { + do_output(buf, bytes_read, logpar); + bytes_read = 0; + } + return 0; +} + +/* + * The default behavior is to stay silent if the user wants to redirect + * output to a file and/or syslog. If neither are provided, then we bounce + * everything back to parent's stdout. + */ +static void +do_output(const unsigned char *buf, size_t len, struct log_params *logpar) { - int terminate, signo; + assert(len <= LBUF_SIZE); + assert(logpar); + + if (len < 1) + return; + if (logpar->dosyslog) + syslog(logpar->logpri, "%.*s", (int)len, buf); + if (logpar->outfd != -1) { + if (write(logpar->outfd, buf, len) == -1) + warn("write"); + } + if (logpar->noclose && !logpar->dosyslog && logpar->outfd == -1) + printf("%.*s", (int)len, buf); +} - terminate = 0; +/* + * We use the global PID acquired directly from fork. If there is no valid + * child pid, the handler should be blocked and/or child_gone == 1. + */ +static void +handle_term(int signo) +{ + if (pid > 0 && !child_gone) + kill(pid, signo); + terminate = 1; +} + +static void +handle_chld(int signo) +{ + (void)signo; for (;;) { - if (sigwait(mask, &signo) == -1) { - warn("sigwaitinfo"); - return (-1); - } - switch (signo) { - case SIGCHLD: - if (waitpid(pid, NULL, WNOHANG) == -1) { - warn("waitpid"); - return (-1); - } - return (terminate); - case SIGTERM: - terminate = 1; - if (kill(pid, signo) == -1) { - warn("kill"); - return (-1); - } - continue; - default: - warnx("sigwaitinfo: invalid signal: %d", signo); - return (-1); + int rv = waitpid(-1, NULL, WNOHANG); + if (pid == rv) { + child_gone = 1; + break; + } else if (rv == -1 && errno != EINTR) { + warn("waitpid"); + return; } } } @@ -275,8 +552,11 @@ wait_child(pid_t pid, sigset_t *mask) static void usage(void) { - (void)fprintf(stderr, "%s\n\t%s\n", - "usage: daemon [-cfr] [-p child_pidfile] [-P supervisor_pidfile]", - "[-t title] [-u user] command arguments ..."); + (void)fprintf(stderr, + "usage: daemon [-cfrS] [-p child_pidfile] [-P supervisor_pidfile]\n" + " [-u user] [-o output_file] [-t title]\n" + " [-l syslog_facility] [-s syslog_priority]\n" + " [-T syslog_tag] [-m output_mask]\n" + "command arguments ...\n"); exit(1); } From owner-svn-src-stable@freebsd.org Fri May 5 21:57:28 2017 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 5FBC2D5FBFA; Fri, 5 May 2017 21:57:28 +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 156E61384; Fri, 5 May 2017 21:57:28 +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 v45LvR2p080249; Fri, 5 May 2017 21:57:27 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45LvRnZ080248; Fri, 5 May 2017 21:57:27 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705052157.v45LvRnZ080248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 5 May 2017 21:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317856 - stable/11/cddl/contrib/opensolaris/cmd/zdb 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, 05 May 2017 21:57:28 -0000 Author: asomers Date: Fri May 5 21:57:26 2017 New Revision: 317856 URL: https://svnweb.freebsd.org/changeset/base/317856 Log: MFC r316856: MFV 316855 7900 zdb shouldn't print the path of a znode at verbosity < 5 Reviewed by: Paul Dagnelie Reviewed by: Matt Ahrens Approved by: Dan McDonald Author: Alan Somers illumos/illumos-gate@e548d2fa41d1baa06662ed9abbb8bcec86e27dd9 https://www.illumos.org/issues/7900 Sponsored by: Spectra Logic Corp Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri May 5 21:52:14 2017 (r317855) +++ stable/11/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri May 5 21:57:26 2017 (r317856) @@ -1718,23 +1718,19 @@ dump_znode(objset_t *os, uint64_t object return; } - error = zfs_obj_to_path(os, object, path, sizeof (path)); - if (error != 0) { - (void) snprintf(path, sizeof (path), "\?\?\?", - (u_longlong_t)object); - } - if (dump_opt['d'] < 3) { - (void) printf("\t%s\n", path); - (void) sa_handle_destroy(hdl); - return; - } - z_crtime = (time_t)crtm[0]; z_atime = (time_t)acctm[0]; z_mtime = (time_t)modtm[0]; z_ctime = (time_t)chgtm[0]; - (void) printf("\tpath %s\n", path); + if (dump_opt['d'] > 4) { + error = zfs_obj_to_path(os, object, path, sizeof (path)); + if (error != 0) { + (void) snprintf(path, sizeof (path), + "\?\?\?", (u_longlong_t)object); + } + (void) printf("\tpath %s\n", path); + } dump_uidgid(os, uid, gid); (void) printf("\tatime %s", ctime(&z_atime)); (void) printf("\tmtime %s", ctime(&z_mtime)); From owner-svn-src-stable@freebsd.org Fri May 5 21:59:35 2017 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 C6BFAD5FC77; Fri, 5 May 2017 21:59:35 +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 A20751631; Fri, 5 May 2017 21:59:35 +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 v45LxYxb080383; Fri, 5 May 2017 21:59:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45LxYnt080379; Fri, 5 May 2017 21:59:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705052159.v45LxYnt080379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 5 May 2017 21:59:34 +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: r317857 - in stable/11: etc/defaults etc/periodic/daily share/man/man5 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, 05 May 2017 21:59:35 -0000 Author: asomers Date: Fri May 5 21:59:34 2017 New Revision: 317857 URL: https://svnweb.freebsd.org/changeset/base/317857 Log: MFC r316945-r316946 r316945: Add 410.status-mfi, a periodic script for mfi(4) arrays PR: 176049 Submitted by: doconnor@gsoft.com.au Reviewed by: scottl, Larry Rosenman Relnotes: yes r316946: Reorder Makefile entries from r316945 PR: 176049 Reported by: Oliver Pinter X-MFC-With: 316945 Added: stable/11/etc/periodic/daily/410.status-mfi - copied unchanged from r316946, head/etc/periodic/daily/410.status-mfi Modified: stable/11/etc/defaults/periodic.conf stable/11/etc/periodic/daily/Makefile stable/11/share/man/man5/periodic.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/defaults/periodic.conf ============================================================================== --- stable/11/etc/defaults/periodic.conf Fri May 5 21:57:26 2017 (r317856) +++ stable/11/etc/defaults/periodic.conf Fri May 5 21:59:34 2017 (r317857) @@ -112,6 +112,9 @@ daily_status_gstripe_enable="NO" # Che # 409.status-gconcat daily_status_gconcat_enable="NO" # Check gconcat(8) +# 410.status-mfi +daily_status_mfi_enable="NO" # Check mfiutil(8) + # 420.status-network daily_status_network_enable="YES" # Check network status daily_status_network_usedns="YES" # DNS lookups are ok Copied: stable/11/etc/periodic/daily/410.status-mfi (from r316946, head/etc/periodic/daily/410.status-mfi) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/etc/periodic/daily/410.status-mfi Fri May 5 21:59:34 2017 (r317857, copy of r316946, head/etc/periodic/daily/410.status-mfi) @@ -0,0 +1,33 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +case "$daily_status_mfi_enable" in + [Yy][Ee][Ss]) + echo + echo 'Checking status of mfi(4) devices:' + + if mfiutil show volumes; then + if mfiutil show volumes | grep -q DEGRADED; then + rc=3 + else + rc=0 + fi + else + rc=2 + fi + ;; + + *) rc=0;; +esac + +exit $rc Modified: stable/11/etc/periodic/daily/Makefile ============================================================================== --- stable/11/etc/periodic/daily/Makefile Fri May 5 21:57:26 2017 (r317856) +++ stable/11/etc/periodic/daily/Makefile Fri May 5 21:59:34 2017 (r317857) @@ -16,6 +16,7 @@ FILES= 100.clean-disks \ 407.status-graid3 \ 408.status-gstripe \ 409.status-gconcat \ + 410.status-mfi \ 420.status-network \ 430.status-uptime \ 450.status-security \ Modified: stable/11/share/man/man5/periodic.conf.5 ============================================================================== --- stable/11/share/man/man5/periodic.conf.5 Fri May 5 21:57:26 2017 (r317856) +++ stable/11/share/man/man5/periodic.conf.5 Fri May 5 21:59:34 2017 (r317857) @@ -399,6 +399,15 @@ if you want to run on your .Xr gconcat 8 devices. +.It Va daily_status_mfi_enable +.Pq Vt bool +Set to +.Dq Li YES +if you want to run +.Nm mfiutil Cm status +on your +.Xr mfi 4 +devices. .It Va daily_status_network_enable .Pq Vt bool Set to From owner-svn-src-stable@freebsd.org Sat May 6 00:50:26 2017 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 5C545D5DA8C; Sat, 6 May 2017 00:50:26 +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 0EB01AA6; Sat, 6 May 2017 00:50:25 +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 v460oOA6049310; Sat, 6 May 2017 00:50:24 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v460oOpw049308; Sat, 6 May 2017 00:50:24 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705060050.v460oOpw049308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 6 May 2017 00:50:24 +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: r317858 - in stable/11: sbin/geom/class/eli sys/geom/eli 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, 06 May 2017 00:50:26 -0000 Author: mav Date: Sat May 6 00:50:24 2017 New Revision: 317858 URL: https://svnweb.freebsd.org/changeset/base/317858 Log: MFC r317246: Always allow setting number of iterations for the first time. Before this change it was impossible to set number of PKCS#5v2 iterations, required to set passphrase, if it has two keys and never had any passphrase. Due to present metadata format limitations there are still cases when number of iterations can not be changed, but now it works in cases when it can. PR: 218512 Sponsored by: iXsystems, Inc. Modified: stable/11/sbin/geom/class/eli/geom_eli.c stable/11/sys/geom/eli/g_eli_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/eli/geom_eli.c ============================================================================== --- stable/11/sbin/geom/class/eli/geom_eli.c Fri May 5 21:59:34 2017 (r317857) +++ stable/11/sbin/geom/class/eli/geom_eli.c Sat May 6 00:50:24 2017 (r317858) @@ -1118,7 +1118,9 @@ eli_setkey_detached(struct gctl_req *req val = gctl_get_intmax(req, "iterations"); /* Check if iterations number should and can be changed. */ - if (val != -1) { + if (val != -1 && md->md_iterations == -1) { + md->md_iterations = val; + } else if (val != -1 && val != md->md_iterations) { if (bitcount32(md->md_keys) != 1) { gctl_error(req, "To be able to use '-i' option, only " "one key can be defined."); Modified: stable/11/sys/geom/eli/g_eli_ctl.c ============================================================================== --- stable/11/sys/geom/eli/g_eli_ctl.c Fri May 5 21:59:34 2017 (r317857) +++ stable/11/sys/geom/eli/g_eli_ctl.c Sat May 6 00:50:24 2017 (r317858) @@ -613,7 +613,9 @@ g_eli_ctl_setkey(struct gctl_req *req, s return; } /* Check if iterations number should and can be changed. */ - if (*valp != -1) { + if (*valp != -1 && md.md_iterations == -1) { + md.md_iterations = *valp; + } else if (*valp != -1 && *valp != md.md_iterations) { if (bitcount32(md.md_keys) != 1) { gctl_error(req, "To be able to use '-i' option, only " "one key can be defined."); From owner-svn-src-stable@freebsd.org Sat May 6 00:51:27 2017 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 1678BD5DB56; Sat, 6 May 2017 00:51:27 +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 DA5FFE36; Sat, 6 May 2017 00:51:26 +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 v460pPnv052173; Sat, 6 May 2017 00:51:25 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v460pPQ4052172; Sat, 6 May 2017 00:51:25 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705060051.v460pPQ4052172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 6 May 2017 00:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317859 - stable/11/sys/geom/eli 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, 06 May 2017 00:51:27 -0000 Author: mav Date: Sat May 6 00:51:25 2017 New Revision: 317859 URL: https://svnweb.freebsd.org/changeset/base/317859 Log: MFC r317247: Dump md_iterations as signed, which it really is. PR: 208305 PR: 196834 Modified: stable/11/sys/geom/eli/g_eli.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/eli/g_eli.h ============================================================================== --- stable/11/sys/geom/eli/g_eli.h Sat May 6 00:50:24 2017 (r317858) +++ stable/11/sys/geom/eli/g_eli.h Sat May 6 00:51:25 2017 (r317859) @@ -499,7 +499,7 @@ eli_metadata_dump(const struct g_eli_met printf(" provsize: %ju\n", (uintmax_t)md->md_provsize); printf("sectorsize: %u\n", (u_int)md->md_sectorsize); printf(" keys: 0x%02x\n", (u_int)md->md_keys); - printf("iterations: %u\n", (u_int)md->md_iterations); + printf("iterations: %d\n", (int)md->md_iterations); bzero(str, sizeof(str)); for (i = 0; i < sizeof(md->md_salt); i++) { str[i * 2] = hex[md->md_salt[i] >> 4]; From owner-svn-src-stable@freebsd.org Sat May 6 02:39:12 2017 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 E1B23D5FC1E; Sat, 6 May 2017 02:39:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B9A90A62; Sat, 6 May 2017 02:39:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v462dBqX093961; Sat, 6 May 2017 02:39:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v462dB1A093957; Sat, 6 May 2017 02:39:11 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705060239.v462dB1A093957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 6 May 2017 02:39: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: r317860 - stable/11/sbin/fsck_ffs 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, 06 May 2017 02:39:13 -0000 Author: pfg Date: Sat May 6 02:39:11 2017 New Revision: 317860 URL: https://svnweb.freebsd.org/changeset/base/317860 Log: MFC r317283: fsck_ffs: Unsign some variables and make use of reallocarray(3). Instead of casting listmax and numdirs to unsigned values just define them as unsigned and avoid the casts. Use reallocarray(3). While here, fs_ncg is already unsigned so the cast is unnecessary. Reviewed by: mckusick Modified: stable/11/sbin/fsck_ffs/fsck.h stable/11/sbin/fsck_ffs/globs.c stable/11/sbin/fsck_ffs/inode.c stable/11/sbin/fsck_ffs/setup.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/11/sbin/fsck_ffs/fsck.h Sat May 6 00:51:25 2017 (r317859) +++ stable/11/sbin/fsck_ffs/fsck.h Sat May 6 02:39:11 2017 (r317860) @@ -282,7 +282,8 @@ struct inoinfo { u_int i_numblks; /* size of block array in bytes */ ufs2_daddr_t i_blks[1]; /* actually longer */ } **inphead, **inpsort; -extern long numdirs, dirhash, listmax, inplast; +extern long dirhash, inplast; +extern unsigned long numdirs, listmax; extern long countdirs; /* number of directories we actually found */ #define MIBSIZE 3 /* size of fsck sysctl MIBs */ Modified: stable/11/sbin/fsck_ffs/globs.c ============================================================================== --- stable/11/sbin/fsck_ffs/globs.c Sat May 6 00:51:25 2017 (r317859) +++ stable/11/sbin/fsck_ffs/globs.c Sat May 6 02:39:11 2017 (r317860) @@ -56,7 +56,8 @@ struct bufarea sblk; /* file system sup struct bufarea *pdirbp; /* current directory contents */ struct bufarea *pbp; /* current inode block */ ino_t cursnapshot; -long numdirs, dirhash, listmax, inplast; +long dirhash, inplast; +unsigned long numdirs, listmax; long countdirs; /* number of directories we actually found */ int adjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */ int adjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */ @@ -123,7 +124,7 @@ fsckinit(void) pdirbp = NULL; pbp = NULL; cursnapshot = 0; - numdirs = dirhash = listmax = inplast = 0; + listmax = numdirs = dirhash = inplast = 0; countdirs = 0; bzero(adjrefcnt, sizeof(int) * MIBSIZE); bzero(adjblkcnt, sizeof(int) * MIBSIZE); Modified: stable/11/sbin/fsck_ffs/inode.c ============================================================================== --- stable/11/sbin/fsck_ffs/inode.c Sat May 6 00:51:25 2017 (r317859) +++ stable/11/sbin/fsck_ffs/inode.c Sat May 6 02:39:11 2017 (r317860) @@ -472,8 +472,8 @@ cacheino(union dinode *dp, ino_t inumber inp->i_blks[NDADDR + i] = DIP(dp, di_ib[i]); if (inplast == listmax) { listmax += 100; - inpsort = (struct inoinfo **)realloc((char *)inpsort, - (unsigned)listmax * sizeof(struct inoinfo *)); + inpsort = (struct inoinfo **)reallocarray((char *)inpsort, + listmax, sizeof(struct inoinfo *)); if (inpsort == NULL) errx(EEXIT, "cannot increase directory list"); } Modified: stable/11/sbin/fsck_ffs/setup.c ============================================================================== --- stable/11/sbin/fsck_ffs/setup.c Sat May 6 00:51:25 2017 (r317859) +++ stable/11/sbin/fsck_ffs/setup.c Sat May 6 02:39:11 2017 (r317860) @@ -268,8 +268,7 @@ setup(char *dev) (unsigned)bmapsize); goto badsb; } - inostathead = Calloc((unsigned)(sblock.fs_ncg), - sizeof(struct inostatlist)); + inostathead = Calloc(sblock.fs_ncg, sizeof(struct inostatlist)); if (inostathead == NULL) { printf("cannot alloc %u bytes for inostathead\n", (unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg))); @@ -279,10 +278,8 @@ setup(char *dev) dirhash = numdirs; inplast = 0; listmax = numdirs + 10; - inpsort = (struct inoinfo **)Calloc((unsigned)listmax, - sizeof(struct inoinfo *)); - inphead = (struct inoinfo **)Calloc((unsigned)numdirs, - sizeof(struct inoinfo *)); + inpsort = (struct inoinfo **)Calloc(listmax, sizeof(struct inoinfo *)); + inphead = (struct inoinfo **)Calloc(numdirs, sizeof(struct inoinfo *)); if (inpsort == NULL || inphead == NULL) { printf("cannot alloc %ju bytes for inphead\n", (uintmax_t)numdirs * sizeof(struct inoinfo *)); From owner-svn-src-stable@freebsd.org Sat May 6 02:43:27 2017 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 F23FCD60065; Sat, 6 May 2017 02:43:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 C6AAB117; Sat, 6 May 2017 02:43:27 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v462hQKf097780; Sat, 6 May 2017 02:43:26 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v462hQIk097779; Sat, 6 May 2017 02:43:26 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705060243.v462hQIk097779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 6 May 2017 02:43: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: r317861 - stable/11/usr.sbin/pmcstat 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, 06 May 2017 02:43:28 -0000 Author: pfg Date: Sat May 6 02:43:26 2017 New Revision: 317861 URL: https://svnweb.freebsd.org/changeset/base/317861 Log: MFC r317284: pmcstat(8); unsign some allocation variables and use reallocarray(3). Use unsigned values in some internal variables that will be used during allocation. The variables are used in reduced scope and have no chance of becoming negative. Provide bounds checking through reallocarray(3). Modified: stable/11/usr.sbin/pmcstat/pmcpl_calltree.c stable/11/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- stable/11/usr.sbin/pmcstat/pmcpl_calltree.c Sat May 6 02:39:11 2017 (r317860) +++ stable/11/usr.sbin/pmcstat/pmcpl_calltree.c Sat May 6 02:43:26 2017 (r317861) @@ -185,7 +185,7 @@ pmcpl_ct_samples_free(struct pmcpl_ct_sa static void pmcpl_ct_samples_grow(struct pmcpl_ct_sample *samples) { - int npmcs; + unsigned int npmcs; /* Enough storage. */ if (pmcstat_npmcs <= samples->npmcs) @@ -193,7 +193,7 @@ pmcpl_ct_samples_grow(struct pmcpl_ct_sa npmcs = samples->npmcs + max(pmcstat_npmcs - samples->npmcs, PMCPL_CT_GROWSIZE); - samples->sb = realloc(samples->sb, npmcs * sizeof(unsigned)); + samples->sb = reallocarray(samples->sb, npmcs, sizeof(unsigned)); if (samples->sb == NULL) errx(EX_SOFTWARE, "ERROR: out of memory"); bzero((char *)samples->sb + samples->npmcs * sizeof(unsigned), @@ -226,13 +226,13 @@ pmcpl_ct_samples_root(struct pmcpl_ct_sa static void pmcpl_ct_arc_grow(int cursize, int *maxsize, struct pmcpl_ct_arc **items) { - int nmaxsize; + unsigned int nmaxsize; if (cursize < *maxsize) return; nmaxsize = *maxsize + max(cursize + 1 - *maxsize, PMCPL_CT_GROWSIZE); - *items = realloc(*items, nmaxsize * sizeof(struct pmcpl_ct_arc)); + *items = reallocarray(*items, nmaxsize, sizeof(struct pmcpl_ct_arc)); if (*items == NULL) errx(EX_SOFTWARE, "ERROR: out of memory"); bzero((char *)*items + *maxsize * sizeof(struct pmcpl_ct_arc), @@ -247,13 +247,13 @@ pmcpl_ct_arc_grow(int cursize, int *maxs static void pmcpl_ct_instr_grow(int cursize, int *maxsize, struct pmcpl_ct_instr **items) { - int nmaxsize; + unsigned int nmaxsize; if (cursize < *maxsize) return; nmaxsize = *maxsize + max(cursize + 1 - *maxsize, PMCPL_CT_GROWSIZE); - *items = realloc(*items, nmaxsize * sizeof(struct pmcpl_ct_instr)); + *items = reallocarray(*items, nmaxsize, sizeof(struct pmcpl_ct_instr)); if (*items == NULL) errx(EX_SOFTWARE, "ERROR: out of memory"); bzero((char *)*items + *maxsize * sizeof(struct pmcpl_ct_instr), Modified: stable/11/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/11/usr.sbin/pmcstat/pmcstat_log.c Sat May 6 02:39:11 2017 (r317860) +++ stable/11/usr.sbin/pmcstat/pmcstat_log.c Sat May 6 02:43:26 2017 (r317861) @@ -535,8 +535,8 @@ pmcstat_image_add_symbols(struct pmcstat * Allocate space for the new entries. */ firsttime = image->pi_symbols == NULL; - symptr = realloc(image->pi_symbols, - sizeof(*symptr) * (image->pi_symcount + nfuncsyms)); + symptr = reallocarray(image->pi_symbols, + image->pi_symcount + nfuncsyms, sizeof(*symptr)); if (symptr == image->pi_symbols) /* realloc() failed. */ return; image->pi_symbols = symptr; @@ -587,8 +587,8 @@ pmcstat_image_add_symbols(struct pmcstat * Return space to the system if there were duplicates. */ if (newsyms < nfuncsyms) - image->pi_symbols = realloc(image->pi_symbols, - sizeof(*symptr) * image->pi_symcount); + image->pi_symbols = reallocarray(image->pi_symbols, + image->pi_symcount, sizeof(*symptr)); /* * Keep the list of symbols sorted. From owner-svn-src-stable@freebsd.org Sat May 6 11:13:34 2017 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 EF6DAD6138C; Sat, 6 May 2017 11:13:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C71871867; Sat, 6 May 2017 11:13:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46BDX5a010207; Sat, 6 May 2017 11:13:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46BDXpA010200; Sat, 6 May 2017 11:13:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705061113.v46BDXpA010200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 6 May 2017 11:13: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: r317880 - in stable/11/contrib/llvm: include/llvm/CodeGen include/llvm/MC include/llvm/MC/MCParser lib/CodeGen/AsmPrinter lib/MC lib/MC/MCParser 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, 06 May 2017 11:13:35 -0000 Author: dim Date: Sat May 6 11:13:33 2017 New Revision: 317880 URL: https://svnweb.freebsd.org/changeset/base/317880 Log: MFC r317458: Pull in r294458 from upstream llvm trunk (by Sanne Wouda): [Assembler] Enable nicer diagnostics for inline assembly. Fixed test. Summary: Enables source location in diagnostic messages from the backend. This is after parsing, during finalization. This requires the SourceMgr, the inline assembly string buffer, and DiagInfo to still be alive after EmitInlineAsm returns. This patch creates a single SourceMgr for inline assembly inside the AsmPrinter. MCContext gets a pointer to this SourceMgr. Using one SourceMgr per call to EmitInlineAsm would make it difficult for MCContext to figure out in which SourceMgr the SMLoc is located, while a single SourceMgr can figure it out if it has multiple buffers. The Str argument to EmitInlineAsm is copied into a buffer and owned by the inline asm SourceMgr. This ensures that DiagHandlers won't print garbage. (Clang emits a "note: instantiated into assembly here", which refers to this string.) The AsmParser gets destroyed before finalization, which means that the DiagHandlers the AsmParser installs into the SourceMgr will be stale. Restore the saved DiagHandlers. Since now we're using just one SourceMgr for multiple inline asm strings, we need to tell the AsmParser which buffer it needs to parse currently. Hand a buffer id -- returned from SourceMgr:: AddNewSourceBuffer -- to the AsmParser. Reviewers: rnk, grosbach, compnerd, rengolin, rovka, anemet Reviewed By: rnk Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29441 This improves error reporting for some inline assembly constructs that clang does not approve of: instead of crashing with a "fatal backend error", it will now show a normal error message, and point out the location of the problematic assembly. Reported by: mmel Modified: stable/11/contrib/llvm/include/llvm/CodeGen/AsmPrinter.h stable/11/contrib/llvm/include/llvm/MC/MCContext.h stable/11/contrib/llvm/include/llvm/MC/MCParser/MCAsmParser.h stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp stable/11/contrib/llvm/lib/MC/MCContext.cpp stable/11/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/include/llvm/CodeGen/AsmPrinter.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/AsmPrinter.h Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/include/llvm/CodeGen/AsmPrinter.h Sat May 6 11:13:33 2017 (r317880) @@ -23,6 +23,7 @@ #include "llvm/IR/InlineAsm.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/SourceMgr.h" namespace llvm { class AsmPrinterHandler; @@ -137,6 +138,19 @@ private: /// maintains ownership of the emitters. SmallVector Handlers; +public: + struct SrcMgrDiagInfo { + SourceMgr SrcMgr; + const MDNode *LocInfo; + LLVMContext::InlineAsmDiagHandlerTy DiagHandler; + void *DiagContext; + }; + +private: + /// Structure for generating diagnostics for inline assembly. Only initialised + /// when necessary. + mutable std::unique_ptr DiagInfo; + /// If the target supports dwarf debug info, this pointer is non-null. DwarfDebug *DD; Modified: stable/11/contrib/llvm/include/llvm/MC/MCContext.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/MC/MCContext.h Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/include/llvm/MC/MCContext.h Sat May 6 11:13:33 2017 (r317880) @@ -59,6 +59,9 @@ namespace llvm { /// The SourceMgr for this object, if any. const SourceMgr *SrcMgr; + /// The SourceMgr for inline assembly, if any. + SourceMgr *InlineSrcMgr; + /// The MCAsmInfo for this target. const MCAsmInfo *MAI; @@ -240,6 +243,8 @@ namespace llvm { const SourceMgr *getSourceManager() const { return SrcMgr; } + void setInlineSourceManager(SourceMgr *SM) { InlineSrcMgr = SM; } + const MCAsmInfo *getAsmInfo() const { return MAI; } const MCRegisterInfo *getRegisterInfo() const { return MRI; } Modified: stable/11/contrib/llvm/include/llvm/MC/MCParser/MCAsmParser.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/MC/MCParser/MCAsmParser.h Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/include/llvm/MC/MCParser/MCAsmParser.h Sat May 6 11:13:33 2017 (r317880) @@ -258,7 +258,7 @@ public: /// \brief Create an MCAsmParser instance. MCAsmParser *createMCAsmParser(SourceMgr &, MCContext &, MCStreamer &, - const MCAsmInfo &); + const MCAsmInfo &, unsigned CB = 0); } // End llvm namespace Modified: stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Sat May 6 11:13:33 2017 (r317880) @@ -40,19 +40,12 @@ using namespace llvm; #define DEBUG_TYPE "asm-printer" -namespace { - struct SrcMgrDiagInfo { - const MDNode *LocInfo; - LLVMContext::InlineAsmDiagHandlerTy DiagHandler; - void *DiagContext; - }; -} - /// srcMgrDiagHandler - This callback is invoked when the SourceMgr for an /// inline asm has an error in it. diagInfo is a pointer to the SrcMgrDiagInfo /// struct above. static void srcMgrDiagHandler(const SMDiagnostic &Diag, void *diagInfo) { - SrcMgrDiagInfo *DiagInfo = static_cast(diagInfo); + AsmPrinter::SrcMgrDiagInfo *DiagInfo = + static_cast(diagInfo); assert(DiagInfo && "Diagnostic context not passed down?"); // If the inline asm had metadata associated with it, pull out a location @@ -99,35 +92,34 @@ void AsmPrinter::EmitInlineAsm(StringRef return; } - SourceMgr SrcMgr; - SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths); + if (!DiagInfo) { + DiagInfo = make_unique(); - SrcMgrDiagInfo DiagInfo; + MCContext &Context = MMI->getContext(); + Context.setInlineSourceManager(&DiagInfo->SrcMgr); - // If the current LLVMContext has an inline asm handler, set it in SourceMgr. - LLVMContext &LLVMCtx = MMI->getModule()->getContext(); - bool HasDiagHandler = false; - if (LLVMCtx.getInlineAsmDiagnosticHandler() != nullptr) { - // If the source manager has an issue, we arrange for srcMgrDiagHandler - // to be invoked, getting DiagInfo passed into it. - DiagInfo.LocInfo = LocMDNode; - DiagInfo.DiagHandler = LLVMCtx.getInlineAsmDiagnosticHandler(); - DiagInfo.DiagContext = LLVMCtx.getInlineAsmDiagnosticContext(); - SrcMgr.setDiagHandler(srcMgrDiagHandler, &DiagInfo); - HasDiagHandler = true; + LLVMContext &LLVMCtx = MMI->getModule()->getContext(); + if (LLVMCtx.getInlineAsmDiagnosticHandler()) { + DiagInfo->DiagHandler = LLVMCtx.getInlineAsmDiagnosticHandler(); + DiagInfo->DiagContext = LLVMCtx.getInlineAsmDiagnosticContext(); + DiagInfo->SrcMgr.setDiagHandler(srcMgrDiagHandler, DiagInfo.get()); + } } + SourceMgr &SrcMgr = DiagInfo->SrcMgr; + SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths); + DiagInfo->LocInfo = LocMDNode; + std::unique_ptr Buffer; - if (isNullTerminated) - Buffer = MemoryBuffer::getMemBuffer(Str, ""); - else - Buffer = MemoryBuffer::getMemBufferCopy(Str, ""); + // The inline asm source manager will outlive Str, so make a copy of the + // string for SourceMgr to own. + Buffer = MemoryBuffer::getMemBufferCopy(Str, ""); // Tell SrcMgr about this buffer, it takes ownership of the buffer. - SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc()); + unsigned BufNum = SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc()); std::unique_ptr Parser( - createMCAsmParser(SrcMgr, OutContext, *OutStreamer, *MAI)); + createMCAsmParser(SrcMgr, OutContext, *OutStreamer, *MAI, BufNum)); // We create a new MCInstrInfo here since we might be at the module level // and not have a MachineFunction to initialize the TargetInstrInfo from and @@ -151,7 +143,13 @@ void AsmPrinter::EmitInlineAsm(StringRef int Res = Parser->Run(/*NoInitialTextSection*/ true, /*NoFinalize*/ true); emitInlineAsmEnd(STI, &TAP->getSTI()); - if (Res && !HasDiagHandler) + + // LocInfo cannot be used for error generation from the backend. + // FIXME: associate LocInfo with the SourceBuffer to improve backend + // messages. + DiagInfo->LocInfo = nullptr; + + if (Res && !DiagInfo->DiagHandler) report_fatal_error("Error parsing inline asm\n"); } Modified: stable/11/contrib/llvm/lib/MC/MCContext.cpp ============================================================================== --- stable/11/contrib/llvm/lib/MC/MCContext.cpp Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/lib/MC/MCContext.cpp Sat May 6 11:13:33 2017 (r317880) @@ -510,13 +510,15 @@ CodeViewContext &MCContext::getCVContext void MCContext::reportError(SMLoc Loc, const Twine &Msg) { HadError = true; - // If we have a source manager use it. Otherwise just use the generic - // report_fatal_error(). - if (!SrcMgr) + // If we have a source manager use it. Otherwise, try using the inline source + // manager. + // If that fails, use the generic report_fatal_error(). + if (SrcMgr) + SrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); + else if (InlineSrcMgr) + InlineSrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); + else report_fatal_error(Msg, false); - - // Use the source manager to print the message. - SrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); } void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) { Modified: stable/11/contrib/llvm/lib/MC/MCParser/AsmParser.cpp ============================================================================== --- stable/11/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Sat May 6 10:59:10 2017 (r317879) +++ stable/11/contrib/llvm/lib/MC/MCParser/AsmParser.cpp Sat May 6 11:13:33 2017 (r317880) @@ -209,7 +209,7 @@ private: public: AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, - const MCAsmInfo &MAI); + const MCAsmInfo &MAI, unsigned CB); ~AsmParser() override; bool Run(bool NoInitialTextSection, bool NoFinalize = false) override; @@ -572,9 +572,9 @@ extern MCAsmParserExtension *createCOFFA enum { DEFAULT_ADDRSPACE = 0 }; AsmParser::AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out, - const MCAsmInfo &MAI) + const MCAsmInfo &MAI, unsigned CB = 0) : Lexer(MAI), Ctx(Ctx), Out(Out), MAI(MAI), SrcMgr(SM), - PlatformParser(nullptr), CurBuffer(SM.getMainFileID()), + PlatformParser(nullptr), CurBuffer(CB ? CB : SM.getMainFileID()), MacrosEnabledFlag(true), CppHashInfo(), AssemblerDialect(~0U), IsDarwin(false), ParsingInlineAsm(false) { HadError = false; @@ -608,6 +608,10 @@ AsmParser::AsmParser(SourceMgr &SM, MCCo AsmParser::~AsmParser() { assert((HadError || ActiveMacros.empty()) && "Unexpected active macro instantiation!"); + + // Restore the saved diagnostics handler and context for use during + // finalization. + SrcMgr.setDiagHandler(SavedDiagHandler, SavedDiagContext); } void AsmParser::printMacroInstantiations() { @@ -5518,6 +5522,7 @@ bool parseAssignmentExpression(StringRef /// \brief Create an MCAsmParser instance. MCAsmParser *llvm::createMCAsmParser(SourceMgr &SM, MCContext &C, - MCStreamer &Out, const MCAsmInfo &MAI) { - return new AsmParser(SM, C, Out, MAI); + MCStreamer &Out, const MCAsmInfo &MAI, + unsigned CB) { + return new AsmParser(SM, C, Out, MAI, CB); } From owner-svn-src-stable@freebsd.org Sat May 6 11:18:38 2017 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 68681D615FA; Sat, 6 May 2017 11:18:38 +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 2D728F40; Sat, 6 May 2017 11:18:38 +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 v46BIbh3011572; Sat, 6 May 2017 11:18:37 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46BIbwx011571; Sat, 6 May 2017 11:18:37 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705061118.v46BIbwx011571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 6 May 2017 11:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317881 - stable/11/contrib/llvm/lib/Target/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: Sat, 06 May 2017 11:18:38 -0000 Author: dim Date: Sat May 6 11:18:36 2017 New Revision: 317881 URL: https://svnweb.freebsd.org/changeset/base/317881 Log: MFC r317751: Pull in r301983 from upstream llvm trunk (by Tim Northover): ARM: avoid handing a deleted node back to TableGen during ISel. When we replaced the multiplicand the destination node might already exist. When that happens the original gets CSEd and deleted. However, it's actually used as the offset so nonsense is produced. Should fix PR32726. This fixes an assertion failure when building building www/firefox 53.0 for arm. Reported by: Bob Prohaska PR: 218782 Modified: stable/11/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sat May 6 11:13:33 2017 (r317880) +++ stable/11/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sat May 6 11:18:36 2017 (r317881) @@ -748,7 +748,9 @@ bool ARMDAGToDAGISel::SelectLdStSOReg(SD unsigned PowerOfTwo = 0; SDValue NewMulConst; if (canExtractShiftFromMul(Offset, 31, PowerOfTwo, NewMulConst)) { + HandleSDNode Handle(Offset); replaceDAGValue(Offset.getOperand(1), NewMulConst); + Offset = Handle.getValue(); ShAmt = PowerOfTwo; ShOpcVal = ARM_AM::lsl; } @@ -1428,7 +1430,9 @@ bool ARMDAGToDAGISel::SelectT2AddrModeSo unsigned PowerOfTwo = 0; SDValue NewMulConst; if (canExtractShiftFromMul(OffReg, 3, PowerOfTwo, NewMulConst)) { + HandleSDNode Handle(OffReg); replaceDAGValue(OffReg.getOperand(1), NewMulConst); + OffReg = Handle.getValue(); ShAmt = PowerOfTwo; } } From owner-svn-src-stable@freebsd.org Sat May 6 16:06:34 2017 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 DD2EBD615B2; Sat, 6 May 2017 16:06:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7049F1861; Sat, 6 May 2017 16:06:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46G6XQ4031100; Sat, 6 May 2017 16:06:33 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46G6X9Y031098; Sat, 6 May 2017 16:06:33 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201705061606.v46G6X9Y031098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 6 May 2017 16:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r317883 - stable/8/sys/fs/tmpfs 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: Sat, 06 May 2017 16:06:35 -0000 Author: ian Date: Sat May 6 16:06:33 2017 New Revision: 317883 URL: https://svnweb.freebsd.org/changeset/base/317883 Log: MFC r230208, r230252, r234346: Add nfs export support to tmpfs(5) Return EOPNOTSUPP since we only support update mounts for NFS export. tmpfs: Allow update mounts only for certain options. Since r230208 update mounts were allowed if the list of mount options contained the "export" option. This is not correct as tmpfs doesn't really support updating all options. Modified: stable/8/sys/fs/tmpfs/tmpfs.h stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/fs/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs.h ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs.h Sat May 6 13:28:42 2017 (r317882) +++ stable/8/sys/fs/tmpfs/tmpfs.h Sat May 6 16:06:33 2017 (r317883) @@ -389,6 +389,9 @@ struct tmpfs_mount { * tmpfs_pool.c. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; + + /* Read-only status. */ + int tm_ronly; }; #define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock) Modified: stable/8/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Sat May 6 13:28:42 2017 (r317882) +++ stable/8/sys/fs/tmpfs/tmpfs_vfsops.c Sat May 6 16:06:33 2017 (r317883) @@ -81,6 +81,10 @@ static const char *tmpfs_opts[] = { NULL }; +static const char *tmpfs_updateopts[] = { + "from", "export", NULL +}; + /* --------------------------------------------------------------------- */ static int @@ -149,10 +153,13 @@ tmpfs_mount(struct mount *mp) return (EINVAL); if (mp->mnt_flag & MNT_UPDATE) { - /* XXX: There is no support yet to update file system - * settings. Should be added. */ - - return EOPNOTSUPP; + /* Only support update mounts for certain options. */ + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) + return (EOPNOTSUPP); + if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) != + ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly) + return (EOPNOTSUPP); + return (0); } vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY); @@ -224,6 +231,7 @@ tmpfs_mount(struct mount *mp) tmpfs_node_ctor, tmpfs_node_dtor, tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); + tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; /* Allocate the root node. */ error = tmpfs_alloc_node(tmp, VDIR, root_uid,