svn commit: r318337 - in head/sys: arm/conf arm/mv/armada38x dev/sdhci

2017-05-15 Thread Luiz Otavio O Souza
Author: loos
Date: Tue May 16 05:10:15 2017
New Revision: 318337
URL: https://svnweb.freebsd.org/changeset/base/318337

Log:
  Add the Marvell SDHCI controller to the list of supported devices in
  sdhci_fdt.
  
  Enable the SDHCI controller, bus and devices on ARMADA38X kernel.
  
  Tested on:ClearFog Pro
  Reviewed by:  Marcin Wojtas 
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D10606

Modified:
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/mv/armada38x/files.armada38x
  head/sys/dev/sdhci/sdhci_fdt.c

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Tue May 16 04:47:50 2017(r318336)
+++ head/sys/arm/conf/ARMADA38X Tue May 16 05:10:15 2017(r318337)
@@ -63,6 +63,11 @@ device   scbus
 device pass
 device da
 
+# MMC/SD/SDIO Card slot support
+device mmc # mmc/sd bus
+device mmcsd   # mmc/sd flash cards
+device sdhci   # mmc/sd host controller
+
 # SATA
 device ahci
 

Modified: head/sys/arm/mv/armada38x/files.armada38x
==
--- head/sys/arm/mv/armada38x/files.armada38x   Tue May 16 04:47:50 2017
(r318336)
+++ head/sys/arm/mv/armada38x/files.armada38x   Tue May 16 05:10:15 2017
(r318337)
@@ -8,3 +8,4 @@ arm/mv/armada38x/armada38x_mp.c optional
 arm/mv/armada38x/pmsu.cstandard
 arm/mv/armada38x/rtc.c standard
 arm/mv/armada38x/armada38x_pl310.c optional pl310
+dev/sdhci/sdhci_fdt.c  optional sdhci

Modified: head/sys/dev/sdhci/sdhci_fdt.c
==
--- head/sys/dev/sdhci/sdhci_fdt.c  Tue May 16 04:47:50 2017
(r318336)
+++ head/sys/dev/sdhci/sdhci_fdt.c  Tue May 16 05:10:15 2017
(r318337)
@@ -57,7 +57,17 @@ __FBSDID("$FreeBSD$");
 #include "mmcbr_if.h"
 #include "sdhci_if.h"
 
-#defineMAX_SLOTS   6
+#defineMAX_SLOTS   6
+#defineSDHCI_FDT_ARMADA38X 1
+#defineSDHCI_FDT_GENERIC   2
+#defineSDHCI_FDT_XLNX_ZY7  3
+
+static struct ofw_compat_data compat_data[] = {
+   { "marvell,armada-380-sdhci",   SDHCI_FDT_ARMADA38X },
+   { "sdhci_generic",  SDHCI_FDT_GENERIC },
+   { "xlnx,zy7_sdhci", SDHCI_FDT_XLNX_ZY7 },
+   { NULL, 0 }
+};
 
 struct sdhci_fdt_softc {
device_tdev;/* Controller device */
@@ -181,13 +191,21 @@ sdhci_fdt_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (ofw_bus_is_compatible(dev, "sdhci_generic")) {
+   switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) {
+   case SDHCI_FDT_ARMADA38X:
+   sc->quirks = SDHCI_QUIRK_BROKEN_AUTO_STOP;
+   device_set_desc(dev, "ARMADA38X SDHCI controller");
+   break;
+   case SDHCI_FDT_GENERIC:
device_set_desc(dev, "generic fdt SDHCI controller");
-   } else if (ofw_bus_is_compatible(dev, "xlnx,zy7_sdhci")) {
+   break;
+   case SDHCI_FDT_XLNX_ZY7:
sc->quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK;
device_set_desc(dev, "Zynq-7000 generic fdt SDHCI controller");
-   } else
+   break;
+   default:
return (ENXIO);
+   }
 
node = ofw_bus_get_node(dev);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318336 - head/sys/arm/mv

2017-05-15 Thread Luiz Otavio O Souza
Author: loos
Date: Tue May 16 04:47:50 2017
New Revision: 318336
URL: https://svnweb.freebsd.org/changeset/base/318336

Log:
  Add the SDHCI Address Decoder registers and routines for ARMADA 38X.
  
  Tested on:ClearFog Pro
  Reviewed by:  Marcin Wojtas 
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D10601

Modified:
  head/sys/arm/mv/mv_common.c
  head/sys/arm/mv/mvwin.h

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Tue May 16 03:31:49 2017(r318335)
+++ head/sys/arm/mv/mv_common.c Tue May 16 04:47:50 2017(r318336)
@@ -82,6 +82,7 @@ static int decode_win_usb3_valid(void);
 static int decode_win_eth_valid(void);
 static int decode_win_pcie_valid(void);
 static int decode_win_sata_valid(void);
+static int decode_win_sdhci_valid(void);
 
 static int decode_win_idma_valid(void);
 static int decode_win_xor_valid(void);
@@ -95,6 +96,7 @@ static void decode_win_usb3_setup(u_long
 static void decode_win_eth_setup(u_long);
 static void decode_win_sata_setup(u_long);
 static void decode_win_ahci_setup(u_long);
+static void decode_win_sdhci_setup(u_long);
 
 static void decode_win_idma_setup(u_long);
 static void decode_win_xor_setup(u_long);
@@ -105,6 +107,7 @@ static void decode_win_eth_dump(u_long b
 static void decode_win_idma_dump(u_long base);
 static void decode_win_xor_dump(u_long base);
 static void decode_win_ahci_dump(u_long base);
+static void decode_win_sdhci_dump(u_long);
 
 static int fdt_get_ranges(const char *, void *, int, int *, int *);
 #ifdef SOC_MV_ARMADA38X
@@ -138,6 +141,7 @@ static struct soc_node_spec soc_nodes[] 
{ "mrvl,usb-ehci", &decode_win_usb_setup, &decode_win_usb_dump },
{ "marvell,armada-380-xhci", &decode_win_usb3_setup, 
&decode_win_usb3_dump },
{ "marvell,armada-380-ahci", &decode_win_ahci_setup, 
&decode_win_ahci_dump },
+   { "marvell,armada-380-sdhci", &decode_win_sdhci_setup, 
&decode_win_sdhci_dump },
{ "mrvl,sata", &decode_win_sata_setup, NULL },
{ "mrvl,xor", &decode_win_xor_setup, &decode_win_xor_dump },
{ "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump },
@@ -568,7 +572,8 @@ soc_decode_win(void)
if (!decode_win_cpu_valid() || !decode_win_usb_valid() ||
!decode_win_eth_valid() || !decode_win_idma_valid() ||
!decode_win_pcie_valid() || !decode_win_sata_valid() ||
-   !decode_win_xor_valid() || !decode_win_usb3_valid())
+   !decode_win_xor_valid() || !decode_win_usb3_valid() ||
+   !decode_win_sdhci_valid())
return (EINVAL);
 
decode_win_cpu_setup();
@@ -659,6 +664,11 @@ WIN_REG_BASE_IDX_RD(win_sata, sz, MV_WIN
 WIN_REG_BASE_IDX_WR(win_sata, sz, MV_WIN_SATA_SIZE);
 #endif
 
+WIN_REG_BASE_IDX_RD(win_sdhci, cr, MV_WIN_SDHCI_CTRL);
+WIN_REG_BASE_IDX_RD(win_sdhci, br, MV_WIN_SDHCI_BASE);
+WIN_REG_BASE_IDX_WR(win_sdhci, cr, MV_WIN_SDHCI_CTRL);
+WIN_REG_BASE_IDX_WR(win_sdhci, br, MV_WIN_SDHCI_BASE);
+
 #ifndef SOC_MV_DOVE
 WIN_REG_IDX_RD(ddr, br, MV_WIN_DDR_BASE, MV_DDR_CADR_BASE)
 WIN_REG_IDX_RD(ddr, sz, MV_WIN_DDR_SIZE, MV_DDR_CADR_BASE)
@@ -2073,6 +2083,60 @@ decode_win_sata_valid(void)
return (decode_win_can_cover_ddr(MV_WIN_SATA_MAX));
 }
 
+static void
+decode_win_sdhci_setup(u_long base)
+{
+   uint32_t cr, br;
+   int i, j;
+
+   for (i = 0; i < MV_WIN_SDHCI_MAX; i++) {
+   win_sdhci_cr_write(base, i, 0);
+   win_sdhci_br_write(base, i, 0);
+   }
+
+   for (i = 0; i < MV_WIN_DDR_MAX; i++)
+   if (ddr_is_active(i)) {
+   br = ddr_base(i);
+   cr = (((ddr_size(i) - 1) &
+   (IO_WIN_SIZE_MASK << IO_WIN_SIZE_SHIFT)) |
+   (ddr_attr(i) << IO_WIN_ATTR_SHIFT) |
+   (ddr_target(i) << IO_WIN_TGT_SHIFT) |
+   IO_WIN_ENA_MASK);
+
+   /* Use the first available SDHCI window */
+   for (j = 0; j < MV_WIN_SDHCI_MAX; j++) {
+   if (win_sdhci_cr_read(base, j) & 
IO_WIN_ENA_MASK)
+   continue;
+
+   win_sdhci_cr_write(base, j, cr);
+   win_sdhci_br_write(base, j, br);
+   break;
+   }
+   }
+}
+
+static void
+decode_win_sdhci_dump(u_long base)
+{
+   int i;
+
+   for (i = 0; i < MV_WIN_SDHCI_MAX; i++)
+   printf("SDHCI window#%d: c 0x%08x, b 0x%08x\n", i,
+   win_sdhci_cr_read(base, i), win_sdhci_br_read(base, i));
+}
+
+static int
+decode_win_sdhci_valid(void)
+{
+
+#ifdef SOC_MV_ARMADA38X
+   return (decode_win_can_cover_ddr(MV_WIN_SDHCI_MAX));
+#endif
+
+   /* Satisfy platforms not equipped with this c

svn commit: r318335 - in head/sys/powerpc: include powerpc

2017-05-15 Thread Justin Hibbits
Author: jhibbits
Date: Tue May 16 03:31:49 2017
New Revision: 318335
URL: https://svnweb.freebsd.org/changeset/base/318335

Log:
  Correct pa argument type for pmap_kenter_attr()
  
  Physical addresses are vm_paddr_t, not vm_offset_t.  This can make a 
difference
  when sizeof(vm_offset_t) != sizeof(vm_paddr_t).

Modified:
  head/sys/powerpc/include/pmap.h
  head/sys/powerpc/powerpc/bus_machdep.c
  head/sys/powerpc/powerpc/pmap_dispatch.c

Modified: head/sys/powerpc/include/pmap.h
==
--- head/sys/powerpc/include/pmap.h Tue May 16 03:12:51 2017
(r318334)
+++ head/sys/powerpc/include/pmap.h Tue May 16 03:31:49 2017
(r318335)
@@ -251,7 +251,7 @@ extern  struct pmap kernel_pmap_store;
 
 void   pmap_bootstrap(vm_offset_t, vm_offset_t);
 void   pmap_kenter(vm_offset_t va, vm_paddr_t pa);
-void   pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t);
+void   pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t);
 void   pmap_kremove(vm_offset_t);
 void   *pmap_mapdev(vm_paddr_t, vm_size_t);
 void   *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t);

Modified: head/sys/powerpc/powerpc/bus_machdep.c
==
--- head/sys/powerpc/powerpc/bus_machdep.c  Tue May 16 03:12:51 2017
(r318334)
+++ head/sys/powerpc/powerpc/bus_machdep.c  Tue May 16 03:31:49 2017
(r318335)
@@ -105,8 +105,9 @@ bs_gen_map(bus_addr_t addr, bus_size_t s
 void
 bs_remap_earlyboot(void)
 {
+   vm_paddr_t pa, spa;
+   vm_offset_t va;
int i;
-   vm_offset_t pa, spa, va;
vm_memattr_t ma;
 
for (i = 0; i < earlyboot_map_idx; i++) {

Modified: head/sys/powerpc/powerpc/pmap_dispatch.c
==
--- head/sys/powerpc/powerpc/pmap_dispatch.cTue May 16 03:12:51 2017
(r318334)
+++ head/sys/powerpc/powerpc/pmap_dispatch.cTue May 16 03:31:49 2017
(r318335)
@@ -495,7 +495,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p
 }
 
 void
-pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t ma)
+pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t ma)
 {
 
CTR4(KTR_PMAP, "%s(%#x, %#x, %#x)", __func__, va, pa, ma);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318334 - head/targets/pseudo/clang

2017-05-15 Thread Bryan Drewery
Author: bdrewery
Date: Tue May 16 03:12:51 2017
New Revision: 318334
URL: https://svnweb.freebsd.org/changeset/base/318334

Log:
  Enable llvm-objdump by default per r310775

Modified:
  head/targets/pseudo/clang/Makefile.depend

Modified: head/targets/pseudo/clang/Makefile.depend
==
--- head/targets/pseudo/clang/Makefile.depend   Tue May 16 02:48:46 2017
(r318333)
+++ head/targets/pseudo/clang/Makefile.depend   Tue May 16 03:12:51 2017
(r318334)
@@ -9,6 +9,7 @@ DIRDEPS = \
share/doc/llvm/clang \
usr.bin/clang/clang \
usr.bin/clang/clang-tblgen \
+   usr.bin/clang/llvm-objdump \
usr.bin/clang/llvm-tblgen \
 
 .if ${MK_LLDB} == "yes"
@@ -38,7 +39,6 @@ DIRDEPS+= \
usr.bin/clang/llvm-mc \
usr.bin/clang/llvm-modextract \
usr.bin/clang/llvm-nm \
-   usr.bin/clang/llvm-objdump \
usr.bin/clang/llvm-pdbdump \
usr.bin/clang/llvm-profdata \
usr.bin/clang/llvm-rtdyld \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318333 - head/contrib/ipfilter/tools

2017-05-15 Thread Cy Schubert
Author: cy
Date: Tue May 16 02:48:46 2017
New Revision: 318333
URL: https://svnweb.freebsd.org/changeset/base/318333

Log:
  Implement ippool command line IPv6 address parse support (for the -i
  option).
  
  PR:   218433

Modified:
  head/contrib/ipfilter/tools/ippool.c

Modified: head/contrib/ipfilter/tools/ippool.c
==
--- head/contrib/ipfilter/tools/ippool.cTue May 16 02:23:54 2017
(r318332)
+++ head/contrib/ipfilter/tools/ippool.cTue May 16 02:48:46 2017
(r318333)
@@ -1030,45 +1030,80 @@ int
 setnodeaddr(int type, int role, void *ptr, char *arg)
 {
struct in_addr mask;
+   sa_family_t family;
char *s;
 
-   s = strchr(arg, '/');
-   if (s == NULL)
-   mask.s_addr = 0x;
-   else if (strchr(s, '.') == NULL) {
-   if (ntomask(AF_INET, atoi(s + 1), &mask.s_addr) != 0)
-   return -1;
+   if (strchr(arg, ':') == NULL) {
+   family = AF_INET;
+   s = strchr(arg, '/');
+   if (s == NULL)
+   mask.s_addr = 0x;
+   else if (strchr(s, '.') == NULL) {
+   if (ntomask(AF_INET, atoi(s + 1), &mask.s_addr) != 0)
+   return -1;
+   } else {
+   mask.s_addr = inet_addr(s + 1);
+   }
+   if (s != NULL)
+   *s = '\0';
} else {
-   mask.s_addr = inet_addr(s + 1);
+   family = AF_INET6;
+
+   /* XXX for now we use mask for IPv6 prefix length */
+   /* XXX mask should be a union with prefix */
+   /* XXX Currently address handling is sloppy. */
+
+   if ((s = strchr(arg, '/')) == NULL)
+   mask.s_addr = 128;
+   else
+   mask.s_addr = atoi(s + 1);
}
-   if (s != NULL)
-   *s = '\0';
 
if (type == IPLT_POOL) {
ip_pool_node_t *node = ptr;
 
+   node->ipn_addr.adf_family = family;
+
 #ifdef USE_INET6
-   if (node->ipn_addr.adf_family == AF_INET)
+   if (node->ipn_addr.adf_family == AF_INET) {
 #endif
node->ipn_addr.adf_len = offsetof(addrfamily_t,
  adf_addr) +
 sizeof(struct in_addr);
+   node->ipn_addr.adf_addr.in4.s_addr = inet_addr(arg);
 #ifdef USE_INET6
-   else
+   } else {
node->ipn_addr.adf_len = offsetof(addrfamily_t,
  adf_addr) +
 sizeof(struct in6_addr);
+   inet_pton(AF_INET6, arg, 
+   &node->ipn_addr.adf_addr.in6.s6_addr);
+   }
 #endif
-   node->ipn_addr.adf_addr.in4.s_addr = inet_addr(arg);
node->ipn_mask.adf_len = node->ipn_addr.adf_len;
node->ipn_mask.adf_addr.in4.s_addr = mask.s_addr;
} else if (type == IPLT_HASH) {
iphtent_t *node = ptr;
 
-   node->ipe_addr.in4.s_addr = inet_addr(arg);
-   node->ipe_mask.in4.s_addr = mask.s_addr;
-   node->ipe_family = AF_INET;
-   node->ipe_unit = role;
+   node->ipe_family = family;
+   node->ipe_unit = role;
+
+#ifdef USE_INET6
+   if (node->ipe_family == AF_INET) {
+#endif
+   node->ipe_addr.in4.s_addr = inet_addr(arg);
+   node->ipe_mask.in4.s_addr = mask.s_addr;
+#ifdef USE_INET6
+   } else {
+   inet_pton(AF_INET6, arg, 
+   &node->ipe_addr.in6.__u6_addr.__u6_addr32);
+   node->ipe_mask.in6.__u6_addr.__u6_addr32[0] =
+   mask.s_addr;
+   node->ipe_mask.in6.__u6_addr.__u6_addr32[1] =
+   node->ipe_mask.in6.__u6_addr.__u6_addr32[2] = 
+   node->ipe_mask.in6.__u6_addr.__u6_addr32[3] = 0;
+   }
+#endif
}
 
return 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318332 - stable/11/share/mk

2017-05-15 Thread Bryan Drewery
Author: bdrewery
Date: Tue May 16 02:23:54 2017
New Revision: 318332
URL: https://svnweb.freebsd.org/changeset/base/318332

Log:
  MFC r318092:
  
PROGS+META_MODE: Avoid rebuilding common sources when recursing.

Modified:
  stable/11/share/mk/bsd.progs.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/bsd.progs.mk
==
--- stable/11/share/mk/bsd.progs.mk Tue May 16 00:34:53 2017
(r318331)
+++ stable/11/share/mk/bsd.progs.mk Tue May 16 02:23:54 2017
(r318332)
@@ -87,11 +87,7 @@ $v =
 # handle being called [bsd.]progs.mk
 .include 
 
-.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
-# tell progs.mk we might want to install things
-PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
-
-# Find common sources among the PROGS and depend on them before building
+# Find common sources among the PROGS to depend on them before building
 # anything.  This allows parallelization without them each fighting over
 # the same objects.
 _PROGS_COMMON_SRCS=
@@ -110,6 +106,20 @@ _PROGS_COMMON_OBJS=${_PROGS_COMMON_SRCS
 .if !empty(_PROGS_COMMON_SRCS:N*.[dhly])
 _PROGS_COMMON_OBJS+=   ${_PROGS_COMMON_SRCS:N*.[dhly]:R:S/$/.o/g}
 .endif
+.endif
+
+# When recursing, ensure common sources are not rebuilt in META_MODE.
+.if defined(_RECURSING_PROGS) && !empty(_PROGS_COMMON_OBJS) && \
+!empty(.MAKE.MODE:Mmeta)
+${_PROGS_COMMON_OBJS}: .NOMETA
+.endif
+
+.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
+# tell progs.mk we might want to install things
+PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+
+# Ensure common objects are built before recursing.
+.if !empty(_PROGS_COMMON_OBJS)
 ${PROGS}: ${_PROGS_COMMON_OBJS}
 .endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318331 - stable/11/sys/net

2017-05-15 Thread Alexander Motin
Author: mav
Date: Tue May 16 00:34:53 2017
New Revision: 318331
URL: https://svnweb.freebsd.org/changeset/base/318331

Log:
  MFC r317585: Propagate IFCAP_LRO from trunk to vlan interface.
  
  False positive here cost nothing, while false negative may lead to some
  confusions.

Modified:
  stable/11/sys/net/if_vlan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_vlan.c
==
--- stable/11/sys/net/if_vlan.c Tue May 16 00:33:46 2017(r318330)
+++ stable/11/sys/net/if_vlan.c Tue May 16 00:34:53 2017(r318331)
@@ -1583,6 +1583,16 @@ vlan_capabilities(struct ifvlan *ifv)
}
 
/*
+* If the parent interface can do LRO and checksum offloading on
+* VLANs, then guess it may do LRO on VLANs.  False positive here
+* cost nothing, while false negative may lead to some confusions.
+*/
+   if (p->if_capabilities & IFCAP_VLAN_HWCSUM)
+   cap |= p->if_capabilities & IFCAP_LRO;
+   if (p->if_capenable & IFCAP_VLAN_HWCSUM)
+   ena |= p->if_capenable & IFCAP_LRO;
+
+   /*
 * If the parent interface can offload TCP connections over VLANs then
 * propagate its TOE capability to the VLAN interface.
 *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318330 - stable/11/sys/net

2017-05-15 Thread Alexander Motin
Author: mav
Date: Tue May 16 00:33:46 2017
New Revision: 318330
URL: https://svnweb.freebsd.org/changeset/base/318330

Log:
  MFC r317547: Allow some control over enabled capabilities for if_vlan.
  
  It improves interoperability with if_bridge, which may need to disable
  some capabilities not supported by other members.  IMHO there is still
  open question about LRO capability, which may need to be disabled on
  physical interface.

Modified:
  stable/11/sys/net/if_vlan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_vlan.c
==
--- stable/11/sys/net/if_vlan.c Tue May 16 00:30:40 2017(r318329)
+++ stable/11/sys/net/if_vlan.c Tue May 16 00:33:46 2017(r318330)
@@ -112,6 +112,7 @@ struct  ifvlan {
 #definePARENT(ifv) ((ifv)->ifv_trunk->parent)
void*ifv_cookie;
int ifv_pflags; /* special flags we have set on parent */
+   int ifv_capenable;
struct  ifv_linkmib {
int ifvm_encaplen;  /* encapsulation length */
int ifvm_mtufudge;  /* MTU fudged by this much */
@@ -1286,6 +1287,7 @@ exists:
ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
ifv->ifv_mintu = ETHERMIN;
ifv->ifv_pflags = 0;
+   ifv->ifv_capenable = -1;
 
/*
 * If the parent supports the VLAN_MTU capability,
@@ -1537,9 +1539,14 @@ vlan_capabilities(struct ifvlan *ifv)
struct ifnet *p = PARENT(ifv);
struct ifnet *ifp = ifv->ifv_ifp;
struct ifnet_hw_tsomax hw_tsomax;
+   int cap = 0, ena = 0, mena;
+   u_long hwa = 0;
 
TRUNK_LOCK_ASSERT(TRUNK(ifv));
 
+   /* Mask parent interface enabled capabilities disabled by user. */
+   mena = p->if_capenable & ifv->ifv_capenable;
+
/*
 * If the parent interface can do checksum offloading
 * on VLANs, then propagate its hardware-assisted
@@ -1547,20 +1554,18 @@ vlan_capabilities(struct ifvlan *ifv)
 * offloading requires hardware VLAN tagging.
 */
if (p->if_capabilities & IFCAP_VLAN_HWCSUM)
-   ifp->if_capabilities =
-   p->if_capabilities & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
-
+   cap |= p->if_capabilities & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
if (p->if_capenable & IFCAP_VLAN_HWCSUM &&
p->if_capenable & IFCAP_VLAN_HWTAGGING) {
-   ifp->if_capenable =
-   p->if_capenable & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
-   ifp->if_hwassist = p->if_hwassist & (CSUM_IP | CSUM_TCP |
-   CSUM_UDP | CSUM_SCTP | CSUM_TCP_IPV6 | CSUM_UDP_IPV6 |
-   CSUM_SCTP_IPV6);
-   } else {
-   ifp->if_capenable = 0;
-   ifp->if_hwassist = 0;
+   ena |= mena & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6);
+   if (ena & IFCAP_TXCSUM)
+   hwa |= p->if_hwassist & (CSUM_IP | CSUM_TCP |
+   CSUM_UDP | CSUM_SCTP);
+   if (ena & IFCAP_TXCSUM_IPV6)
+   hwa |= p->if_hwassist & (CSUM_TCP_IPV6 |
+   CSUM_UDP_IPV6 | CSUM_SCTP_IPV6);
}
+
/*
 * If the parent interface can do TSO on VLANs then
 * propagate the hardware-assisted flag. TSO on VLANs
@@ -1570,13 +1575,11 @@ vlan_capabilities(struct ifvlan *ifv)
if_hw_tsomax_common(p, &hw_tsomax);
if_hw_tsomax_update(ifp, &hw_tsomax);
if (p->if_capabilities & IFCAP_VLAN_HWTSO)
-   ifp->if_capabilities |= p->if_capabilities & IFCAP_TSO;
+   cap |= p->if_capabilities & IFCAP_TSO;
if (p->if_capenable & IFCAP_VLAN_HWTSO) {
-   ifp->if_capenable |= p->if_capenable & IFCAP_TSO;
-   ifp->if_hwassist |= p->if_hwassist & CSUM_TSO;
-   } else {
-   ifp->if_capenable &= ~(p->if_capenable & IFCAP_TSO);
-   ifp->if_hwassist &= ~(p->if_hwassist & CSUM_TSO);
+   ena |= mena & IFCAP_TSO;
+   if (ena & IFCAP_TSO)
+   hwa |= p->if_hwassist & CSUM_TSO;
}
 
/*
@@ -1589,11 +1592,22 @@ vlan_capabilities(struct ifvlan *ifv)
 */
 #defineIFCAP_VLAN_TOE IFCAP_TOE
if (p->if_capabilities & IFCAP_VLAN_TOE)
-   ifp->if_capabilities |= p->if_capabilities & IFCAP_TOE;
+   cap |= p->if_capabilities & IFCAP_TOE;
if (p->if_capenable & IFCAP_VLAN_TOE) {
TOEDEV(ifp) = TOEDEV(p);
-   ifp->if_capenable |= p->if_capenable & IFCAP_TOE;
+   ena |= mena & IFCAP_TOE;
}
+
+   /*
+* If the parent interface supports dynamic link state, so does the
+* VLAN interface.
+*/
+   cap |= (p->if_capabilities & IFCAP_LINKSTATE);
+   ena |= (mena & IFCAP_LINKSTATE);
+
+   ifp->if_capabilities = cap;
+  

svn commit: r318329 - stable/11/sys/net

2017-05-15 Thread Alexander Motin
Author: mav
Date: Tue May 16 00:30:40 2017
New Revision: 318329
URL: https://svnweb.freebsd.org/changeset/base/318329

Log:
  MFC r317696, r317723, r317836:  Introduce sleepable locks into if_lagg.
  
  Before this change if_lagg was using nonsleepable rmlocks to protect its
  internal state.  This patch introduces another sx lock to protect code
  paths that require sleeping, while still uses old rmlock to protect hot
  nonsleepable data paths.
  
  This change allows to remove taskqueue decoupling used before to change
  interface addresses without holding the lock.  Instead it uses sx lock to
  protect direct if_ioctl() calls.
  
  As another bonus, the new code synchronizes enabled capabilities of member
  interfaces, and allows to control them with ifconfig laggX, that was
  impossible before.  This part should fix interoperation with if_bridge,
  that may need to disable some capabilities, such as TXCSUM or LRO, to allow
  bridging with noncapable interfaces.

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 16 00:21:03 2017(r318328)
+++ stable/11/sys/net/if_lagg.c Tue May 16 00:30:40 2017(r318329)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -98,10 +99,7 @@ static VNET_DEFINE(struct if_clone *, la
 #defineV_lagg_cloner   VNET(lagg_cloner)
 static const char laggname[] = "lagg";
 
-static voidlagg_lladdr(struct lagg_softc *, uint8_t *);
 static voidlagg_capabilities(struct lagg_softc *);
-static voidlagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype);
-static voidlagg_port_setlladdr(void *, int);
 static int lagg_port_create(struct lagg_softc *, struct ifnet *);
 static int lagg_port_destroy(struct lagg_port *, int);
 static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
@@ -118,8 +116,9 @@ static void lagg_port2req(struct lagg_po
 static voidlagg_init(void *);
 static voidlagg_stop(struct lagg_softc *);
 static int lagg_ioctl(struct ifnet *, u_long, caddr_t);
-static int lagg_ether_setmulti(struct lagg_softc *);
-static int lagg_ether_cmdmulti(struct lagg_port *, int);
+static int lagg_setmulti(struct lagg_port *);
+static int lagg_clrmulti(struct lagg_port *);
+static int lagg_setcaps(struct lagg_port *, int cap);
 static int lagg_setflag(struct lagg_port *, int, int,
int (*func)(struct ifnet *, int));
 static int lagg_setflags(struct lagg_port *, int status);
@@ -311,6 +310,7 @@ static void
 lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr)
 {
 
+   LAGG_XLOCK_ASSERT(sc);
KASSERT(sc->sc_proto == LAGG_PROTO_NONE, ("%s: sc %p has proto",
__func__, sc));
 
@@ -327,8 +327,8 @@ lagg_proto_detach(struct lagg_softc *sc)
 {
lagg_proto pr;
 
+   LAGG_XLOCK_ASSERT(sc);
LAGG_WLOCK_ASSERT(sc);
-
pr = sc->sc_proto;
sc->sc_proto = LAGG_PROTO_NONE;
 
@@ -427,15 +427,14 @@ lagg_register_vlan(void *arg, struct ifn
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, &tracker);
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, &tracker);
+   LAGG_SUNLOCK(sc);
 }
 
 /*
@@ -447,15 +446,14 @@ lagg_unregister_vlan(void *arg, struct i
 {
struct lagg_softc *sc = ifp->if_softc;
struct lagg_port *lp;
-   struct rm_priotracker tracker;
 
if (ifp->if_softc !=  arg)   /* Not our event */
return;
 
-   LAGG_RLOCK(sc, &tracker);
+   LAGG_SLOCK(sc);
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   LAGG_RUNLOCK(sc, &tracker);
+   LAGG_SUNLOCK(sc);
 }
 
 static int
@@ -471,7 +469,10 @@ lagg_clone_create(struct if_clone *ifc, 
free(sc, M_DEVBUF);
return (ENOSPC);
}
+   LAGG_LOCK_INIT(sc);
+   LAGG_SX_INIT(sc);
 
+   LAGG_XLOCK(sc);
if (V_def_use_flowid)
sc->sc_opts |= LAGG_OPT_USE_FLOWID;
sc->flowid_shift = V_def_flowid_shift;
@@ -481,9 +482,7 @@ lagg_clone_create(struct if_clone *ifc, 
 
lagg_proto_attach(sc, LAGG_PROTO_DEFAULT);
 
-   LAGG_LOCK_INIT(sc);
SLIST_INIT(&sc->sc_ports);
-   TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc);
 
/* Initialise pseudo media types */
ifmedia_init(&sc->sc_media, 0, lagg_media_change,
@@ -516,6 +515,7 @@ lagg_clone_create(struct if_clone *ifc, 

Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Simon J. Gerraty
Konstantin Belousov  wrote:
> > Consider a downstream vendor who has support for signed binary
> > executions.  If rtld allows a backdoor around exec(2) to run an unsigned
> > binary, that could be a problem for them.  It is on them to add support
> > to exec(2) to validate the special case of execing rtld with an
> > argument, or to just disable the feature in rtld from this commit.
> 
> Note the undocumented O_VERIFY flag in open(2) from the patch.
> This is very vendor-ish addition to request veriexec (?).

Yep, we make rtld use O_VERIFY so that it will not load/link anything
which is unsigned.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318328 - stable/11/sys/dev/uart

2017-05-15 Thread Alexander Motin
Author: mav
Date: Tue May 16 00:21:03 2017
New Revision: 318328
URL: https://svnweb.freebsd.org/changeset/base/318328

Log:
  MFC r317659, r317752:
  Make some UART consoles to not spin wait for data to be sent.
  
  At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot
  time with serial console at 115200 baud.

Modified:
  stable/11/sys/dev/uart/uart_dev_lpc.c
  stable/11/sys/dev/uart/uart_dev_ns8250.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/uart/uart_dev_lpc.c
==
--- stable/11/sys/dev/uart/uart_dev_lpc.c   Mon May 15 23:13:49 2017
(r318327)
+++ stable/11/sys/dev/uart/uart_dev_lpc.c   Tue May 16 00:21:03 2017
(r318328)
@@ -345,9 +345,6 @@ lpc_ns8250_putc(struct uart_bas *bas, in
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
-   limit = 25;
-   while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
-   DELAY(4);
 }
 
 static int
@@ -890,8 +887,13 @@ lpc_ns8250_bus_transmit(struct uart_soft
 
bas = &sc->sc_bas;
uart_lock(sc->sc_hwmtx);
-   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
-   ;
+   if (sc->sc_txdatasz > 1) {
+   if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+   lpc_ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+   } else {
+   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+   DELAY(4);
+   }
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);

Modified: stable/11/sys/dev/uart/uart_dev_ns8250.c
==
--- stable/11/sys/dev/uart/uart_dev_ns8250.cMon May 15 23:13:49 2017
(r318327)
+++ stable/11/sys/dev/uart/uart_dev_ns8250.cTue May 16 00:21:03 2017
(r318328)
@@ -335,9 +335,6 @@ ns8250_putc(struct uart_bas *bas, int c)
DELAY(4);
uart_setreg(bas, REG_DATA, c);
uart_barrier(bas);
-   limit = 25;
-   while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit)
-   DELAY(4);
 }
 
 static int
@@ -968,8 +965,13 @@ ns8250_bus_transmit(struct uart_softc *s
 
bas = &sc->sc_bas;
uart_lock(sc->sc_hwmtx);
-   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
-   ;
+   if (sc->sc_txdatasz > 1) {
+   if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0)
+   ns8250_drain(bas, UART_DRAIN_TRANSMITTER);
+   } else {
+   while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0)
+   DELAY(4);
+   }
for (i = 0; i < sc->sc_txdatasz; i++) {
uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]);
uart_barrier(bas);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318314 - head/lib/libc/sys

2017-05-15 Thread Maxim Konovalov
Hi Stephen,

On Mon, 15 May 2017, 19:32-, Stephen J. Kiernan wrote:

> Author: stevek
> Date: Mon May 15 19:32:26 2017
> New Revision: 318314
> URL: https://svnweb.freebsd.org/changeset/base/318314
>
> Log:
>   Add information to open(2) man page about the O_VERIFY flag.
>
>   Reviewed by:bjk wblock
>   Approved by:sjg (mentor)
>   Obtained from:  Juniper Networks, Inc.
>
> Modified:
>   head/lib/libc/sys/open.2
>
It is also

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219262

-- 
Maxim Konovalov
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318327 - in stable/10: contrib/netbsd-tests/lib/libc/rpc lib/libc/rpc

2017-05-15 Thread Brooks Davis
Author: brooks
Date: Mon May 15 23:13:49 2017
New Revision: 318327
URL: https://svnweb.freebsd.org/changeset/base/318327

Log:
  MFC r317660, r317710
  
  r317660:
  Support clnt_raw's use of FD_SETSIZE as a fake file descriptor.
  
  Accomplish this by allocating space for it in __svc_xports and allowing
  it to be registered.  The failure to allocate space was causing an
  out-of-bounds read in svc_getreq_common().  The failure to register
  caused PR 211804.
  
  The bug was found with CHERI bounds checking.
  
  PR:   211804
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Reviewed by:  ngie
  Differential Revision:https://reviews.freebsd.org/D10528
  
  r317710:
  Remove expected failure now that it was fixed in r317660.
  
  PR:   211804
  Reviewed by:  ngie
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10576

Modified:
  stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
  stable/10/lib/libc/rpc/svc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
==
--- stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon May 15 23:12:04 
2017(r318326)
+++ stable/10/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon May 15 23:13:49 
2017(r318327)
@@ -335,9 +335,6 @@ ATF_TC_BODY(raw, tc)
 #ifdef __FreeBSD_bug_216954__
atf_tc_expect_signal(SIGSEGV,
"fails with SIGSEGV only on ^/stable/10 -- bug # 216954");
-#else
-   atf_tc_expect_fail("fails with: clnt_call: "
-   "RPC: Can't decode result -- PR # 211804");
 #endif
 #endif
rawtest(NULL);

Modified: stable/10/lib/libc/rpc/svc.c
==
--- stable/10/lib/libc/rpc/svc.cMon May 15 23:12:04 2017
(r318326)
+++ stable/10/lib/libc/rpc/svc.cMon May 15 23:13:49 2017
(r318327)
@@ -108,18 +108,19 @@ xprt_register(SVCXPRT *xprt)
rwlock_wrlock(&svc_fd_lock);
if (__svc_xports == NULL) {
__svc_xports = (SVCXPRT **)
-   mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+   mem_alloc((FD_SETSIZE + 1) * sizeof(SVCXPRT *));
if (__svc_xports == NULL) {
rwlock_unlock(&svc_fd_lock);
return;
}
-   memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
+   memset(__svc_xports, '\0', (FD_SETSIZE + 1) * sizeof(SVCXPRT 
*));
}
if (sock < FD_SETSIZE) {
__svc_xports[sock] = xprt;
FD_SET(sock, &svc_fdset);
svc_maxfd = max(svc_maxfd, sock);
-   }
+   } else if (sock == FD_SETSIZE)
+   __svc_xports[sock] = xprt;
rwlock_unlock(&svc_fd_lock);
 }
 
@@ -157,7 +158,8 @@ __xprt_do_unregister(SVCXPRT *xprt, bool
if (__svc_xports[svc_maxfd])
break;
}
-   }
+   } else if ((sock == FD_SETSIZE) && (__svc_xports[sock] == xprt))
+   __svc_xports[sock] = NULL;
if (dolock)
rwlock_unlock(&svc_fd_lock);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318326 - head/sys/dev/vt

2017-05-15 Thread Jung-uk Kim
Author: jkim
Date: Mon May 15 23:12:04 2017
New Revision: 318326
URL: https://svnweb.freebsd.org/changeset/base/318326

Log:
  - Revert r317171. [1]
  - Fix overlapping corners and fix an off-by-one bug.
  
  MFC after:3 days
  Requested by: emaste [1]

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Mon May 15 22:52:25 2017(r318325)
+++ head/sys/dev/vt/vt_core.c   Mon May 15 23:12:04 2017(r318326)
@@ -1150,30 +1150,33 @@ vt_mark_mouse_position_as_dirty(struct v
 #endif
 
 static void
-vt_set_border(struct vt_device *vd, term_color_t c)
+vt_set_border(struct vt_device *vd, const term_rect_t *area,
+const term_color_t c)
 {
-   term_rect_t *tarea = &vd->vd_curwindow->vw_draw_area;
-   int x, y;
+   vd_drawrect_t *drawrect = vd->vd_driver->vd_drawrect;
 
-   /* Top bar. */
-   for (y = 0; y < tarea->tr_begin.tp_row; y++)
-   for (x = 0; x < vd->vd_width; x++)
-   vd->vd_driver->vd_setpixel(vd, x, y, c);
-
-   for (y = tarea->tr_begin.tp_row; y < tarea->tr_end.tp_row; y++) {
-   /* Left bar. */
-   for (x = 0; x < tarea->tr_begin.tp_col; x++)
-   vd->vd_driver->vd_setpixel(vd, x, y, c);
-
-   /* Right bar. */
-   for (x = tarea->tr_end.tp_col; x < vd->vd_width; x++)
-   vd->vd_driver->vd_setpixel(vd, x, y, c);
-   }
-
-   /* Bottom bar. */
-   for (y = tarea->tr_end.tp_row; y < vd->vd_height; y++)
-   for (x = 0; x < vd->vd_width; x++)
-   vd->vd_driver->vd_setpixel(vd, x, y, c);
+   if (drawrect == NULL)
+   return;
+
+   /* Top bar */
+   if (area->tr_begin.tp_row > 0)
+   drawrect(vd, 0, 0, vd->vd_width - 1,
+   area->tr_begin.tp_row - 1, 1, c);
+
+   /* Left bar */
+   if (area->tr_begin.tp_col > 0)
+   drawrect(vd, 0, area->tr_begin.tp_row,
+   area->tr_begin.tp_col - 1, area->tr_end.tp_row - 1, 1, c);
+
+   /* Right bar */
+   if (area->tr_end.tp_col < vd->vd_width)
+   drawrect(vd, area->tr_end.tp_col, area->tr_begin.tp_row,
+   vd->vd_width - 1, area->tr_end.tp_row - 1, 1, c);
+
+   /* Bottom bar */
+   if (area->tr_end.tp_row < vd->vd_height)
+   drawrect(vd, 0, area->tr_end.tp_row, vd->vd_width - 1,
+   vd->vd_height - 1, 1, c);
 }
 
 static int
@@ -1241,7 +1244,7 @@ vt_flush(struct vt_device *vd)
if (vd->vd_flags & VDF_INVALID) {
vd->vd_flags &= ~VDF_INVALID;
 
-   vt_set_border(vd, TC_BLACK);
+   vt_set_border(vd, &vw->vw_draw_area, TC_BLACK);
vt_termrect(vd, vf, &tarea);
if (vt_draw_logo_cpus)
vtterm_draw_cpu_logos(vd);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318325 - in head: etc/mtree usr.bin/procstat usr.bin/procstat/tests

2017-05-15 Thread Ngie Cooper
Author: ngie
Date: Mon May 15 22:52:25 2017
New Revision: 318325
URL: https://svnweb.freebsd.org/changeset/base/318325

Log:
  Start writing up some basic feature tests for procstat
  
  These tests query a running process for information related to the -b,
  -c, -e, and -f flags; the -f testcase is largely stubbed out, pending
  additional work to determine a good, deterministic descriptor.
  
  Core file test support is coming soon--it requires a bit more effort
  due to the fact that:
  - coredumps can be disabled (kern.coredump=0).
  - corefiles can be put in different directories than the current
directory, or be named something other than `.core`
(`kern.corefile`).
  
  MFC after:2 months
  Sponsored by: Dell EMC Isilon

Added:
  head/usr.bin/procstat/tests/
  head/usr.bin/procstat/tests/Makefile   (contents, props changed)
  head/usr.bin/procstat/tests/procstat_test.sh   (contents, props changed)
  head/usr.bin/procstat/tests/while1.c   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/usr.bin/procstat/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Mon May 15 22:51:22 2017
(r318324)
+++ head/etc/mtree/BSD.tests.dist   Mon May 15 22:52:25 2017
(r318325)
@@ -650,6 +650,8 @@
 ..
 printf
 ..
+procstat
+..
 sdiff
 ..
 sed

Modified: head/usr.bin/procstat/Makefile
==
--- head/usr.bin/procstat/Makefile  Mon May 15 22:51:22 2017
(r318324)
+++ head/usr.bin/procstat/Makefile  Mon May 15 22:52:25 2017
(r318325)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  procstat
 MAN=   procstat.1
 SRCS=  procstat.c  \
@@ -20,4 +22,8 @@ SRCS= procstat.c  \
 
 LIBADD+=   procstat xo util sbuf
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=   tests
+.endif
+
 .include 

Added: head/usr.bin/procstat/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/procstat/tests/MakefileMon May 15 22:52:25 2017
(r318325)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+ATF_TESTS_SH+= procstat_test
+
+PROGS+=while1
+
+BINDIR=${TESTSDIR}
+
+.include 

Added: head/usr.bin/procstat/tests/procstat_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/procstat/tests/procstat_test.shMon May 15 22:52:25 
2017(r318325)
@@ -0,0 +1,140 @@
+#
+# Copyright (c) 2017 Ngie Cooper 
+# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+MAX_TRIES=20
+PROG_PID=
+PROG_PATH=$(atf_get_srcdir)/while1
+
+SP='[[:space:]]'
+
+start_program()
+{
+   echo "Starting program in background"
+   PROG_COMM=while1
+   PROG_PATH=$(atf_get_srcdir)/$PROG_COMM
+
+   $PROG_PATH $* &
+   PROG_PID=$!
+   try=0
+   while [ $try -lt $MAX_TRIES ] && ! kill -0 $PROG_PID; do
+   sleep 0.5
+   : $(( try += 1 ))
+   done
+   if [ $try -ge $MAX_TRIES ]; then
+   atf_fail "Polled for program start $MAX_TRIES tries and failed"
+   fi
+}
+
+atf_test_case binary_info
+binary_info_head()
+{
+   atf_set "descr" "Checks -b support"
+}
+binary_info_body()
+{
+   start_program bogus-arg
+
+   line_format="$SP*%s$SP+%s$SP+%s$SP+%s$SP*"
+   header_re=$(printf "$line_format" "PID" "COM

svn commit: r318323 - in stable/10: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2017-05-15 Thread Brooks Davis
Author: brooks
Date: Mon May 15 22:50:54 2017
New Revision: 318323
URL: https://svnweb.freebsd.org/changeset/base/318323

Log:
  MFC r317845-r317846
  
  r317845:
  Provide a freebsd32 implementation of sigqueue()
  
  The previous misuse of sys_sigqueue() was sending random register or
  stack garbage to 64-bit targets.  The freebsd32 implementation preserves
  the sival_int member of value when signaling a 64-bit process.
  
  Document the mixed ABI implementation of union sigval and the
  incompability of sival_ptr with pointer integrity schemes.
  
  Reviewed by:  kib, wblock
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10605
  
  r317846:
  Regen post r317845.
  
  MFC with: r317845
  Sponsored by: DARPA, AFRL

Modified:
  stable/10/lib/libc/sys/sigqueue.2
  stable/10/sys/compat/freebsd32/freebsd32_misc.c
  stable/10/sys/compat/freebsd32/freebsd32_proto.h
  stable/10/sys/compat/freebsd32/freebsd32_syscall.h
  stable/10/sys/compat/freebsd32/freebsd32_syscalls.c
  stable/10/sys/compat/freebsd32/freebsd32_sysent.c
  stable/10/sys/compat/freebsd32/freebsd32_systrace_args.c
  stable/10/sys/compat/freebsd32/syscalls.master
  stable/10/sys/kern/kern_sig.c
  stable/10/sys/sys/syscallsubr.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/sys/sigqueue.2
==
--- stable/10/lib/libc/sys/sigqueue.2   Mon May 15 22:41:01 2017
(r318322)
+++ stable/10/lib/libc/sys/sigqueue.2   Mon May 15 22:50:54 2017
(r318323)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 10, 2012
+.Dd May 5, 2017
 .Dt SIGQUEUE 2
 .Os
 .Sh NAME
@@ -129,7 +129,6 @@ does not exist.
 .Xr kill 2 ,
 .Xr sigaction 2 ,
 .Xr sigpending 2 ,
-.Xr sigqueue 2 ,
 .Xr sigsuspend 2 ,
 .Xr sigtimedwait 2 ,
 .Xr sigwait 2 ,
@@ -147,3 +146,18 @@ Support for
 .Tn POSIX
 realtime signal queue first appeared in
 .Fx 7.0 .
+.Sh CAVEATS
+When using
+.Nm
+to send signals to a process which might have a different ABI
+(for instance, one is 32-bit and the other 64-bit),
+the
+.Va sival_int
+member of
+.Fa value
+can be delivered reliably, but the
+.Va sival_ptr
+may be truncated in endian dependent ways and must not be relied on.
+Further, many pointer integrity schemes disallow sending pointers to other
+processes, and this technique should not be used in programs intended to
+be portable.

Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/10/sys/compat/freebsd32/freebsd32_misc.c Mon May 15 22:41:01 
2017(r318322)
+++ stable/10/sys/compat/freebsd32/freebsd32_misc.c Mon May 15 22:50:54 
2017(r318323)
@@ -2581,6 +2581,32 @@ siginfo_to_siginfo32(const siginfo_t *sr
dst->si_overrun = src->si_overrun;
 }
 
+#ifndef _FREEBSD32_SYSPROTO_H_
+struct freebsd32_sigqueue_args {
+pid_t pid;
+int signum;
+/* union sigval32 */ int value;
+};
+#endif
+int
+freebsd32_sigqueue(struct thread *td, struct freebsd32_sigqueue_args *uap)
+{
+   union sigval sv;
+
+   /*
+* On 32-bit ABIs, sival_int and sival_ptr are the same.
+* On 64-bit little-endian ABIs, the low bits are the same.
+* In 64-bit big-endian ABIs, sival_int overlaps with
+* sival_ptr's HIGH bits.  We choose to support sival_int
+* rather than sival_ptr in this case as it seems to be
+* more common.
+*/
+   bzero(&sv, sizeof(sv));
+   sv.sival_int = uap->value;
+
+   return (kern_sigqueue(td, uap->pid, uap->signum, &sv));
+}
+
 int
 freebsd32_sigtimedwait(struct thread *td, struct freebsd32_sigtimedwait_args 
*uap)
 {

Modified: stable/10/sys/compat/freebsd32/freebsd32_proto.h
==
--- stable/10/sys/compat/freebsd32/freebsd32_proto.hMon May 15 22:41:01 
2017(r318322)
+++ stable/10/sys/compat/freebsd32/freebsd32_proto.hMon May 15 22:50:54 
2017(r318323)
@@ -395,6 +395,11 @@ struct freebsd32_thr_new_args {
char param_l_[PADL_(struct thr_param32 *)]; struct thr_param32 * param; 
char param_r_[PADR_(struct thr_param32 *)];
char param_size_l_[PADL_(int)]; int param_size; char 
param_size_r_[PADR_(int)];
 };
+struct freebsd32_sigqueue_args {
+   char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];
+   char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];
+   char value_l_[PADL_(int)]; int value; char value_r_[PADR_(int)];
+};
 struct freebsd32_kmq_open_args {
char path_l_[PADL_(const char *)]; const char * path; char 
path_r_[PADR_(const char *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
@@ -785,6 +790,7 @@ int freebsd32_ksem_timedwait(struct thre
 intfreebsd32_thr_suspend(struct thread *, struct 
freebsd32_thr_suspend_args *);
 intfreebs

svn commit: r318324 - stable/11/sys/compat/linux

2017-05-15 Thread Tai-hwa Liang
Author: avatar
Date: Mon May 15 22:51:22 2017
New Revision: 318324
URL: https://svnweb.freebsd.org/changeset/base/318324

Log:
  MFC 316658:
  
  Adding SIOCGIFNAME support in Linuxulator.  This should silence the console 
warning associated
  with linux-opera:
linux: pid 23492 (opera): ioctl fd=5, cmd=0x8910 ('\M^I',16) is not 
implemented
linux: pid 23492 (opera): ioctl fd=28, cmd=0x8910 ('\M^I',16) is not 
implemented
...
  
  Reviewed by:  kib, marcel, dchagin
  Tested with:  linux-opera-12.16_3

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.cMon May 15 22:50:54 2017
(r318323)
+++ stable/11/sys/compat/linux/linux_ioctl.cMon May 15 22:51:22 2017
(r318324)
@@ -2173,6 +2173,49 @@ ifname_linux_to_bsd(struct thread *td, c
 }
 
 /*
+ * Implement the SIOCGIFNAME ioctl
+ */
+
+static int
+linux_ioctl_ifname(struct thread *td, struct l_ifreq *uifr)
+{
+   struct l_ifreq ifr;
+   struct ifnet *ifp;
+   int error, ethno, index;
+
+   error = copyin(uifr, &ifr, sizeof(ifr));
+   if (error != 0)
+   return (error);
+
+   CURVNET_SET(TD_TO_VNET(curthread));
+   IFNET_RLOCK();
+   index = 1;  /* ifr.ifr_ifindex starts from 1 */
+   ethno = 0;
+   error = ENODEV;
+   TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
+   if (ifr.ifr_ifindex == index) {
+   if (IFP_IS_ETH(ifp))
+   snprintf(ifr.ifr_name, LINUX_IFNAMSIZ,
+   "eth%d", ethno);
+   else
+   strlcpy(ifr.ifr_name, ifp->if_xname,
+   LINUX_IFNAMSIZ);
+   error = 0;
+   break;
+   }
+   if (IFP_IS_ETH(ifp))
+   ethno++;
+   index++;
+   }
+   IFNET_RUNLOCK();
+   if (error == 0)
+   error = copyout(&ifr, uifr, sizeof(ifr));
+   CURVNET_RESTORE();
+
+   return (error);
+}
+
+/*
  * Implement the SIOCGIFCONF ioctl
  */
 
@@ -2399,6 +2442,7 @@ linux_ioctl_socket(struct thread *td, st
case LINUX_SIOCADDMULTI:
case LINUX_SIOCATMARK:
case LINUX_SIOCDELMULTI:
+   case LINUX_SIOCGIFNAME:
case LINUX_SIOCGIFCONF:
case LINUX_SIOCGPGRP:
case LINUX_SIOCSPGRP:
@@ -2484,6 +2528,10 @@ linux_ioctl_socket(struct thread *td, st
 
/* LINUX_SIOCGSTAMP */
 
+   case LINUX_SIOCGIFNAME:
+   error = linux_ioctl_ifname(td, (struct l_ifreq *)args->arg);
+   break;
+
case LINUX_SIOCGIFCONF:
error = linux_ifconf(td, (struct ifconf *)args->arg);
break;

Modified: stable/11/sys/compat/linux/linux_ioctl.h
==
--- stable/11/sys/compat/linux/linux_ioctl.hMon May 15 22:50:54 2017
(r318323)
+++ stable/11/sys/compat/linux/linux_ioctl.hMon May 15 22:51:22 2017
(r318324)
@@ -226,6 +226,7 @@
 #defineLINUX_SIOCGPGRP 0x8904
 #defineLINUX_SIOCATMARK0x8905
 #defineLINUX_SIOCGSTAMP0x8906
+#defineLINUX_SIOCGIFNAME   0x8910
 #defineLINUX_SIOCGIFCONF   0x8912
 #defineLINUX_SIOCGIFFLAGS  0x8913
 #defineLINUX_SIOCGIFADDR   0x8915
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318322 - in stable/11: contrib/netbsd-tests/lib/libc/rpc lib/libc/rpc

2017-05-15 Thread Brooks Davis
Author: brooks
Date: Mon May 15 22:41:01 2017
New Revision: 318322
URL: https://svnweb.freebsd.org/changeset/base/318322

Log:
  MFC r317660, r317710
  
  r317660:
  Support clnt_raw's use of FD_SETSIZE as a fake file descriptor.
  
  Accomplish this by allocating space for it in __svc_xports and allowing
  it to be registered.  The failure to allocate space was causing an
  out-of-bounds read in svc_getreq_common().  The failure to register
  caused PR 211804.
  
  The bug was found with CHERI bounds checking.
  
  PR:   211804
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Reviewed by:  ngie
  Differential Revision:https://reviews.freebsd.org/D10528
  
  r317710:
  Remove expected failure now that it was fixed in r317660.
  
  PR:   211804
  Reviewed by:  ngie
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10576

Modified:
  stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
  stable/11/lib/libc/rpc/svc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
==
--- stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon May 15 21:58:36 
2017(r318321)
+++ stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Mon May 15 22:41:01 
2017(r318322)
@@ -325,10 +325,6 @@ ATF_TC_HEAD(raw, tc)
 
 ATF_TC_BODY(raw, tc)
 {
-#ifdef __FreeBSD__
-   atf_tc_expect_fail("fails with: clnt_call: "
-   "RPC: Can't decode result -- PR # 211804");
-#endif
rawtest(NULL);
 
 }

Modified: stable/11/lib/libc/rpc/svc.c
==
--- stable/11/lib/libc/rpc/svc.cMon May 15 21:58:36 2017
(r318321)
+++ stable/11/lib/libc/rpc/svc.cMon May 15 22:41:01 2017
(r318322)
@@ -108,18 +108,19 @@ xprt_register(SVCXPRT *xprt)
rwlock_wrlock(&svc_fd_lock);
if (__svc_xports == NULL) {
__svc_xports = (SVCXPRT **)
-   mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *));
+   mem_alloc((FD_SETSIZE + 1) * sizeof(SVCXPRT *));
if (__svc_xports == NULL) {
rwlock_unlock(&svc_fd_lock);
return;
}
-   memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *));
+   memset(__svc_xports, '\0', (FD_SETSIZE + 1) * sizeof(SVCXPRT 
*));
}
if (sock < FD_SETSIZE) {
__svc_xports[sock] = xprt;
FD_SET(sock, &svc_fdset);
svc_maxfd = max(svc_maxfd, sock);
-   }
+   } else if (sock == FD_SETSIZE)
+   __svc_xports[sock] = xprt;
rwlock_unlock(&svc_fd_lock);
 }
 
@@ -157,7 +158,8 @@ __xprt_do_unregister(SVCXPRT *xprt, bool
if (__svc_xports[svc_maxfd])
break;
}
-   }
+   } else if ((sock == FD_SETSIZE) && (__svc_xports[sock] == xprt))
+   __svc_xports[sock] = NULL;
if (dolock)
rwlock_unlock(&svc_fd_lock);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 01:00:48PM -0700, Rodney W. Grimes wrote:
> > On Mon, May 15, 2017 at 03:09:33PM -0400, Nikolai Lifanov wrote:
> > > On 05/15/2017 14:52, Alexey Dokuchaev wrote:
> > ...
> > Because /bin/chmod is owned by root, not because /libexec/ld-elf.so.1 is
> > limiting execution to root only, or is it (I might have missed uid check
> > in that patch [1], but at a quick glance I didn't see it).
> > 
> > On a living system, there are plenty of other ways to restore missing
> > +x on /bin/chmod as long as you can call chmod(2), from simple Python
> > script down to manually crafting small binary in hex.
> 
> Simple tool to get out of this is use of install(8) to "install" your
> broken chmod to another file with proper modes.  And if you lost that
> one you could use mtree(8) with a easily crafted input file.

Right.  Like I've said, there are plenty of ways.  In the mean time...

While we've been somewhat calmed by r313967, which had secured us from
consequences of running binaries from filesystems mounted with -o noexec,
few questions had remained unanswered so far:

  - Would doing chmod -x /libexec/ld-elf.so.1 break anything from now on?
  - Does it make sense to implement something like [1]?
  - Could original "MFC after: 2 weeks" be extended a bit to give more
time to gather enough feedback?  I don't see the need for the rush.

./danfe

> > [1] Idea for security.bsd.ld_elf_exec_root_only sysctl(8)?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 21:09 +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 02:49:30PM -0600, Ian Lepore wrote:
> > 
> > ...
> > You acknowledge that the situation is different for ports, so does that
> > mean your objections go away when base becomes packaged and faces the
> > same installation and update issues that packaged ports do?  Because I
> > was under the impression that's coming pretty soon.
> The reason it is different for ports is because we cannot know up-front what
> software might user have installed and ergo what logs should be rotated by
> newsyslog(8).  For the base, we know these pieces (albeit packaging the base
> could probably benefit from the same generic approach, if we ever start to
> support 3rd-party "base" packages).
> 
> ./danfe
> 

The same is true of packaged base -- the user may have installed a
subset of the base system.  No need to configure ftp log stuff if ftp
didn't get installed.  Likewise for ntp, mail, news, everything that
has its own syslog facility code.

And really, while syslog config started this thread, most of what I've
been saying is more widely related to my initial comment:  moving from
monolithic to per-subsystem/object/whatever config files has been the
freebsd trend for a while.  That's not just for syslog rotation, that's
for rc config and jail config and pam (maybe where the trend started?)
and devd and periodic jobs and so on.

Most of these things support both a single file and individual files,
so nobody is forced to change all at once, but it does seem natural
that the existing base code evolve towards the newer mechanism.  When
it makes sense to still have the original file and only split out parts
of it to individual files, it might also make sense to drop a comment
into the original file to let old-timers know they should go looking in
the newer directory for additional entries.

Or it might makes sense to say: no half measures for a given
configuration scheme, if some items are to be split out to separate
files, then everything should be split, so that before the next major
release there is only a monolithic file, or a directory full of fine-
grained config, but not a mix.  I'm not advocating for that
necessarily, just thinking out loud really.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318321 - head/sys/netinet

2017-05-15 Thread Gleb Smirnoff
Author: glebius
Date: Mon May 15 21:58:36 2017
New Revision: 318321
URL: https://svnweb.freebsd.org/changeset/base/318321

Log:
  Reduce in_pcbinfo_init() by two params.  No users supply any flags to this
  function (they used to say UMA_ZONE_NOFREE), so flag parameter goes away.
  The zone_fini parameter also goes away.  Previously no protocols (except
  divert) supplied zone_fini function, so inpcb locks were leaked with slabs.
  This was okay while zones were allocated with UMA_ZONE_NOFREE flag, but now
  this is a leak.  Fix that by suppling inpcb_fini() function as fini method
  for all inpcb zones.

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_divert.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Mon May 15 21:50:34 2017(r318320)
+++ head/sys/netinet/in_pcb.c   Mon May 15 21:58:36 2017(r318321)
@@ -212,14 +212,25 @@ SYSCTL_INT(_net_inet_ip_portrange, OID_A
  */
 
 /*
+ * Different protocols initialize their inpcbs differently - giving
+ * different name to the lock.  But they all are disposed the same.
+ */
+static void
+inpcb_fini(void *mem, int size)
+{
+   struct inpcb *inp = mem;
+
+   INP_LOCK_DESTROY(inp);
+}
+
+/*
  * Initialize an inpcbinfo -- we should be able to reduce the number of
  * arguments in time.
  */
 void
 in_pcbinfo_init(struct inpcbinfo *pcbinfo, const char *name,
 struct inpcbhead *listhead, int hash_nelements, int porthash_nelements,
-char *inpcbzone_name, uma_init inpcbzone_init, uma_fini inpcbzone_fini,
-uint32_t inpcbzone_flags, u_int hashfields)
+char *inpcbzone_name, uma_init inpcbzone_init, u_int hashfields)
 {
 
INP_INFO_LOCK_INIT(pcbinfo, name);
@@ -239,8 +250,7 @@ in_pcbinfo_init(struct inpcbinfo *pcbinf
in_pcbgroup_init(pcbinfo, hashfields, hash_nelements);
 #endif
pcbinfo->ipi_zone = uma_zcreate(inpcbzone_name, sizeof(struct inpcb),
-   NULL, NULL, inpcbzone_init, inpcbzone_fini, UMA_ALIGN_PTR,
-   inpcbzone_flags);
+   NULL, NULL, inpcbzone_init, inpcb_fini, UMA_ALIGN_PTR, 0);
uma_zone_set_max(pcbinfo->ipi_zone, maxsockets);
uma_zone_set_warning(pcbinfo->ipi_zone,
"kern.ipc.maxsockets limit reached");

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Mon May 15 21:50:34 2017(r318320)
+++ head/sys/netinet/in_pcb.h   Mon May 15 21:58:36 2017(r318321)
@@ -690,7 +690,7 @@ VNET_DECLARE(int, ipport_tcpallocs);
 
 void   in_pcbinfo_destroy(struct inpcbinfo *);
 void   in_pcbinfo_init(struct inpcbinfo *, const char *, struct inpcbhead *,
-   int, int, char *, uma_init, uma_fini, uint32_t, u_int);
+   int, int, char *, uma_init, u_int);
 
 intin_pcbbind_check_bindmulti(const struct inpcb *ni,
const struct inpcb *oi);

Modified: head/sys/netinet/ip_divert.c
==
--- head/sys/netinet/ip_divert.cMon May 15 21:50:34 2017
(r318320)
+++ head/sys/netinet/ip_divert.cMon May 15 21:58:36 2017
(r318321)
@@ -141,14 +141,6 @@ div_inpcb_init(void *mem, int size, int 
 }
 
 static void
-div_inpcb_fini(void *mem, int size)
-{
-   struct inpcb *inp = mem;
-
-   INP_LOCK_DESTROY(inp);
-}
-
-static void
 div_init(void)
 {
 
@@ -158,7 +150,7 @@ div_init(void)
 * place for hashbase == NULL.
 */
in_pcbinfo_init(&V_divcbinfo, "div", &V_divcb, 1, 1, "divcb",
-   div_inpcb_init, div_inpcb_fini, 0, IPI_HASHFIELDS_NONE);
+   div_inpcb_init, IPI_HASHFIELDS_NONE);
 }
 
 static void

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Mon May 15 21:50:34 2017(r318320)
+++ head/sys/netinet/raw_ip.c   Mon May 15 21:58:36 2017(r318321)
@@ -210,7 +210,7 @@ rip_init(void)
 {
 
in_pcbinfo_init(&V_ripcbinfo, "rip", &V_ripcb, INP_PCBHASH_RAW_SIZE,
-   1, "ripcb", rip_inpcb_init, NULL, 0, IPI_HASHFIELDS_NONE);
+   1, "ripcb", rip_inpcb_init, IPI_HASHFIELDS_NONE);
EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change, NULL,
EVENTHANDLER_PRI_ANY);
 }

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Mon May 15 21:50:34 2017(r318320)
+++ head/sys/netinet/tcp_subr.c Mon May 15 21:58:36 2017(r318321)
@@ -647,7 +647,7 @@ tcp_init(void)
hashsize);
}
in_pcbinfo_init(&V_tcbinfo, "tcp", &V_tcb, hashsize, hashsize,
-   "tcp_inpcb", tcp_inpcb_init, NULL, 0, IPI_HASHFIELDS

svn commit: r318320 - head/lib/libstand

2017-05-15 Thread Toomas Soome
Author: tsoome
Date: Mon May 15 21:50:34 2017
New Revision: 318320
URL: https://svnweb.freebsd.org/changeset/base/318320

Log:
  loader: add ip layer code into libstand
  
  Implement simple separate ip module and fragment re-assembly.
  
  The work is based on send and receive previously implemented in udp.c,
  moved to ip.c and added the ip fragment re-assembly.
  
  This change allows to specify larger tftp or nfs payload, such as:
  tftp.blksize=4096 or nfs.read_size=4096
  
  Reviewed by:bapt
  Differential Revision:  https://reviews.freebsd.org/D10631

Added:
  head/lib/libstand/ip.c   (contents, props changed)
Modified:
  head/lib/libstand/Makefile
  head/lib/libstand/net.h
  head/lib/libstand/udp.c

Modified: head/lib/libstand/Makefile
==
--- head/lib/libstand/Makefile  Mon May 15 21:44:40 2017(r318319)
+++ head/lib/libstand/Makefile  Mon May 15 21:50:34 2017(r318320)
@@ -141,7 +141,7 @@ SRCS+=  closeall.c dev.c ioctl.c nullfs.c
fstat.c close.c lseek.c open.c read.c write.c readdir.c
 
 # network routines
-SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
+SRCS+= arp.c ether.c ip.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
 
 # network info services:
 SRCS+= bootp.c rarp.c bootparam.c

Added: head/lib/libstand/ip.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libstand/ip.c  Mon May 15 21:50:34 2017(r318320)
@@ -0,0 +1,422 @@
+/*
+ * Copyright (c) 1992 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+/*
+ * The send and receive functions were originally implemented in udp.c and
+ * moved here. Also it is likely some more cleanup can be done, especially
+ * once we will implement the support for tcp.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "stand.h"
+#include "net.h"
+
+typedef STAILQ_HEAD(ipqueue, ip_queue) ip_queue_t;
+struct ip_queue {
+   void*ipq_pkt;
+   struct ip   *ipq_hdr;
+   STAILQ_ENTRY(ip_queue) ipq_next;
+};
+
+/*
+ * Fragment re-assembly queue.
+ */
+struct ip_reasm {
+   struct in_addr  ip_src;
+   struct in_addr  ip_dst;
+   uint16_tip_id;
+   uint8_t ip_proto;
+   uint8_t ip_ttl;
+   size_t  ip_total_size;
+   ip_queue_t  ip_queue;
+   void*ip_pkt;
+   struct ip   *ip_hdr;
+   STAILQ_ENTRY(ip_reasm) ip_next;
+};
+
+STAILQ_HEAD(ire_list, ip_reasm) ire_list = STAILQ_HEAD_INITIALIZER(ire_list);
+
+/* Caller must leave room for ethernet and ip headers in front!! */
+ssize_t
+sendip(struct iodesc *d, void *pkt, size_t len, uint8_t proto)
+{
+   ssize_t cc;
+   struct ip *ip;
+   u_char *ea;
+
+#ifdef NET_DEBUG
+   if (debug) {
+   printf("sendip: proto: %x d=%p called.\n", proto, (void *)d);
+   if (d) {
+   printf("saddr: %s:%d",
+   inet_ntoa(d->myip), ntohs(d->myport));
+

svn commit: r318319 - head/sys/cddl/dev/profile

2017-05-15 Thread Mark Johnston
Author: markj
Date: Mon May 15 21:44:40 2017
New Revision: 318319
URL: https://svnweb.freebsd.org/changeset/base/318319

Log:
  Ensure that profile and tick probes provide a non-zero PC value.
  
  The idle thread may process callouts while reloading the timer in
  cpu_activeclock(). In this case, provide a representative value, &cpu_idle,
  instead of 0 for args[0] so that the active thread can be more easily
  identified from the probe.
  
  This addresses intermittent failures of the profile-n/tst.argtest.d test.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D10651

Modified:
  head/sys/cddl/dev/profile/profile.c

Modified: head/sys/cddl/dev/profile/profile.c
==
--- head/sys/cddl/dev/profile/profile.c Mon May 15 20:52:43 2017
(r318318)
+++ head/sys/cddl/dev/profile/profile.c Mon May 15 21:44:40 2017
(r318319)
@@ -266,37 +266,43 @@ sbt_to_nsec(sbintime_t sbt)
 }
 
 static void
-profile_fire(void *arg)
+profile_probe(profile_probe_t *prof, hrtime_t late)
 {
-   profile_probe_percpu_t *pcpu = arg;
-   profile_probe_t *prof = pcpu->profc_probe;
-   hrtime_t late;
+   struct thread *td;
struct trapframe *frame;
uintfptr_t pc, upc;
 
-#ifdef illumos
-   late = gethrtime() - pcpu->profc_expected;
-#else
-   late = sbt_to_nsec(sbinuptime() - pcpu->profc_expected);
-#endif
-
-   pc = 0;
-   upc = 0;
+   td = curthread;
+   pc = upc = 0;
 
/*
-* td_intr_frame can be unset if this is a catch up event
-* after waking up from idle sleep.
-* This can only happen on a CPU idle thread.
+* td_intr_frame can be unset if this is a catch-up event upon waking up
+* from idle sleep. This can only happen on a CPU idle thread. Use a
+* representative arg0 value in this case so that one of the probe
+* arguments is non-zero.
 */
-   frame = curthread->td_intr_frame;
+   frame = td->td_intr_frame;
if (frame != NULL) {
if (TRAPF_USERMODE(frame))
upc = TRAPF_PC(frame);
else
pc = TRAPF_PC(frame);
-   }
+   } else if (TD_IS_IDLETHREAD(td))
+   pc = (uintfptr_t)&cpu_idle;
+
dtrace_probe(prof->prof_id, pc, upc, late, 0, 0);
+}
 
+static void
+profile_fire(void *arg)
+{
+   profile_probe_percpu_t *pcpu = arg;
+   profile_probe_t *prof = pcpu->profc_probe;
+   hrtime_t late;
+
+   late = sbt_to_nsec(sbinuptime() - pcpu->profc_expected);
+
+   profile_probe(prof, late);
pcpu->profc_expected += pcpu->profc_interval;
callout_schedule_sbt_curcpu(&pcpu->profc_cyclic,
pcpu->profc_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE);
@@ -306,26 +312,8 @@ static void
 profile_tick(void *arg)
 {
profile_probe_t *prof = arg;
-   struct trapframe *frame;
-   uintfptr_t pc, upc;
-
-   pc = 0;
-   upc = 0;
-
-   /*
-* td_intr_frame can be unset if this is a catch up event
-* after waking up from idle sleep.
-* This can only happen on a CPU idle thread.
-*/
-   frame = curthread->td_intr_frame;
-   if (frame != NULL) {
-   if (TRAPF_USERMODE(frame))
-   upc = TRAPF_PC(frame);
-   else
-   pc = TRAPF_PC(frame);
-   }
-   dtrace_probe(prof->prof_id, pc, upc, 0, 0, 0);
 
+   profile_probe(prof, 0);
prof->prof_expected += prof->prof_interval;
callout_schedule_sbt(&prof->prof_cyclic,
prof->prof_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 08:28:53PM +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 02:11:53PM -0600, Ian Lepore wrote:
> > ...
> > Sure, all us old-timers have the finger memory for editing rc.conf and
> > syslog.conf and so on, but how often do you crack open syslog.conf with
> > the plan of editing 12 different lines in it at once?
> 
> Actually I don't want to open it [newsyslog.conf] at all, and on desktop,
> where odd things are noticed quickly, default rotation is good enough.
> I might want to edit it on server to e.g. keep at least one year worth of
> logs, and when I do, I'd rather edit one file instead of half-dozen.

Thinking of it, it occurred to me that some simple inheritance mechanism
that would allow one to set (and centrally maintain) default "mode/count/
size/when/flags" in /etc/newsyslog.conf, without having to touch every
individual /etc/newsyslog.conf.d/foo.conf (while allowing per-log and per-
mode/count/size/when/flags override) could address most of the expressed
concerns so far.

I just hope it does not smell like sysd too much, because oh
boy, please no.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread John Baldwin
On Monday, May 15, 2017 02:11:53 PM Ian Lepore wrote:
> On Mon, 2017-05-15 at 12:22 -0700, John Baldwin wrote:
> > Also, _you_ could just splat an empty /etc/newsyslog.conf file on
> > your
> > appliance and create a bunch of conf.d/foo files if that is easier
> > for
> > you to use on an appliance.  The files we ship in a release aren't
> > really
> > tailored for an appliance (I've yet to see an appliance that doesn't
> > use
> > a FooBSD with local patches).  OTOH, the existing setup is probably
> > simpler to manage for an out-of-the-box install.
> > 
> > I'm also suprised you don't manage the newsyslog.conf file yourself
> > rather than trying to edit and merge in upstream changes?  That is, I
> > can see a few approaches:
> > 
> 
> You seem to be picturing some sort of etcupdate kind of thing.  I'm
> more talking about a GUI or other config-management tool within an
> embedded product that has to edit or rewrite configuration on the fly
> based on user choices.
> 
> Of course, separate files does also simplify the update process, for
> the most part.  If a new subsystem is added in a new freebsd release, I
> have zero work to do to upgrade a system in the field if that new
> subsystem just drops a new file into a .conf.d directory.  If it has
> new entries in a monolithic file, then I do have to do some sort of
> merge/edit operation.

But given that the new system now supports both approaches, why wouldn't
you always split it up in your product?

> > 1) Keep your real newsyslog.conf / syslogd.conf files in your
> > FooBSD's
> >VCS and when newsyslog.conf changes upstream you merge that in the
> >way you normally merge changes.
> > 
> > 2) Move the "vendor" newsyslog.conf out entirely and install your own
> >versions of these files either as a monolithic assembled by config
> >management rules or a bunch of conf.d/foo files (here I would
> > probably
> >opt for separate files).
> > 
> > However, your approach doesn't seem to describe either of these since
> > this commit doesn't impact those work flows (if 1), you would have
> > already
> > made any local changes you need and if anything merging this commit
> > gives
> > you the kind of merge conflicts people will get on the next
> > mergemaster /
> > etcupdate for non-appliance boxes, or if 2) you ignore these files)
> > 
> 
> This seems to be an argument for everyone doing for themselves the
> operation of splitting the distributed monolithic file into finer
> grained files, and re-performing that operation (or at least the
> analysis part of it) on every update.

s/everbody/appliance vendors/.  Not everyone is your use case (nor mine).

That said, I would think that the current approach is still the worst
of both worlds for you.  Now you have a single file you need to edit
in some cases and in other cases you generate the single foo.conf
file.  I don't see why you wouldn't always want to split things up in
your product and on the rare chance that the big file changes upstream
you alter the default broken-out file in your FooBSD (especially given
how rarely these files change).

> In general a lot of this feels like "I only needed 6 big config files
> to control my whole system in 1988, and so I should only need those
> same 6 files now."  Sure, all us old-timers have the finger memory for
> editing rc.conf and syslog.conf and so on, but how often do you crack
> open syslog.conf with the plan of editing 12 different lines in it at
> once?  Because the main objection to .conf.d directories seems to be
> that there are more files to edit, and that just doesn't feel like a
> big problem in actual daily use.

To be clear, I _don't_ object to conf.d directories and I'm happy to
have the tools support both types of configurations.  I object to
employing a half-way mix of both styles in a way that breaks POLA and
causes merge headaches for existing users that are applying these
changes as upgrades to existing systems.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 02:49:30PM -0600, Ian Lepore wrote:
> ...
> You acknowledge that the situation is different for ports, so does that
> mean your objections go away when base becomes packaged and faces the
> same installation and update issues that packaged ports do?  Because I
> was under the impression that's coming pretty soon.

The reason it is different for ports is because we cannot know up-front what
software might user have installed and ergo what logs should be rotated by
newsyslog(8).  For the base, we know these pieces (albeit packaging the base
could probably benefit from the same generic approach, if we ever start to
support 3rd-party "base" packages).

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318318 - in head/sys: amd64/acpica amd64/amd64 x86/acpica

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 20:52:43 2017
New Revision: 318318
URL: https://svnweb.freebsd.org/changeset/base/318318

Log:
  Ensure that resume path on amd64 only accesses page tables for normal
  operation after processor is configured to allow all required
  features.
  
  In particular, NX must be enabled in EFER, otherwise load of page
  table element with nx bit set causes reserved bit page fault.  Since
  malloc uses direct mapping for small allocations, in particular for
  the suspension pcbs, and DMAP is nx after r316767, this commit tripped
  fault on resume path.
  
  Restore complete state of EFER while wakeup code is still executing
  with custom page table, before calling resumectx, instead of trying to
  guess which features might be needed before resumectx restored EFER on
  its own.
  
  Bisected and tested by:   trasz
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/amd64/acpica/acpi_wakecode.S
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/x86/acpica/acpi_wakeup.c

Modified: head/sys/amd64/acpica/acpi_wakecode.S
==
--- head/sys/amd64/acpica/acpi_wakecode.S   Mon May 15 20:41:29 2017
(r318317)
+++ head/sys/amd64/acpica/acpi_wakecode.S   Mon May 15 20:52:43 2017
(r318318)
@@ -156,11 +156,12 @@ wakeup_32:
/*
 * Enable EFER.LME so that we get long mode when all the prereqs are
 * in place.  In this case, it turns on when CR0_PG is finally enabled.
-* Pick up a few other EFER bits that we'll use need we're here.
+* Also it picks up a few other EFER bits that we'll use need we're
+* here, like SYSCALL and NX enable.
 */
movl$MSR_EFER, %ecx
-   rdmsr
-   orl $EFER_LME | EFER_SCE, %eax
+   movlwakeup_efer - wakeup_start(%ebx), %eax
+   movlwakeup_efer + 4 - wakeup_start(%ebx), %edx
wrmsr
 
/*
@@ -276,6 +277,8 @@ wakeup_pcb:
.quad   0
 wakeup_ret:
.quad   0
+wakeup_efer:
+   .quad   0
 wakeup_gdt:
.word   0
.quad   0

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Mon May 15 20:41:29 2017
(r318317)
+++ head/sys/amd64/amd64/cpu_switch.S   Mon May 15 20:52:43 2017
(r318318)
@@ -396,7 +396,7 @@ ENTRY(resumectx)
movl4 + PCB_KGSBASE(%rdi),%edx
wrmsr
 
-   /* Restore EFER. */
+   /* Restore EFER one more time. */
movl$MSR_EFER,%ecx
movlPCB_EFER(%rdi),%eax
wrmsr

Modified: head/sys/x86/acpica/acpi_wakeup.c
==
--- head/sys/x86/acpica/acpi_wakeup.c   Mon May 15 20:41:29 2017
(r318317)
+++ head/sys/x86/acpica/acpi_wakeup.c   Mon May 15 20:52:43 2017
(r318318)
@@ -223,7 +223,9 @@ acpi_sleep_machdep(struct acpi_softc *sc
WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
 
-#ifndef __amd64__
+#ifdef __amd64__
+   WAKECODE_FIXUP(wakeup_efer, uint64_t, rdmsr(MSR_EFER));
+#else
WAKECODE_FIXUP(wakeup_cr4, register_t, pcb->pcb_cr4);
 #endif
WAKECODE_FIXUP(wakeup_pcb, struct pcb *, pcb);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 20:28 +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 02:11:53PM -0600, Ian Lepore wrote:
> > 
> > ...
> > In general a lot of this feels like "I only needed 6 big config
> > files
> > to control my whole system in 1988, and so I should only need those
> > same 6 files now."
> Yup; doesn't it feel good?  (That's one of our selling points BTW.)
> 
> > 
> > Sure, all us old-timers have the finger memory for editing rc.conf
> > and
> > syslog.conf and so on, but how often do you crack open syslog.conf
> > with
> > the plan of editing 12 different lines in it at once?
> Actually I don't want to open it [newsyslog.conf] at all, and on
> desktop,
> where odd things are noticed quickly, default rotation is good
> enough.
> I might want to edit it on server to e.g. keep at least one year
> worth of
> logs, and when I do, I'd rather edit one file instead of half-dozen.
> 
> > 
> > Because the main objection to .conf.d directories seems to be that
> > there are more files to edit, and that just doesn't feel like a big
> > problem in actual daily use.
> Well, it kind of is.  Keeping in mind "same 6 files" is a big helper;
> for the base you can be sure you won't forget anything accidentally.
> It is not that easy for ports for obvious reasons, but then again: we
> are talking about the base only here.
> 

What you're talking about is how YOU view and use base.  That's fine,
except that obviously it's only a tiny subset of how all freebsd users
view and use base.

Besides how I view things as someone who has to create and maintain
complex embedded systems with freebsd, as a simple user of freebsd I
would much prefer to edit syslog.conf.d/mail than search around in a
big syslog.conf file for lines pertaining to mail logging.

You acknowledge that the situation is different for ports, so does that
mean your objections go away when base becomes packaged and faces the
same installation and update issues that packaged ports do?  Because I
was under the impression that's coming pretty soon.

-- Ian

> ./danfe
> 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318317 - head/contrib/netbsd-tests/usr.bin/grep

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 20:41:29 2017
New Revision: 318317
URL: https://svnweb.freebsd.org/changeset/base/318317

Log:
  bsdgrep: add more tests for different binary flags
  
  The existing 'binary' test in netbsd-tests/ does a basic check of the
  default treatment for binary behavior, but not much more than that.
  Given some opportunity for breakage recently that did not trigger any
  failures, add some tests to cover the three different binary file
  behaviors (a, -I, -U) and their --binary-files= equivalent values.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem, ngie
  Differential Revision:https://reviews.freebsd.org/D10620

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shMon May 15 20:18:14 
2017(r318316)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shMon May 15 20:41:29 
2017(r318317)
@@ -539,6 +539,41 @@ badcontext_body()
 
atf_check -s not-exit:0 -e ignore grep -C "B" "B" test1
 }
+
+atf_test_case binary_flags
+binary_flags_head()
+{
+   atf_set "descr" "Check output for binary flags (-a, -I, -U, 
--binary-files)"
+}
+binary_flags_body()
+{
+   printf "A\000B\000C" > test1
+   printf "A\n\000B\n\000C" > test2
+   binmatchtext="Binary file test1 matches\n"
+
+   # Binaries not treated as text (default, -U)
+   atf_check -o inline:"${binmatchtext}" grep 'B' test1
+   atf_check -o inline:"${binmatchtext}" grep 'B' -C 1 test1
+
+   atf_check -o inline:"${binmatchtext}" grep -U 'B' test1
+   atf_check -o inline:"${binmatchtext}" grep -U 'B' -C 1 test1
+
+   # Binary, -a, no newlines
+   atf_check -o inline:"A\000B\000C\n" grep -a 'B' test1
+   atf_check -o inline:"A\000B\000C\n" grep -a 'B' -C 1 test1
+
+   # Binary, -a, newlines
+   atf_check -o inline:"\000B\n" grep -a 'B' test2
+   atf_check -o inline:"A\n\000B\n\000C\n" grep -a 'B' -C 1 test2
+
+   # Binary files ignored
+   atf_check -s exit:1 grep -I 'B' test2
+
+   # --binary-files equivalence
+   atf_check -o inline:"${binmatchtext}" grep --binary-files=binary 'B' 
test1
+   atf_check -o inline:"A\000B\000C\n" grep --binary-files=text 'B' test1
+   atf_check -s exit:1 grep --binary-files=without-match 'B' test2
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -573,6 +608,7 @@ atf_init_test_cases()
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
atf_add_test_case grep_nomatch_flags
+   atf_add_test_case binary_flags
atf_add_test_case badcontext
 # End FreeBSD
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 02:11:53PM -0600, Ian Lepore wrote:
> ...
> In general a lot of this feels like "I only needed 6 big config files
> to control my whole system in 1988, and so I should only need those
> same 6 files now."

Yup; doesn't it feel good?  (That's one of our selling points BTW.)

> Sure, all us old-timers have the finger memory for editing rc.conf and
> syslog.conf and so on, but how often do you crack open syslog.conf with
> the plan of editing 12 different lines in it at once?

Actually I don't want to open it [newsyslog.conf] at all, and on desktop,
where odd things are noticed quickly, default rotation is good enough.
I might want to edit it on server to e.g. keep at least one year worth of
logs, and when I do, I'd rather edit one file instead of half-dozen.

> Because the main objection to .conf.d directories seems to be that
> there are more files to edit, and that just doesn't feel like a big
> problem in actual daily use.

Well, it kind of is.  Keeping in mind "same 6 files" is a big helper;
for the base you can be sure you won't forget anything accidentally.
It is not that easy for ports for obvious reasons, but then again: we
are talking about the base only here.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 14:11 -0600, Ian Lepore wrote:
> On Mon, 2017-05-15 at 12:22 -0700, John Baldwin wrote:
> > 
> > On Monday, May 15, 2017 11:43:21 AM Ian Lepore wrote:
> > > 
> > > 
[...]
> > 
> > Also, _you_ could just splat an empty /etc/newsyslog.conf file on
> > your
> > appliance and create a bunch of conf.d/foo files if that is easier
> > for
> > you to use on an appliance.  The files we ship in a release aren't
> > really
> > tailored for an appliance (I've yet to see an appliance that doesn't
> > use
> > a FooBSD with local patches).  OTOH, the existing setup is probably
> > simpler to manage for an out-of-the-box install.
> > 
> > I'm also suprised you don't manage the newsyslog.conf file yourself
> > rather than trying to edit and merge in upstream changes?  That is, I
> > can see a few approaches:
> > 
> You seem to be picturing some sort of etcupdate kind of thing.  I'm
> more talking about a GUI or other config-management tool within an
> embedded product that has to edit or rewrite configuration on the fly
> based on user choices.
> 
> Of course, separate files does also simplify the update process, for
> the most part.  If a new subsystem is added in a new freebsd release, I
> have zero work to do to upgrade a system in the field if that new
> subsystem just drops a new file into a .conf.d directory.  If it has
> new entries in a monolithic file, then I do have to do some sort of
> merge/edit operation.
> 

And just to be clear here, I'm talking about running some kind of
merge/edit on the live system being updated in the field, not as part
of importing a newer freebsd snapshot into our VCS.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318316 - head/usr.bin/uniq

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 20:18:14 2017
New Revision: 318316
URL: https://svnweb.freebsd.org/changeset/base/318316

Log:
  uniq: allow -c to be used with -d or -u
  
  Bring in some bits from NetBSD and lift the restriction in uniq(1) that
  -c cannot be used with the -d and -u options.  This restriction seems
  unnecessary and is supported at least by GNU, OpenBSD, and NetBSD.  Lift
  the restriction and simplify the show() logic a little bit to maintain
  functionality when -c is provided with -d/-u.
  
  Also with this change, -d and -u are now actually a mutually exclusive,
  albeit valid, combination.  Given that they both indicate opposite
  behavior, uniq(1) will no longer output anything if both -d and -u are
  supplied.  This is in line with NetBSD as well as GNU.
  
  Adjust the man page and usage() to reflect that -c is its own standalone
  option.
  
  PR:   200553
  Submitted by: Kyle Evans 
  Reviewed by:  cem, emaste
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D10694

Modified:
  head/usr.bin/uniq/uniq.1
  head/usr.bin/uniq/uniq.c

Modified: head/usr.bin/uniq/uniq.1
==
--- head/usr.bin/uniq/uniq.1Mon May 15 19:58:01 2017(r318315)
+++ head/usr.bin/uniq/uniq.1Mon May 15 20:18:14 2017(r318316)
@@ -31,7 +31,7 @@
 .\" From: @(#)uniq.1   8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd December 17, 2009
+.Dd May 15, 2017
 .Dt UNIQ 1
 .Os
 .Sh NAME
@@ -39,7 +39,8 @@
 .Nd report or filter out repeated lines in a file
 .Sh SYNOPSIS
 .Nm
-.Op Fl c | Fl d | Fl u
+.Op Fl c
+.Op Fl d | Fl u
 .Op Fl i
 .Op Fl f Ar num
 .Op Fl s Ar chars

Modified: head/usr.bin/uniq/uniq.c
==
--- head/usr.bin/uniq/uniq.cMon May 15 19:58:01 2017(r318315)
+++ head/usr.bin/uniq/uniq.cMon May 15 20:18:14 2017(r318316)
@@ -129,13 +129,6 @@ main (int argc, char *argv[])
argc -= optind;
argv += optind;
 
-   /* If no flags are set, default is -d -u. */
-   if (cflag) {
-   if (dflag || uflag)
-   usage();
-   } else if (!dflag && !uflag)
-   dflag = uflag = 1;
-
if (argc > 2)
usage();
 
@@ -182,9 +175,6 @@ main (int argc, char *argv[])
}
tprev = convert(prevline);
 
-   if (!cflag && uflag && dflag)
-   show(ofp, prevline);
-
tthis = NULL;
while (getline(&thisline, &thisbuflen, ifp) >= 0) {
if (tthis != NULL)
@@ -200,8 +190,7 @@ main (int argc, char *argv[])
 
if (comp) {
/* If different, print; set previous to new value. */
-   if (cflag || !dflag || !uflag)
-   show(ofp, prevline);
+   show(ofp, prevline);
p = prevline;
b1 = prevbuflen;
prevline = thisline;
@@ -209,8 +198,6 @@ main (int argc, char *argv[])
if (tprev != NULL)
free(tprev);
tprev = tthis;
-   if (!cflag && uflag && dflag)
-   show(ofp, prevline);
thisline = p;
thisbuflen = b1;
tthis = NULL;
@@ -220,8 +207,7 @@ main (int argc, char *argv[])
}
if (ferror(ifp))
err(1, "%s", ifn);
-   if (cflag || !dflag || !uflag)
-   show(ofp, prevline);
+   show(ofp, prevline);
exit(0);
 }
 
@@ -286,9 +272,11 @@ static void
 show(FILE *ofp, const char *str)
 {
 
+   if ((dflag && repeats == 0) || (uflag && repeats > 0))
+   return;
if (cflag)
(void)fprintf(ofp, "%4d %s", repeats + 1, str);
-   if ((dflag && repeats) || (uflag && !repeats))
+   else
(void)fprintf(ofp, "%s", str);
 }
 
@@ -351,6 +339,6 @@ static void
 usage(void)
 {
(void)fprintf(stderr,
-"usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
+"usage: uniq [-c] [-d | -u] [-i] [-f fields] [-s chars] [input [output]]\n");
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 12:22 -0700, John Baldwin wrote:
> On Monday, May 15, 2017 11:43:21 AM Ian Lepore wrote:
> > 
> > On Mon, 2017-05-15 at 10:13 -0700, John Baldwin wrote:
> > > 
> > > On Saturday, May 13, 2017 10:39:15 AM Warner Losh wrote:
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > - It's really easy to screw up a mergemaster call if you
> > > > > > edit
> > > > > > the files, and install the stock version which removes the
> > > > > > edits.
> > > > > Also, programmatically removing the entries means you have to
> > > > > bake the metadata into etc/Makefile, which is already
> > > > > complicated
> > > > > enough as-is.
> > > > Why do you care about removing them at all? They are no-ops if
> > > > the
> > > > files don't exist. Why not just always install all these files
> > > > is
> > > > where I'm going with this...
> > > I think this is actually the bigger question.  I think it is
> > > perfectly
> > > sensible to support conf.d/* files for ports to use and as a way
> > > to
> > > manage logs for application logs on an appliance, etc.  However,
> > > this
> > > shuffling is a bit of a merge nightmare for anyone using
> > > mergemaster
> > > or etcupdate, and the biggest cost is that newsyslog will create
> > > a
> > > one-line file in /var/log for entries with 'C'.
> > > 
> > That's only a good argument for keeping the lines in the monolithic
> > file if those lines will be ignored when a file in the .conf.d
> > directory provides conflicting config.  Otherwise my embedded
> > product
> > that drops different rules for rotating /var/log/messages into
> > .conf.d
> > STILL has to programmatically edit the monolithic file to remove
> > the
> > standard rule(s).
> Now you have to programmatically edit the file in
> conf.d/foo.  However,
> by this argument the monolithic conf file shouldn't even exist.  The
> current approach is a half-way mix with the worst of both models it
> seems.
> 

Programmatically editing a single file containing only config for a
single component typically means just rewriting the entire file with
your new contents.  In particular, you don't need to attempt to
preserve other information, the format of which you may not even know,
including free-form comments and who knows what-else.

> Also, _you_ could just splat an empty /etc/newsyslog.conf file on
> your
> appliance and create a bunch of conf.d/foo files if that is easier
> for
> you to use on an appliance.  The files we ship in a release aren't
> really
> tailored for an appliance (I've yet to see an appliance that doesn't
> use
> a FooBSD with local patches).  OTOH, the existing setup is probably
> simpler to manage for an out-of-the-box install.
> 
> I'm also suprised you don't manage the newsyslog.conf file yourself
> rather than trying to edit and merge in upstream changes?  That is, I
> can see a few approaches:
> 

You seem to be picturing some sort of etcupdate kind of thing.  I'm
more talking about a GUI or other config-management tool within an
embedded product that has to edit or rewrite configuration on the fly
based on user choices.

Of course, separate files does also simplify the update process, for
the most part.  If a new subsystem is added in a new freebsd release, I
have zero work to do to upgrade a system in the field if that new
subsystem just drops a new file into a .conf.d directory.  If it has
new entries in a monolithic file, then I do have to do some sort of
merge/edit operation.

> 1) Keep your real newsyslog.conf / syslogd.conf files in your
> FooBSD's
>    VCS and when newsyslog.conf changes upstream you merge that in the
>    way you normally merge changes.
> 
> 2) Move the "vendor" newsyslog.conf out entirely and install your own
>    versions of these files either as a monolithic assembled by config
>    management rules or a bunch of conf.d/foo files (here I would
> probably
>    opt for separate files).
> 
> However, your approach doesn't seem to describe either of these since
> this commit doesn't impact those work flows (if 1), you would have
> already
> made any local changes you need and if anything merging this commit
> gives
> you the kind of merge conflicts people will get on the next
> mergemaster /
> etcupdate for non-appliance boxes, or if 2) you ignore these files)
> 

This seems to be an argument for everyone doing for themselves the
operation of splitting the distributed monolithic file into finer
grained files, and re-performing that operation (or at least the
analysis part of it) on every update.

In general a lot of this feels like "I only needed 6 big config files
to control my whole system in 1988, and so I should only need those
same 6 files now."  Sure, all us old-timers have the finger memory for
editing rc.conf and syslog.conf and so on, but how often do you crack
open syslog.conf with the plan of editing 12 different lines in it at
once?  Because the main objection to .conf.d directories seems to be
that there are more files to edit

Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Rodney W. Grimes
> On Mon, May 15, 2017 at 03:09:33PM -0400, Nikolai Lifanov wrote:
> > On 05/15/2017 14:52, Alexey Dokuchaev wrote:
> > > Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> > > /bin/chmod would now be possible on FreeBSD as well?  Does this have
> > > any security implications?
> > 
> > This is a use case for fixing accidentally hosed /bin/chmod binary and
> > not some sort of an escalation thing. You will need to be root to do
> > this.
> 
> Because /bin/chmod is owned by root, not because /libexec/ld-elf.so.1 is
> limiting execution to root only, or is it (I might have missed uid check
> in that patch [1], but at a quick glance I didn't see it).
> 
> On a living system, there are plenty of other ways to restore missing
> +x on /bin/chmod as long as you can call chmod(2), from simple Python
> script down to manually crafting small binary in hex.

Simple tool to get out of this is use of install(8) to "install" your
broken chmod to another file with proper modes.  And if you lost that
one you could use mtree(8) with a easily crafted input file.

> > Likewise, with working chmod binary, you should be able to mark
> > binaries with write access executable.
> 
> Well, it's not just about chmod(1), this opens what can be a can of worms
> and I want to know how big it is.

Big.. very very big... and painted Blue!

> ./danfe
> 
> [1] Idea for security.bsd.ld_elf_exec_root_only sysctl(8)?

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318315 - head/contrib/netbsd-tests/lib/libc/gen

2017-05-15 Thread Ngie Cooper
Author: ngie
Date: Mon May 15 19:58:01 2017
New Revision: 318315
URL: https://svnweb.freebsd.org/changeset/base/318315

Log:
  lib/libc/gen/realpath_test: make check result from getcwd(3)
  
  This is being done to avoid dereferencing a NULL pointer via strlcat,
  obscuring the underlying issue with the getcwd(3) call.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_realpath.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_realpath.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_realpath.c Mon May 15 19:32:26 
2017(r318314)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_realpath.c Mon May 15 19:58:01 
2017(r318315)
@@ -34,6 +34,9 @@ __RCSID("$NetBSD: t_realpath.c,v 1.2 201
 #include 
 
 #include 
+#ifdef __FreeBSD__
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -122,8 +125,15 @@ ATF_TC_BODY(realpath_symlink, tc)
char resb[MAXPATHLEN] = { 0 };
int fd;
 
+#ifdef __FreeBSD__
+   ATF_REQUIRE_MSG(getcwd(path, sizeof(path)) != NULL,
+   "getcwd(path) failed: %s", strerror(errno));
+   ATF_REQUIRE_MSG(getcwd(slnk, sizeof(slnk)) != NULL,
+   "getcwd(slnk) failed: %s", strerror(errno));
+#else
(void)getcwd(path, sizeof(path));
(void)getcwd(slnk, sizeof(slnk));
+#endif
 
(void)strlcat(path, "/realpath", sizeof(path));
(void)strlcat(slnk, "/symbolic", sizeof(slnk));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Nikolai Lifanov
On 05/15/2017 15:52, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 07:42:23PM +, Alexey Dokuchaev wrote:
>> On Mon, May 15, 2017 at 10:40:49PM +0300, Konstantin Belousov wrote:
>>> On Mon, May 15, 2017 at 03:37:42PM -0400, Nikolai Lifanov wrote:
 On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> ...
> Would this now allow executing binaries (with or without +x bit) from
> filesystems mounted with -o noexec?

 No:

 # zfs create -o mountpoint=/mnt -o exec=off tank/TEST
 # cp /bin/sh /mnt/
 # /mnt/sh
 /mnt/sh: Permission denied.
 # /libexec/ld-elf.so.1 /mnt/sh
 /mnt/sh: mmap of data failed: Permission denied
>>>
>>> This is due to
>>> r313967 | kib | 2017-02-19 22:51:04 +0200 (Sun, 19 Feb 2017) | 24 lines
>>> Apply noexec mount option for mmap(PROT_EXEC).
>>
>> Nice, good to know that.
> 
> [Replying to random mail in thread]
> 
> I tried this on an up to date latest Fedora installation:
> [kostik@sandy ~]$ cp /bin/ls /tmp
> [kostik@sandy ~]$ chmod a-x /tmp/ls
> [kostik@sandy ~]$ /lib64/ld-linux-x86-64.so.2  /tmp/ls
> Dropbox  intel  tmp  work
> 
> I am not sure about one detail, the /tmp/ls file has some security context
> on it, but I do not believe that it may affect the outcome of the experiment.
> Please correct me if I am wrong.
> 


This is because /tmp is exec. On Linux it does the same thing:

# mount -t tmpfs none -o noexec,mode=1777 /mnt
# cp /bin/bash /mnt/
# /lib64/ld-linux-x86-64.so.2 /mnt/bash
/mnt/bash: error while loading shared libraries: /mnt/bash: failed to
map segment from shared object: Operation not permitted

- Nikolai Lifanov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 07:42:23PM +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 10:40:49PM +0300, Konstantin Belousov wrote:
> > On Mon, May 15, 2017 at 03:37:42PM -0400, Nikolai Lifanov wrote:
> > > On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> > > > ...
> > > > Would this now allow executing binaries (with or without +x bit) from
> > > > filesystems mounted with -o noexec?
> > > 
> > > No:
> > > 
> > > # zfs create -o mountpoint=/mnt -o exec=off tank/TEST
> > > # cp /bin/sh /mnt/
> > > # /mnt/sh
> > > /mnt/sh: Permission denied.
> > > # /libexec/ld-elf.so.1 /mnt/sh
> > > /mnt/sh: mmap of data failed: Permission denied
> > 
> > This is due to
> > r313967 | kib | 2017-02-19 22:51:04 +0200 (Sun, 19 Feb 2017) | 24 lines
> > Apply noexec mount option for mmap(PROT_EXEC).
> 
> Nice, good to know that.

[Replying to random mail in thread]

I tried this on an up to date latest Fedora installation:
[kostik@sandy ~]$ cp /bin/ls /tmp
[kostik@sandy ~]$ chmod a-x /tmp/ls
[kostik@sandy ~]$ /lib64/ld-linux-x86-64.so.2  /tmp/ls
Dropbox  intel  tmp  work

I am not sure about one detail, the /tmp/ls file has some security context
on it, but I do not believe that it may affect the outcome of the experiment.
Please correct me if I am wrong.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 10:40:49PM +0300, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 03:37:42PM -0400, Nikolai Lifanov wrote:
> > On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> > > ...
> > > Would this now allow executing binaries (with or without +x bit) from
> > > filesystems mounted with -o noexec?
> > 
> > No:
> > 
> > # zfs create -o mountpoint=/mnt -o exec=off tank/TEST
> > # cp /bin/sh /mnt/
> > # /mnt/sh
> > /mnt/sh: Permission denied.
> > # /libexec/ld-elf.so.1 /mnt/sh
> > /mnt/sh: mmap of data failed: Permission denied
> 
> This is due to
> r313967 | kib | 2017-02-19 22:51:04 +0200 (Sun, 19 Feb 2017) | 24 lines
> Apply noexec mount option for mmap(PROT_EXEC).

Nice, good to know that.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 03:37:42PM -0400, Nikolai Lifanov wrote:
> On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> > On Mon, May 15, 2017 at 10:25:29PM +0300, Konstantin Belousov wrote:
> >> On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
> >>> Well, for example, it seems like it would allow anyone to execute a
> >>> binary even if the sysadmin had set it to -x specifically to prevent
> >>> people from running it.
> >>
> >> The direct mode does not (and cannot) honor set{u,g}id modes of the
> >> executable, so any binary run this way would only exercise the existing
> >> power of the user which did it.
> >>
> >> The most advanced explanation that I was given in private was among
> >> the lines: "if you have an environment where users can upload content
> >> to a shared server, but have no access to chmod(2), no compilers, no
> >> scripting languages, etc." The person then admitted that (s)he does not
> >> consider it as an actual concern.
> > 
> > Would this now allow executing binaries (with or without +x bit) from
> > filesystems mounted with -o noexec?
> > 
> > ./danfe
> 
> No:
> 
> # zfs create -o mountpoint=/mnt -o exec=off tank/TEST
> # cp /bin/sh /mnt/
> # /mnt/sh
> /mnt/sh: Permission denied.
> # /libexec/ld-elf.so.1 /mnt/sh
> /mnt/sh: mmap of data failed: Permission denied

This is due to
r313967 | kib | 2017-02-19 22:51:04 +0200 (Sun, 19 Feb 2017) | 24 lines
Apply noexec mount option for mmap(PROT_EXEC).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 03:37:42PM -0400, Nikolai Lifanov wrote:
> On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> > On Mon, May 15, 2017 at 10:25:29PM +0300, Konstantin Belousov wrote:
> >> ...
> >> The most advanced explanation that I was given in private was among
> >> the lines: "if you have an environment where users can upload content
> >> to a shared server, but have no access to chmod(2), no compilers, no
> >> scripting languages, etc." The person then admitted that (s)he does not
> >> consider it as an actual concern.
> > 
> > Would this now allow executing binaries (with or without +x bit) from
> > filesystems mounted with -o noexec?
> 
> No:
> 
> # zfs create -o mountpoint=/mnt -o exec=off tank/TEST
> # cp /bin/sh /mnt/
> # /mnt/sh
> /mnt/sh: Permission denied.
> # /libexec/ld-elf.so.1 /mnt/sh
> /mnt/sh: mmap of data failed: Permission denied

Good, thanks for conducting this test Nikolai.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Nikolai Lifanov
On 05/15/2017 15:36, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 10:25:29PM +0300, Konstantin Belousov wrote:
>> On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
>>> Well, for example, it seems like it would allow anyone to execute a
>>> binary even if the sysadmin had set it to -x specifically to prevent
>>> people from running it.
>>
>> The direct mode does not (and cannot) honor set{u,g}id modes of the
>> executable, so any binary run this way would only exercise the existing
>> power of the user which did it.
>>
>> The most advanced explanation that I was given in private was among
>> the lines: "if you have an environment where users can upload content
>> to a shared server, but have no access to chmod(2), no compilers, no
>> scripting languages, etc." The person then admitted that (s)he does not
>> consider it as an actual concern.
> 
> Would this now allow executing binaries (with or without +x bit) from
> filesystems mounted with -o noexec?
> 
> ./danfe

No:

# zfs create -o mountpoint=/mnt -o exec=off tank/TEST
# cp /bin/sh /mnt/
# /mnt/sh
/mnt/sh: Permission denied.
# /libexec/ld-elf.so.1 /mnt/sh
/mnt/sh: mmap of data failed: Permission denied

- Nikolai Lifanov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Nikolai Lifanov
On 05/15/2017 15:32, Bryan Drewery wrote:
> On 5/15/2017 12:29 PM, Konstantin Belousov wrote:
>> On Mon, May 15, 2017 at 12:25:20PM -0700, Bryan Drewery wrote:
>>> On 5/15/2017 12:00 PM, Konstantin Belousov wrote:
 On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
>> New Revision: 318313
>> URL: https://svnweb.freebsd.org/changeset/base/318313
>>
>> Log:
>>   Make ld-elf.so.1 directly executable.
>
> Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> /bin/chmod would now be possible on FreeBSD as well?
 Yes.

> Does this have any security implications?
 What do you mean ?

>>>
>>> I think for 3rd-party distributions it may be a problem. At the very
>>> least it needs to be communicated clearly in release notes or UPDATING.
>>>
>>> Consider a downstream vendor who has support for signed binary
>>> executions.  If rtld allows a backdoor around exec(2) to run an unsigned
>>> binary, that could be a problem for them.  It is on them to add support
>>> to exec(2) to validate the special case of execing rtld with an
>>> argument, or to just disable the feature in rtld from this commit.
>>
>> Note the undocumented O_VERIFY flag in open(2) from the patch.
>> This is very vendor-ish addition to request veriexec (?).
>>
> 
> Ah nice.
> 


Note, this already does the right thing with noexec filesystems:
# zfs create -o mountpoint=/mnt -o exec=off tank/TEST
# cp /bin/sh /mnt/
# /mnt/sh
/mnt/sh: Permission denied.
# /libexec/ld-elf.so.1 /mnt/sh
/mnt/sh: mmap of data failed: Permission denied

- Nikolai Lifanov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 10:25:29PM +0300, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
> > Well, for example, it seems like it would allow anyone to execute a
> > binary even if the sysadmin had set it to -x specifically to prevent
> > people from running it.
> 
> The direct mode does not (and cannot) honor set{u,g}id modes of the
> executable, so any binary run this way would only exercise the existing
> power of the user which did it.
> 
> The most advanced explanation that I was given in private was among
> the lines: "if you have an environment where users can upload content
> to a shared server, but have no access to chmod(2), no compilers, no
> scripting languages, etc." The person then admitted that (s)he does not
> consider it as an actual concern.

Would this now allow executing binaries (with or without +x bit) from
filesystems mounted with -o noexec?

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318314 - head/lib/libc/sys

2017-05-15 Thread Stephen J. Kiernan
Author: stevek
Date: Mon May 15 19:32:26 2017
New Revision: 318314
URL: https://svnweb.freebsd.org/changeset/base/318314

Log:
  Add information to open(2) man page about the O_VERIFY flag.
  
  Reviewed by:  bjk wblock
  Approved by:  sjg (mentor)
  Obtained from:Juniper Networks, Inc.

Modified:
  head/lib/libc/sys/open.2

Modified: head/lib/libc/sys/open.2
==
--- head/lib/libc/sys/open.2Mon May 15 18:48:58 2017(r318313)
+++ head/lib/libc/sys/open.2Mon May 15 19:32:26 2017(r318314)
@@ -141,6 +141,7 @@ O_NOCTTYignored
 O_TTY_INIT ignored
 O_DIRECTORYerror if file is not a directory
 O_CLOEXEC  set FD_CLOEXEC upon open
+O_VERIFY   verify the contents of the file
 .Ed
 .Pp
 Opening a file with
@@ -259,6 +260,15 @@ may be used to set
 .Dv FD_CLOEXEC
 flag for the newly returned file descriptor.
 .Pp
+.Dv O_VERIFY
+may be used to indicate to the kernel that the contents of the file should
+be verified before allowing the open to proceed.
+The details of what
+.Dq verified
+means is implementation specific.
+The run-time linker (rtld) uses this flag to ensure shared objects have
+been verified before operating on them.
+.Pp
 If successful,
 .Fn open
 returns a non-negative integer, termed a file descriptor.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Bryan Drewery
On 5/15/2017 12:29 PM, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 12:25:20PM -0700, Bryan Drewery wrote:
>> On 5/15/2017 12:00 PM, Konstantin Belousov wrote:
>>> On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
 On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
> New Revision: 318313
> URL: https://svnweb.freebsd.org/changeset/base/318313
>
> Log:
>   Make ld-elf.so.1 directly executable.

 Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
 /bin/chmod would now be possible on FreeBSD as well?
>>> Yes.
>>>
 Does this have any security implications?
>>> What do you mean ?
>>>
>>
>> I think for 3rd-party distributions it may be a problem. At the very
>> least it needs to be communicated clearly in release notes or UPDATING.
>>
>> Consider a downstream vendor who has support for signed binary
>> executions.  If rtld allows a backdoor around exec(2) to run an unsigned
>> binary, that could be a problem for them.  It is on them to add support
>> to exec(2) to validate the special case of execing rtld with an
>> argument, or to just disable the feature in rtld from this commit.
> 
> Note the undocumented O_VERIFY flag in open(2) from the patch.
> This is very vendor-ish addition to request veriexec (?).
> 

Ah nice.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread John Baldwin
On Monday, May 15, 2017 11:43:21 AM Ian Lepore wrote:
> On Mon, 2017-05-15 at 10:13 -0700, John Baldwin wrote:
> > On Saturday, May 13, 2017 10:39:15 AM Warner Losh wrote:
> > > 
> > > > 
> > > > > 
> > > > > - It's really easy to screw up a mergemaster call if you edit
> > > > > the files, and install the stock version which removes the
> > > > > edits.
> > > > Also, programmatically removing the entries means you have to
> > > > bake the metadata into etc/Makefile, which is already complicated
> > > > enough as-is.
> > > Why do you care about removing them at all? They are no-ops if the
> > > files don't exist. Why not just always install all these files is
> > > where I'm going with this...
> > I think this is actually the bigger question.  I think it is
> > perfectly
> > sensible to support conf.d/* files for ports to use and as a way to
> > manage logs for application logs on an appliance, etc.  However, this
> > shuffling is a bit of a merge nightmare for anyone using mergemaster
> > or etcupdate, and the biggest cost is that newsyslog will create a
> > one-line file in /var/log for entries with 'C'.
> > 
> 
> That's only a good argument for keeping the lines in the monolithic
> file if those lines will be ignored when a file in the .conf.d
> directory provides conflicting config.  Otherwise my embedded product
> that drops different rules for rotating /var/log/messages into .conf.d
> STILL has to programmatically edit the monolithic file to remove the
> standard rule(s).

Now you have to programmatically edit the file in conf.d/foo.  However,
by this argument the monolithic conf file shouldn't even exist.  The
current approach is a half-way mix with the worst of both models it
seems.

Also, _you_ could just splat an empty /etc/newsyslog.conf file on your
appliance and create a bunch of conf.d/foo files if that is easier for
you to use on an appliance.  The files we ship in a release aren't really
tailored for an appliance (I've yet to see an appliance that doesn't use
a FooBSD with local patches).  OTOH, the existing setup is probably
simpler to manage for an out-of-the-box install.

I'm also suprised you don't manage the newsyslog.conf file yourself
rather than trying to edit and merge in upstream changes?  That is, I
can see a few approaches:

1) Keep your real newsyslog.conf / syslogd.conf files in your FooBSD's
   VCS and when newsyslog.conf changes upstream you merge that in the
   way you normally merge changes.

2) Move the "vendor" newsyslog.conf out entirely and install your own
   versions of these files either as a monolithic assembled by config
   management rules or a bunch of conf.d/foo files (here I would probably
   opt for separate files).

However, your approach doesn't seem to describe either of these since
this commit doesn't impact those work flows (if 1), you would have already
made any local changes you need and if anything merging this commit gives
you the kind of merge conflicts people will get on the next mergemaster /
etcupdate for non-appliance boxes, or if 2) you ignore these files)

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 12:25:20PM -0700, Bryan Drewery wrote:
> On 5/15/2017 12:00 PM, Konstantin Belousov wrote:
> > On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> >> On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
> >>> New Revision: 318313
> >>> URL: https://svnweb.freebsd.org/changeset/base/318313
> >>>
> >>> Log:
> >>>   Make ld-elf.so.1 directly executable.
> >>
> >> Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> >> /bin/chmod would now be possible on FreeBSD as well?
> > Yes.
> > 
> >> Does this have any security implications?
> > What do you mean ?
> > 
> 
> I think for 3rd-party distributions it may be a problem. At the very
> least it needs to be communicated clearly in release notes or UPDATING.
> 
> Consider a downstream vendor who has support for signed binary
> executions.  If rtld allows a backdoor around exec(2) to run an unsigned
> binary, that could be a problem for them.  It is on them to add support
> to exec(2) to validate the special case of execing rtld with an
> argument, or to just disable the feature in rtld from this commit.

Note the undocumented O_VERIFY flag in open(2) from the patch.
This is very vendor-ish addition to request veriexec (?).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
> Well, for example, it seems like it would allow anyone to execute a
> binary even if the sysadmin had set it to -x specifically to prevent
> people from running it.

The direct mode does not (and cannot) honor set{u,g}id modes of the
executable, so any binary run this way would only exercise the existing
power of the user which did it.

The most advanced explanation that I was given in private was among
the lines: "if you have an environment where users can upload content
to a shared server, but have no access to chmod(2), no compilers, no
scripting languages, etc." The person then admitted that (s)he does not
consider it as an actual concern.

If somebody is worried about this or similar scenario, I might add too
restrictive check, e.g. requiring u+x if user is owner, g+x is primary
user group is the group of file, and o+x otherwise. This would be strict
subset of the normal unix checks and ACL would be also ignored.
Still I am not convinced.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Bryan Drewery
On 5/15/2017 12:00 PM, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
>> On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
>>> New Revision: 318313
>>> URL: https://svnweb.freebsd.org/changeset/base/318313
>>>
>>> Log:
>>>   Make ld-elf.so.1 directly executable.
>>
>> Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
>> /bin/chmod would now be possible on FreeBSD as well?
> Yes.
> 
>> Does this have any security implications?
> What do you mean ?
> 

I think for 3rd-party distributions it may be a problem. At the very
least it needs to be communicated clearly in release notes or UPDATING.

Consider a downstream vendor who has support for signed binary
executions.  If rtld allows a backdoor around exec(2) to run an unsigned
binary, that could be a problem for them.  It is on them to add support
to exec(2) to validate the special case of execing rtld with an
argument, or to just disable the feature in rtld from this commit.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 03:09:33PM -0400, Nikolai Lifanov wrote:
> On 05/15/2017 14:52, Alexey Dokuchaev wrote:
> > Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> > /bin/chmod would now be possible on FreeBSD as well?  Does this have
> > any security implications?
> 
> This is a use case for fixing accidentally hosed /bin/chmod binary and
> not some sort of an escalation thing. You will need to be root to do
> this.

Because /bin/chmod is owned by root, not because /libexec/ld-elf.so.1 is
limiting execution to root only, or is it (I might have missed uid check
in that patch [1], but at a quick glance I didn't see it).

On a living system, there are plenty of other ways to restore missing
+x on /bin/chmod as long as you can call chmod(2), from simple Python
script down to manually crafting small binary in hex.

> Likewise, with working chmod binary, you should be able to mark
> binaries with write access executable.

Well, it's not just about chmod(1), this opens what can be a can of worms
and I want to know how big it is.

./danfe

[1] Idea for security.bsd.ld_elf_exec_root_only sysctl(8)?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Nikolai Lifanov
On 05/15/2017 15:18, Jonathan Anderson wrote:
> On 15 May 2017, at 16:44, Jonathan Anderson wrote:
> 
>> You can already execute "non-executable" binaries using the `exec`
>> shell built-in:
>>
>> ```
>> $ cp /bin/sh .
>> $ chmod -x sh
>> $ exec sh
>> ```
> 
> Er, oops: I ought to have said, you can execute non-executable binaries
> by copying and marking them `+x`:
> 
> ```
> $ cp /bin/sh .
> $ chmod +x sh
> $ ./sh
> ```
> 
> (please ignore the bit about `exec`, that's from another mental thread)
> 
> 
> Jon

And the default install doesn't mount /tmp noexec ...

- Nikolai Lifanov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Jonathan Anderson

On 15 May 2017, at 16:44, Jonathan Anderson wrote:

You can already execute "non-executable" binaries using the `exec` 
shell built-in:


```
$ cp /bin/sh .
$ chmod -x sh
$ exec sh
```


Er, oops: I ought to have said, you can execute non-executable binaries 
by copying and marking them `+x`:


```
$ cp /bin/sh .
$ chmod +x sh
$ ./sh
```

(please ignore the bit about `exec`, that's from another mental thread)


Jon
--
Jonathan Anderson
jonat...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Jonathan Anderson

On 15 May 2017, at 16:38, Ian Lepore wrote:


On Mon, 2017-05-15 at 22:00 +0300, Konstantin Belousov wrote:

On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:


Does this have any security implications?

What do you mean ?



Well, for example, it seems like it would allow anyone to execute a
binary even if the sysadmin had set it to -x specifically to prevent
people from running it.


You can already execute "non-executable" binaries using the `exec` shell 
built-in:


```
$ cp /bin/sh .
$ chmod -x sh
$ exec sh
```


Jon
--
Jonathan Anderson
jonat...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Shawn Webb
On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
> On Mon, 2017-05-15 at 22:00 +0300, Konstantin Belousov wrote:
> > On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> > > 
> > > On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov
> > > wrote:
> > > > 
> > > > New Revision: 318313
> > > > URL: https://svnweb.freebsd.org/changeset/base/318313
> > > > 
> > > > Log:
> > > > ? Make ld-elf.so.1 directly executable.
> > > Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod
> > > +x
> > > /bin/chmod would now be possible on FreeBSD as well?
> > Yes.
> > 
> > > 
> > > Does this have any security implications?
> > What do you mean ?
> > 
> 
> Well, for example, it seems like it would allow anyone to execute a
> binary even if the sysadmin had set it to -x specifically to prevent
> people from running it.

It additionally subverts application whitelisting schemes where all
dependent shared objects (even the rtld) are checked (such is the case
with Integriforce in HardenedBSD).

Since even the rtld is checked, an attacker can now bypass the
application whitelisting scheme by running: /libexec/ld-elf.so.1
/path/to/previously/disallowed/executable

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 01:08:55PM -0600, Ian Lepore wrote:
> On Mon, 2017-05-15 at 22:00 +0300, Konstantin Belousov wrote:
> > On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> > > Does this have any security implications?
> > 
> > What do you mean ?
> 
> Well, for example, it seems like it would allow anyone to execute a
> binary even if the sysadmin had set it to -x specifically to prevent
> people from running it.

Right, that was something I was subconsciously worried of but could not
word it in timely fashion.  Thanks Ian.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Nikolai Lifanov
On 05/15/2017 14:52, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
>> New Revision: 318313
>> URL: https://svnweb.freebsd.org/changeset/base/318313
>>
>> Log:
>>   Make ld-elf.so.1 directly executable.
> 
> Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> /bin/chmod would now be possible on FreeBSD as well?  Does this have
> any security implications?
> 
> ./danfe

This is a use case for fixing accidentally hosed /bin/chmod binary and
not some sort of an escalation thing. You will need to be root to do
this. Likewise, with working chmod binary, you should be able to mark
binaries with write access executable.

- Nikolai Lifanov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 22:00 +0300, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> > 
> > On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov
> > wrote:
> > > 
> > > New Revision: 318313
> > > URL: https://svnweb.freebsd.org/changeset/base/318313
> > > 
> > > Log:
> > >   Make ld-elf.so.1 directly executable.
> > Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod
> > +x
> > /bin/chmod would now be possible on FreeBSD as well?
> Yes.
> 
> > 
> > Does this have any security implications?
> What do you mean ?
> 

Well, for example, it seems like it would allow anyone to execute a
binary even if the sysadmin had set it to -x specifically to prevent
people from running it.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 10:00:30PM +0300, Konstantin Belousov wrote:
> On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> > On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
> > > New Revision: 318313
> > > URL: https://svnweb.freebsd.org/changeset/base/318313
> > > 
> > > Log:
> > >   Make ld-elf.so.1 directly executable.
> ...
> > Does this have any security implications?
> 
> What do you mean ?

I don't know, but was thinking of something like "this change makes X and Z
scenarios now possible; if you're worried about this you might want to chmod
-x /libexec/ld-elf.so.1 to restore previous behavior".  BTW, would chmod -x
/libexec/ld-elf.so.1 break anything from now on?

If you cannot think of anything like this (specific), sorry for the noise,
you can ignore me.

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 06:52:36PM +, Alexey Dokuchaev wrote:
> On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
> > New Revision: 318313
> > URL: https://svnweb.freebsd.org/changeset/base/318313
> > 
> > Log:
> >   Make ld-elf.so.1 directly executable.
> 
> Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
> /bin/chmod would now be possible on FreeBSD as well?
Yes.

> Does this have any security implications?
What do you mean ?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Alexey Dokuchaev
On Mon, May 15, 2017 at 06:48:58PM +, Konstantin Belousov wrote:
> New Revision: 318313
> URL: https://svnweb.freebsd.org/changeset/base/318313
> 
> Log:
>   Make ld-elf.so.1 directly executable.

Does it mean that old Linux' trick of /lib/ld-linux.so.2 /bin/chmod +x
/bin/chmod would now be possible on FreeBSD as well?  Does this have
any security implications?

./danfe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 11:24 -0700, Ngie Cooper (yaneurabeya) wrote:
> > 
> > On May 15, 2017, at 10:47, Ngie Cooper (yaneurabeya)  > mail.com> wrote:
> > 
> > 
> > > 
> > > On May 15, 2017, at 10:43, Ian Lepore  wrote:
> > …
> > 
> > > 
> > > That's only a good argument for keeping the lines in the
> > > monolithic
> > > file if those lines will be ignored when a file in the .conf.d
> > > directory provides conflicting config.  Otherwise my embedded
> > > product
> > > that drops different rules for rotating /var/log/messages into
> > > .conf.d
> > > STILL has to programmatically edit the monolithic file to remove
> > > the
> > > standard rule(s).
> > Bingo. This is part of the reason why I did this, apart from
> > being selfish in not wanting to handle a handful of unnecessary
> > entries in newsyslog/syslogd on all of my systems where I set these
> > knobs to no.
> > Literally all I did was `dd+p` in vim in the new files. I didn’t
> > add or subtract any overall entries.
> And for context, we (Isilon) run newsyslog more frequently than
> upstream (sometimes every couple minutes, sometimes multiple times an
> hour/day), attributing to unnecessary creation and modification of
> log files (like this) that we (Isilon) don’t care about at all, which
> causes other potential issues with root media wear, potential for
> filesystem corruption, reduced number of available inodes/space
> because it allocates at least the frag size for a file, etc.
> 

We also run log rotation frequently (every 5 minutes) on our embedded
systems.  That was super-important back when we logged to a ram
filesystem, then newsyslog would rotate and compress from there to
sdcard.  Now we just log to sdcard because when something goes wrong
it's almost always the end of the log that has the clues (unless
something triggers runaway log spewage) and we often lost it.

A local modification we still apply to our syslogd allows you to
specify in syslog.conf that for any given file, syslogd itself should
limit the size of that file if the rotation doesn't take care of it
soon enough.  That was important to prevent filling up a ram filesystem
with runaway logging.  Now it's a feature we don't use much, but before
I throw it overboard I thought I'd mention it here in case others have
any use for it...

The way the feature worked was you could put at the end of a line in
syslog.conf "R K" -- the 'R' had a historical meaning that's now
lost, so we bacronymed it to mean "Recycle" -- when the log grows to
K in size, the last 32K of the file becomes a circular buffer that
continually gets rewritten until a normal file rotation happens.  If
something triggers runaway logging, the hope is that that event got
captured somewhere before the final 32k of the file, so you still have
some clues for postmortem analysis.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r318313 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 18:48:58 2017
New Revision: 318313
URL: https://svnweb.freebsd.org/changeset/base/318313

Log:
  Make ld-elf.so.1 directly executable.
  
  Check if passed phdr is actually phdr of the interpreter itself, and
  decide that this is the case of direct execution.  In this case, the
  binary to activate is specified in the argv[1].  After opening it,
  shift down on-stack structure with argv, env and aux vectors to
  emulate execution of the binary and not of the interpreter.
  
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D10701

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon May 15 18:47:25 2017
(r318312)
+++ head/libexec/rtld-elf/rtld.cMon May 15 18:48:58 2017
(r318313)
@@ -339,13 +339,14 @@ _LD(const char *var)
 func_ptr_type
 _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
 {
-Elf_Auxinfo *aux, *auxp, *aux_info[AT_COUNT];
+Elf_Auxinfo *aux, *auxp, *auxpf, *aux_info[AT_COUNT];
 Objlist_Entry *entry;
 Obj_Entry *last_interposer, *obj, *preload_tail;
 const Elf_Phdr *phdr;
 Objlist initlist;
 RtldLockState lockstate;
-char **argv, *argv0, **env, *kexecpath, *library_path_rpath;
+Elf_Addr *argcp;
+char **argv, *argv0, **env, **envp, *kexecpath, *library_path_rpath;
 caddr_t imgentry;
 char buf[MAXPATHLEN];
 int argc, fd, i, mib[2], phnum;
@@ -359,6 +360,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
  */
 
 /* Find the auxiliary vector on the stack. */
+argcp = sp;
 argc = *sp++;
 argv = (char **) sp;
 sp += argc + 1;/* Skip over arguments and NULL terminator */
@@ -410,6 +412,57 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 
 md_abi_variant_hook(aux_info);
 
+fd = -1;
+if (aux_info[AT_EXECFD] != NULL) {
+   fd = aux_info[AT_EXECFD]->a_un.a_val;
+} else {
+   assert(aux_info[AT_PHDR] != NULL);
+   phdr = (const Elf_Phdr *)aux_info[AT_PHDR]->a_un.a_ptr;
+   if (phdr == obj_rtld.phdr) {
+   dbg("opening main program in direct exec mode");
+   if (argc >= 2) {
+   argv0 = argv[1];
+   fd = open(argv0, O_RDONLY | O_CLOEXEC | O_VERIFY);
+   if (fd == -1) {
+   rtld_printf("Opening %s: %s\n", argv0,
+ rtld_strerror(errno));
+   rtld_die();
+   }
+
+   /*
+* For direct exec mode, argv[0] is the interpreter
+* name, we must remove it and shift arguments left by
+* 1 before invoking binary main.  Since stack layout
+* places environment pointers and aux vectors right
+* after the terminating NULL, we must shift
+* environment and aux as well.
+* XXX Shift will be > 1 when options are implemented.
+*/
+   do {
+   *argv = *(argv + 1);
+   argv++;
+   } while (*argv != NULL);
+   *argcp -= 1;
+   main_argc = argc - 1;
+   environ = env = envp = argv;
+   do {
+   *envp = *(envp + 1);
+   envp++;
+   } while (*envp != NULL);
+   aux = auxp = (Elf_Auxinfo *)envp;
+   auxpf = (Elf_Auxinfo *)(envp + 1);
+   for (;; auxp++, auxpf++) {
+   *auxp = *auxpf;
+   if (auxp->a_type == AT_NULL)
+   break;
+   }
+   } else {
+   rtld_printf("no binary\n");
+   rtld_die();
+   }
+   }
+}
+
 ld_bind_now = getenv(_LD("BIND_NOW"));
 
 /* 
@@ -470,8 +523,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
  * Load the main program, or process its program header if it is
  * already loaded.
  */
-if (aux_info[AT_EXECFD] != NULL) { /* Load the main program. */
-   fd = aux_info[AT_EXECFD]->a_un.a_val;
+if (fd != -1) {/* Load the main program. */
dbg("loading main program");
obj_main = map_object(fd, argv0, NULL);
close(fd);
@@ -492,7 +544,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
rtld_die();
 }
 
-if (aux_info[AT_EXECPATH] != NULL) {
+if (aux_info[AT_EXECPATH] != NULL && fd == -1) {
kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr;
dbg("AT_EXECPATH %p %s", kexecpath, kexecpath);
if (kexecpath[0] == '/')
@@ -504,7 +556,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
else
obj_main->path = xstrdup(buf);
 } else {
-   dbg("No AT_EXECPATH");
+   dbg("No AT_EXECPATH or direct exec");
obj_main->path 

svn commit: r318312 - head/libexec/rtld-elf

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 18:47:25 2017
New Revision: 318312
URL: https://svnweb.freebsd.org/changeset/base/318312

Log:
  Fix the AT_EXECFD functionality.
  
  If the mapped object is linked at specific address, we must obey it.
  If AT_EXECFD is not used, only in-kernel ELF image activator needed to
  keep the mapping address, since only binaries are linked at the fixed
  address, and binaries are mapped by kernel in this case.
  
  Reviewed by:  emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  X-Differential revision:  https://reviews.freebsd.org/D10701

Modified:
  head/libexec/rtld-elf/map_object.c

Modified: head/libexec/rtld-elf/map_object.c
==
--- head/libexec/rtld-elf/map_object.c  Mon May 15 18:41:12 2017
(r318311)
+++ head/libexec/rtld-elf/map_object.c  Mon May 15 18:47:25 2017
(r318312)
@@ -193,6 +193,8 @@ map_object(int fd, const char *path, con
 base_flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE;
 if (npagesizes > 1 && round_page(segs[0]->p_filesz) >= pagesizes[1])
base_flags |= MAP_ALIGNED_SUPER;
+if (base_vaddr != 0)
+   base_flags |= MAP_FIXED | MAP_EXCL;
 
 mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0);
 if (mapbase == (caddr_t) -1) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Bryan Drewery
On 5/12/2017 8:10 PM, Ngie Cooper wrote:
> Author: ngie
> Date: Sat May 13 03:10:50 2017
> New Revision: 318250
> URL: https://svnweb.freebsd.org/changeset/base/318250
> 
> Log:
>   Handle the logfiles in newsyslog and syslogd conditionally, based on
>   src.conf(5) knobs
>   
>   This will allow consumers of FreeBSD to use the unmodified configuration
>   files out of the box more than previously.
>   
>   Both newsyslog.conf and syslog.conf:
>   - /var/log/lpd-errs (MK_LPR != no)
>   - /var/log/ppp.log (MK_PPP != no)
>   - /var/log/xferlog (MK_FTP != no)
>   
>   newsyslog.conf:
>   - /var/log/amd.log (MK_AMD != no)
>   - /var/log/pflog (MK_PF != no)
>   - /var/log/sendmail.st (MK_SENDMAIL != no)
>   
>   MFC after:  3 weeks
>   Sponsored by:   Dell EMC Isilon
> 
> Added:
>   head/etc/newsyslog.conf.d/amd.conf   (contents, props changed)
>   head/etc/newsyslog.conf.d/ftp.conf   (contents, props changed)
>   head/etc/newsyslog.conf.d/lpr.conf   (contents, props changed)
>   head/etc/newsyslog.conf.d/pf.conf   (contents, props changed)
>   head/etc/newsyslog.conf.d/ppp.conf   (contents, props changed)
>   head/etc/newsyslog.conf.d/sendmail.conf   (contents, props changed)
>   head/etc/syslog.d/
>   head/etc/syslog.d/Makefile   (contents, props changed)
>   head/etc/syslog.d/ftp.conf   (contents, props changed)
>   head/etc/syslog.d/lpr.conf   (contents, props changed)
>   head/etc/syslog.d/ppp.conf   (contents, props changed)
> Modified:
>   head/etc/Makefile
>   head/etc/newsyslog.conf
>   head/etc/newsyslog.conf.d/Makefile
>   head/etc/syslog.conf
>   head/tools/build/mk/OptionalObsoleteFiles.inc

+1

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r318311 - stable/10/usr.bin

2017-05-15 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 15 18:41:12 2017
New Revision: 318311
URL: https://svnweb.freebsd.org/changeset/base/318311

Log:
  MFC r317658:
  
Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean'

Modified:
  stable/10/usr.bin/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/Makefile
==
--- stable/10/usr.bin/Makefile  Mon May 15 18:38:01 2017(r318310)
+++ stable/10/usr.bin/Makefile  Mon May 15 18:41:12 2017(r318311)
@@ -403,6 +403,12 @@ SUBDIR+=   who
 SUBDIR+=   svn
 .endif
 
+# These are normally only handled for build-tools.
+.if make(clean*)
+SUBDIR+=   mkcsmapper_static
+SUBDIR+=   mkesdb_static
+.endif
+
 .include 
 
 SUBDIR:=   ${SUBDIR:O}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318310 - stable/11/usr.bin

2017-05-15 Thread Bryan Drewery
Author: bdrewery
Date: Mon May 15 18:38:01 2017
New Revision: 318310
URL: https://svnweb.freebsd.org/changeset/base/318310

Log:
  MFC r317658:
  
Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean'

Modified:
  stable/11/usr.bin/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/Makefile
==
--- stable/11/usr.bin/Makefile  Mon May 15 18:24:14 2017(r318309)
+++ stable/11/usr.bin/Makefile  Mon May 15 18:38:01 2017(r318310)
@@ -303,6 +303,12 @@ SUBDIR.${MK_UTMPX}+=   who
 SUBDIR.${MK_SVN}+= svn
 SUBDIR.${MK_SVNLITE}+= svn
 
+# These are normally only handled for build-tools.
+.if make(clean*)
+SUBDIR+=   mkcsmapper_static
+SUBDIR+=   mkesdb_static
+.endif
+
 .include 
 
 SUBDIR:=   ${SUBDIR:O:u}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ngie Cooper (yaneurabeya)

> On May 15, 2017, at 10:47, Ngie Cooper (yaneurabeya)  
> wrote:
> 
> 
>> On May 15, 2017, at 10:43, Ian Lepore  wrote:
> 
> …
> 
>> That's only a good argument for keeping the lines in the monolithic
>> file if those lines will be ignored when a file in the .conf.d
>> directory provides conflicting config.  Otherwise my embedded product
>> that drops different rules for rotating /var/log/messages into .conf.d
>> STILL has to programmatically edit the monolithic file to remove the
>> standard rule(s).
> 
>   Bingo. This is part of the reason why I did this, apart from being 
> selfish in not wanting to handle a handful of unnecessary entries in 
> newsyslog/syslogd on all of my systems where I set these knobs to no.
> Literally all I did was `dd+p` in vim in the new files. I didn’t add or 
> subtract any overall entries.

And for context, we (Isilon) run newsyslog more frequently than upstream 
(sometimes every couple minutes, sometimes multiple times an hour/day), 
attributing to unnecessary creation and modification of log files (like this) 
that we (Isilon) don’t care about at all, which causes other potential issues 
with root media wear, potential for filesystem corruption, reduced number of 
available inodes/space because it allocates at least the frag size for a file, 
etc.

Plus with the number of entries we have in syslog.conf (an order of magnitude 
larger than upstream), having to walk a linked list to evaluate how to handle 
messages when putting them out in log files does tend to add up with all of the 
logging we do on our appliances (which is considerably more chatty than I’ve 
seen other appliance vendors that I’ve worked for).

Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r318309 - stable/9/sys/dev/qlxgbe

2017-05-15 Thread David C Somayajulu
Author: davidcs
Date: Mon May 15 18:24:14 2017
New Revision: 318309
URL: https://svnweb.freebsd.org/changeset/base/318309

Log:
  MFC r317996
  Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
  Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

Modified:
  stable/9/sys/dev/qlxgbe/ql_isr.c
  stable/9/sys/dev/qlxgbe/ql_os.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/qlxgbe/ql_isr.c
==
--- stable/9/sys/dev/qlxgbe/ql_isr.cMon May 15 18:21:36 2017
(r318308)
+++ stable/9/sys/dev/qlxgbe/ql_isr.cMon May 15 18:24:14 2017
(r318309)
@@ -983,7 +983,8 @@ ql_isr(void *arg)
 
fp = &ha->tx_fp[idx];
 
-   if (fp->fp_taskqueue != NULL)
+   if ((fp->fp_taskqueue != NULL) &&
+   (ifp->if_drv_flags & IFF_DRV_RUNNING))
taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task);
 
return;

Modified: stable/9/sys/dev/qlxgbe/ql_os.c
==
--- stable/9/sys/dev/qlxgbe/ql_os.c Mon May 15 18:21:36 2017
(r318308)
+++ stable/9/sys/dev/qlxgbe/ql_os.c Mon May 15 18:24:14 2017
(r318309)
@@ -930,7 +930,9 @@ qla_set_multi(qla_host_t *ha, uint32_t a
if_maddr_runlock(ifp);
 
QLA_LOCK(ha);
-   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   }
QLA_UNLOCK(ha);
 
return (ret);
@@ -1036,20 +1038,16 @@ qla_ioctl(struct ifnet *ifp, u_long cmd,
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 1))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 1))
+   ret = EINVAL;
break;
 
case SIOCDELMULTI:
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 0))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 0))
+   ret = EINVAL;
break;
 
case SIOCSIFMEDIA:
@@ -1550,9 +1548,9 @@ qla_stop(qla_host_t *ha)
 
ha->flags.qla_interface_up = 0;
 
+   QLA_UNLOCK(ha);
qla_drain_fp_taskqueues(ha);
-
-   ql_hw_stop_rcv(ha);
+   QLA_LOCK(ha);
 
ql_del_hw_if(ha);
 
@@ -1943,8 +1941,6 @@ qla_error_recovery(void *context, int pe
ha->hw.imd_compl = 1;
qla_mdelay(__func__, 300);
 
-   ql_hw_stop_rcv(ha);
-
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING);
 
for (i = 0; i < ha->hw.num_sds_rings; i++) {
@@ -1964,6 +1960,8 @@ qla_error_recovery(void *context, int pe
 
 QLA_UNLOCK(ha);
 
+   qla_drain_fp_taskqueues(ha);
+
if ((ha->pci_func & 0x1) == 0) {
 
if (!ha->msg_from_peer) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318308 - stable/10/sys/dev/qlxgbe

2017-05-15 Thread David C Somayajulu
Author: davidcs
Date: Mon May 15 18:21:36 2017
New Revision: 318308
URL: https://svnweb.freebsd.org/changeset/base/318308

Log:
  MFC r317996
  Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
  Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

Modified:
  stable/10/sys/dev/qlxgbe/ql_isr.c
  stable/10/sys/dev/qlxgbe/ql_os.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/qlxgbe/ql_isr.c
==
--- stable/10/sys/dev/qlxgbe/ql_isr.c   Mon May 15 18:18:32 2017
(r318307)
+++ stable/10/sys/dev/qlxgbe/ql_isr.c   Mon May 15 18:21:36 2017
(r318308)
@@ -988,7 +988,8 @@ ql_isr(void *arg)
 
fp = &ha->tx_fp[idx];
 
-   if (fp->fp_taskqueue != NULL)
+   if ((fp->fp_taskqueue != NULL) &&
+   (ifp->if_drv_flags & IFF_DRV_RUNNING))
taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task);
 
return;

Modified: stable/10/sys/dev/qlxgbe/ql_os.c
==
--- stable/10/sys/dev/qlxgbe/ql_os.cMon May 15 18:18:32 2017
(r318307)
+++ stable/10/sys/dev/qlxgbe/ql_os.cMon May 15 18:21:36 2017
(r318308)
@@ -930,7 +930,9 @@ qla_set_multi(qla_host_t *ha, uint32_t a
if_maddr_runlock(ifp);
 
QLA_LOCK(ha);
-   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   }
QLA_UNLOCK(ha);
 
return (ret);
@@ -1036,20 +1038,16 @@ qla_ioctl(struct ifnet *ifp, u_long cmd,
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 1))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 1))
+   ret = EINVAL;
break;
 
case SIOCDELMULTI:
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 0))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 0))
+   ret = EINVAL;
break;
 
case SIOCSIFMEDIA:
@@ -1534,9 +1532,9 @@ qla_stop(qla_host_t *ha)
 
ha->flags.qla_interface_up = 0;
 
+   QLA_UNLOCK(ha);
qla_drain_fp_taskqueues(ha);
-
-   ql_hw_stop_rcv(ha);
+   QLA_LOCK(ha);
 
ql_del_hw_if(ha);
 
@@ -1927,8 +1925,6 @@ qla_error_recovery(void *context, int pe
ha->hw.imd_compl = 1;
qla_mdelay(__func__, 300);
 
-   ql_hw_stop_rcv(ha);
-
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING);
 
for (i = 0; i < ha->hw.num_sds_rings; i++) {
@@ -1948,6 +1944,8 @@ qla_error_recovery(void *context, int pe
 
 QLA_UNLOCK(ha);
 
+   qla_drain_fp_taskqueues(ha);
+
if ((ha->pci_func & 0x1) == 0) {
 
if (!ha->msg_from_peer) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318307 - head/sys/dev/cxgbe

2017-05-15 Thread Navdeep Parhar
Author: np
Date: Mon May 15 18:18:32 2017
New Revision: 318307
URL: https://svnweb.freebsd.org/changeset/base/318307

Log:
  cxgbe(4): Avoid an out of bounds access when an attempt to unbind a tx
  queue from a traffic class fails.
  
  Reported by:  x ksi 
  MFC after:3 days

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Mon May 15 18:07:57 2017(r318306)
+++ head/sys/dev/cxgbe/t4_sge.c Mon May 15 18:18:32 2017(r318307)
@@ -5323,7 +5323,7 @@ sysctl_tc(SYSCTL_HANDLER_ARGS)
tc->refcount--;
}
txq->tc_idx = tc_idx;
-   } else {
+   } else if (tc_idx != -1) {
tc = &pi->sched_params->cl_rl[tc_idx];
MPASS(tc->refcount > 0);
tc->refcount--;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318306 - stable/11/sys/dev/qlxgbe

2017-05-15 Thread David C Somayajulu
Author: davidcs
Date: Mon May 15 18:07:57 2017
New Revision: 318306
URL: https://svnweb.freebsd.org/changeset/base/318306

Log:
  MFC r317996
Fix bug where MTX_DEF lock was held while taskqueue_drain() was invoked.
Check IFF_DRV_RUNNING flag is set prior to calling ql_hw_set_multi()

Modified:
  stable/11/sys/dev/qlxgbe/ql_isr.c
  stable/11/sys/dev/qlxgbe/ql_os.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/qlxgbe/ql_isr.c
==
--- stable/11/sys/dev/qlxgbe/ql_isr.c   Mon May 15 18:02:13 2017
(r318305)
+++ stable/11/sys/dev/qlxgbe/ql_isr.c   Mon May 15 18:07:57 2017
(r318306)
@@ -987,7 +987,8 @@ ql_isr(void *arg)
 
fp = &ha->tx_fp[idx];
 
-   if (fp->fp_taskqueue != NULL)
+   if ((fp->fp_taskqueue != NULL) &&
+   (ifp->if_drv_flags & IFF_DRV_RUNNING))
taskqueue_enqueue(fp->fp_taskqueue, &fp->fp_task);
 
return;

Modified: stable/11/sys/dev/qlxgbe/ql_os.c
==
--- stable/11/sys/dev/qlxgbe/ql_os.cMon May 15 18:02:13 2017
(r318305)
+++ stable/11/sys/dev/qlxgbe/ql_os.cMon May 15 18:07:57 2017
(r318306)
@@ -925,7 +925,9 @@ qla_set_multi(qla_host_t *ha, uint32_t a
if_maddr_runlock(ifp);
 
QLA_LOCK(ha);
-   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   ret = ql_hw_set_multi(ha, mta, mcnt, add_multi);
+   }
QLA_UNLOCK(ha);
 
return (ret);
@@ -1031,20 +1033,16 @@ qla_ioctl(struct ifnet *ifp, u_long cmd,
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCADDMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 1))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 1))
+   ret = EINVAL;
break;
 
case SIOCDELMULTI:
QL_DPRINT4(ha, (ha->pci_dev,
"%s: %s (0x%lx)\n", __func__, "SIOCDELMULTI", cmd));
 
-   if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   if (qla_set_multi(ha, 0))
-   ret = EINVAL;
-   }
+   if (qla_set_multi(ha, 0))
+   ret = EINVAL;
break;
 
case SIOCSIFMEDIA:
@@ -1529,9 +1527,9 @@ qla_stop(qla_host_t *ha)
 
ha->flags.qla_interface_up = 0;
 
+   QLA_UNLOCK(ha);
qla_drain_fp_taskqueues(ha);
-
-   ql_hw_stop_rcv(ha);
+   QLA_LOCK(ha);
 
ql_del_hw_if(ha);
 
@@ -1922,8 +1920,6 @@ qla_error_recovery(void *context, int pe
ha->hw.imd_compl = 1;
qla_mdelay(__func__, 300);
 
-   ql_hw_stop_rcv(ha);
-
ifp->if_drv_flags &= ~(IFF_DRV_OACTIVE | IFF_DRV_RUNNING);
 
for (i = 0; i < ha->hw.num_sds_rings; i++) {
@@ -1943,6 +1939,8 @@ qla_error_recovery(void *context, int pe
 
 QLA_UNLOCK(ha);
 
+   qla_drain_fp_taskqueues(ha);
+
if ((ha->pci_func & 0x1) == 0) {
 
if (!ha->msg_from_peer) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318305 - head/tools/build/options

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 18:02:13 2017
New Revision: 318305
URL: https://svnweb.freebsd.org/changeset/base/318305

Log:
  makeman: reword description, based on feedback from wblock

Modified:
  head/tools/build/options/makeman

Modified: head/tools/build/options/makeman
==
--- head/tools/build/options/makemanMon May 15 17:57:09 2017
(r318304)
+++ head/tools/build/options/makemanMon May 15 18:02:13 2017
(r318305)
@@ -3,15 +3,15 @@
 # This file is in the public domain.
 # $FreeBSD$
 #
-# This script is used to create the src.conf.5 man page, using template text
-# contained herein and the contents of the WITH_* and WITHOUT_* files in the
-# same directory. Each WITH_* and WITHOUT_* file documents the effect of the
+# This script creates the src.conf.5 man page using template text contained
+# herein and the contents of the WITH_* and WITHOUT_* files in the same
+# directory. Each WITH_* and WITHOUT_* file documents the effect of the
 # /etc/src.conf knob with the same name.
 #
-# This script invokes "make showconfig" for each supported architecture in
-# order to determine, for each option, whether the default setting is always
-# WITH, always WITHOUT, or is architecture-dependent. It also determines
-# and describes dependencies between options.
+# For each supported architecture, "make showconfig" is invoked to determine
+# the default setting of every option: always WITH_, always WITHOUT_, or
+# architecture-dependent WITH_/WITHOUT_.  It also determines and describes
+# dependencies between options.
 #
 # Usage:
 #
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318304 - head/lib/libc/gen

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 17:57:09 2017
New Revision: 318304
URL: https://svnweb.freebsd.org/changeset/base/318304

Log:
  getusershell: don't write past end of line buffer reading local shells
  
  _local_initshells did not reset cp to the beginning of the line buffer
  for every iteration that it called fgets(3), leading to writing past the
  end of line with fairly long /etc/shells or excessively long line
  lengths. Correct this by properly resetting cp.
  
  PR:   192528
  Submitted by: Kyle Evans 
  Reviewed by:  cem, jilles
  Differential Revision:https://reviews.freebsd.org/D10690

Modified:
  head/lib/libc/gen/getusershell.c

Modified: head/lib/libc/gen/getusershell.c
==
--- head/lib/libc/gen/getusershell.cMon May 15 17:54:36 2017
(r318303)
+++ head/lib/libc/gen/getusershell.cMon May 15 17:57:09 2017
(r318304)
@@ -115,8 +115,8 @@ _local_initshells(void  *rv, void *cb_dat
if ((fp = fopen(_PATH_SHELLS, "re")) == NULL)
return NS_UNAVAIL;
 
-   cp = line;
-   while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) {
+   while (fgets(line, MAXPATHLEN + 1, fp) != NULL) {
+   cp = line;
while (*cp != '#' && *cp != '/' && *cp != '\0')
cp++;
if (*cp == '#' || *cp == '\0')
@@ -124,7 +124,7 @@ _local_initshells(void  *rv, void *cb_dat
sp = cp;
while (!isspace(*cp) && *cp != '#' && *cp != '\0')
cp++;
-   *cp++ = '\0';
+   *cp = '\0';
sl_add(sl, strdup(sp));
}
(void)fclose(fp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318303 - head/lib/libc/stdlib

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 17:54:36 2017
New Revision: 318303
URL: https://svnweb.freebsd.org/changeset/base/318303

Log:
  Style.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==
--- head/lib/libc/stdlib/realpath.c Mon May 15 17:51:01 2017
(r318302)
+++ head/lib/libc/stdlib/realpath.c Mon May 15 17:54:36 2017
(r318303)
@@ -89,7 +89,7 @@ realpath1(const char *path, char *resolv
 */
p = strchr(left, '/');
 
-   next_token_len = p ? p - left : left_len;
+   next_token_len = p != NULL ? p - left : left_len;
memcpy(next_token, left, next_token_len);
next_token[next_token_len] = '\0';
 
@@ -112,10 +112,9 @@ realpath1(const char *path, char *resolv
if (next_token[0] == '\0') {
/* Handle consequential slashes. */
continue;
-   }
-   else if (strcmp(next_token, ".") == 0)
+   } else if (strcmp(next_token, ".") == 0) {
continue;
-   else if (strcmp(next_token, "..") == 0) {
+   } else if (strcmp(next_token, "..") == 0) {
/*
 * Strip the last path component except when we have
 * single "/"
@@ -146,13 +145,12 @@ realpath1(const char *path, char *resolv
}
slen = readlink(resolved, symlink, sizeof(symlink));
if (slen <= 0 || slen >= sizeof(symlink)) {
-   if (slen < 0) {
-   /* keep errno from readlink(2) call */
-   } else if (slen == 0) {
+   if (slen < 0)
+   ; /* keep errno from readlink(2) call */
+   else if (slen == 0)
errno = ENOENT;
-   } else {
+   else
errno = ENAMETOOLONG;
-   }
return (NULL);
}
symlink[slen] = '\0';
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318302 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 17:51:01 2017
New Revision: 318302
URL: https://svnweb.freebsd.org/changeset/base/318302

Log:
  bsdgrep: don't allow negative -A / -B / -C
  
  Previously, when given a negative -A/-B/-C argument bsdgrep would
  overflow the respective context flag(s) and exhibited surprising
  behavior.
  
  Fix this by removing unsignedness of Aflag/Bflag and erroring out if
  we're given a value < 0.  Also adjust the type used to track 'tail'
  context in procfile() so that it accurately reflects the Aflag value
  rather than overflowing and losing trailing context.
  
  This also fixes an inconsistency previously existing between -n and
  -C "n" behavior.  They are now both limited to LLONG_MAX, to be
  consistent.
  
  Add some test cases to make sure grep errors out properly for both
  negative context values as well as non-numeric context values rather
  than giving bogus matches.
  
  Submitted by: Kyle Evans 
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D10675

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/grep.h
  head/usr.bin/grep/queue.c
  head/usr.bin/grep/util.c

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shMon May 15 17:48:58 
2017(r318301)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shMon May 15 17:51:01 
2017(r318302)
@@ -517,6 +517,28 @@ grep_nomatch_flags_body()
atf_check -o empty grep -q -A 1 -e "B" test1
atf_check -o empty grep -q -C 1 -e "B" test1
 }
+
+atf_test_case badcontext
+badcontext_head()
+{
+   atf_set "descr" "Check for handling of invalid context arguments"
+}
+badcontext_body()
+{
+   printf "A\nB\nC\n" > test1
+
+   atf_check -s not-exit:0 -e ignore grep -A "-1" "B" test1
+
+   atf_check -s not-exit:0 -e ignore grep -B "-1" "B" test1
+
+   atf_check -s not-exit:0 -e ignore grep -C "-1" "B" test1
+
+   atf_check -s not-exit:0 -e ignore grep -A "B" "B" test1
+
+   atf_check -s not-exit:0 -e ignore grep -B "B" "B" test1
+
+   atf_check -s not-exit:0 -e ignore grep -C "B" "B" test1
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -551,5 +573,6 @@ atf_init_test_cases()
atf_add_test_case egrep_sanity
atf_add_test_case grep_sanity
atf_add_test_case grep_nomatch_flags
+   atf_add_test_case badcontext
 # End FreeBSD
 }

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cMon May 15 17:48:58 2017(r318301)
+++ head/usr.bin/grep/grep.cMon May 15 17:51:01 2017(r318302)
@@ -108,8 +108,8 @@ struct epat *dpattern, *fpattern;
 charre_error[RE_ERROR_BUF + 1];
 
 /* Command-line flags */
-unsigned long long Aflag;  /* -A x: print x lines trailing each match */
-unsigned long long Bflag;  /* -B x: print x lines leading each match */
+long long Aflag;   /* -A x: print x lines trailing each match */
+long long Bflag;   /* -B x: print x lines leading each match */
 boolHflag; /* -H: always print file name */
 boolLflag; /* -L: only show names of files with no matches */
 boolbflag; /* -b: show block numbers for each match */
@@ -351,7 +351,7 @@ main(int argc, char *argv[])
char **aargv, **eargv, *eopts;
char *ep;
const char *pn;
-   unsigned long long l;
+   long long l;
unsigned int aargc, eargc, i;
int c, lastc, needpattern, newarg, prevoptind;
 
@@ -438,10 +438,11 @@ main(int argc, char *argv[])
case '5': case '6': case '7': case '8': case '9':
if (newarg || !isdigit(lastc))
Aflag = 0;
-   else if (Aflag > LLONG_MAX / 10) {
+   else if (Aflag > LLONG_MAX / 10 - 1) {
errno = ERANGE;
err(2, NULL);
}
+
Aflag = Bflag = (Aflag * 10) + (c - '0');
break;
case 'C':
@@ -454,14 +455,17 @@ main(int argc, char *argv[])
/* FALLTHROUGH */
case 'B':
errno = 0;
-   l = strtoull(optarg, &ep, 10);
-   if (((errno == ERANGE) && (l == ULLONG_MAX)) ||
-   ((errno == EINVAL) && (l == 0)))
+   l = strtoll(optarg, &ep, 10);
+   if (errno == ERANGE || errno == EINVAL)
err(2, NULL);
else if (ep[0] != '\0') {
errno = EINVAL;
err(2, NULL);
+   } else if (l < 0) {
+  

svn commit: r318301 - stable/10/sys/dev/qlnx/qlnxe

2017-05-15 Thread David C Somayajulu
Author: davidcs
Date: Mon May 15 17:48:58 2017
New Revision: 318301
URL: https://svnweb.freebsd.org/changeset/base/318301

Log:
  MFC r318126
  llh_func_filter needs to be configured for 100G

Modified:
  stable/10/sys/dev/qlnx/qlnxe/ecore_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/qlnx/qlnxe/ecore_dev.c
==
--- stable/10/sys/dev/qlnx/qlnxe/ecore_dev.cMon May 15 17:45:05 2017
(r318300)
+++ stable/10/sys/dev/qlnx/qlnxe/ecore_dev.cMon May 15 17:48:58 2017
(r318301)
@@ -1986,6 +1986,15 @@ static enum _ecore_status_t ecore_hw_ini
}
}
 #endif
+   /* Add an LLH filter with the primary MAC address.  */
+   if (p_hwfn->p_dev->num_hwfns > 1 && IS_LEAD_HWFN(p_hwfn)) {
+   rc = ecore_llh_add_mac_filter(p_hwfn, p_ptt,
+ p_hwfn->hw_info.hw_mac_addr);
+   if (rc != ECORE_SUCCESS)
+   DP_NOTICE(p_hwfn, false,
+   "Failed to add an LLH filter with the primary 
MAC\n");
+   }
+
if (b_hw_start) {
/* enable interrupts */
rc = ecore_int_igu_enable(p_hwfn, p_ptt, int_mode);
@@ -2473,6 +2482,11 @@ enum _ecore_status_t ecore_hw_stop(struc
rc2 = ECORE_UNKNOWN_ERROR;
}
}
+
+   /* remove the LLH filter with the primary MAC addres */
+   if (p_hwfn->p_dev->num_hwfns > 1 && IS_LEAD_HWFN(p_hwfn))
+   ecore_llh_remove_mac_filter(p_hwfn, p_ptt,
+   p_hwfn->hw_info.hw_mac_addr);
} /* hwfn loop */
 
if (IS_PF(p_dev)) {
@@ -4569,7 +4583,7 @@ enum _ecore_status_t ecore_llh_add_mac_f
}
 
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx is added at 
%d\n",
+  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx is added at 
LLH entry %d\n",
   p_filter[0], p_filter[1], p_filter[2], p_filter[3],
   p_filter[4], p_filter[5], entry_num);
 
@@ -4651,7 +4665,7 @@ void ecore_llh_remove_mac_filter(struct 
}
 
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx was removed 
from %d\n",
+  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx was removed 
from LLH entry %d\n",
   p_filter[0], p_filter[1], p_filter[2], p_filter[3],
   p_filter[4], p_filter[5], entry_num);
 }
@@ -4760,37 +4774,37 @@ ecore_llh_add_protocol_filter(struct eco
switch (type) {
case ECORE_LLH_FILTER_ETHERTYPE:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "ETH type %x is added at %d\n",
+  "ETH type %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_TCP_SRC_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP src port %x is added at %d\n",
+  "TCP src port %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_UDP_SRC_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP src port %x is added at %d\n",
+  "UDP src port %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_TCP_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP dst port %x is added at %d\n",
+  "TCP dst port %x is added at LLH entry %d\n",
   dest_port, entry_num);
break;
case ECORE_LLH_FILTER_UDP_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP dst port %x is added at %d\n",
+  "UDP dst port %x is added at LLH entry %d\n",
   dest_port, entry_num);
break;
case ECORE_LLH_FILTER_TCP_SRC_AND_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP src/dst ports %x/%x are added at %d\n",
+  "TCP src/dst ports %x/%x are added at LLH entry 
%d\n",
   source_port_or_eth_type, dest_port, entry_num);
break;
case ECORE_LLH_FILTER_UDP_SRC_AND_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP src/dst ports %x/%x are added at %d\n",
+  "UDP src/dst ports %x/%x are added at LLH entry 
%d\n",
   source_port_or_eth_type, dest_port, entry_num

Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ngie Cooper (yaneurabeya)

> On May 15, 2017, at 10:43, Ian Lepore  wrote:

…

> That's only a good argument for keeping the lines in the monolithic
> file if those lines will be ignored when a file in the .conf.d
> directory provides conflicting config.  Otherwise my embedded product
> that drops different rules for rotating /var/log/messages into .conf.d
> STILL has to programmatically edit the monolithic file to remove the
> standard rule(s).

Bingo. This is part of the reason why I did this, apart from being 
selfish in not wanting to handle a handful of unnecessary entries in 
newsyslog/syslogd on all of my systems where I set these knobs to no.
Literally all I did was `dd+p` in vim in the new files. I didn’t add or 
subtract any overall entries.
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r318300 - stable/11/sys/dev/qlnx/qlnxe

2017-05-15 Thread David C Somayajulu
Author: davidcs
Date: Mon May 15 17:45:05 2017
New Revision: 318300
URL: https://svnweb.freebsd.org/changeset/base/318300

Log:
  MFC r318126
llh_func_filter needs to be configured for 100G

Modified:
  stable/11/sys/dev/qlnx/qlnxe/ecore_dev.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/qlnx/qlnxe/ecore_dev.c
==
--- stable/11/sys/dev/qlnx/qlnxe/ecore_dev.cMon May 15 17:34:17 2017
(r318299)
+++ stable/11/sys/dev/qlnx/qlnxe/ecore_dev.cMon May 15 17:45:05 2017
(r318300)
@@ -1986,6 +1986,15 @@ static enum _ecore_status_t ecore_hw_ini
}
}
 #endif
+   /* Add an LLH filter with the primary MAC address.  */
+   if (p_hwfn->p_dev->num_hwfns > 1 && IS_LEAD_HWFN(p_hwfn)) {
+   rc = ecore_llh_add_mac_filter(p_hwfn, p_ptt,
+ p_hwfn->hw_info.hw_mac_addr);
+   if (rc != ECORE_SUCCESS)
+   DP_NOTICE(p_hwfn, false,
+   "Failed to add an LLH filter with the primary 
MAC\n");
+   }
+
if (b_hw_start) {
/* enable interrupts */
rc = ecore_int_igu_enable(p_hwfn, p_ptt, int_mode);
@@ -2473,6 +2482,11 @@ enum _ecore_status_t ecore_hw_stop(struc
rc2 = ECORE_UNKNOWN_ERROR;
}
}
+
+   /* remove the LLH filter with the primary MAC addres */
+   if (p_hwfn->p_dev->num_hwfns > 1 && IS_LEAD_HWFN(p_hwfn))
+   ecore_llh_remove_mac_filter(p_hwfn, p_ptt,
+   p_hwfn->hw_info.hw_mac_addr);
} /* hwfn loop */
 
if (IS_PF(p_dev)) {
@@ -4569,7 +4583,7 @@ enum _ecore_status_t ecore_llh_add_mac_f
}
 
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx is added at 
%d\n",
+  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx is added at 
LLH entry %d\n",
   p_filter[0], p_filter[1], p_filter[2], p_filter[3],
   p_filter[4], p_filter[5], entry_num);
 
@@ -4651,7 +4665,7 @@ void ecore_llh_remove_mac_filter(struct 
}
 
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx was removed 
from %d\n",
+  "MAC: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx was removed 
from LLH entry %d\n",
   p_filter[0], p_filter[1], p_filter[2], p_filter[3],
   p_filter[4], p_filter[5], entry_num);
 }
@@ -4760,37 +4774,37 @@ ecore_llh_add_protocol_filter(struct eco
switch (type) {
case ECORE_LLH_FILTER_ETHERTYPE:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "ETH type %x is added at %d\n",
+  "ETH type %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_TCP_SRC_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP src port %x is added at %d\n",
+  "TCP src port %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_UDP_SRC_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP src port %x is added at %d\n",
+  "UDP src port %x is added at LLH entry %d\n",
   source_port_or_eth_type, entry_num);
break;
case ECORE_LLH_FILTER_TCP_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP dst port %x is added at %d\n",
+  "TCP dst port %x is added at LLH entry %d\n",
   dest_port, entry_num);
break;
case ECORE_LLH_FILTER_UDP_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP dst port %x is added at %d\n",
+  "UDP dst port %x is added at LLH entry %d\n",
   dest_port, entry_num);
break;
case ECORE_LLH_FILTER_TCP_SRC_AND_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "TCP src/dst ports %x/%x are added at %d\n",
+  "TCP src/dst ports %x/%x are added at LLH entry 
%d\n",
   source_port_or_eth_type, dest_port, entry_num);
break;
case ECORE_LLH_FILTER_UDP_SRC_AND_DEST_PORT:
DP_VERBOSE(p_hwfn, ECORE_MSG_HW,
-  "UDP src/dst ports %x/%x are added at %d\n",
+  "UDP src/dst ports %x/%x are added at LLH entry 
%d\n",
   source_port_or_eth_type, dest_port, entry_num);

Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread Ian Lepore
On Mon, 2017-05-15 at 10:13 -0700, John Baldwin wrote:
> On Saturday, May 13, 2017 10:39:15 AM Warner Losh wrote:
> > 
> > > 
> > > > 
> > > > - It's really easy to screw up a mergemaster call if you edit
> > > > the files, and install the stock version which removes the
> > > > edits.
> > > Also, programmatically removing the entries means you have to
> > > bake the metadata into etc/Makefile, which is already complicated
> > > enough as-is.
> > Why do you care about removing them at all? They are no-ops if the
> > files don't exist. Why not just always install all these files is
> > where I'm going with this...
> I think this is actually the bigger question.  I think it is
> perfectly
> sensible to support conf.d/* files for ports to use and as a way to
> manage logs for application logs on an appliance, etc.  However, this
> shuffling is a bit of a merge nightmare for anyone using mergemaster
> or etcupdate, and the biggest cost is that newsyslog will create a
> one-line file in /var/log for entries with 'C'.
> 

That's only a good argument for keeping the lines in the monolithic
file if those lines will be ignored when a file in the .conf.d
directory provides conflicting config.  Otherwise my embedded product
that drops different rules for rotating /var/log/messages into .conf.d
STILL has to programmatically edit the monolithic file to remove the
standard rule(s).

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318299 - head/lib/libc/stdlib

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 17:34:17 2017
New Revision: 318299
URL: https://svnweb.freebsd.org/changeset/base/318299

Log:
  Simplify cleanup on failure in realpath(3).
  
  If realpath() allocated memory for result and failed, the memory is
  freed in each place where return is performed.  More, the function
  needs to track the allocation status, to not free user-supplied
  buffer.
  
  Consolidate the memory handling in the wrapper, freeing the buffer if
  the actual worker failed.
  
  Reviewed by:  emaste (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D10670

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==
--- head/lib/libc/stdlib/realpath.c Mon May 15 17:14:53 2017
(r318298)
+++ head/lib/libc/stdlib/realpath.c Mon May 15 17:34:17 2017
(r318299)
@@ -47,32 +47,16 @@ __FBSDID("$FreeBSD$");
  * components.  Returns (resolved) on success, or (NULL) on failure,
  * in which case the path which caused trouble is left in (resolved).
  */
-char *
-realpath(const char * __restrict path, char * __restrict resolved)
+static char *
+realpath1(const char *path, char *resolved)
 {
struct stat sb;
char *p, *q;
size_t left_len, resolved_len, next_token_len;
unsigned symlinks;
-   int m;
ssize_t slen;
char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
-   if (path == NULL) {
-   errno = EINVAL;
-   return (NULL);
-   }
-   if (path[0] == '\0') {
-   errno = ENOENT;
-   return (NULL);
-   }
-   if (resolved == NULL) {
-   resolved = malloc(PATH_MAX);
-   if (resolved == NULL)
-   return (NULL);
-   m = 1;
-   } else
-   m = 0;
symlinks = 0;
if (path[0] == '/') {
resolved[0] = '/';
@@ -83,20 +67,14 @@ realpath(const char * __restrict path, c
left_len = strlcpy(left, path + 1, sizeof(left));
} else {
if (getcwd(resolved, PATH_MAX) == NULL) {
-   if (m)
-   free(resolved);
-   else {
-   resolved[0] = '.';
-   resolved[1] = '\0';
-   }
+   resolved[0] = '.';
+   resolved[1] = '\0';
return (NULL);
}
resolved_len = strlen(resolved);
left_len = strlcpy(left, path, sizeof(left));
}
if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
-   if (m)
-   free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -125,8 +103,6 @@ realpath(const char * __restrict path, c
 
if (resolved[resolved_len - 1] != '/') {
if (resolved_len + 1 >= PATH_MAX) {
-   if (m)
-   free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -158,27 +134,18 @@ realpath(const char * __restrict path, c
 */
resolved_len = strlcat(resolved, next_token, PATH_MAX);
if (resolved_len >= PATH_MAX) {
-   if (m)
-   free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
-   if (lstat(resolved, &sb) != 0) {
-   if (m)
-   free(resolved);
+   if (lstat(resolved, &sb) != 0)
return (NULL);
-   }
if (S_ISLNK(sb.st_mode)) {
if (symlinks++ > MAXSYMLINKS) {
-   if (m)
-   free(resolved);
errno = ELOOP;
return (NULL);
}
slen = readlink(resolved, symlink, sizeof(symlink));
if (slen <= 0 || slen >= sizeof(symlink)) {
-   if (m)
-   free(resolved);
if (slen < 0) {
/* keep errno from readlink(2) call */
} else if (slen == 0) {
@@ -207,8 +174,6 @@ realpath(const char * __restrict path, c
if (p != NULL) {
if (symlink[slen - 1] != '/') {
if (slen + 1 >= sizeof(symlink)) {
-   

Re: svn commit: r318250 - in head: etc etc/newsyslog.conf.d etc/syslog.d tools/build/mk

2017-05-15 Thread John Baldwin
On Saturday, May 13, 2017 10:39:15 AM Warner Losh wrote:
> >> - It's really easy to screw up a mergemaster call if you edit the files, 
> >> and install the stock version which removes the edits.
> >
> > Also, programmatically removing the entries means you have to bake the 
> > metadata into etc/Makefile, which is already complicated enough as-is.
> 
> Why do you care about removing them at all? They are no-ops if the
> files don't exist. Why not just always install all these files is
> where I'm going with this...

I think this is actually the bigger question.  I think it is perfectly
sensible to support conf.d/* files for ports to use and as a way to
manage logs for application logs on an appliance, etc.  However, this
shuffling is a bit of a merge nightmare for anyone using mergemaster
or etcupdate, and the biggest cost is that newsyslog will create a
one-line file in /var/log for entries with 'C'.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318298 - head/lib/libc/stdlib

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 17:14:53 2017
New Revision: 318298
URL: https://svnweb.freebsd.org/changeset/base/318298

Log:
  Fix several buffer overflows in realpath(3).
  - The statement "left_len -= s - left;" does not take the slash into
account if one was found. This results in the invariant
"left[left_len] == '\0'" being violated (and possible buffer
overflows). The patch replaces the variable "s" with a size_t
"next_token_len" for more clarity.
  - "slen" from readlink(2) can be 0 when encountering empty
symlinks. Then, further down, "symlink[slen - 1]" underflows the
buffer. When slen == 0, realpath(3) should probably return ENOENT
(http://austingroupbugs.net/view.php?id=825,
https://lwn.net/Articles/551224/).
  
  Some other minor issues:
  - The condition "resolved_len >= PATH_MAX" cannot be true.
  - Similarly, "s - left >= sizeof(next_token)" cannot be true, as long
as "sizeof(next_token) >= sizeof(left)".
  - Return ENAMETOOLONG when a resolved symlink from readlink(2) is too
long for the symlink buffer (instead of just truncating it).
  - "resolved_len > 1" below the call to readlink(2) is always true as
"strlcat(resolved, next_token, PATH_MAX);" always results in a
string of length > 1. Also, "resolved[resolved_len - 1] = '\0';" is
not needed; there can never be a trailing slash here.
  - The truncation check for "strlcat(symlink, left, sizeof(symlink));"
should be against "sizeof(symlink)" (the third argument to strlcat)
instead of "sizeof(left)".
  
  Submitted by: Jan Kokemц╪ller 
  PR:   219154
  MFC after:2 weeks

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==
--- head/lib/libc/stdlib/realpath.c Mon May 15 16:53:02 2017
(r318297)
+++ head/lib/libc/stdlib/realpath.c Mon May 15 17:14:53 2017
(r318298)
@@ -51,10 +51,11 @@ char *
 realpath(const char * __restrict path, char * __restrict resolved)
 {
struct stat sb;
-   char *p, *q, *s;
-   size_t left_len, resolved_len;
+   char *p, *q;
+   size_t left_len, resolved_len, next_token_len;
unsigned symlinks;
-   int m, slen;
+   int m;
+   ssize_t slen;
char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
if (path == NULL) {
@@ -109,18 +110,19 @@ realpath(const char * __restrict path, c
 * and its length.
 */
p = strchr(left, '/');
-   s = p ? p : left + left_len;
-   if (s - left >= sizeof(next_token)) {
-   if (m)
-   free(resolved);
-   errno = ENAMETOOLONG;
-   return (NULL);
+
+   next_token_len = p ? p - left : left_len;
+   memcpy(next_token, left, next_token_len);
+   next_token[next_token_len] = '\0';
+
+   if (p != NULL) {
+   left_len -= next_token_len + 1;
+   memmove(left, p + 1, left_len + 1);
+   } else {
+   left[0] = '\0';
+   left_len = 0;
}
-   memcpy(next_token, left, s - left);
-   next_token[s - left] = '\0';
-   left_len -= s - left;
-   if (p != NULL)
-   memmove(left, s + 1, left_len + 1);
+
if (resolved[resolved_len - 1] != '/') {
if (resolved_len + 1 >= PATH_MAX) {
if (m)
@@ -173,19 +175,25 @@ realpath(const char * __restrict path, c
errno = ELOOP;
return (NULL);
}
-   slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-   if (slen < 0) {
+   slen = readlink(resolved, symlink, sizeof(symlink));
+   if (slen <= 0 || slen >= sizeof(symlink)) {
if (m)
free(resolved);
+   if (slen < 0) {
+   /* keep errno from readlink(2) call */
+   } else if (slen == 0) {
+   errno = ENOENT;
+   } else {
+   errno = ENAMETOOLONG;
+   }
return (NULL);
}
symlink[slen] = '\0';
if (symlink[0] == '/') {
resolved[1] = 0;
resolved_len = 1;
-   } else if (resolved_len > 1) {
+   } else {
/* Strip the last path component. */
-  

svn commit: r318297 - head/sys/dev/e1000

2017-05-15 Thread Toomas Soome
Author: tsoome
Date: Mon May 15 16:53:02 2017
New Revision: 318297
URL: https://svnweb.freebsd.org/changeset/base/318297

Log:
  e1000api: misleading-indentation
  
  Two blocks in e1000_ich8lan.c are misaligned, causing noise with some
  compilers (gcc 6).
  
  Reviewed by:  imp, erj
  Differential Revision:https://reviews.freebsd.org/D10741

Modified:
  head/sys/dev/e1000/e1000_ich8lan.c

Modified: head/sys/dev/e1000/e1000_ich8lan.c
==
--- head/sys/dev/e1000/e1000_ich8lan.c  Mon May 15 15:28:01 2017
(r318296)
+++ head/sys/dev/e1000/e1000_ich8lan.c  Mon May 15 16:53:02 2017
(r318297)
@@ -1496,24 +1496,24 @@ s32 e1000_disable_ulp_lpt_lp(struct e100
ret_val = e1000_read_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, &phy_reg);
if (ret_val)
goto release;
-   phy_reg &= ~(I218_ULP_CONFIG1_IND |
-I218_ULP_CONFIG1_STICKY_ULP |
-I218_ULP_CONFIG1_RESET_TO_SMBUS |
-I218_ULP_CONFIG1_WOL_HOST |
-I218_ULP_CONFIG1_INBAND_EXIT |
-I218_ULP_CONFIG1_EN_ULP_LANPHYPC |
-I218_ULP_CONFIG1_DIS_CLR_STICKY_ON_PERST |
-I218_ULP_CONFIG1_DISABLE_SMB_PERST);
-   e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
-
-   /* Commit ULP changes by starting auto ULP configuration */
-   phy_reg |= I218_ULP_CONFIG1_START;
-   e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
-
-   /* Clear Disable SMBus Release on PERST# in MAC */
-   mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM7);
-   mac_reg &= ~E1000_FEXTNVM7_DISABLE_SMB_PERST;
-   E1000_WRITE_REG(hw, E1000_FEXTNVM7, mac_reg);
+   phy_reg &= ~(I218_ULP_CONFIG1_IND |
+I218_ULP_CONFIG1_STICKY_ULP |
+I218_ULP_CONFIG1_RESET_TO_SMBUS |
+I218_ULP_CONFIG1_WOL_HOST |
+I218_ULP_CONFIG1_INBAND_EXIT |
+I218_ULP_CONFIG1_EN_ULP_LANPHYPC |
+I218_ULP_CONFIG1_DIS_CLR_STICKY_ON_PERST |
+I218_ULP_CONFIG1_DISABLE_SMB_PERST);
+   e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
+
+   /* Commit ULP changes by starting auto ULP configuration */
+   phy_reg |= I218_ULP_CONFIG1_START;
+   e1000_write_phy_reg_hv_locked(hw, I218_ULP_CONFIG1, phy_reg);
+
+   /* Clear Disable SMBus Release on PERST# in MAC */
+   mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM7);
+   mac_reg &= ~E1000_FEXTNVM7_DISABLE_SMB_PERST;
+   E1000_WRITE_REG(hw, E1000_FEXTNVM7, mac_reg);
 
 release:
hw->phy.ops.release(hw);
@@ -1556,13 +1556,13 @@ static s32 e1000_check_for_copper_link_i
if (!mac->get_link_status)
return E1000_SUCCESS;
 
-   /* First we want to see if the MII Status Register reports
-* link.  If so, then we want to get the current speed/duplex
-* of the PHY.
-*/
-   ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
-   if (ret_val)
-   return ret_val;
+   /* First we want to see if the MII Status Register reports
+* link.  If so, then we want to get the current speed/duplex
+* of the PHY.
+*/
+   ret_val = e1000_phy_has_link_generic(hw, 1, 0, &link);
+   if (ret_val)
+   return ret_val;
 
if (hw->mac.type == e1000_pchlan) {
ret_val = e1000_k1_gig_workaround_hv(hw, link);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318295 - in stable/10: lib/libmt usr.bin/mt

2017-05-15 Thread Kenneth D. Merry
Author: ken
Date: Mon May 15 15:27:59 2017
New Revision: 318295
URL: https://svnweb.freebsd.org/changeset/base/318295

Log:
  MFC r318185:
  
Add LTO-8 density codes.
  
lib/libmt/mtlib.c:
Add the LTO-8 density code to the density table in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 density code, tracks, bpmm, and bpi to the density
table in the mt(1) man page.
  
  Sponsored by: Spectra Logic

Modified:
  stable/10/lib/libmt/mtlib.c
  stable/10/usr.bin/mt/mt.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libmt/mtlib.c
==
--- stable/10/lib/libmt/mtlib.c Mon May 15 15:18:36 2017(r318294)
+++ stable/10/lib/libmt/mtlib.c Mon May 15 15:27:59 2017(r318295)
@@ -644,6 +644,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/10/usr.bin/mt/mt.1
==
--- stable/10/usr.bin/mt/mt.1   Mon May 15 15:18:36 2017(r318294)
+++ stable/10/usr.bin/mt/mt.1   Mon May 15 15:27:59 2017(r318295)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -521,6 +521,7 @@ Value  WidthTracksDensity   
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318296 - in stable/11: lib/libmt usr.bin/mt

2017-05-15 Thread Kenneth D. Merry
Author: ken
Date: Mon May 15 15:28:01 2017
New Revision: 318296
URL: https://svnweb.freebsd.org/changeset/base/318296

Log:
  MFC r318185:
  
Add LTO-8 density codes.
  
lib/libmt/mtlib.c:
Add the LTO-8 density code to the density table in libmt.
  
usr.bin/mt/mt.1:
Add the LTO-8 density code, tracks, bpmm, and bpi to the density
table in the mt(1) man page.
  
  Sponsored by: Spectra Logic

Modified:
  stable/11/lib/libmt/mtlib.c
  stable/11/usr.bin/mt/mt.1
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libmt/mtlib.c
==
--- stable/11/lib/libmt/mtlib.c Mon May 15 15:27:59 2017(r318295)
+++ stable/11/lib/libmt/mtlib.c Mon May 15 15:28:01 2017(r318296)
@@ -644,6 +644,7 @@ static struct densities {
{ 0x58, 15142,  384607, "LTO-5" },
{ 0x5A, 15142,  384607, "LTO-6" },
{ 0x5C, 19107,  485318, "LTO-7" },
+   { 0x5E, 20669,  524993, "LTO-8" },
{ 0x71, 11800,  299720, "3592A1 (encrypted)" },
{ 0x72, 11800,  299720, "3592A2 (encrypted)" },
{ 0x73, 13452,  341681, "3592A3 (encrypted)" },

Modified: stable/11/usr.bin/mt/mt.1
==
--- stable/11/usr.bin/mt/mt.1   Mon May 15 15:27:59 2017(r318295)
+++ stable/11/usr.bin/mt/mt.1   Mon May 15 15:28:01 2017(r318296)
@@ -29,7 +29,7 @@
 .\"@(#)mt.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2017
+.Dd May 11, 2017
 .Dt MT 1
 .Os
 .Sh NAME
@@ -521,6 +521,7 @@ Value  WidthTracksDensity   
 0x58   12.7  (0.5) 1280  15,142 (384,607)   C   LTO-5
 0x5A   12.7  (0.5) 2176  15,142 (384,607)   C   LTO-6
 0x5C   12.7  (0.5) 3584  19,107 (485,318)   C   LTO-7
+0x5E   12.7  (0.5) 6656  20,669 (524,993)   C   LTO-8
 0x71   12.7  (0.5)  512  11,800 (299,720)   C   3592A1 (encrypted)
 0x72   12.7  (0.5)  896  11,800 (299,720)   C   3592A2 (encrypted)
 0x73   12.7  (0.5) 1152  13,452 (341,681)   C   3592A3 (encrypted)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318294 - head

2017-05-15 Thread Glen Barber
Author: gjb
Date: Mon May 15 15:18:36 2017
New Revision: 318294
URL: https://svnweb.freebsd.org/changeset/base/318294

Log:
  Correct the URL to instructions for updated system sources.
  
  MFC after:3 days
  Submitted by: schaiba  gmail  com
  PR:   219303
  Sponsored by: The FreeBSD Foundation

Modified:
  head/README

Modified: head/README
==
--- head/README Mon May 15 14:41:47 2017(r318293)
+++ head/README Mon May 15 15:18:36 2017(r318294)
@@ -81,4 +81,4 @@ usr.sbin  System administration commands.
 For information on synchronizing your source tree with one or more of
 the FreeBSD Project's development branches, please see:
 
-  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html
+  https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-src.html
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318293 - stable/11/sys/kern

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 14:41:47 2017
New Revision: 318293
URL: https://svnweb.freebsd.org/changeset/base/318293

Log:
  MFC r315685: tighten buffer bounds in imgact_binmisc_populate_interp
  
  We must ensure there's space for the terminating null in the temporary
  buffer in imgact_binmisc_populate_interp().
  
  Note that there's no buffer overflow here because xbe->xbe_interpreter's
  length and null termination is checked in imgact_binmisc_add_entry()
  before imgact_binmisc_populate_interp() is called. However, the latter
  should correctly enforce its own bounds.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/kern/imgact_binmisc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/imgact_binmisc.c
==
--- stable/11/sys/kern/imgact_binmisc.c Mon May 15 14:23:53 2017
(r318292)
+++ stable/11/sys/kern/imgact_binmisc.c Mon May 15 14:41:47 2017
(r318293)
@@ -120,7 +120,7 @@ imgact_binmisc_populate_interp(char *str
sp = str; tp = t;
while (*sp != '\0') {
if (*sp == ' ' || *sp == '\t') {
-   if (++len > IBE_INTERP_LEN_MAX)
+   if (++len >= IBE_INTERP_LEN_MAX)
break;
*tp++ = ' ';
argc++;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318292 - in stable/11/sys: conf modules/linux modules/linux64 modules/svr4 modules/vmm

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 14:23:53 2017
New Revision: 318292
URL: https://svnweb.freebsd.org/changeset/base/318292

Log:
  MFC r314054: Exclude -flto when building *genassym.o
  
  The build process generates *assym.h using nm from *genassym.o (which is
  in turn created from *genassym.c).
  
  When compiling with link-time optimization (LTO) using -flto, .o files
  are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
  so remove -flto from those ${CC} invocations.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/conf/files.amd64
  stable/11/sys/conf/files.i386
  stable/11/sys/conf/kern.post.mk
  stable/11/sys/conf/kmod.mk
  stable/11/sys/modules/linux/Makefile
  stable/11/sys/modules/linux64/Makefile
  stable/11/sys/modules/svr4/Makefile
  stable/11/sys/modules/vmm/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/conf/files.amd64
==
--- stable/11/sys/conf/files.amd64  Mon May 15 14:22:03 2017
(r318291)
+++ stable/11/sys/conf/files.amd64  Mon May 15 14:23:53 2017
(r318292)
@@ -34,7 +34,7 @@ cloudabi64_vdso_blob.ooptionalcompat_
 #
 linux32_genassym.o optionalcompat_linux32  \
dependency  "$S/amd64/linux32/linux32_genassym.c"   \
-   compile-with"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"\
+   compile-with"${CC} ${CFLAGS:N-flto:N-fno-common} -c ${.IMPSRC}" \
no-obj no-implicit-rule \
clean   "linux32_genassym.o"
 #
@@ -58,7 +58,7 @@ linux32_vdso.so   optionalcompat_linux32
 #
 ia32_genassym.ostandard
\
dependency  "$S/compat/ia32/ia32_genassym.c"\
-   compile-with"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"\
+   compile-with"${CC} ${CFLAGS:N-flto:N-fno-common} -c ${.IMPSRC}" \
no-obj no-implicit-rule \
clean   "ia32_genassym.o"
 #

Modified: stable/11/sys/conf/files.i386
==
--- stable/11/sys/conf/files.i386   Mon May 15 14:22:03 2017
(r318291)
+++ stable/11/sys/conf/files.i386   Mon May 15 14:23:53 2017
(r318292)
@@ -21,7 +21,7 @@ cloudabi32_vdso_blob.ooptionalcompat_
 #
 linux_genassym.o   optionalcompat_linux\
dependency  "$S/i386/linux/linux_genassym.c"\
-   compile-with"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"\
+   compile-with"${CC} ${CFLAGS:N-flto:N-fno-common} -c ${.IMPSRC}" \
no-obj no-implicit-rule \
clean   "linux_genassym.o"
 #
@@ -45,7 +45,7 @@ linux_vdso.so optionalcompat_linux
\
 #
 svr4_genassym.ooptionalcompat_svr4 
\
dependency  "$S/i386/svr4/svr4_genassym.c"  \
-   compile-with"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"\
+   compile-with"${CC} ${CFLAGS:N-flto:N-fno-common} -c ${.IMPSRC}" \
no-obj no-implicit-rule \
clean   "svr4_genassym.o"
 #

Modified: stable/11/sys/conf/kern.post.mk
==
--- stable/11/sys/conf/kern.post.mk Mon May 15 14:22:03 2017
(r318291)
+++ stable/11/sys/conf/kern.post.mk Mon May 15 14:23:53 2017
(r318292)
@@ -189,7 +189,7 @@ assym.s: $S/kern/genassym.sh genassym.o
NM='${NM}' NMFLAGS='${NMFLAGS}' sh $S/kern/genassym.sh genassym.o > 
${.TARGET}
 
 genassym.o: $S/$M/$M/genassym.c
-   ${CC} -c ${CFLAGS:N-fno-common} $S/$M/$M/genassym.c
+   ${CC} -c ${CFLAGS:N-flto:N-fno-common} $S/$M/$M/genassym.c
 
 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
 

Modified: stable/11/sys/conf/kmod.mk
==
--- stable/11/sys/conf/kmod.mk  Mon May 15 14:22:03 2017(r318291)
+++ stable/11/sys/conf/kmod.mk  Mon May 15 14:23:53 2017(r318292)
@@ -462,7 +462,7 @@ assym.s: ${SYSDIR}/kern/genassym.sh
sh ${SYSDIR}/kern/genassym.sh genassym.o > ${.TARGET}
 genassym.o: ${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c
 genassym.o: ${SRCS:Mopt_*.h}
-   ${CC} -c ${CFLAGS:N-fno-common} \
+   ${CC} -c ${CFLAGS:N-flto:N-fno-common} \
${SYSDIR}/${MACHINE}/${MACHINE}/genassym.c
 .endif
 

Modified: stable/11/sys/modules/linux/Makefile
==
--- stable/11/sys/modules/linux/MakefileMon May 15 14:22:03 2017
(r318291)
+++ stable/

svn commit: r318291 - stable/11/release/scripts

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 14:22:03 2017
New Revision: 318291
URL: https://svnweb.freebsd.org/changeset/base/318291

Log:
  MFC r317376: Add sysutils/tmux to the DVD package set
  
  The zsh + tmux combination is commonly wanted.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/scripts/pkg-stage.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/release/scripts/pkg-stage.sh
==
--- stable/11/release/scripts/pkg-stage.sh  Mon May 15 14:11:18 2017
(r318290)
+++ stable/11/release/scripts/pkg-stage.sh  Mon May 15 14:22:03 2017
(r318291)
@@ -24,6 +24,7 @@ shells/bash
 shells/zsh
 security/sudo
 sysutils/screen
+sysutils/tmux
 www/firefox
 www/links
 x11-drivers/xf86-video-vmware
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318290 - stable/11/share/man/man5

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 14:11:18 2017
New Revision: 318290
URL: https://svnweb.freebsd.org/changeset/base/318290

Log:
  Regenerate src.conf.5 after r318286
  
  r318286 removed the $FreeBSD$ tags copied from the source WITH_/WITHOUT_
  description snippets.  Regenerate src.conf.5 now so that only relevant
  changes appear in it when it is next regenerated after an MFC.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/share/man/man5/src.conf.5

Modified: stable/11/share/man/man5/src.conf.5
==
--- stable/11/share/man/man5/src.conf.5 Mon May 15 13:50:21 2017
(r318289)
+++ stable/11/share/man/man5/src.conf.5 Mon May 15 14:11:18 2017
(r318290)
@@ -1,7 +1,6 @@
-.\" DO NOT EDIT-- this file is automatically generated.
-.\" from FreeBSD: stable/11/tools/build/options/makeman 292283 2015-12-15 
18:42:30Z bdrewery
+.\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd April 2, 2017
+.Dd May 15, 2017
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -94,56 +93,45 @@ The following list provides a name and s
 that can be used for source builds.
 .Bl -tag -width indent
 .It Va WITHOUT_ACCT
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_ACCT 223201 2011-06-17 
20:47:44Z ed
 Set to not build process accounting tools such as
 .Xr accton 8
 and
 .Xr sa 8 .
 .It Va WITHOUT_ACPI
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_ACPI 156932 2006-03-21 
07:50:50Z ru
 Set to not build
 .Xr acpiconf 8 ,
 .Xr acpidump 8
 and related programs.
 .It Va WITHOUT_AMD
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_AMD 183242 2008-09-21 
22:02:26Z sam
 Set to not build
 .Xr amd 8 ,
 and related programs.
 .It Va WITHOUT_APM
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_APM 183242 2008-09-21 
22:02:26Z sam
 Set to not build
 .Xr apm 8 ,
 .Xr apmd 8
 and related programs.
 .It Va WITHOUT_ASSERT_DEBUG
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_ASSERT_DEBUG 162215 
2006-09-11 13:55:27Z ru
 Set to compile programs and libraries without the
 .Xr assert 3
 checks.
 .It Va WITHOUT_AT
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_AT 183242 2008-09-21 
22:02:26Z sam
 Set to not build
 .Xr at 1
 and related utilities.
 .It Va WITHOUT_ATM
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_ATM 156932 2006-03-21 
07:50:50Z ru
 Set to not build
 programs and libraries related to ATM networking.
 .It Va WITHOUT_AUDIT
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_AUDIT 156932 
2006-03-21 07:50:50Z ru
 Set to not build audit support into system programs.
 .It Va WITHOUT_AUTHPF
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_AUTHPF 156932 
2006-03-21 07:50:50Z ru
 Set to not build
 .Xr authpf 8 .
 .It Va WITHOUT_AUTOFS
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_AUTOFS 296264 
2016-03-01 11:36:10Z trasz
 Set to not build
 .Xr autofs 5
 related programs, libraries, and kernel modules.
 .It Va WITH_AUTO_OBJ
-.\" from FreeBSD: stable/11/tools/build/options/WITH_AUTO_OBJ 284708 
2015-06-22 20:21:57Z sjg
 Enable automatic creation of objdirs.
 .Pp
 This must be set in the environment, make command line, or
@@ -151,14 +139,12 @@ This must be set in the environment, mak
 not
 .Pa /etc/src.conf .
 .It Va WITHOUT_BHYVE
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_BHYVE 277727 
2015-01-26 06:44:48Z ngie
 Set to not build or install
 .Xr bhyve 8 ,
 associated utilities, and examples.
 .Pp
 This option only affects amd64/amd64.
 .It Va WITHOUT_BINUTILS
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_BINUTILS 286332 
2015-08-05 18:30:00Z emaste
 Set to not build or install binutils (as, ld, objcopy, and objdump ) as part
 of the normal system build.
 The resulting system cannot build programs from source.
@@ -166,14 +152,12 @@ The resulting system cannot build progra
 It is a default setting on
 arm64/aarch64.
 .It Va WITH_BINUTILS
-.\" from FreeBSD: stable/11/tools/build/options/WITH_BINUTILS 295491 
2016-02-11 00:14:00Z emaste
 Set to build and install binutils (as, ld, objcopy, and objdump) as part
 of the normal system build.
 .Pp
 It is a default setting on
 amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, 
powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITHOUT_BINUTILS_BOOTSTRAP
-.\" from FreeBSD: stable/11/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 
295490 2016-02-10 23:57:09Z emaste
 Set to not build binutils (as, ld, objcopy and objdump)
 as part of the bootstrap process.
 .Bf -symbolic
@@ -184,14 +168,12 @@ toolchain is provided.
 It is a default setting on
 arm64/aarch64.
 .It Va WITH_BINUTILS_BOOTSTRAP
-.\" from FreeBSD: stable/11/tools/build/options/WITH_BINUTILS_BOOTSTRAP 295491 
2016-02-11 00:14:00Z emaste
 Set build binutils (as, ld, objcopy and objdump)
 as part of the bootstrap process.
 .Pp

svn commit: r318289 - stable/11/tools/build/options

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 13:50:21 2017
New Revision: 318289
URL: https://svnweb.freebsd.org/changeset/base/318289

Log:
  MFC r310271 (gjb): Comment the RCSID (in WITH_REPRODUCIBLE_BUILD)
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD
==
--- stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD   Mon May 15 
13:41:38 2017(r318288)
+++ stable/11/tools/build/options/WITH_REPRODUCIBLE_BUILD   Mon May 15 
13:50:21 2017(r318289)
@@ -1,4 +1,4 @@
-$FreeBSD$
+.\" $FreeBSD$
 Set to exclude build metadata (such as the build time, user, or host)
 from the kernel, boot loaders, and uname output, so that builds produce
 bit-for-bit identical output.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318288 - stable/11/tools/build/options

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 13:41:38 2017
New Revision: 318288
URL: https://svnweb.freebsd.org/changeset/base/318288

Log:
  MFC r317156: makeman: add a comment describing purpose and invocation
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/tools/build/options/makeman
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/build/options/makeman
==
--- stable/11/tools/build/options/makeman   Mon May 15 13:14:13 2017
(r318287)
+++ stable/11/tools/build/options/makeman   Mon May 15 13:41:38 2017
(r318288)
@@ -1,8 +1,22 @@
 #!/bin/sh
 #
 # This file is in the public domain.
-#
 # $FreeBSD$
+#
+# This script is used to create the src.conf.5 man page, using template text
+# contained herein and the contents of the WITH_* and WITHOUT_* files in the
+# same directory. Each WITH_* and WITHOUT_* file documents the effect of the
+# /etc/src.conf knob with the same name.
+#
+# This script invokes "make showconfig" for each supported architecture in
+# order to determine, for each option, whether the default setting is always
+# WITH, always WITHOUT, or is architecture-dependent. It also determines
+# and describes dependencies between options.
+#
+# Usage:
+#
+# cd tools/build/options
+# sh makeman > ../../../share/man/man5/src.conf.5
 
 set -o errexit
 export LC_ALL=C
@@ -121,7 +135,7 @@ main()
 
fbsdid='$'FreeBSD'$'
cat 

svn commit: r318287 - head/sys/fs/nfsclient

2017-05-15 Thread Rick Macklem
Author: rmacklem
Date: Mon May 15 13:14:13 2017
New Revision: 318287
URL: https://svnweb.freebsd.org/changeset/base/318287

Log:
  Make nfscl_mtofh() return ENXIO when *nfhpp == NULL.
  
  r317272 introduced a case where nfscl_mtofh() could return 0 when
  *nfhpp is NULL. This patch makes it return ENXIO for this case.
  
  MFC after:1 week

Modified:
  head/sys/fs/nfsclient/nfs_clcomsubs.c

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- head/sys/fs/nfsclient/nfs_clcomsubs.c   Mon May 15 13:05:02 2017
(r318286)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c   Mon May 15 13:14:13 2017
(r318287)
@@ -475,6 +475,7 @@ nfscl_mtofh(struct nfsrv_descript *nd, s
if (*++tl != 0) {
nd->nd_flag |= ND_NOMOREDATA;
flag = 0;
+   error = ENXIO;  /* Return ENXIO so *nfhpp isn't used. */
}
}
if (flag) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318286 - stable/11/tools/build/options

2017-05-15 Thread Ed Maste
Author: emaste
Date: Mon May 15 13:05:02 2017
New Revision: 318286
URL: https://svnweb.freebsd.org/changeset/base/318286

Log:
  MFC r316706: makeman: don't copy $FreeBSD$ tags from source files into output
  
  Copying the source VCS ID from WITH_/WITHOUT_* into the generated
  src.conf.5 is not necessary, as it is generally possible to determine
  the same information using the VCS to examine commit metadata. The
  individual source files also match the name of the option recorded in
  the generated file, so it is clear from where the content originated.
  
  The copied IDs generate extraneous, non-content noise in the generated
  src.conf.5 in some cases, including the first time the file is generated
  on a stable branch. In addition, the source file $FreeBSD$ tags are not
  expanded by git or other non-Subversion VCSs, which means that makeman
  previously could not be used in a non-Subversion working tree.
  
  I accept that there's some desire to keep these, but on balance believe
  there is more benefit in removing them.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/tools/build/options/makeman
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/build/options/makeman
==
--- stable/11/tools/build/options/makeman   Mon May 15 10:02:45 2017
(r318285)
+++ stable/11/tools/build/options/makeman   Mon May 15 13:05:02 2017
(r318286)
@@ -1,12 +1,12 @@
 #!/bin/sh
 #
 # This file is in the public domain.
+#
+# $FreeBSD$
 
 set -o errexit
 export LC_ALL=C
 
-ident='$FreeBSD$'
-
 t=$(mktemp -d -t makeman)
 trap 'test -d $t && rm -rf $t' exit
 
@@ -119,12 +119,9 @@ show()
 main()
 {
 
-   ident=${ident#$}
-   ident=${ident% $}
fbsdid='$'FreeBSD'$'
cat 

Re: svn commit: r318285 - head/sys/kern

2017-05-15 Thread Konstantin Belousov
On Mon, May 15, 2017 at 10:02:45AM +, Konstantin Belousov wrote:
> Author: kib
> Date: Mon May 15 10:02:45 2017
> New Revision: 318285
> URL: https://svnweb.freebsd.org/changeset/base/318285
> 
> Log:
>   mnt_vnode_next_active: use conventional lock order when trylock fails.
>   
>   Previously, when the VI_TRYLOCK failed, we would spin under the mutex
>   that protects the vnode active list until we either succeeded or
>   noticed that we had hogged the CPU. Since we were violating the lock
>   order, this would guarantee that we would become a hog under any
>   deadlock condition (e.g. a race with vdrop(9) on the same vnode). In
>   the presence of many concurrent threads in sync(2) or vdrop etc, the
>   victim could hang for a long time.
>   
>   Now, avoid spinning by dropping and reacquiring the locks in the
>   conventional lock order when the trylock fails. This requires a dance
>   with the vnode hold count.
>   
>   Submitted by:   Tom Rix 
This must be Ryan Libby , I am sorry.

>   Tested by:  pho
>   Differential revision:  https://reviews.freebsd.org/D10692
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r318285 - head/sys/kern

2017-05-15 Thread Konstantin Belousov
Author: kib
Date: Mon May 15 10:02:45 2017
New Revision: 318285
URL: https://svnweb.freebsd.org/changeset/base/318285

Log:
  mnt_vnode_next_active: use conventional lock order when trylock fails.
  
  Previously, when the VI_TRYLOCK failed, we would spin under the mutex
  that protects the vnode active list until we either succeeded or
  noticed that we had hogged the CPU. Since we were violating the lock
  order, this would guarantee that we would become a hog under any
  deadlock condition (e.g. a race with vdrop(9) on the same vnode). In
  the presence of many concurrent threads in sync(2) or vdrop etc, the
  victim could hang for a long time.
  
  Now, avoid spinning by dropping and reacquiring the locks in the
  conventional lock order when the trylock fails. This requires a dance
  with the vnode hold count.
  
  Submitted by: Tom Rix 
  Tested by:pho
  Differential revision:https://reviews.freebsd.org/D10692

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cMon May 15 03:39:35 2017(r318284)
+++ head/sys/kern/vfs_subr.cMon May 15 10:02:45 2017(r318285)
@@ -5362,6 +5362,84 @@ mnt_vnode_markerfree_active(struct vnode
*mvp = NULL;
 }
 
+/*
+ * Relock the mp mount vnode list lock with the vp vnode interlock in the
+ * conventional lock order during mnt_vnode_next_active iteration.
+ *
+ * On entry, the mount vnode list lock is held and the vnode interlock is not.
+ * The list lock is dropped and reacquired.  On success, both locks are held.
+ * On failure, the mount vnode list lock is held but the vnode interlock is
+ * not, and the procedure may have yielded.
+ */
+static bool
+mnt_vnode_next_active_relock(struct vnode *mvp, struct mount *mp,
+struct vnode *vp)
+{
+   const struct vnode *tmp;
+   bool held, ret;
+
+   VNASSERT(mvp->v_mount == mp && mvp->v_type == VMARKER &&
+   TAILQ_NEXT(mvp, v_actfreelist) != NULL, mvp,
+   ("%s: bad marker", __func__));
+   VNASSERT(vp->v_mount == mp && vp->v_type != VMARKER, vp,
+   ("%s: inappropriate vnode", __func__));
+   ASSERT_VI_UNLOCKED(vp, __func__);
+   mtx_assert(&mp->mnt_listmtx, MA_OWNED);
+
+   ret = false;
+
+   TAILQ_REMOVE(&mp->mnt_activevnodelist, mvp, v_actfreelist);
+   TAILQ_INSERT_BEFORE(vp, mvp, v_actfreelist);
+
+   /*
+* Use a hold to prevent vp from disappearing while the mount vnode
+* list lock is dropped and reacquired.  Normally a hold would be
+* acquired with vhold(), but that might try to acquire the vnode
+* interlock, which would be a LOR with the mount vnode list lock.
+*/
+   held = vfs_refcount_acquire_if_not_zero(&vp->v_holdcnt);
+   mtx_unlock(&mp->mnt_listmtx);
+   if (!held)
+   goto abort;
+   VI_LOCK(vp);
+   if (!vfs_refcount_release_if_not_last(&vp->v_holdcnt)) {
+   vdropl(vp);
+   goto abort;
+   }
+   mtx_lock(&mp->mnt_listmtx);
+
+   /*
+* Determine whether the vnode is still the next one after the marker,
+* excepting any other markers.  If the vnode has not been doomed by
+* vgone() then the hold should have ensured that it remained on the
+* active list.  If it has been doomed but is still on the active list,
+* don't abort, but rather skip over it (avoid spinning on doomed
+* vnodes).
+*/
+   tmp = mvp;
+   do {
+   tmp = TAILQ_NEXT(tmp, v_actfreelist);
+   } while (tmp != NULL && tmp->v_type == VMARKER);
+   if (tmp != vp) {
+   mtx_unlock(&mp->mnt_listmtx);
+   VI_UNLOCK(vp);
+   goto abort;
+   }
+
+   ret = true;
+   goto out;
+abort:
+   maybe_yield();
+   mtx_lock(&mp->mnt_listmtx);
+out:
+   if (ret)
+   ASSERT_VI_LOCKED(vp, __func__);
+   else
+   ASSERT_VI_UNLOCKED(vp, __func__);
+   mtx_assert(&mp->mnt_listmtx, MA_OWNED);
+   return (ret);
+}
+
 static struct vnode *
 mnt_vnode_next_active(struct vnode **mvp, struct mount *mp)
 {
@@ -5371,22 +5449,19 @@ mnt_vnode_next_active(struct vnode **mvp
KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch"));
 restart:
vp = TAILQ_NEXT(*mvp, v_actfreelist);
-   TAILQ_REMOVE(&mp->mnt_activevnodelist, *mvp, v_actfreelist);
while (vp != NULL) {
if (vp->v_type == VMARKER) {
vp = TAILQ_NEXT(vp, v_actfreelist);
continue;
}
-   if (!VI_TRYLOCK(vp)) {
-   if (mp_ncpus == 1 || should_yield()) {
-   TAILQ_INSERT_BEFORE(vp, *mvp, v_actfreelist);
-   mtx_unlock(&mp->mnt_listmtx);
-   pause("vnacti", 1);
-