svn commit: r312403 - in stable/10: lib/libstand sys/boot/libstand32 sys/boot/userboot/libstand

2017-01-18 Thread Xin LI
Author: delphij
Date: Thu Jan 19 07:29:52 2017
New Revision: 312403
URL: https://svnweb.freebsd.org/changeset/base/312403

Log:
  MFC r293040,293341,293435:
  
  Reduce libstand Makefile duplication.
  
  PR:   216251

Modified:
  stable/10/lib/libstand/Makefile
  stable/10/sys/boot/libstand32/Makefile
  stable/10/sys/boot/userboot/libstand/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libstand/Makefile
==
--- stable/10/lib/libstand/Makefile Thu Jan 19 06:48:03 2017
(r312402)
+++ stable/10/lib/libstand/Makefile Thu Jan 19 07:29:52 2017
(r312403)
@@ -9,16 +9,20 @@
 .include 
 MK_SSP=no
 
+LIBSTAND_SRC?= ${.CURDIR}
+LIBSTAND_CPUARCH?=${MACHINE_CPUARCH}
+LIBC_SRC=  ${LIBSTAND_SRC}/../libc
+
 LIB=   stand
 NO_PROFILE=
 NO_PIC=
-INCS=  stand.h
-MAN=   libstand.3
+INCS?= stand.h
+MAN?=  libstand.3
 
 WARNS?=0
 
 CFLAGS+= -ffreestanding -Wformat
-CFLAGS+= -I${.CURDIR}
+CFLAGS+= -I${LIBSTAND_SRC}
 
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
 CFLAGS+=   -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
@@ -50,12 +54,12 @@ SRCS+=  gzguts.h zutil.h __main.c assert.
 # private (pruned) versions of libc string functions
 SRCS+= strcasecmp.c
 
-.PATH: ${.CURDIR}/../libc/net
+.PATH: ${LIBC_SRC}/net
 
 SRCS+= ntoh.c
 
 # string functions from libc
-.PATH: ${.CURDIR}/../libc/string
+.PATH: ${LIBC_SRC}/string
 .if ${MACHINE_CPUARCH} != "ia64"
 SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \
memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \
@@ -63,60 +67,60 @@ SRCS+=  bcmp.c bcopy.c bzero.c ffs.c memc
strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
 .endif
 .if ${MACHINE_CPUARCH} == "arm"
-.PATH: ${.CURDIR}/../libc/arm/gen
+.PATH: ${LIBC_SRC}/arm/gen
 
 .if ${MK_ARM_EABI} == "no"
 SRCS+= divsi3.S
 .else
 # Compiler support functions
-.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/
+.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/
 # __clzsi2 and ctzsi2 for various builtin functions
 SRCS+= clzsi2.c ctzsi2.c
 # Divide and modulus functions called by the compiler
 SRCS+=  divmoddi4.c  divmodsi4.c  divdi3.c  divsi3.c  moddi3.c  modsi3.c
 SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c
 
-.PATH: ${.CURDIR}/../../contrib/compiler-rt/lib/arm/
+.PATH: ${LIBSTAND_SRC}/../../contrib/compiler-rt/lib/arm/
 SRCS+= aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S
 SRCS+= aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S
 .endif
 
 .endif
 .if ${MACHINE_CPUARCH} == "ia64"
-.PATH: ${.CURDIR}/../libc/ia64/string
+.PATH: ${LIBC_SRC}/ia64/string
 SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \
memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
strlcat.c strlcpy.c \
strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
strspn.c strstr.c strtok.c swab.c
 
-.PATH: ${.CURDIR}/../libc/ia64/gen
+.PATH: ${LIBC_SRC}/ia64/gen
 SRCS+= __divdi3.S __divsi3.S __moddi3.S __modsi3.S
 SRCS+= __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc"
-.PATH: ${.CURDIR}/../libc/quad
+.PATH: ${LIBC_SRC}/quad
 SRCS+= ashldi3.c ashrdi3.c
-.PATH: ${.CURDIR}/../libc/powerpc/gen
+.PATH: ${LIBC_SRC}/powerpc/gen
 SRCS+= syncicache.c
 .endif
 
 # uuid functions from libc
-.PATH: ${.CURDIR}/../libc/uuid
+.PATH: ${LIBC_SRC}/uuid
 SRCS+= uuid_equal.c uuid_is_nil.c
 
 # _setjmp/_longjmp
 .if ${MACHINE_ARCH} == "powerpc64"
-.PATH: ${.CURDIR}/powerpc
+.PATH: ${LIBSTAND_SRC}/powerpc
 .else
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}
+.PATH: ${LIBSTAND_SRC}/${LIBSTAND_CPUARCH}
 .endif
 SRCS+= _setjmp.S
 
 # decompression functionality from libbz2
 # NOTE: to actually test this functionality after libbz2 upgrade compile
 # loader(8) with LOADER_BZIP2_SUPPORT defined
-.PATH: ${.CURDIR}/../../contrib/bzip2
+.PATH: ${LIBSTAND_SRC}/../../contrib/bzip2
 CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS
 SRCS+= libstand_bzlib_private.h
 
@@ -134,8 +138,8 @@ libstand_bzlib_private.h: bzlib_private.
${.ALLSRC} > ${.TARGET}
 
 # decompression functionality from libz
-.PATH: ${.CURDIR}/../../contrib/zlib
-CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../../contrib/zlib
+.PATH: ${LIBSTAND_SRC}/../../contrib/zlib
+CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib
 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
 
 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c

Modified: stable/10/sys/boot/libstand32/Makefile
==
--- stable/10/sys/boot/libstand32/Makefile  Thu Jan 19 06:48:03 2017
(r312402)
+++ stable/10/sys/boot/libstand32/Makefile  Thu Jan 19 07:29:52 

svn commit: r312402 - stable/10/libexec/rtld-elf

2017-01-18 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 19 06:48:03 2017
New Revision: 312402
URL: https://svnweb.freebsd.org/changeset/base/312402

Log:
  MFC r311984:
  For the main binary, postpone enforcing relro read-only protection
  until copy relocations are done.

Modified:
  stable/10/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/rtld-elf/rtld.c
==
--- stable/10/libexec/rtld-elf/rtld.c   Thu Jan 19 06:44:27 2017
(r312401)
+++ stable/10/libexec/rtld-elf/rtld.c   Thu Jan 19 06:48:03 2017
(r312402)
@@ -104,6 +104,7 @@ static int load_needed_objects(Obj_Entry
 static int load_preload_objects(void);
 static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
 static void map_stacks_exec(RtldLockState *);
+static int obj_enforce_relro(Obj_Entry *);
 static Obj_Entry *obj_from_addr(const void *);
 static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *);
 static void objlist_call_init(Objlist *, RtldLockState *);
@@ -609,6 +610,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 if (do_copy_relocations(obj_main) == -1)
rtld_die();
 
+dbg("enforcing main obj relro");
+if (obj_enforce_relro(obj_main) == -1)
+   rtld_die();
+
 if (getenv(LD_ "DUMP_REL_POST") != NULL) {
dump_relocations(obj_main);
exit (0);
@@ -2691,14 +2696,8 @@ relocate_object(Obj_Entry *obj, bool bin
reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate))
return (-1);
 
-   if (obj->relro_size > 0) {
-   if (mprotect(obj->relro_page, obj->relro_size,
-   PROT_READ) == -1) {
-   _rtld_error("%s: Cannot enforce relro protection: %s",
-   obj->path, rtld_strerror(errno));
-   return (-1);
-   }
-   }
+   if (!obj->mainprog && obj_enforce_relro(obj) == -1)
+   return (-1);
 
/*
 * Set up the magic number and version in the Obj_Entry.  These
@@ -4986,6 +4985,19 @@ _rtld_is_dlopened(void *arg)
return (res);
 }
 
+int
+obj_enforce_relro(Obj_Entry *obj)
+{
+
+   if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size,
+   PROT_READ) == -1) {
+   _rtld_error("%s: Cannot enforce relro protection: %s",
+   obj->path, rtld_strerror(errno));
+   return (-1);
+   }
+   return (0);
+}
+
 static void
 map_stacks_exec(RtldLockState *lockstate)
 {
___
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: r312401 - stable/11/libexec/rtld-elf

2017-01-18 Thread Konstantin Belousov
Author: kib
Date: Thu Jan 19 06:44:27 2017
New Revision: 312401
URL: https://svnweb.freebsd.org/changeset/base/312401

Log:
  MFC r311984:
  For the main binary, postpone enforcing relro read-only protection
  until copy relocations are done.

Modified:
  stable/11/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/rtld.c
==
--- stable/11/libexec/rtld-elf/rtld.c   Wed Jan 18 23:26:10 2017
(r312400)
+++ stable/11/libexec/rtld-elf/rtld.c   Thu Jan 19 06:44:27 2017
(r312401)
@@ -100,6 +100,7 @@ static int load_needed_objects(Obj_Entry
 static int load_preload_objects(void);
 static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int);
 static void map_stacks_exec(RtldLockState *);
+static int obj_enforce_relro(Obj_Entry *);
 static Obj_Entry *obj_from_addr(const void *);
 static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *);
 static void objlist_call_init(Objlist *, RtldLockState *);
@@ -613,6 +614,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 if (do_copy_relocations(obj_main) == -1)
rtld_die();
 
+dbg("enforcing main obj relro");
+if (obj_enforce_relro(obj_main) == -1)
+   rtld_die();
+
 if (getenv(_LD("DUMP_REL_POST")) != NULL) {
dump_relocations(obj_main);
exit (0);
@@ -2711,14 +2716,8 @@ relocate_object(Obj_Entry *obj, bool bin
reloc_non_plt(obj, rtldobj, flags | SYMLOOK_IFUNC, lockstate))
return (-1);
 
-   if (obj->relro_size > 0) {
-   if (mprotect(obj->relro_page, obj->relro_size,
-   PROT_READ) == -1) {
-   _rtld_error("%s: Cannot enforce relro protection: %s",
-   obj->path, rtld_strerror(errno));
-   return (-1);
-   }
-   }
+   if (!obj->mainprog && obj_enforce_relro(obj) == -1)
+   return (-1);
 
/*
 * Set up the magic number and version in the Obj_Entry.  These
@@ -5061,6 +5060,19 @@ _rtld_is_dlopened(void *arg)
return (res);
 }
 
+int
+obj_enforce_relro(Obj_Entry *obj)
+{
+
+   if (obj->relro_size > 0 && mprotect(obj->relro_page, obj->relro_size,
+   PROT_READ) == -1) {
+   _rtld_error("%s: Cannot enforce relro protection: %s",
+   obj->path, rtld_strerror(errno));
+   return (-1);
+   }
+   return (0);
+}
+
 static void
 map_stacks_exec(RtldLockState *lockstate)
 {
___
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: r312399 - in stable/11/sys/dev: ichiic mmc sdhci

2017-01-18 Thread Marius Strobl
Author: marius
Date: Wed Jan 18 23:25:46 2017
New Revision: 312399
URL: https://svnweb.freebsd.org/changeset/base/312399

Log:
  MFC: r310309, r310340-310341, r311664, r311793-r311794
  
  o sdhci/mmc: Minor whitespace cleanups
  
  o Add Braswell PCI IDs for Intel Cherryview
  
  o mmc: Accept even lower voltage for Cherryview
  
And HP x2 210, per DragonFlyBSD 240bd9cd58f8259c12c14a8006837e698.
  
  o In mmcsd_task(), bio_resid was not being set to 0 on a successful read
or write, resulting in random short-read and short-write returns for
requests. Fixing this fixes nominal block I/O via mmcsd(4).
  
Obtained from: DragonFlyBSD (fd4b97583be1a1e57234713c25f6e81bc0411cb0)
  
  o Add support for Intel Apollo Lake and Bay Trail eMMC PCI controllers.
  
  o Flesh out the support for Intel Braswell eMMC controllers further.
  
  o In sdhci_init_slot(), use the right capability field for determining
the announced bus width based on MMC_CAP_*_BIT_DATA.

Modified:
  stable/11/sys/dev/ichiic/ig4_pci.c
  stable/11/sys/dev/mmc/mmc.c
  stable/11/sys/dev/mmc/mmcreg.h
  stable/11/sys/dev/mmc/mmcsd.c
  stable/11/sys/dev/sdhci/sdhci.c
  stable/11/sys/dev/sdhci/sdhci.h
  stable/11/sys/dev/sdhci/sdhci_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ichiic/ig4_pci.c
==
--- stable/11/sys/dev/ichiic/ig4_pci.c  Wed Jan 18 23:23:46 2017
(r312398)
+++ stable/11/sys/dev/ichiic/ig4_pci.c  Wed Jan 18 23:25:46 2017
(r312399)
@@ -68,6 +68,12 @@ static int ig4iic_pci_detach(device_t de
 
 #define PCI_CHIP_LYNXPT_LP_I2C_1   0x9c618086
 #define PCI_CHIP_LYNXPT_LP_I2C_2   0x9c628086
+#define PCI_CHIP_BRASWELL_I2C_10x22c18086
+#define PCI_CHIP_BRASWELL_I2C_20x22c28086
+#define PCI_CHIP_BRASWELL_I2C_30x22c38086
+#define PCI_CHIP_BRASWELL_I2C_50x22c58086
+#define PCI_CHIP_BRASWELL_I2C_60x22c68086
+#define PCI_CHIP_BRASWELL_I2C_70x22c78086
 
 static int
 ig4iic_pci_probe(device_t dev)
@@ -79,6 +85,24 @@ ig4iic_pci_probe(device_t dev)
case PCI_CHIP_LYNXPT_LP_I2C_2:
device_set_desc(dev, "Intel Lynx Point-LP I2C Controller-2");
break;
+   case PCI_CHIP_BRASWELL_I2C_1:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 1");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_2:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 2");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_3:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 3");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_5:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 5");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_6:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 6");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_7:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 7");
+   break;
default:
return (ENXIO);
}

Modified: stable/11/sys/dev/mmc/mmc.c
==
--- stable/11/sys/dev/mmc/mmc.c Wed Jan 18 23:23:46 2017(r312398)
+++ stable/11/sys/dev/mmc/mmc.c Wed Jan 18 23:25:46 2017(r312399)
@@ -401,7 +401,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s
msleep(req, >sc_mtx, 0, "mmcreq", 0);
MMC_UNLOCK(sc);
if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
-   device_printf(sc->dev, "CMD%d RESULT: %d\n", 
+   device_printf(sc->dev, "CMD%d RESULT: %d\n",
req->cmd->opcode, req->cmd->error);
return (0);
 }
@@ -511,7 +511,7 @@ mmc_idle_cards(struct mmc_softc *sc)
 {
device_t dev;
struct mmc_command cmd;
-   
+
dev = sc->dev;
mmcbr_set_chip_select(dev, cs_high);
mmcbr_update_ios(dev);
@@ -795,7 +795,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 8;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -808,7 +808,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_READ;
err = mmc_wait_for_cmd(sc, , 0);
sc->squelched--;
-   
+
mmcbr_set_bus_width(sc->dev, bus_width_1);
mmcbr_update_ios(sc->dev);
 
@@ -832,7 +832,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 4;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, 

svn commit: r312400 - in stable/10/sys/dev: mmc sdhci

2017-01-18 Thread Marius Strobl
Author: marius
Date: Wed Jan 18 23:26:10 2017
New Revision: 312400
URL: https://svnweb.freebsd.org/changeset/base/312400

Log:
  MFC: r273180, r283754, r297329, r299414, r300707, r310309, r310340 (partial),
   r310341, r311664, r311793-311794
  
  o Use correct response bits for MMC_RSP_R4-R7 types
  
  o Make sdhci(4) work after suspend/resume for chipsets that require
the frequency quirk. This makes it work on eg ThinkPad T420.
  
  o Add a convenience macro that masks all the bits related to clock divisors
in all versions of the sdhci spec (the HI bits are just unused reserved
bits in earlier versions).
  
  o sdhci/mmc: Minor whitespace cleanups
  
  o Add Braswell PCI IDs for Intel Cherryview
  
  o mmc: Accept even lower voltage for Cherryview
  
And HP x2 210, per DragonFlyBSD 240bd9cd58f8259c12c14a8006837e698.
  
  o In mmcsd_task(), bio_resid was not being set to 0 on a successful read
or write, resulting in random short-read and short-write returns for
requests. Fixing this fixes nominal block I/O via mmcsd(4).
  
Obtained from: DragonFlyBSD (fd4b97583be1a1e57234713c25f6e81bc0411cb0)
  
  o Add support for Intel Apollo Lake and Bay Trail eMMC PCI controllers.
  
  o Flesh out the support for Intel Braswell eMMC controllers further.
  
  o In sdhci_init_slot(), use the right capability field for determining
the announced bus width based on MMC_CAP_*_BIT_DATA.

Modified:
  stable/10/sys/dev/mmc/mmc.c
  stable/10/sys/dev/mmc/mmcreg.h
  stable/10/sys/dev/mmc/mmcsd.c
  stable/10/sys/dev/sdhci/sdhci.c
  stable/10/sys/dev/sdhci/sdhci.h
  stable/10/sys/dev/sdhci/sdhci_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mmc/mmc.c
==
--- stable/10/sys/dev/mmc/mmc.c Wed Jan 18 23:25:46 2017(r312399)
+++ stable/10/sys/dev/mmc/mmc.c Wed Jan 18 23:26:10 2017(r312400)
@@ -401,7 +401,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s
msleep(req, >sc_mtx, 0, "mmcreq", 0);
MMC_UNLOCK(sc);
if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
-   device_printf(sc->dev, "CMD%d RESULT: %d\n", 
+   device_printf(sc->dev, "CMD%d RESULT: %d\n",
req->cmd->opcode, req->cmd->error);
return (0);
 }
@@ -511,7 +511,7 @@ mmc_idle_cards(struct mmc_softc *sc)
 {
device_t dev;
struct mmc_command cmd;
-   
+
dev = sc->dev;
mmcbr_set_chip_select(dev, cs_high);
mmcbr_update_ios(dev);
@@ -795,7 +795,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 8;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -808,7 +808,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_READ;
err = mmc_wait_for_cmd(sc, , 0);
sc->squelched--;
-   
+
mmcbr_set_bus_width(sc->dev, bus_width_1);
mmcbr_update_ios(sc->dev);
 
@@ -832,7 +832,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 4;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -1017,7 +1017,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
-   } else 
+   } else
panic("unknown SD CSD version");
 }
 
@@ -1349,9 +1349,9 @@ mmc_discover_cards(struct mmc_softc *sc)
if (ivar->csd.csd_structure > 0)
ivar->high_cap = 1;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *
ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
-   
+
err = mmc_send_status(sc, ivar->rca, );
if (err != MMC_ERR_NONE) {
device_printf(sc->dev,
@@ -1446,7 +1446,7 @@ mmc_discover_cards(struct mmc_softc *sc)
mmc_decode_csd_mmc(ivar->raw_csd, >csd);
ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *

svn commit: r312398 - in stable/10/sys/dev: amdsbwd arcmsr hpt27xx hptmv hptnr hptrr sdhci sound/pci tws

2017-01-18 Thread Marius Strobl
Author: marius
Date: Wed Jan 18 23:23:46 2017
New Revision: 312398
URL: https://svnweb.freebsd.org/changeset/base/312398

Log:
  MFC: r296135
  
  Replace several bus_alloc_resource() calls with bus_alloc_resource_any()
  
  Most of these are BARs, and we allocate them in their entirety. The one
  outlier in this is amdsbwd(4), which calls bus_set_resource() prior.

Modified:
  stable/10/sys/dev/amdsbwd/amdsbwd.c
  stable/10/sys/dev/arcmsr/arcmsr.c
  stable/10/sys/dev/hpt27xx/hpt27xx_os_bsd.c
  stable/10/sys/dev/hptmv/entry.c
  stable/10/sys/dev/hptnr/hptnr_os_bsd.c
  stable/10/sys/dev/hptrr/hptrr_os_bsd.c
  stable/10/sys/dev/sdhci/sdhci_pci.c
  stable/10/sys/dev/sound/pci/als4000.c
  stable/10/sys/dev/sound/pci/cs4281.c
  stable/10/sys/dev/sound/pci/vibes.c
  stable/10/sys/dev/tws/tws.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/amdsbwd/amdsbwd.c
==
--- stable/10/sys/dev/amdsbwd/amdsbwd.c Wed Jan 18 22:40:22 2017
(r312397)
+++ stable/10/sys/dev/amdsbwd/amdsbwd.c Wed Jan 18 23:23:46 2017
(r312398)
@@ -416,8 +416,8 @@ amdsbwd_probe(device_t dev)
return (ENXIO);
}
rid = 0;
-   res = bus_alloc_resource(dev, SYS_RES_IOPORT, , 0ul, ~0ul,
-   AMDSB_PMIO_WIDTH, RF_ACTIVE | RF_SHAREABLE);
+   res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, ,
+   RF_ACTIVE | RF_SHAREABLE);
if (res == NULL) {
device_printf(dev, "bus_alloc_resource for IO failed\n");
return (ENXIO);

Modified: stable/10/sys/dev/arcmsr/arcmsr.c
==
--- stable/10/sys/dev/arcmsr/arcmsr.c   Wed Jan 18 22:40:22 2017
(r312397)
+++ stable/10/sys/dev/arcmsr/arcmsr.c   Wed Jan 18 23:23:46 2017
(r312398)
@@ -4143,7 +4143,7 @@ static u_int32_t arcmsr_initialize(devic
u_int32_t rid0 = PCIR_BAR(0);
vm_offset_t mem_base0;
 
-   acb->sys_res_arcmsr[0] = 
bus_alloc_resource(dev,SYS_RES_MEMORY, , 0ul, ~0ul, 0x1000, RF_ACTIVE);
+   acb->sys_res_arcmsr[0] = 
bus_alloc_resource_any(dev,SYS_RES_MEMORY, , RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == NULL) {
arcmsr_free_resource(acb);
printf("arcmsr%d: bus_alloc_resource 
failure!\n", device_get_unit(dev));
@@ -4177,11 +4177,11 @@ static u_int32_t arcmsr_initialize(devic
size = sizeof(struct HBB_DOORBELL);
for(i=0; i < 2; i++) {
if(i == 0) {
-   acb->sys_res_arcmsr[i] = 
bus_alloc_resource(dev,SYS_RES_MEMORY, [i],
-   
0ul, ~0ul, size, RF_ACTIVE);
+   acb->sys_res_arcmsr[i] = 
bus_alloc_resource_any(dev,SYS_RES_MEMORY, [i],
+   
RF_ACTIVE);
} else {
-   acb->sys_res_arcmsr[i] = 
bus_alloc_resource(dev, SYS_RES_MEMORY, [i],
-   
0ul, ~0ul, sizeof(struct HBB_RWBUFFER), RF_ACTIVE);
+   acb->sys_res_arcmsr[i] = 
bus_alloc_resource_any(dev, SYS_RES_MEMORY, [i],
+   
RF_ACTIVE);
}
if(acb->sys_res_arcmsr[i] == NULL) {
arcmsr_free_resource(acb);
@@ -4224,7 +4224,7 @@ static u_int32_t arcmsr_initialize(devic
u_int32_t rid0 = PCIR_BAR(1);
vm_offset_t mem_base0;
 
-   acb->sys_res_arcmsr[0] = 
bus_alloc_resource(dev,SYS_RES_MEMORY, , 0ul, ~0ul, sizeof(struct 
HBC_MessageUnit), RF_ACTIVE);
+   acb->sys_res_arcmsr[0] = 
bus_alloc_resource_any(dev,SYS_RES_MEMORY, , RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == NULL) {
arcmsr_free_resource(acb);
printf("arcmsr%d: bus_alloc_resource 
failure!\n", device_get_unit(dev));
@@ -4251,7 +4251,7 @@ static u_int32_t arcmsr_initialize(devic
u_int32_t rid0 = PCIR_BAR(0);
vm_offset_t mem_base0;
 
-   acb->sys_res_arcmsr[0] = 
bus_alloc_resource(dev,SYS_RES_MEMORY, , 0ul, ~0ul, sizeof(struct 
HBD_MessageUnit), RF_ACTIVE);
+   acb->sys_res_arcmsr[0] = 
bus_alloc_resource_any(dev,SYS_RES_MEMORY, , RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == 

svn commit: r312397 - in stable: 10/sys/vm 11/sys/vm

2017-01-18 Thread John Baldwin
Author: jhb
Date: Wed Jan 18 22:40:22 2017
New Revision: 312397
URL: https://svnweb.freebsd.org/changeset/base/312397

Log:
  MFC 310028: Use db_lookup_proc() in the DDB 'show procvm' command.
  
  This allows processes to be identified by PID as well as a pointer address.

Modified:
  stable/11/sys/vm/vm_map.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/vm/vm_map.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/sys/vm/vm_map.c
==
--- stable/11/sys/vm/vm_map.c   Wed Jan 18 22:10:18 2017(r312396)
+++ stable/11/sys/vm/vm_map.c   Wed Jan 18 22:40:22 2017(r312397)
@@ -4313,7 +4313,7 @@ DB_SHOW_COMMAND(procvm, procvm)
struct proc *p;
 
if (have_addr) {
-   p = (struct proc *) addr;
+   p = db_lookup_proc(addr);
} else {
p = curproc;
}
___
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: r312397 - in stable: 10/sys/vm 11/sys/vm

2017-01-18 Thread John Baldwin
Author: jhb
Date: Wed Jan 18 22:40:22 2017
New Revision: 312397
URL: https://svnweb.freebsd.org/changeset/base/312397

Log:
  MFC 310028: Use db_lookup_proc() in the DDB 'show procvm' command.
  
  This allows processes to be identified by PID as well as a pointer address.

Modified:
  stable/10/sys/vm/vm_map.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/vm/vm_map.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/vm/vm_map.c
==
--- stable/10/sys/vm/vm_map.c   Wed Jan 18 22:10:18 2017(r312396)
+++ stable/10/sys/vm/vm_map.c   Wed Jan 18 22:40:22 2017(r312397)
@@ -4274,7 +4274,7 @@ DB_SHOW_COMMAND(procvm, procvm)
struct proc *p;
 
if (have_addr) {
-   p = (struct proc *) addr;
+   p = db_lookup_proc(addr);
} else {
p = curproc;
}
___
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: r286700 - in head: sbin/ifconfig sys/net

2017-01-18 Thread Hiren Panchasara
Adding the submitter and other reviewers for their comments.

On 01/18/17 at 03:03P, Alan Somers wrote:
> Is the change to lacp_port_create correct?  The comment indicates that
> fast is configurable, but it's actually constant.  Later on, there's
> some dead code that depends on the value of fast (it was dead before
> this commit, too).
> 
> CID: 1305734
> CID: 1305692
> 
> -Alan
> 
> On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara  wrote:
> > Author: hiren
> > Date: Wed Aug 12 20:21:04 2015
> > New Revision: 286700
> > URL: https://svnweb.freebsd.org/changeset/base/286700
> >
> > Log:
> >   Make LAG LACP fast timeout tunable through IOCTL.
> >
> >   Differential Revision:D3300
> >   Submitted by: LN Sundararajan 
> >   Reviewed by:  wblock, smh, gnn, hiren, rpokala at panasas
> >   MFC after:2 weeks
> >   Sponsored by: Panasas
> >
> > Modified:
> >   head/sbin/ifconfig/ifconfig.8
> >   head/sbin/ifconfig/iflagg.c
> >   head/sys/net/ieee8023ad_lacp.c
> >   head/sys/net/ieee8023ad_lacp.h
> >   head/sys/net/if_lagg.c
> >   head/sys/net/if_lagg.h
> >
> > Modified: head/sbin/ifconfig/ifconfig.8
> > ==
> > --- head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:16:13 2015
> > (r286699)
> > +++ head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:21:04 2015
> > (r286700)
> > @@ -28,7 +28,7 @@
> >  .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
> >  .\" $FreeBSD$
> >  .\"
> > -.Dd May 15, 2015
> > +.Dd Aug 12, 2015
> >  .Dt IFCONFIG 8
> >  .Os
> >  .Sh NAME
> > @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h
> >  Set a shift parameter for RSS local hash computation.
> >  Hash is calculated by using flowid bits in a packet header mbuf
> >  which are shifted by the number of this parameter.
> > +.It Cm lacp_fast_timeout
> > +Enable lacp fast-timeout on the interface.
> > +.It Cm -lacp_fast_timeout
> > +Disable lacp fast-timeout on the interface.
> >  .El
> >  .Pp
> >  The following parameters are specific to IP tunnel interfaces,
> >
> > Modified: head/sbin/ifconfig/iflagg.c
> > ==
> > --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015(r286699)
> > +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015(r286700)
> > @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in
> > case -LAGG_OPT_LACP_TXTEST:
> > case LAGG_OPT_LACP_RXTEST:
> > case -LAGG_OPT_LACP_RXTEST:
> > +   case LAGG_OPT_LACP_TIMEOUT:
> > +   case -LAGG_OPT_LACP_TIMEOUT:
> > break;
> > default:
> > err(1, "Invalid lagg option");
> > @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = {
> > DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST,  setlaggsetopt),
> > DEF_CMD("lacp_rxtest",  LAGG_OPT_LACP_RXTEST,   setlaggsetopt),
> > DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST,  setlaggsetopt),
> > +   DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT,  
> > setlaggsetopt),
> > +   DEF_CMD("-lacp_fast_timeout",   -LAGG_OPT_LACP_TIMEOUT, 
> > setlaggsetopt),
> > DEF_CMD_ARG("flowid_shift", setlaggflowidshift),
> >  };
> >  static struct afswtch af_lagg = {
> >
> > Modified: head/sys/net/ieee8023ad_lacp.c
> > ==
> > --- head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:16:13 2015
> > (r286699)
> > +++ head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:21:04 2015
> > (r286700)
> > @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp)
> > int error;
> >
> > boolean_t active = TRUE; /* XXX should be configurable */
> > -   boolean_t fast = FALSE; /* XXX should be configurable */
> > +   boolean_t fast = FALSE; /* Configurable via ioctl */
> >
> > link_init_sdl(ifp, (struct sockaddr *), IFT_ETHER);
> > sdl.sdl_alen = ETHER_ADDR_LEN;
> >
> > Modified: head/sys/net/ieee8023ad_lacp.h
> > ==
> > --- head/sys/net/ieee8023ad_lacp.h  Wed Aug 12 20:16:13 2015
> > (r286699)
> > +++ head/sys/net/ieee8023ad_lacp.h  Wed Aug 12 20:21:04 2015
> > (r286700)
> > @@ -251,6 +251,7 @@ struct lacp_softc {
> > u_int32_t   lsc_tx_test;
> > } lsc_debug;
> > u_int32_t   lsc_strict_mode;
> > +   boolean_t   lsc_fast_timeout; /* if set, fast timeout */
> >  };
> >
> >  #defineLACP_TYPE_ACTORINFO 1
> >
> > Modified: head/sys/net/if_lagg.c
> > ==
> > --- head/sys/net/if_lagg.c  Wed Aug 12 20:16:13 2015(r286699)
> > +++ head/sys/net/if_lagg.c  Wed Aug 12 20:21:04 2015(r286700)
> > @@ -1257,6 

svn commit: r312396 - head/cddl/usr.sbin/zfsd

2017-01-18 Thread Alan Somers
Author: asomers
Date: Wed Jan 18 22:10:18 2017
New Revision: 312396
URL: https://svnweb.freebsd.org/changeset/base/312396

Log:
  Fix an unchecked return value in zfsd
  
  It's pretty unlikely to actually hit this, but good to check it anyway
  
  Reported by:  Coverity
  CID:  1362018
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/cddl/usr.sbin/zfsd/case_file.cc

Modified: head/cddl/usr.sbin/zfsd/case_file.cc
==
--- head/cddl/usr.sbin/zfsd/case_file.ccWed Jan 18 20:24:37 2017
(r312395)
+++ head/cddl/usr.sbin/zfsd/case_file.ccWed Jan 18 22:10:18 2017
(r312396)
@@ -656,8 +656,11 @@ CaseFile::DeSerializeFile(const char *fi
uint64_t vdevGUID;
nvlist_t *vdevConf;
 
-   sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case",
-  , );
+   if (sscanf(fileName, "pool_%" PRIu64 "_vdev_%" PRIu64 ".case",
+  , ) != 2) {
+   throw ZfsdException("CaseFile::DeSerialize: "
+   "Unintelligible CaseFile filename %s.\n", fileName);
+   }
existingCaseFile = Find(Guid(poolGUID), Guid(vdevGUID));
if (existingCaseFile != NULL) {
/*
___
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: r286700 - in head: sbin/ifconfig sys/net

2017-01-18 Thread Alan Somers
Is the change to lacp_port_create correct?  The comment indicates that
fast is configurable, but it's actually constant.  Later on, there's
some dead code that depends on the value of fast (it was dead before
this commit, too).

CID: 1305734
CID: 1305692

-Alan

On Wed, Aug 12, 2015 at 2:21 PM, Hiren Panchasara  wrote:
> Author: hiren
> Date: Wed Aug 12 20:21:04 2015
> New Revision: 286700
> URL: https://svnweb.freebsd.org/changeset/base/286700
>
> Log:
>   Make LAG LACP fast timeout tunable through IOCTL.
>
>   Differential Revision:D3300
>   Submitted by: LN Sundararajan 
>   Reviewed by:  wblock, smh, gnn, hiren, rpokala at panasas
>   MFC after:2 weeks
>   Sponsored by: Panasas
>
> Modified:
>   head/sbin/ifconfig/ifconfig.8
>   head/sbin/ifconfig/iflagg.c
>   head/sys/net/ieee8023ad_lacp.c
>   head/sys/net/ieee8023ad_lacp.h
>   head/sys/net/if_lagg.c
>   head/sys/net/if_lagg.h
>
> Modified: head/sbin/ifconfig/ifconfig.8
> ==
> --- head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:16:13 2015
> (r286699)
> +++ head/sbin/ifconfig/ifconfig.8   Wed Aug 12 20:21:04 2015
> (r286700)
> @@ -28,7 +28,7 @@
>  .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
>  .\" $FreeBSD$
>  .\"
> -.Dd May 15, 2015
> +.Dd Aug 12, 2015
>  .Dt IFCONFIG 8
>  .Os
>  .Sh NAME
> @@ -2396,6 +2396,10 @@ Disable local hash computation for RSS h
>  Set a shift parameter for RSS local hash computation.
>  Hash is calculated by using flowid bits in a packet header mbuf
>  which are shifted by the number of this parameter.
> +.It Cm lacp_fast_timeout
> +Enable lacp fast-timeout on the interface.
> +.It Cm -lacp_fast_timeout
> +Disable lacp fast-timeout on the interface.
>  .El
>  .Pp
>  The following parameters are specific to IP tunnel interfaces,
>
> Modified: head/sbin/ifconfig/iflagg.c
> ==
> --- head/sbin/ifconfig/iflagg.c Wed Aug 12 20:16:13 2015(r286699)
> +++ head/sbin/ifconfig/iflagg.c Wed Aug 12 20:21:04 2015(r286700)
> @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in
> case -LAGG_OPT_LACP_TXTEST:
> case LAGG_OPT_LACP_RXTEST:
> case -LAGG_OPT_LACP_RXTEST:
> +   case LAGG_OPT_LACP_TIMEOUT:
> +   case -LAGG_OPT_LACP_TIMEOUT:
> break;
> default:
> err(1, "Invalid lagg option");
> @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = {
> DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST,  setlaggsetopt),
> DEF_CMD("lacp_rxtest",  LAGG_OPT_LACP_RXTEST,   setlaggsetopt),
> DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST,  setlaggsetopt),
> +   DEF_CMD("lacp_fast_timeout",LAGG_OPT_LACP_TIMEOUT,  
> setlaggsetopt),
> +   DEF_CMD("-lacp_fast_timeout",   -LAGG_OPT_LACP_TIMEOUT, 
> setlaggsetopt),
> DEF_CMD_ARG("flowid_shift", setlaggflowidshift),
>  };
>  static struct afswtch af_lagg = {
>
> Modified: head/sys/net/ieee8023ad_lacp.c
> ==
> --- head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:16:13 2015
> (r286699)
> +++ head/sys/net/ieee8023ad_lacp.c  Wed Aug 12 20:21:04 2015
> (r286700)
> @@ -522,7 +522,7 @@ lacp_port_create(struct lagg_port *lgp)
> int error;
>
> boolean_t active = TRUE; /* XXX should be configurable */
> -   boolean_t fast = FALSE; /* XXX should be configurable */
> +   boolean_t fast = FALSE; /* Configurable via ioctl */
>
> link_init_sdl(ifp, (struct sockaddr *), IFT_ETHER);
> sdl.sdl_alen = ETHER_ADDR_LEN;
>
> Modified: head/sys/net/ieee8023ad_lacp.h
> ==
> --- head/sys/net/ieee8023ad_lacp.h  Wed Aug 12 20:16:13 2015
> (r286699)
> +++ head/sys/net/ieee8023ad_lacp.h  Wed Aug 12 20:21:04 2015
> (r286700)
> @@ -251,6 +251,7 @@ struct lacp_softc {
> u_int32_t   lsc_tx_test;
> } lsc_debug;
> u_int32_t   lsc_strict_mode;
> +   boolean_t   lsc_fast_timeout; /* if set, fast timeout */
>  };
>
>  #defineLACP_TYPE_ACTORINFO 1
>
> Modified: head/sys/net/if_lagg.c
> ==
> --- head/sys/net/if_lagg.c  Wed Aug 12 20:16:13 2015(r286699)
> +++ head/sys/net/if_lagg.c  Wed Aug 12 20:21:04 2015(r286700)
> @@ -1257,6 +1257,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd
> ro->ro_opts |= LAGG_OPT_LACP_RXTEST;
> if (lsc->lsc_strict_mode != 0)
> ro->ro_opts |= LAGG_OPT_LACP_STRICT;
> +   if (lsc->lsc_fast_timeout != 0)
> +   

svn commit: r312395 - head/sbin/devd

2017-01-18 Thread Alan Somers
Author: asomers
Date: Wed Jan 18 20:24:37 2017
New Revision: 312395
URL: https://svnweb.freebsd.org/changeset/base/312395

Log:
  Fix several Coverity CIDs in devd
  
  CID 1362055, 1362054: File descriptor leaks during shutdown
  CID 1362013: Potential null-termination fail with long network device names
  CID 1362097: Uncaught exception during memory pressure
  CID 1362017, 1362016: Unchecked errors, possibly resulting in weird behavior
if two devd instances start at the same time.
  CID 1362015:  Unchecked error that will probably never fail
  
  Reported by:  Coverity
  CID:  1362055 1362054 1362013 1362097 1362017 1362016 1362015
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==
--- head/sbin/devd/devd.cc  Wed Jan 18 19:38:53 2017(r312394)
+++ head/sbin/devd/devd.cc  Wed Jan 18 20:24:37 2017(r312395)
@@ -372,7 +372,7 @@ media::do_match(config )
s = socket(PF_INET, SOCK_DGRAM, 0);
if (s >= 0) {
memset(, 0, sizeof(ifmr));
-   strncpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
+   strlcpy(ifmr.ifm_name, value.c_str(), sizeof(ifmr.ifm_name));
 
if (ioctl(s, SIOCGIFMEDIA, (caddr_t)) >= 0 &&
ifmr.ifm_status & IFM_AVALID) {
@@ -871,8 +871,10 @@ create_socket(const char *name, int sock
if (::bind(fd, (struct sockaddr *) & sun, slen) < 0)
err(1, "bind");
listen(fd, 4);
-   chown(name, 0, 0);  /* XXX - root.wheel */
-   chmod(name, 0666);
+   if (chown(name, 0, 0))  /* XXX - root.wheel */
+   err(1, "chown");
+   if (chmod(name, 0666))
+   err(1, "chmod");
return (fd);
 }
 
@@ -1058,7 +1060,13 @@ event_loop(void)
buffer[rv] = '\0';
while (buffer[--rv] == '\n')
buffer[rv] = '\0';
-   process_event(buffer);
+   try {
+   process_event(buffer);
+   }
+   catch (std::length_error e) {
+   devdlog(LOG_ERR, "Dropping event %s "
+   "due to low memory", buffer);
+   }
} else if (rv < 0) {
if (errno != EINTR)
break;
@@ -1076,6 +1084,8 @@ event_loop(void)
if (FD_ISSET(seqpacket_fd, ))
new_client(seqpacket_fd, SOCK_SEQPACKET);
}
+   close(seqpacket_fd);
+   close(stream_fd);
close(fd);
 }
 
@@ -1218,7 +1228,8 @@ check_devd_enabled()
if (val == 0) {
warnx("Setting " SYSCTL " to 1000");
val = 1000;
-   sysctlbyname(SYSCTL, NULL, NULL, , sizeof(val));
+   if (sysctlbyname(SYSCTL, NULL, NULL, , sizeof(val)))
+   err(1, "sysctlbyname");
}
 }
 
___
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: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys

2017-01-18 Thread Adrian Chadd
It depends, is this -HEAD or is this -stable?

If this thing doesn't pan out with the chelsio/mellanox hardware
socket rate limiting then we can either evolve it or remove it.



-adrian
___
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: r312394 - in stable/11/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 mips/mips powerpc/powerpc sparc64/sparc64

2017-01-18 Thread John Baldwin
Author: jhb
Date: Wed Jan 18 19:38:53 2017
New Revision: 312394
URL: https://svnweb.freebsd.org/changeset/base/312394

Log:
  MFC 307332,312086: Drop support for using mmap() with /dev/kmem.
  
  307332:
  Drop support for using mmap() with /dev/kmem.
  
  Using the device pager with /dev/kmem is not stable since KVA mappings
  are transient, but the device pager caches the PA associated with a
  given offset forever.  Interestingly, mips' implementation of
  memmap() already refused requests for /dev/kmem.
  
  Note that kvm_read/kvm_write do not use mmap, but use read and write on
  /dev/kmem, so this should not affect libkvm users.
  
  312086:
  Trim a few comments on platforms that did not implement mmap of /dev/kmem.
  
  After r307332, no platforms implement mmap for /dev/kmem, so the lack of
  it for these platforms is no longer unique.

Modified:
  stable/11/sys/amd64/amd64/mem.c
  stable/11/sys/arm/arm/mem.c
  stable/11/sys/arm64/arm64/mem.c
  stable/11/sys/i386/i386/mem.c
  stable/11/sys/mips/mips/mem.c
  stable/11/sys/powerpc/powerpc/mem.c
  stable/11/sys/sparc64/sparc64/mem.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/mem.c
==
--- stable/11/sys/amd64/amd64/mem.c Wed Jan 18 18:16:57 2017
(r312393)
+++ stable/11/sys/amd64/amd64/mem.c Wed Jan 18 19:38:53 2017
(r312394)
@@ -172,10 +172,9 @@ memmmap(struct cdev *dev, vm_ooffset_t o
if (offset > cpu_getmaxphyaddr())
return (-1);
*paddr = offset;
-   } else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }
 
 /*

Modified: stable/11/sys/arm/arm/mem.c
==
--- stable/11/sys/arm/arm/mem.c Wed Jan 18 18:16:57 2017(r312393)
+++ stable/11/sys/arm/arm/mem.c Wed Jan 18 19:38:53 2017(r312394)
@@ -161,10 +161,9 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot __unused, vm_memattr_t *memattr __unused)
 {
-   if (dev2unit(dev) == CDEV_MINOR_MEM)
+   if (dev2unit(dev) == CDEV_MINOR_MEM) {
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }

Modified: stable/11/sys/arm64/arm64/mem.c
==
--- stable/11/sys/arm64/arm64/mem.c Wed Jan 18 18:16:57 2017
(r312393)
+++ stable/11/sys/arm64/arm64/mem.c Wed Jan 18 19:38:53 2017
(r312394)
@@ -123,10 +123,9 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot __unused, vm_memattr_t *memattr __unused)
 {
-   if (dev2unit(dev) == CDEV_MINOR_MEM)
+   if (dev2unit(dev) == CDEV_MINOR_MEM) {
*paddr = offset;
-   else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }

Modified: stable/11/sys/i386/i386/mem.c
==
--- stable/11/sys/i386/i386/mem.c   Wed Jan 18 18:16:57 2017
(r312393)
+++ stable/11/sys/i386/i386/mem.c   Wed Jan 18 19:38:53 2017
(r312394)
@@ -168,10 +168,9 @@ memmmap(struct cdev *dev, vm_ooffset_t o
if (offset > cpu_getmaxphyaddr())
return (-1);
*paddr = offset;
-   } else if (dev2unit(dev) == CDEV_MINOR_KMEM)
-   *paddr = vtophys(offset);
-   /* else panic! */
-   return (0);
+   return (0);
+   }
+   return (-1);
 }
 
 /*

Modified: stable/11/sys/mips/mips/mem.c
==
--- stable/11/sys/mips/mips/mem.c   Wed Jan 18 18:16:57 2017
(r312393)
+++ stable/11/sys/mips/mips/mem.c   Wed Jan 18 19:38:53 2017
(r312394)
@@ -151,12 +151,6 @@ int
 memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
 int prot, vm_memattr_t *memattr)
 {
-   /*
-* /dev/mem is the only one that makes sense through this
-* interface.  For /dev/kmem any physaddr we return here
-* could be transient and hence incorrect or invalid at
-* a later time.
-*/
if (dev2unit(dev) != CDEV_MINOR_MEM)
return (-1);
 

Modified: stable/11/sys/powerpc/powerpc/mem.c
==
--- stable/11/sys/powerpc/powerpc/mem.c Wed Jan 18 18:16:57 2017
(r312393)
+++ 

Re: svn commit: r312387 - head/sys/sys

2017-01-18 Thread John Baldwin
On Wednesday, January 18, 2017 05:09:22 PM Gleb Smirnoff wrote:
> Author: glebius
> Date: Wed Jan 18 17:09:22 2017
> New Revision: 312387
> URL: https://svnweb.freebsd.org/changeset/base/312387
> 
> Log:
>   Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
>   lead to delayed send of data sent with sendto(MSG_NOSIGNAL).
>   
>   Submitted by:   rrs

Ouch, thanks for fixing.  Hopefully this fixes the freerdp report. :(

-- 
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: r312393 - in head: sbin/restore sys/sys sys/ufs/ufs

2017-01-18 Thread Conrad E. Meyer
Author: cem
Date: Wed Jan 18 18:16:57 2017
New Revision: 312393
URL: https://svnweb.freebsd.org/changeset/base/312393

Log:
  restore(8): Handle extended attribute names correctly
  
  UFS2 extended attribute names are not NUL-terminated.  Handle
  appropriately.
  
  Correct the EXTATTR_BASE_LENGTH() macro, which handled ea_namelength ==
  one (mod eight) extended attributes incorrectly.
  
  PR:   216127
  Reported by:  dewayne at heuristicsystems.com.au
  Reviewed by:  kib@
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D9208

Modified:
  head/sbin/restore/dirs.c
  head/sbin/restore/extern.h
  head/sbin/restore/tape.c
  head/sys/sys/extattr.h
  head/sys/ufs/ufs/extattr.h

Modified: head/sbin/restore/dirs.c
==
--- head/sbin/restore/dirs.cWed Jan 18 18:14:50 2017(r312392)
+++ head/sbin/restore/dirs.cWed Jan 18 18:16:57 2017(r312393)
@@ -645,7 +645,7 @@ setdirmodes(int flags)
if (!Nflag) {
if (node.extsize > 0) {
if (bufsize >= node.extsize) {
-   set_extattr_file(cp, buf, node.extsize);
+   set_extattr(-1, cp, buf, node.extsize, 
SXA_FILE);
} else {
fprintf(stderr, "Cannot restore %s%s\n",
"extended attributes for ", cp);

Modified: head/sbin/restore/extern.h
==
--- head/sbin/restore/extern.h  Wed Jan 18 18:14:50 2017(r312392)
+++ head/sbin/restore/extern.h  Wed Jan 18 18:16:57 2017(r312393)
@@ -87,7 +87,12 @@ struct direct*rst_readdir(RST_DIR *);
 voidrst_closedir(void *);
 voidruncmdshell(void);
 char   *savename(char *);
-voidset_extattr_file(char *, void *, int);
+enum set_extattr_mode {
+   SXA_FILE,
+   SXA_LINK,
+   SXA_FD,
+};
+voidset_extattr(int, char *, void *, int, enum set_extattr_mode);
 voidsetdirmodes(int);
 voidsetinput(char *, int);
 voidsetup(void);

Modified: head/sbin/restore/tape.c
==
--- head/sbin/restore/tape.cWed Jan 18 18:14:50 2017(r312392)
+++ head/sbin/restore/tape.cWed Jan 18 18:16:57 2017(r312393)
@@ -105,8 +105,6 @@ static void  findinode(struct s_spcl *);
 static void findtapeblksize(void);
 static char*setupextattr(int);
 static void xtrattr(char *, size_t);
-static void set_extattr_link(char *, void *, int);
-static void set_extattr_fd(int, char *, void *, int);
 static void skiphole(void (*)(char *, size_t), size_t *);
 static int  gethead(struct s_spcl *);
 static void readtape(char *);
@@ -627,7 +625,7 @@ extractfile(char *name)
}
if (linkit(lnkbuf, name, SYMLINK) == GOOD) {
if (extsize > 0)
-   set_extattr_link(name, buf, extsize);
+   set_extattr(-1, name, buf, extsize, SXA_LINK);
(void) lchown(name, uid, gid);
(void) lchmod(name, mode);
(void) utimensat(AT_FDCWD, name, ctimep,
@@ -658,7 +656,7 @@ extractfile(char *name)
} else {
buf = setupextattr(extsize);
getfile(xtrnull, xtrattr, xtrnull);
-   set_extattr_file(name, buf, extsize);
+   set_extattr(-1, name, buf, extsize, SXA_FILE);
}
(void) chown(name, uid, gid);
(void) chmod(name, mode);
@@ -688,7 +686,7 @@ extractfile(char *name)
} else {
buf = setupextattr(extsize);
getfile(xtrnull, xtrattr, xtrnull);
-   set_extattr_file(name, buf, extsize);
+   set_extattr(-1, name, buf, extsize, SXA_FILE);
}
(void) chown(name, uid, gid);
(void) chmod(name, mode);
@@ -715,7 +713,7 @@ extractfile(char *name)
buf = setupextattr(extsize);
getfile(xtrfile, xtrattr, xtrskip);
if (extsize > 0)
-   set_extattr_fd(ofile, name, buf, extsize);
+   set_extattr(ofile, name, buf, extsize, SXA_FD);
(void) fchown(ofile, uid, gid);
(void) fchmod(ofile, mode);
(void) futimens(ofile, ctimep);
@@ -728,12 +726,16 @@ extractfile(char *name)
 }
 
 /*
- * Set attributes for a file.
+ * Set attributes on a file descriptor, link, or file.
  */
 void
-set_extattr_file(char *name, void *buf, int size)

Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys

2017-01-18 Thread Gleb Smirnoff
On Wed, Jan 18, 2017 at 07:04:05PM +0100, Hans Petter Selasky wrote:
H> > there were no production testing of the feature,
H> > that will prove that the idea actually works.
H> 
H> Hi Gleb,
H> 
H> This feature has been tested small scale in production environments and 
H> it for sure saves CPU versus doing rate limiting all in software.
H> 
H> Mellanox plans to checkin support for the mlx5en driver which starts 
H> using this feature soon and I believe np@ has similar plans for cxgbe.
H> 
H> I'll reply to your other questions tomorrow.

The pacing in general (either software or hardware) haven't yet been used
in production anywhere, to my knowledge.

So, let's decide is FreeBSD an academical experimental OS, where we throw
bare fresh ideas in, or is it a mature production ready OS, which we recommend
to install to end users, who aren't hackers theirselves?

-- 
Totus tuus, Glebius.
___
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: r312392 - head/lib/libwrap

2017-01-18 Thread Ngie Cooper
Author: ngie
Date: Wed Jan 18 18:14:50 2017
New Revision: 312392
URL: https://svnweb.freebsd.org/changeset/base/312392

Log:
  Use SRCTOP instead of .CURDIR-relative path in .PATH directive
  
  MFC after:3 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libwrap/Makefile

Modified: head/lib/libwrap/Makefile
==
--- head/lib/libwrap/Makefile   Wed Jan 18 17:55:49 2017(r312391)
+++ head/lib/libwrap/Makefile   Wed Jan 18 18:14:50 2017(r312392)
@@ -15,7 +15,7 @@ MLINKS=   hosts_access.3 hosts_ctl.3 \
hosts_access.3 request_set.3 \
hosts_options.5 hosts.allow.5
 
-.PATH: ${.CURDIR}/../../contrib/tcp_wrappers
+.PATH: ${SRCTOP}/contrib/tcp_wrappers
 
 CFLAGS+=-DFACILITY=LOG_AUTH -DHOSTS_ACCESS -DNETGROUP -DDAEMON_UMASK=022 \
-DREAL_DAEMON_DIR=\"${LIBEXECDIR}\" -DPROCESS_OPTIONS \
___
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: r312391 - in head: share/man/man5 sys/ufs/ufs

2017-01-18 Thread Conrad Meyer
On Wed, Jan 18, 2017 at 9:55 AM, Conrad E. Meyer  wrote:
> Author: cem
> Date: Wed Jan 18 17:55:49 2017
> New Revision: 312391
> URL: https://svnweb.freebsd.org/changeset/base/312391
>
> Log:
>   ufs/extattr.h: Fix documentation of ea_name termination
>
>   The ea_name string is not nul-terminated.  Correct the documentation.
>
>   Because the subsequent field is padded to 8 bytes, and the padding is
>   zeroed, the ea_name string will appear to be nul-terminated whenever the
>   length isn't exactly one (mod eight).
>
>   This was introduced in r167010 (2007).
>
>   Additionally, mark the length fields as unsigned.  This particularly
>   matters for the single byte ea_namelength field, which can represent
>   extended attribute names up to 255 bytes long.
>
>   No functional change.

Whoops — very minor functional change — restore(8) can now handle some
dumps with extended attribute names longer than 127 characters that it
couldn't before, due to the unsigned type change called out above.

Best,
Conrad
___
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: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys

2017-01-18 Thread Hans Petter Selasky

On 01/18/17 18:31, Gleb Smirnoff wrote:

there were no production testing of the feature,
that will prove that the idea actually works.


Hi Gleb,

This feature has been tested small scale in production environments and 
it for sure saves CPU versus doing rate limiting all in software.


Mellanox plans to checkin support for the mlx5en driver which starts 
using this feature soon and I believe np@ has similar plans for cxgbe.


I'll reply to your other questions tomorrow.

--HPS
___
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: r312389 - in head/sys: kern sys

2017-01-18 Thread Mateusz Guzik
Author: mjg
Date: Wed Jan 18 17:53:57 2017
New Revision: 312389
URL: https://svnweb.freebsd.org/changeset/base/312389

Log:
  rwlock: reduce lock accesses similarly to r311172
  
  Discussed with: jhb
  Tested by:pho (previous version)

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/sys/rwlock.h

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Wed Jan 18 17:21:28 2017(r312388)
+++ head/sys/kern/kern_rwlock.c Wed Jan 18 17:53:57 2017(r312389)
@@ -132,9 +132,12 @@ LOCK_DELAY_SYSINIT(rw_delay_sysinit);
  * Return a pointer to the owning thread if the lock is write-locked or
  * NULL if the lock is unlocked or read-locked.
  */
-#definerw_wowner(rw)   
\
-   ((rw)->rw_lock & RW_LOCK_READ ? NULL :  \
-   (struct thread *)RW_OWNER((rw)->rw_lock))
+
+#definelv_rw_wowner(v) 
\
+   ((v) & RW_LOCK_READ ? NULL :\
+(struct thread *)RW_OWNER((v)))
+
+#definerw_wowner(rw)   lv_rw_wowner(RW_READ_VALUE(rw))
 
 /*
  * Returns if a write owner is recursed.  Write ownership is not assured
@@ -415,7 +418,10 @@ __rw_rlock(volatile uintptr_t *c, const 
 
 #ifdef KDTRACE_HOOKS
all_time -= lockstat_nsecs(>lock_object);
-   state = rw->rw_lock;
+#endif
+   v = RW_READ_VALUE(rw);
+#ifdef KDTRACE_HOOKS
+   state = v;
 #endif
for (;;) {
/*
@@ -428,7 +434,6 @@ __rw_rlock(volatile uintptr_t *c, const 
 * completely unlocked rwlock since such a lock is encoded
 * as a read lock with no waiters.
 */
-   v = rw->rw_lock;
if (RW_CAN_READ(v)) {
/*
 * The RW_LOCK_READ_WAITERS flag should only be set
@@ -444,6 +449,7 @@ __rw_rlock(volatile uintptr_t *c, const 
(void *)(v + RW_ONE_READER));
break;
}
+   v = RW_READ_VALUE(rw);
continue;
}
 #ifdef KDTRACE_HOOKS
@@ -471,9 +477,11 @@ __rw_rlock(volatile uintptr_t *c, const 
KTR_STATE1(KTR_SCHED, "thread",
sched_tdname(curthread), "spinning",
"lockname:\"%s\"", rw->lock_object.lo_name);
-   while ((struct thread*)RW_OWNER(rw->rw_lock) ==
-   owner && TD_IS_RUNNING(owner))
+   do {
lock_delay();
+   v = RW_READ_VALUE(rw);
+   owner = lv_rw_wowner(v);
+   } while (owner != NULL && TD_IS_RUNNING(owner));
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname(curthread), "running");
continue;
@@ -484,11 +492,12 @@ __rw_rlock(volatile uintptr_t *c, const 
"spinning", "lockname:\"%s\"",
rw->lock_object.lo_name);
for (i = 0; i < rowner_loops; i++) {
-   v = rw->rw_lock;
+   v = RW_READ_VALUE(rw);
if ((v & RW_LOCK_READ) == 0 || RW_CAN_READ(v))
break;
cpu_spinwait();
}
+   v = RW_READ_VALUE(rw);
 #ifdef KDTRACE_HOOKS
lda.spin_cnt += rowner_loops - i;
 #endif
@@ -511,7 +520,7 @@ __rw_rlock(volatile uintptr_t *c, const 
 * The lock might have been released while we spun, so
 * recheck its state and restart the loop if needed.
 */
-   v = rw->rw_lock;
+   v = RW_READ_VALUE(rw);
if (RW_CAN_READ(v)) {
turnstile_cancel(ts);
continue;
@@ -549,6 +558,7 @@ __rw_rlock(volatile uintptr_t *c, const 
if (!atomic_cmpset_ptr(>rw_lock, v,
v | RW_LOCK_READ_WAITERS)) {
turnstile_cancel(ts);
+   v = RW_READ_VALUE(rw);
continue;
}
if (LOCK_LOG_TEST(>lock_object, 0))
@@ -574,6 +584,7 @@ __rw_rlock(volatile uintptr_t *c, const 
if (LOCK_LOG_TEST(>lock_object, 0))
CTR2(KTR_LOCK, "%s: %p resuming from turnstile",
__func__, rw);
+   v = RW_READ_VALUE(rw);
}
 

svn commit: r312391 - in head: share/man/man5 sys/ufs/ufs

2017-01-18 Thread Conrad E. Meyer
Author: cem
Date: Wed Jan 18 17:55:49 2017
New Revision: 312391
URL: https://svnweb.freebsd.org/changeset/base/312391

Log:
  ufs/extattr.h: Fix documentation of ea_name termination
  
  The ea_name string is not nul-terminated.  Correct the documentation.
  
  Because the subsequent field is padded to 8 bytes, and the padding is
  zeroed, the ea_name string will appear to be nul-terminated whenever the
  length isn't exactly one (mod eight).
  
  This was introduced in r167010 (2007).
  
  Additionally, mark the length fields as unsigned.  This particularly
  matters for the single byte ea_namelength field, which can represent
  extended attribute names up to 255 bytes long.
  
  No functional change.
  
  PR:   216127
  Reported by:  dewayne at heuristicsystems.com.au
  Reviewed by:  kib@
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D9206

Modified:
  head/share/man/man5/fs.5
  head/sys/ufs/ufs/extattr.h

Modified: head/share/man/man5/fs.5
==
--- head/share/man/man5/fs.5Wed Jan 18 17:55:08 2017(r312390)
+++ head/share/man/man5/fs.5Wed Jan 18 17:55:49 2017(r312391)
@@ -28,7 +28,7 @@
 .\" @(#)fs.5   8.2 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd April 23, 2016
+.Dd January 16, 2017
 .Dt FS 5
 .Os
 .Sh NAME
@@ -388,18 +388,19 @@ For further information, see the include
 The format of an external attribute is defined by the extattr structure:
 .Bd -literal
 struct extattr {
-   int32_t ea_length;  /* length of this attribute */
-   int8_t  ea_namespace;   /* name space of this attribute */
-   int8_t  ea_contentpadlen;   /* padding at end of attribute */
-   int8_t  ea_namelength;  /* length of attribute name */
-   charea_name[1]; /* null-terminated attribute name */
+   uint32_t ea_length; /* length of this attribute */
+   uint8_t ea_namespace;   /* name space of this attribute */
+   uint8_t ea_contentpadlen;   /* bytes of padding at end of attribute */
+   uint8_t ea_namelength;  /* length of attribute name */
+   charea_name[1]; /* attribute name (NOT nul-terminated) */
+   /* padding, if any, to align attribute content to 8 byte boundary */
/* extended attribute content follows */
 };
 .Ed
 .Pp
 Several macros are defined to manipulate these structures.
 Each macro takes a pointer to an extattr structure.
-.Bl -tag -width ".Dv EXTATTR_SET_LENGTHS(eap, size)"
+.Bl -tag -width ".Dv EXTATTR_CONTENT_SIZE(eap)"
 .It Dv EXTATTR_NEXT(eap)
 Returns a pointer to the next extended attribute following
 .Fa eap .
@@ -409,35 +410,19 @@ Returns a pointer to the extended attrib
 .It Dv EXTATTR_CONTENT_SIZE(eap)
 Returns the size of the extended attribute content referenced by
 .Fa eap .
-.It Dv EXTATTR_SET_LENGTHS(eap, size)
-Called with the size of the attribute content after initializing
-the attribute name to calculate and set the
-.Fa ea_length ,
-.Fa ea_namelength ,
-and
-.Fa ea_contentpadlen
-fields of the extended attribute structure.
 .El
 .Pp
 The following code identifies an ACL:
 .Bd -literal
if (eap->ea_namespace == EXTATTR_NAMESPACE_SYSTEM &&
-   !strcmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME) {
+eap->ea_namelength == sizeof(POSIX1E_ACL_ACCESS_EXTATTR_NAME) - 1 
&&
+   strncmp(eap->ea_name, POSIX1E_ACL_ACCESS_EXTATTR_NAME,
+ sizeof(POSIX1E_ACL_ACCESS_EXTATTR_NAME) - 1) == 0) {
aclp = EXTATTR_CONTENT(eap);
acllen = EXTATTR_CONTENT_SIZE(eap);
...
}
 .Ed
-.Pp
-The following code creates an extended attribute
-containing a copy of a structure
-.Fa mygif :
-.Bd -literal
-   eap->ea_namespace = EXTATTR_NAMESPACE_USER;
-   strcpy(eap->ea_name, "filepic.gif");
-   EXTATTR_SET_LENGTHS(eap, sizeof(struct mygif));
-   memcpy(EXTATTR_CONTENT(eap), , sizeof(struct mygif));
-.Ed
 .Sh HISTORY
 A super-block structure named filsys appeared in
 .At v6 .

Modified: head/sys/ufs/ufs/extattr.h
==
--- head/sys/ufs/ufs/extattr.h  Wed Jan 18 17:55:08 2017(r312390)
+++ head/sys/ufs/ufs/extattr.h  Wed Jan 18 17:55:49 2017(r312391)
@@ -73,11 +73,12 @@ struct ufs_extattr_header {
  * This structure defines the required fields of an extended-attribute header.
  */
 struct extattr {
-   int32_t ea_length;  /* length of this attribute */
-   int8_t  ea_namespace;   /* name space of this attribute */
-   int8_t  ea_contentpadlen;   /* bytes of padding at end of attribute */
-   int8_t  ea_namelength;  /* length of attribute name */
-   charea_name[1]; /* null-terminated attribute name */
+   uint32_t ea_length; /* length of this attribute */
+   uint8_t ea_namespace;   /* name space 

svn commit: r312390 - in head/sys: kern sys

2017-01-18 Thread Mateusz Guzik
Author: mjg
Date: Wed Jan 18 17:55:08 2017
New Revision: 312390
URL: https://svnweb.freebsd.org/changeset/base/312390

Log:
  sx: reduce lock accesses similarly to r311172
  
  Discussed with:   jhb
  Tested by:pho (previous version)

Modified:
  head/sys/kern/kern_sx.c
  head/sys/sys/sx.h

Modified: head/sys/kern/kern_sx.c
==
--- head/sys/kern/kern_sx.c Wed Jan 18 17:53:57 2017(r312389)
+++ head/sys/kern/kern_sx.c Wed Jan 18 17:55:08 2017(r312390)
@@ -563,8 +563,10 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
lock_delay_arg_init(, NULL);
 #endif
 
+   x = SX_READ_VALUE(sx);
+
/* If we already hold an exclusive lock, then recurse. */
-   if (sx_xlocked(sx)) {
+   if (__predict_false(lv_sx_owner(x) == (struct thread *)tid)) {
KASSERT((sx->lock_object.lo_flags & LO_RECURSABLE) != 0,
("_sx_xlock_hard: recursed on non-recursive sx %s @ %s:%d\n",
sx->lock_object.lo_name, file, line));
@@ -581,12 +583,15 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 
 #ifdef KDTRACE_HOOKS
all_time -= lockstat_nsecs(>lock_object);
-   state = sx->sx_lock;
+   state = x;
 #endif
for (;;) {
-   if (sx->sx_lock == SX_LOCK_UNLOCKED &&
-   atomic_cmpset_acq_ptr(>sx_lock, SX_LOCK_UNLOCKED, tid))
-   break;
+   if (x == SX_LOCK_UNLOCKED) {
+   if (atomic_cmpset_acq_ptr(>sx_lock, x, tid))
+   break;
+   x = SX_READ_VALUE(sx);
+   continue;
+   }
 #ifdef KDTRACE_HOOKS
lda.spin_cnt++;
 #endif
@@ -601,11 +606,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 * running on another CPU, spin until the owner stops
 * running or the state of the lock changes.
 */
-   x = sx->sx_lock;
if ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0) {
if ((x & SX_LOCK_SHARED) == 0) {
-   x = SX_OWNER(x);
-   owner = (struct thread *)x;
+   owner = lv_sx_owner(x);
if (TD_IS_RUNNING(owner)) {
if (LOCK_LOG_TEST(>lock_object, 0))
CTR3(KTR_LOCK,
@@ -616,9 +619,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
"lockname:\"%s\"",
sx->lock_object.lo_name);
GIANT_SAVE();
-   while (SX_OWNER(sx->sx_lock) == x &&
-   TD_IS_RUNNING(owner))
+   do {
lock_delay();
+   x = SX_READ_VALUE(sx);
+   owner = lv_sx_owner(x);
+   } while (owner != NULL &&
+   TD_IS_RUNNING(owner));
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname(curthread), "running");
continue;
@@ -645,6 +651,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
}
KTR_STATE0(KTR_SCHED, "thread",
sched_tdname(curthread), "running");
+   x = SX_READ_VALUE(sx);
if (i != asx_loops)
continue;
}
@@ -652,7 +659,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
 #endif
 
sleepq_lock(>lock_object);
-   x = sx->sx_lock;
+   x = SX_READ_VALUE(sx);
 
/*
 * If the lock was released while spinning on the
@@ -701,6 +708,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
break;
}
sleepq_release(>lock_object);
+   x = SX_READ_VALUE(sx);
continue;
}
 
@@ -712,6 +720,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (!atomic_cmpset_ptr(>sx_lock, x,
x | SX_LOCK_EXCLUSIVE_WAITERS)) {
sleepq_release(>lock_object);
+   x = SX_READ_VALUE(sx);
continue;
}
if (LOCK_LOG_TEST(>lock_object, 0))
@@ -753,6 +762,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t 
if (LOCK_LOG_TEST(>lock_object, 0))
 

Re: svn commit: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys

2017-01-18 Thread Gleb Smirnoff
  Hi!

  I'm quite disappointed by this checkin. This is an interesting experimental
feature, but to my knowledge, there were no production testing of the feature,
that will prove that the idea actually works. To my knowledge the code isn't
used anywhere right now, it was just tested to work as a concept. At the same
time it introduces yet another socket to interface layering violation, bloats
the ifnet structure and other intrusive things.

Please correct me if I am wrong.

On Wed, Jan 18, 2017 at 01:31:17PM +, Hans Petter Selasky wrote:
H> Author: hselasky
H> Date: Wed Jan 18 13:31:17 2017
H> New Revision: 312379
H> URL: https://svnweb.freebsd.org/changeset/base/312379
H> 
H> Log:
H>   Implement kernel support for hardware rate limited sockets.
H>   
H>   - Add RATELIMIT kernel configuration keyword which must be set to
H>   enable the new functionality.
H>   
H>   - Add support for hardware driven, Receive Side Scaling, RSS aware, rate
H>   limited sendqueues and expose the functionality through the already
H>   established SO_MAX_PACING_RATE setsockopt(). The API support rates in
H>   the range from 1 to 4Gbytes/s which are suitable for regular TCP and
H>   UDP streams. The setsockopt(2) manual page has been updated.
H>   
H>   - Add rate limit function callback API to "struct ifnet" which supports
H>   the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
H>   if_snd_tag_query() and if_snd_tag_free().
H>   
H>   - Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
H>   flag, which tells if a network driver supports rate limiting or not.
H>   
H>   - This patch also adds support for rate limiting through VLAN and LAGG
H>   intermediate network devices.
H>   
H>   - How rate limiting works:
H>   
H>   1) The userspace application calls setsockopt() after accepting or
H>   making a new connection to set the rate which is then stored in the
H>   socket structure in the kernel. Later on when packets are transmitted
H>   a check is made in the transmit path for rate changes. A rate change
H>   implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
H>   destination network interface, which then sets up a custom sendqueue
H>   with the given rate limitation parameter. A "struct m_snd_tag" pointer is
H>   returned which serves as a "snd_tag" hint in the m_pkthdr for the
H>   subsequently transmitted mbufs.
H>   
H>   2) When the network driver sees the "m->m_pkthdr.snd_tag" different
H>   from NULL, it will move the packets into a designated rate limited 
sendqueue
H>   given by the snd_tag pointer. It is up to the individual drivers how the 
rate
H>   limited traffic will be rate limited.
H>   
H>   3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
H>   routine when the ifnet pointer in the incoming snd_tag mismatches the
H>   one of the network interface. The network adapter frees the mbuf and
H>   returns EAGAIN which causes the ip_output() to release and clear the send
H>   tag. Upon next ip_output() a new "snd_tag" will be tried allocated.
H>   
H>   4) When the PCB is detached the custom sendqueue will be released by a
H>   non-blocking ifp->if_snd_tag_free() call to the currently bound network
H>   interface.
H>   
H>   Reviewed by:   wblock (manpages), adrian, gallatin, scottl 
(network)
H>   Differential Revision: https://reviews.freebsd.org/D3687
H>   Sponsored by:  Mellanox Technologies
H>   MFC after: 3 months
H> 
H> Modified:
H>   head/lib/libc/sys/getsockopt.2
H>   head/sbin/ifconfig/ifconfig.8
H>   head/sbin/ifconfig/ifconfig.c
H>   head/sys/conf/NOTES
H>   head/sys/conf/config.mk
H>   head/sys/conf/kern.opts.mk
H>   head/sys/conf/options
H>   head/sys/kern/uipc_socket.c
H>   head/sys/modules/if_lagg/Makefile
H>   head/sys/modules/if_vlan/Makefile
H>   head/sys/net/ieee8023ad_lacp.c
H>   head/sys/net/ieee8023ad_lacp.h
H>   head/sys/net/if.h
H>   head/sys/net/if_dead.c
H>   head/sys/net/if_lagg.c
H>   head/sys/net/if_var.h
H>   head/sys/net/if_vlan.c
H>   head/sys/netinet/in_pcb.c
H>   head/sys/netinet/in_pcb.h
H>   head/sys/netinet/ip_output.c
H>   head/sys/netinet6/ip6_output.c
H>   head/sys/sys/mbuf.h
H>   head/sys/sys/socket.h
H>   head/sys/sys/socketvar.h
H> 
H> Modified: head/lib/libc/sys/getsockopt.2
H> 
==
H> --- head/lib/libc/sys/getsockopt.2   Wed Jan 18 13:27:24 2017
(r312378)
H> +++ head/lib/libc/sys/getsockopt.2   Wed Jan 18 13:31:17 2017
(r312379)
H> @@ -28,7 +28,7 @@
H>  .\" @(#)getsockopt.28.4 (Berkeley) 5/2/95
H>  .\" $FreeBSD$
H>  .\"
H> -.Dd April 5, 2013
H> +.Dd January 18, 2017
H>  .Dt GETSOCKOPT 2
H>  .Os
H>  .Sh NAME
H> @@ -188,6 +188,7 @@ The following options are recognized in
H>  .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get 
only)"
H>  .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket 
(uint32_t, set only)"
H>  

svn commit: r312388 - head/sys/sys

2017-01-18 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 18 17:21:28 2017
New Revision: 312388
URL: https://svnweb.freebsd.org/changeset/base/312388

Log:
  Format and sort MSG_* flags, to prevent misedits in future.  There is no
  functional change.

Modified:
  head/sys/sys/socket.h

Modified: head/sys/sys/socket.h
==
--- head/sys/sys/socket.h   Wed Jan 18 17:09:22 2017(r312387)
+++ head/sys/sys/socket.h   Wed Jan 18 17:21:28 2017(r312388)
@@ -425,28 +425,36 @@ struct msghdr {
int  msg_flags; /* flags on received message */
 };
 
-#defineMSG_OOB 0x1 /* process out-of-band data */
-#defineMSG_PEEK0x2 /* peek at incoming message */
-#defineMSG_DONTROUTE   0x4 /* send without using routing 
tables */
-#defineMSG_EOR 0x8 /* data completes record */
-#defineMSG_TRUNC   0x10/* data discarded before 
delivery */
-#defineMSG_CTRUNC  0x20/* control data lost before 
delivery */
-#defineMSG_WAITALL 0x40/* wait for full request or 
error */
+#defineMSG_OOB  0x0001 /* process out-of-band data */
+#defineMSG_PEEK 0x0002 /* peek at incoming message */
+#defineMSG_DONTROUTE0x0004 /* send without using routing 
tables */
+#defineMSG_EOR  0x0008 /* data completes record */
+#defineMSG_TRUNC0x0010 /* data discarded before 
delivery */
+#defineMSG_CTRUNC   0x0020 /* control data lost before 
delivery */
+#defineMSG_WAITALL  0x0040 /* wait for full request or 
error */
+#if __BSD_VISIBLE
+#defineMSG_DONTWAIT 0x0080 /* this message should be 
nonblocking */
+#defineMSG_EOF  0x0100 /* data completes connection */
+/*  0x0200unused */
+/*  0x0400unused */
+/*  0x0800unused */
+/*  0x1000unused */
+#defineMSG_NOTIFICATION 0x2000 /* SCTP notification */
+#defineMSG_NBIO 0x4000 /* FIONBIO mode, used by fifofs 
*/
+#defineMSG_COMPAT   0x8000 /* used in sendit() */
+#endif
+#ifdef _KERNEL
+#defineMSG_SOCALLBCK0x0001 /* for use by socket callbacks 
- soreceive (TCP) */
+#endif
 #if __POSIX_VISIBLE >= 200809
-#defineMSG_NOSIGNAL0x2 /* do not generate SIGPIPE on 
EOF */
+#defineMSG_NOSIGNAL 0x0002 /* do not generate SIGPIPE on 
EOF */
 #endif
 #if __BSD_VISIBLE
-#defineMSG_DONTWAIT0x80/* this message should be 
nonblocking */
-#defineMSG_EOF 0x100   /* data completes connection */
-#defineMSG_NOTIFICATION 0x2000 /* SCTP notification */
-#defineMSG_NBIO0x4000  /* FIONBIO mode, used by fifofs 
*/
-#defineMSG_COMPAT  0x8000  /* used in sendit() */
-#defineMSG_CMSG_CLOEXEC 0x4/* make received fds 
close-on-exec */
-#defineMSG_WAITFORONE  0x8 /* for recvmmsg() */
+#defineMSG_CMSG_CLOEXEC 0x0004 /* make received fds 
close-on-exec */
+#defineMSG_WAITFORONE   0x0008 /* for recvmmsg() */
 #endif
 #ifdef _KERNEL
-#defineMSG_SOCALLBCK   0x1 /* for use by socket callbacks 
- soreceive (TCP) */
-#defineMSG_MORETOCOME  0x10/* additional data pending */
+#defineMSG_MORETOCOME   0x0010 /* additional data pending */
 #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: r312387 - head/sys/sys

2017-01-18 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan 18 17:09:22 2017
New Revision: 312387
URL: https://svnweb.freebsd.org/changeset/base/312387

Log:
  Fix regression from r311568: collision of MSG_NOSIGNAL with MSG_MORETOCOME
  lead to delayed send of data sent with sendto(MSG_NOSIGNAL).
  
  Submitted by: rrs

Modified:
  head/sys/sys/socket.h

Modified: head/sys/sys/socket.h
==
--- head/sys/sys/socket.h   Wed Jan 18 15:23:40 2017(r312386)
+++ head/sys/sys/socket.h   Wed Jan 18 17:09:22 2017(r312387)
@@ -446,7 +446,7 @@ struct msghdr {
 #endif
 #ifdef _KERNEL
 #defineMSG_SOCALLBCK   0x1 /* for use by socket callbacks 
- soreceive (TCP) */
-#defineMSG_MORETOCOME  0x2 /* additional data pending */
+#defineMSG_MORETOCOME  0x10/* additional data pending */
 #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: r312386 - stable/10/usr.bin/rpcgen

2017-01-18 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jan 18 15:23:40 2017
New Revision: 312386
URL: https://svnweb.freebsd.org/changeset/base/312386

Log:
  MFC r311947, r311981:
  
  rpcgen(1): Avoid unused variable warning on generated code.
  
  Avoid "unused variable 'i'" warnings in generated .c files by only
  emitting the "int i;" for non-opaque arrays. Opaque arrays use
  xdr_opaque() rather than iterating over the array.
  
  Obtained from:OpenBSD (CVS rev 1.28)
  
  rpcgen(1): Check getrlimit() return for generated code.
  
  Obtained from:NetBSD (CVS rev 1.27, 1.28)

Modified:
  stable/10/usr.bin/rpcgen/rpc_cout.c
  stable/10/usr.bin/rpcgen/rpc_svcout.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/rpcgen/rpc_cout.c
==
--- stable/10/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 15:22:54 2017
(r312385)
+++ stable/10/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 15:23:40 2017
(r312386)
@@ -551,7 +551,8 @@ emit_struct(definition *def)
}
 
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-   if (dl->decl.rel == REL_VECTOR){
+   if (dl->decl.rel == REL_VECTOR &&
+   strcmp(dl->decl.type, "opaque") != 0){
f_print(fout, "\tint i;\n");
break;
}

Modified: stable/10/usr.bin/rpcgen/rpc_svcout.c
==
--- stable/10/usr.bin/rpcgen/rpc_svcout.c   Wed Jan 18 15:22:54 2017
(r312385)
+++ stable/10/usr.bin/rpcgen/rpc_svcout.c   Wed Jan 18 15:23:40 2017
(r312386)
@@ -728,7 +728,8 @@ write_timeout_func(void)
if (tirpcflag) {
f_print(fout, "\t\t\tstruct rlimit rl;\n\n");
f_print(fout, "\t\t\trl.rlim_max = 0;\n");
-   f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, );\n");
+   f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, ) == 
-1)\n");
+   f_print(fout, "\t\t\t\treturn;\n");
f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");

if (mtflag)
@@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, con
/* get number of file descriptors */
if (tirpcflag) {
f_print(fout, "%srl.rlim_max = 0;\n", sp);
-   f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, );\n", sp);
+   f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, ) == -1) {\n",
+   sp);
+   f_print(fout, "%s\tperror(\"getrlimit\");\n", sp);
+   f_print(fout, "%s\texit(1);\n", sp);
+   f_print(fout, "%s}\n", sp);
f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
f_print(fout, "%s\texit(1);\n", sp);
} else {
___
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: r312385 - stable/11/usr.bin/rpcgen

2017-01-18 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jan 18 15:22:54 2017
New Revision: 312385
URL: https://svnweb.freebsd.org/changeset/base/312385

Log:
  MFC r311947, r311981:
  
  rpcgen(1): Avoid unused variable warning on generated code.
  
  Avoid "unused variable 'i'" warnings in generated .c files by only
  emitting the "int i;" for non-opaque arrays. Opaque arrays use
  xdr_opaque() rather than iterating over the array.
  
  Obtained from:OpenBSD (CVS rev 1.28)
  
  rpcgen(1): Check getrlimit() return for generated code.
  
  Obtained from:NetBSD (CVS rev 1.27, 1.28)

Modified:
  stable/11/usr.bin/rpcgen/rpc_cout.c
  stable/11/usr.bin/rpcgen/rpc_svcout.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/rpcgen/rpc_cout.c
==
--- stable/11/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 14:41:59 2017
(r312384)
+++ stable/11/usr.bin/rpcgen/rpc_cout.c Wed Jan 18 15:22:54 2017
(r312385)
@@ -551,7 +551,8 @@ emit_struct(definition *def)
}
 
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-   if (dl->decl.rel == REL_VECTOR){
+   if (dl->decl.rel == REL_VECTOR &&
+   strcmp(dl->decl.type, "opaque") != 0){
f_print(fout, "\tint i;\n");
break;
}

Modified: stable/11/usr.bin/rpcgen/rpc_svcout.c
==
--- stable/11/usr.bin/rpcgen/rpc_svcout.c   Wed Jan 18 14:41:59 2017
(r312384)
+++ stable/11/usr.bin/rpcgen/rpc_svcout.c   Wed Jan 18 15:22:54 2017
(r312385)
@@ -728,7 +728,8 @@ write_timeout_func(void)
if (tirpcflag) {
f_print(fout, "\t\t\tstruct rlimit rl;\n\n");
f_print(fout, "\t\t\trl.rlim_max = 0;\n");
-   f_print(fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, );\n");
+   f_print(fout, "\t\t\tif (getrlimit(RLIMIT_NOFILE, ) == 
-1)\n");
+   f_print(fout, "\t\t\t\treturn;\n");
f_print(fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");

if (mtflag)
@@ -902,7 +903,11 @@ write_rpc_svc_fg(const char *infile, con
/* get number of file descriptors */
if (tirpcflag) {
f_print(fout, "%srl.rlim_max = 0;\n", sp);
-   f_print(fout, "%sgetrlimit(RLIMIT_NOFILE, );\n", sp);
+   f_print(fout, "%sif (getrlimit(RLIMIT_NOFILE, ) == -1) {\n",
+   sp);
+   f_print(fout, "%s\tperror(\"getrlimit\");\n", sp);
+   f_print(fout, "%s\texit(1);\n", sp);
+   f_print(fout, "%s}\n", sp);
f_print(fout, "%sif ((size = rl.rlim_max) == 0)\n", sp);
f_print(fout, "%s\texit(1);\n", sp);
} else {
___
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: r312384 - head/sys/boot/fdt/dts/mips

2017-01-18 Thread Ruslan Bukin
Author: br
Date: Wed Jan 18 14:41:59 2017
New Revision: 312384
URL: https://svnweb.freebsd.org/changeset/base/312384

Log:
  Remove empty ranges property so beri_simplebus can be attached again.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/boot/fdt/dts/mips/beri-netfpga.dts
  head/sys/boot/fdt/dts/mips/beri-sim.dts
  head/sys/boot/fdt/dts/mips/beripad-de4.dts
  head/sys/boot/fdt/dts/mips/beripad-sockit.dts

Modified: head/sys/boot/fdt/dts/mips/beri-netfpga.dts
==
--- head/sys/boot/fdt/dts/mips/beri-netfpga.dts Wed Jan 18 14:23:43 2017
(r312383)
+++ head/sys/boot/fdt/dts/mips/beri-netfpga.dts Wed Jan 18 14:41:59 2017
(r312384)
@@ -97,7 +97,6 @@
 * we use mips4k coprocessor 0 interrupt management directly.
 */
compatible = "simple-bus", "mips,mips4k";
-   ranges = <>;
 
beripic: beripic@7f804000 {
compatible = "sri-cambridge,beri-pic";

Modified: head/sys/boot/fdt/dts/mips/beri-sim.dts
==
--- head/sys/boot/fdt/dts/mips/beri-sim.dts Wed Jan 18 14:23:43 2017
(r312383)
+++ head/sys/boot/fdt/dts/mips/beri-sim.dts Wed Jan 18 14:41:59 2017
(r312384)
@@ -95,7 +95,6 @@
 * we use mips4k coprocessor 0 interrupt management directly.
 */
compatible = "simple-bus", "mips,mips4k";
-   ranges = <>;
 
beripic0: beripic@7f804000 {
compatible = "sri-cambridge,beri-pic";

Modified: head/sys/boot/fdt/dts/mips/beripad-de4.dts
==
--- head/sys/boot/fdt/dts/mips/beripad-de4.dts  Wed Jan 18 14:23:43 2017
(r312383)
+++ head/sys/boot/fdt/dts/mips/beripad-de4.dts  Wed Jan 18 14:41:59 2017
(r312384)
@@ -95,7 +95,6 @@
 * we use mips4k coprocessor 0 interrupt management directly.
 */
compatible = "simple-bus", "mips,mips4k";
-   ranges = <>;
 
beripic0: beripic@7f804000 {
compatible = "sri-cambridge,beri-pic";

Modified: head/sys/boot/fdt/dts/mips/beripad-sockit.dts
==
--- head/sys/boot/fdt/dts/mips/beripad-sockit.dts   Wed Jan 18 14:23:43 
2017(r312383)
+++ head/sys/boot/fdt/dts/mips/beripad-sockit.dts   Wed Jan 18 14:41:59 
2017(r312384)
@@ -93,7 +93,6 @@
 * we use mips4k coprocessor 0 interrupt management directly.
 */
compatible = "simple-bus", "mips,mips4k";
-   /* ranges = <>; */
 
beripic0: beripic@7f804000 {
compatible = "sri-cambridge,beri-pic";
___
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: r312383 - head/sys/dev/e1000

2017-01-18 Thread Sean Bruno
Author: sbruno
Date: Wed Jan 18 14:23:43 2017
New Revision: 312383
URL: https://svnweb.freebsd.org/changeset/base/312383

Log:
  ugh, device_t not device_t *
  
  Reported by:  hps

Modified:
  head/sys/dev/e1000/if_em.h

Modified: head/sys/dev/e1000/if_em.h
==
--- head/sys/dev/e1000/if_em.h  Wed Jan 18 14:14:00 2017(r312382)
+++ head/sys/dev/e1000/if_em.h  Wed Jan 18 14:23:43 2017(r312383)
@@ -436,7 +436,7 @@ struct adapter {
 #define intr_type shared->isc_intr
/* FreeBSD operating-system-specific structures. */
struct e1000_osdep osdep;
-   device_t*dev;
+   device_tdev;
struct cdev *led_dev;
 
 struct em_tx_queue *tx_queues;
___
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: r312380 - head/sys/dev/e1000

2017-01-18 Thread Mateusz Guzik
On Wed, Jan 18, 2017 at 01:57:29PM +, Sean Bruno wrote:
> Author: sbruno
> Date: Wed Jan 18 13:57:29 2017
> New Revision: 312380
> URL: https://svnweb.freebsd.org/changeset/base/312380
> 
> Log:
>   Change device type to unbreak drm-next testing and builds.
>   
>   Submitted by:   Matt Macy 
> 
> Modified:
>   head/sys/dev/e1000/if_em.h
> 
> Modified: head/sys/dev/e1000/if_em.h
> ==
> --- head/sys/dev/e1000/if_em.hWed Jan 18 13:31:17 2017
> (r312379)
> +++ head/sys/dev/e1000/if_em.hWed Jan 18 13:57:29 2017
> (r312380)
> @@ -436,7 +436,7 @@ struct adapter {
>  #define intr_type shared->isc_intr
>   /* FreeBSD operating-system-specific structures. */
>   struct e1000_osdep osdep;
> - struct device   *dev;
> + device_t*dev;

this should be 'device_t dev';

>   struct cdev *led_dev;
>  
>  struct em_tx_queue *tx_queues;
> ___
> 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"

-- 
Mateusz Guzik 
___
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: r312382 - in stable/10: include lib/libkvm

2017-01-18 Thread Andriy Gapon
Author: avg
Date: Wed Jan 18 14:14:00 2017
New Revision: 312382
URL: https://svnweb.freebsd.org/changeset/base/312382

Log:
  MFC r310630: libkvm: support access to vmm guest memory, allow writes to
  fwmem and vmm
  
  Sponsored by:  Panzura

Modified:
  stable/10/include/paths.h
  stable/10/lib/libkvm/kvm.c
  stable/10/lib/libkvm/kvm_private.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/include/paths.h
==
--- stable/10/include/paths.h   Wed Jan 18 14:13:28 2017(r312381)
+++ stable/10/include/paths.h   Wed Jan 18 14:14:00 2017(r312382)
@@ -98,6 +98,7 @@
 #define_PATH_VARDB "/var/db/"
 #define_PATH_VARRUN"/var/run/"
 #define_PATH_VARTMP"/var/tmp/"
+#define_PATH_DEVVMM"/dev/vmm/"
 #define_PATH_YP"/var/yp/"
 #define_PATH_UUCPLOCK  "/var/spool/lock/"
 

Modified: stable/10/lib/libkvm/kvm.c
==
--- stable/10/lib/libkvm/kvm.c  Wed Jan 18 14:13:28 2017(r312381)
+++ stable/10/lib/libkvm/kvm.c  Wed Jan 18 14:14:00 2017(r312382)
@@ -198,8 +198,10 @@ _kvm_open(kvm_t *kd, const char *uf, con
return (kd);
}
}
+
/*
-* This is a crash dump.
+* This is either a crash dump or a remote live system with its physical
+* memory fully accessible via a special device.
 * Initialize the virtual address translation machinery,
 * but first setup the namelist fd.
 */
@@ -207,8 +209,11 @@ _kvm_open(kvm_t *kd, const char *uf, con
_kvm_syserr(kd, kd->program, "%s", uf);
goto failed;
}
-   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0)
+   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0 ||
+   strncmp(mf, _PATH_DEVVMM, strlen(_PATH_DEVVMM)) == 0) {
kd->rawdump = 1;
+   kd->writable = 1;
+   }
if (_kvm_initvtop(kd) < 0)
goto failed;
return (kd);
@@ -557,6 +562,15 @@ ssize_t
 kvm_write(kvm_t *kd, u_long kva, const void *buf, size_t len)
 {
int cc;
+   ssize_t cw;
+   off_t pa;
+   const char *cp;
+
+   if (!ISALIVE(kd) && !kd->writable) {
+   _kvm_err(kd, kd->program,
+   "kvm_write not implemented for dead kernels");
+   return (-1);
+   }
 
if (ISALIVE(kd)) {
/*
@@ -574,10 +588,36 @@ kvm_write(kvm_t *kd, u_long kva, const v
} else if ((size_t)cc < len)
_kvm_err(kd, kd->program, "short write");
return (cc);
-   } else {
-   _kvm_err(kd, kd->program,
-   "kvm_write not implemented for dead kernels");
-   return (-1);
}
-   /* NOTREACHED */
+
+   cp = buf;
+   while (len > 0) {
+   cc = _kvm_kvatop(kd, kva, );
+   if (cc == 0)
+   return (-1);
+   if (cc > (ssize_t)len)
+   cc = len;
+   errno = 0;
+   if (lseek(kd->pmfd, pa, 0) == -1 && errno != 0) {
+   _kvm_syserr(kd, 0, _PATH_MEM);
+   break;
+   }
+   cw = write(kd->pmfd, cp, cc);
+   if (cw < 0) {
+   _kvm_syserr(kd, kd->program, "kvm_write");
+   break;
+   }
+   /*
+* If ka_kvatop returns a bogus value or our core file is
+* truncated, we might wind up seeking beyond the end of the
+* core file in which case the read will return 0 (EOF).
+*/
+   if (cw == 0)
+   break;
+   cp += cw;
+   kva += cw;
+   len -= cw;
+   }
+
+   return (cp - (char *)buf);
 }

Modified: stable/10/lib/libkvm/kvm_private.h
==
--- stable/10/lib/libkvm/kvm_private.h  Wed Jan 18 14:13:28 2017
(r312381)
+++ stable/10/lib/libkvm/kvm_private.h  Wed Jan 18 14:14:00 2017
(r312382)
@@ -62,6 +62,7 @@ struct __kvm {
 */
struct vmstate *vmst;
int rawdump;/* raw dump format */
+   int writable;   /* physical memory is writable */
 
int vnet_initialized;   /* vnet fields set up */
uintptr_t   vnet_start; /* start of kernel's vnet region */
___
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: r312381 - in stable/11: include lib/libkvm

2017-01-18 Thread Andriy Gapon
Author: avg
Date: Wed Jan 18 14:13:28 2017
New Revision: 312381
URL: https://svnweb.freebsd.org/changeset/base/312381

Log:
  MFC r310630: libkvm: support access to vmm guest memory, allow writes to
  fwmem and vmm
  
  Sponsored by: Panzura

Modified:
  stable/11/include/paths.h
  stable/11/lib/libkvm/kvm.c
  stable/11/lib/libkvm/kvm_private.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/include/paths.h
==
--- stable/11/include/paths.h   Wed Jan 18 13:57:29 2017(r312380)
+++ stable/11/include/paths.h   Wed Jan 18 14:13:28 2017(r312381)
@@ -99,6 +99,7 @@
 #define_PATH_VARDB "/var/db/"
 #define_PATH_VARRUN"/var/run/"
 #define_PATH_VARTMP"/var/tmp/"
+#define_PATH_DEVVMM"/dev/vmm/"
 #define_PATH_YP"/var/yp/"
 #define_PATH_UUCPLOCK  "/var/spool/lock/"
 

Modified: stable/11/lib/libkvm/kvm.c
==
--- stable/11/lib/libkvm/kvm.c  Wed Jan 18 13:57:29 2017(r312380)
+++ stable/11/lib/libkvm/kvm.c  Wed Jan 18 14:13:28 2017(r312381)
@@ -429,8 +429,10 @@ _kvm_open(kvm_t *kd, const char *uf, con
return (kd);
}
}
+
/*
-* This is a crash dump.
+* This is either a crash dump or a remote live system with its physical
+* memory fully accessible via a special device.
 * Open the namelist fd and determine the architecture.
 */
if ((kd->nlfd = open(uf, O_RDONLY | O_CLOEXEC, 0)) < 0) {
@@ -439,8 +441,11 @@ _kvm_open(kvm_t *kd, const char *uf, con
}
if (_kvm_read_kernel_ehdr(kd) < 0)
goto failed;
-   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0)
+   if (strncmp(mf, _PATH_FWMEM, strlen(_PATH_FWMEM)) == 0 ||
+   strncmp(mf, _PATH_DEVVMM, strlen(_PATH_DEVVMM)) == 0) {
kd->rawdump = 1;
+   kd->writable = 1;
+   }
SET_FOREACH(parch, kvm_arch) {
if ((*parch)->ka_probe(kd)) {
kd->arch = *parch;
@@ -866,6 +871,15 @@ ssize_t
 kvm_write(kvm_t *kd, u_long kva, const void *buf, size_t len)
 {
int cc;
+   ssize_t cw;
+   off_t pa;
+   const char *cp;
+
+   if (!ISALIVE(kd) && !kd->writable) {
+   _kvm_err(kd, kd->program,
+   "kvm_write not implemented for dead kernels");
+   return (-1);
+   }
 
if (ISALIVE(kd)) {
/*
@@ -883,12 +897,38 @@ kvm_write(kvm_t *kd, u_long kva, const v
} else if ((size_t)cc < len)
_kvm_err(kd, kd->program, "short write");
return (cc);
-   } else {
-   _kvm_err(kd, kd->program,
-   "kvm_write not implemented for dead kernels");
-   return (-1);
}
-   /* NOTREACHED */
+
+   cp = buf;
+   while (len > 0) {
+   cc = kd->arch->ka_kvatop(kd, kva, );
+   if (cc == 0)
+   return (-1);
+   if (cc > (ssize_t)len)
+   cc = len;
+   errno = 0;
+   if (lseek(kd->pmfd, pa, 0) == -1 && errno != 0) {
+   _kvm_syserr(kd, 0, _PATH_MEM);
+   break;
+   }
+   cw = write(kd->pmfd, cp, cc);
+   if (cw < 0) {
+   _kvm_syserr(kd, kd->program, "kvm_write");
+   break;
+   }
+   /*
+* If ka_kvatop returns a bogus value or our core file is
+* truncated, we might wind up seeking beyond the end of the
+* core file in which case the read will return 0 (EOF).
+*/
+   if (cw == 0)
+   break;
+   cp += cw;
+   kva += cw;
+   len -= cw;
+   }
+
+   return (cp - (char *)buf);
 }
 
 int

Modified: stable/11/lib/libkvm/kvm_private.h
==
--- stable/11/lib/libkvm/kvm_private.h  Wed Jan 18 13:57:29 2017
(r312380)
+++ stable/11/lib/libkvm/kvm_private.h  Wed Jan 18 14:13:28 2017
(r312381)
@@ -78,6 +78,7 @@ struct __kvm {
 */
struct vmstate *vmst;
int rawdump;/* raw dump format */
+   int writable;   /* physical memory is writable */
 
int vnet_initialized;   /* vnet fields set up */
kvaddr_tvnet_start; /* start of kernel's vnet region */
___
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: r312380 - head/sys/dev/e1000

2017-01-18 Thread Sean Bruno
Author: sbruno
Date: Wed Jan 18 13:57:29 2017
New Revision: 312380
URL: https://svnweb.freebsd.org/changeset/base/312380

Log:
  Change device type to unbreak drm-next testing and builds.
  
  Submitted by: Matt Macy 

Modified:
  head/sys/dev/e1000/if_em.h

Modified: head/sys/dev/e1000/if_em.h
==
--- head/sys/dev/e1000/if_em.h  Wed Jan 18 13:31:17 2017(r312379)
+++ head/sys/dev/e1000/if_em.h  Wed Jan 18 13:57:29 2017(r312380)
@@ -436,7 +436,7 @@ struct adapter {
 #define intr_type shared->isc_intr
/* FreeBSD operating-system-specific structures. */
struct e1000_osdep osdep;
-   struct device   *dev;
+   device_t*dev;
struct cdev *led_dev;
 
 struct em_tx_queue *tx_queues;
___
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: r312379 - in head: lib/libc/sys sbin/ifconfig sys/conf sys/kern sys/modules/if_lagg sys/modules/if_vlan sys/net sys/netinet sys/netinet6 sys/sys

2017-01-18 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jan 18 13:31:17 2017
New Revision: 312379
URL: https://svnweb.freebsd.org/changeset/base/312379

Log:
  Implement kernel support for hardware rate limited sockets.
  
  - Add RATELIMIT kernel configuration keyword which must be set to
  enable the new functionality.
  
  - Add support for hardware driven, Receive Side Scaling, RSS aware, rate
  limited sendqueues and expose the functionality through the already
  established SO_MAX_PACING_RATE setsockopt(). The API support rates in
  the range from 1 to 4Gbytes/s which are suitable for regular TCP and
  UDP streams. The setsockopt(2) manual page has been updated.
  
  - Add rate limit function callback API to "struct ifnet" which supports
  the following operations: if_snd_tag_alloc(), if_snd_tag_modify(),
  if_snd_tag_query() and if_snd_tag_free().
  
  - Add support to ifconfig to view, set and clear the IFCAP_TXRTLMT
  flag, which tells if a network driver supports rate limiting or not.
  
  - This patch also adds support for rate limiting through VLAN and LAGG
  intermediate network devices.
  
  - How rate limiting works:
  
  1) The userspace application calls setsockopt() after accepting or
  making a new connection to set the rate which is then stored in the
  socket structure in the kernel. Later on when packets are transmitted
  a check is made in the transmit path for rate changes. A rate change
  implies a non-blocking ifp->if_snd_tag_alloc() call will be made to the
  destination network interface, which then sets up a custom sendqueue
  with the given rate limitation parameter. A "struct m_snd_tag" pointer is
  returned which serves as a "snd_tag" hint in the m_pkthdr for the
  subsequently transmitted mbufs.
  
  2) When the network driver sees the "m->m_pkthdr.snd_tag" different
  from NULL, it will move the packets into a designated rate limited sendqueue
  given by the snd_tag pointer. It is up to the individual drivers how the rate
  limited traffic will be rate limited.
  
  3) Route changes are detected by the NIC drivers in the ifp->if_transmit()
  routine when the ifnet pointer in the incoming snd_tag mismatches the
  one of the network interface. The network adapter frees the mbuf and
  returns EAGAIN which causes the ip_output() to release and clear the send
  tag. Upon next ip_output() a new "snd_tag" will be tried allocated.
  
  4) When the PCB is detached the custom sendqueue will be released by a
  non-blocking ifp->if_snd_tag_free() call to the currently bound network
  interface.
  
  Reviewed by:  wblock (manpages), adrian, gallatin, scottl (network)
  Differential Revision:https://reviews.freebsd.org/D3687
  Sponsored by: Mellanox Technologies
  MFC after:3 months

Modified:
  head/lib/libc/sys/getsockopt.2
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifconfig.c
  head/sys/conf/NOTES
  head/sys/conf/config.mk
  head/sys/conf/kern.opts.mk
  head/sys/conf/options
  head/sys/kern/uipc_socket.c
  head/sys/modules/if_lagg/Makefile
  head/sys/modules/if_vlan/Makefile
  head/sys/net/ieee8023ad_lacp.c
  head/sys/net/ieee8023ad_lacp.h
  head/sys/net/if.h
  head/sys/net/if_dead.c
  head/sys/net/if_lagg.c
  head/sys/net/if_var.h
  head/sys/net/if_vlan.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_output.c
  head/sys/netinet6/ip6_output.c
  head/sys/sys/mbuf.h
  head/sys/sys/socket.h
  head/sys/sys/socketvar.h

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Wed Jan 18 13:27:24 2017
(r312378)
+++ head/lib/libc/sys/getsockopt.2  Wed Jan 18 13:31:17 2017
(r312379)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd April 5, 2013
+.Dd January 18, 2017
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -188,6 +188,7 @@ The following options are recognized in
 .It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get 
only)"
 .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket 
(uint32_t, set only)"
 .It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by 
SO_TIMESTAMP"
+.It Dv SO_MAX_PACING_RATE "set the maximum transmit rate in bytes per second 
for the socket"
 .El
 .Pp
 .Dv SO_DEBUG
@@ -515,6 +516,10 @@ returns the maximal number of queued con
 returns the number of unaccepted complete connections.
 .Dv SO_LISTENINCQLEN
 returns the number of unaccepted incomplete connections.
+.Pp
+.Dv SO_MAX_PACING_RATE
+instruct the socket and underlying network adapter layers to limit the
+transfer rate to the given unsigned 32-bit value in bytes per second.
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Wed Jan 18 13:27:24 2017
(r312378)
+++ head/sbin/ifconfig/ifconfig.8   

svn commit: r312378 - head/sys/cddl/dev/fbt/arm

2017-01-18 Thread Andrew Turner
Author: andrew
Date: Wed Jan 18 13:27:24 2017
New Revision: 312378
URL: https://svnweb.freebsd.org/changeset/base/312378

Log:
  Use the kernel stack in the ARM FBT DTrace provider. This is used to find
  the fifth argument to functions being traced, however there was an error
  where the userspace stack was being used. This may be invalid leading to
  a kernel panic if this address is unmapped.
  
  Submitted by: Graeme Jenkinson 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D9229

Modified:
  head/sys/cddl/dev/fbt/arm/fbt_isa.c

Modified: head/sys/cddl/dev/fbt/arm/fbt_isa.c
==
--- head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Jan 18 10:21:06 2017
(r312377)
+++ head/sys/cddl/dev/fbt/arm/fbt_isa.c Wed Jan 18 13:27:24 2017
(r312378)
@@ -61,7 +61,7 @@ fbt_invop(uintptr_t addr, struct trapfra
 
/* Get 5th parameter from stack */
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
-   fifthparam = *(register_t *)frame->tf_usr_sp;
+   fifthparam = *(register_t *)frame->tf_svc_sp;
DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | 
CPU_DTRACE_BADADDR);
 
dtrace_probe(fbt->fbtp_id, frame->tf_r0,
___
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: r312375 - in stable/10: lib/libstand lib/libz lib/libz/contrib lib/libz/doc lib/libz/test usr.bin/minigzip

2017-01-18 Thread Xin LI
Author: delphij
Date: Wed Jan 18 08:20:36 2017
New Revision: 312375
URL: https://svnweb.freebsd.org/changeset/base/312375

Log:
  MFC r311275: Restructure libz.

Added:
 - copied from r311275, head/contrib/zlib/
Directory Properties:
  stable/10/contrib/zlib/   (props changed)
Deleted:
  stable/10/lib/libz/ChangeLog
  stable/10/lib/libz/FAQ
  stable/10/lib/libz/README
  stable/10/lib/libz/adler32.c
  stable/10/lib/libz/compress.c
  stable/10/lib/libz/contrib/
  stable/10/lib/libz/crc32.c
  stable/10/lib/libz/crc32.h
  stable/10/lib/libz/deflate.c
  stable/10/lib/libz/deflate.h
  stable/10/lib/libz/doc/
  stable/10/lib/libz/gzclose.c
  stable/10/lib/libz/gzguts.h
  stable/10/lib/libz/gzlib.c
  stable/10/lib/libz/gzread.c
  stable/10/lib/libz/gzwrite.c
  stable/10/lib/libz/infback.c
  stable/10/lib/libz/inffast.c
  stable/10/lib/libz/inffast.h
  stable/10/lib/libz/inffixed.h
  stable/10/lib/libz/inflate.c
  stable/10/lib/libz/inflate.h
  stable/10/lib/libz/inftrees.c
  stable/10/lib/libz/inftrees.h
  stable/10/lib/libz/test/
  stable/10/lib/libz/trees.c
  stable/10/lib/libz/trees.h
  stable/10/lib/libz/uncompr.c
  stable/10/lib/libz/zconf.h
  stable/10/lib/libz/zlib.3
  stable/10/lib/libz/zlib.h
  stable/10/lib/libz/zutil.c
  stable/10/lib/libz/zutil.h
Modified:
  stable/10/lib/libstand/Makefile
  stable/10/lib/libz/FREEBSD-upgrade
  stable/10/lib/libz/Makefile
  stable/10/usr.bin/minigzip/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libstand/Makefile
==
--- stable/10/lib/libstand/Makefile Wed Jan 18 08:18:07 2017
(r312374)
+++ stable/10/lib/libstand/Makefile Wed Jan 18 08:20:36 2017
(r312375)
@@ -134,8 +134,8 @@ libstand_bzlib_private.h: bzlib_private.
${.ALLSRC} > ${.TARGET}
 
 # decompression functionality from libz
-.PATH: ${.CURDIR}/../libz
-CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../libz
+.PATH: ${.CURDIR}/../../contrib/zlib
+CFLAGS+=-DHAVE_MEMCPY -I${.CURDIR}/../../contrib/zlib
 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
 
 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c

Modified: stable/10/lib/libz/FREEBSD-upgrade
==
--- stable/10/lib/libz/FREEBSD-upgrade  Wed Jan 18 08:18:07 2017
(r312374)
+++ stable/10/lib/libz/FREEBSD-upgrade  Wed Jan 18 08:20:36 2017
(r312375)
@@ -1,44 +1,16 @@
 $FreeBSD: head/lib/libz/FREEBSD-upgrade 146082 2005-05-11 03:50:50Z kientzle $
 
-ZLib 1.2.2
-
-Original distribution from http://www.gzip.org/zlib/
-
-Vendor files removed from distribution before import:
-INDEX   configure   qnx/
-Makefilecontrib/win32/
-Makefile.in msdos/  zconf.in.h
-amiga/  old/
-as400/  projects/
-
-Vendor files imported:
-ChangeLog   example.c   minigzip.c
-FAQ gzio.c  trees.c
-README  infback.c   trees.h
-adler32.c   inffast.c   uncompr.c
-algorithm.txt   inffast.h   zconf.h
-compress.c  inffixed.h  zlib.3
-crc32.c inflate.c   zlib.h
-crc32.h inflate.h   zutil.c
-deflate.c   inftrees.c  zutil.h
-deflate.h   inftrees.h
-
-As of April, 2005, only the following three vendor files
-had non-trivial local changes:
-gzio.c   minigzip.c  zconf.h
-
-Added files (not from vendor):
-Makefilezopen.c FREEBSD-upgrade
+Original distribution from http://zlib.net/.  Currently, only trivial
+changes were made to support build of libstand and to suppress certain
+compiler warnings, we upstream our local changes whenever they would
+benefit other consumers.
 
 To Update:
   1) Unpack vendor sources into a clean directory.
-  2) Delete unnecessary files.
-  3) Import onto the vendor branch.  The 1.2.2 import was done like this:
-   cvs -d  import -ko -m "ZLib 1.2.2" src/lib/libz ZLIB v1_2_2
-  4) In a clean directory, check out a fresh copy of HEAD,
-merging in vendor changes since the last import.
-   cvs -d  co -jZLIB:yesterday -jZLIB src/lib/libz
-  5) Resolve any conflicts and commit them.
-  6) Update this file with any changes to the file list or update procedure.
+  2) Import onto the vendor area.
+  3) Merge the vendor tree to contrib/zlib, which contains a stripped down
+ version of upstream source, resolve any conflicts.
+  4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we
+ have the required changes.  Test universe and commit them.
 
-kient...@freebsd.org
+delp...@freebsd.org

Modified: stable/10/lib/libz/Makefile
==
--- stable/10/lib/libz/Makefile Wed Jan 18 08:18:07 2017(r312374)
+++ stable/10/lib/libz/Makefile 

svn commit: r312374 - head/sys/boot/efi/libefi

2017-01-18 Thread Toomas Soome
Author: tsoome
Date: Wed Jan 18 08:18:07 2017
New Revision: 312374
URL: https://svnweb.freebsd.org/changeset/base/312374

Log:
  loader: efi devpath api usage should be more aware of NULL pointers
  
  As the efi_devpath_last_node() and efi_devpath_trim() can return NULL
  pointers, the consumers of this API should check the the NULL pointers.
  
  Same for efinet_dev_init() using calloc().
  
  Reported by:  Robert Mustacchi 
  Reviewed by:  jhb, allanjude
  Approved by:  allanjude (mentor)
  Differential Revision:https://reviews.freebsd.org/D9203

Modified:
  head/sys/boot/efi/libefi/devpath.c
  head/sys/boot/efi/libefi/efinet.c
  head/sys/boot/efi/libefi/efipart.c

Modified: head/sys/boot/efi/libefi/devpath.c
==
--- head/sys/boot/efi/libefi/devpath.c  Wed Jan 18 08:11:18 2017
(r312373)
+++ head/sys/boot/efi/libefi/devpath.c  Wed Jan 18 08:18:07 2017
(r312374)
@@ -106,15 +106,18 @@ efi_devpath_trim(EFI_DEVICE_PATH *devpat
EFI_DEVICE_PATH *node, *copy;
size_t prefix, len;
 
-   node = efi_devpath_last_node(devpath);
+   if ((node = efi_devpath_last_node(devpath)) == NULL)
+   return (NULL);
prefix = (UINT8 *)node - (UINT8 *)devpath;
if (prefix == 0)
return (NULL);
len = prefix + DevicePathNodeLength(NextDevicePathNode(node));
copy = malloc(len);
-   memcpy(copy, devpath, prefix);
-   node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix);
-   SetDevicePathEndNode(node);
+   if (copy != NULL) {
+   memcpy(copy, devpath, prefix);
+   node = (EFI_DEVICE_PATH *)((UINT8 *)copy + prefix);
+   SetDevicePathEndNode(node);
+   }
return (copy);
 }
 

Modified: head/sys/boot/efi/libefi/efinet.c
==
--- head/sys/boot/efi/libefi/efinet.c   Wed Jan 18 08:11:18 2017
(r312373)
+++ head/sys/boot/efi/libefi/efinet.c   Wed Jan 18 08:18:07 2017
(r312374)
@@ -291,12 +291,18 @@ efinet_dev_init()
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
handles2 = (EFI_HANDLE *)malloc(sz);
+   if (handles2 == NULL) {
+   free(handles);
+   return (ENOMEM);
+   }
nifs = 0;
for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) {
devpath = efi_lookup_devpath(handles[i]);
if (devpath == NULL)
continue;
-   node = efi_devpath_last_node(devpath);
+   if ((node = efi_devpath_last_node(devpath)) == NULL)
+   continue;
+
if (DevicePathType(node) != MESSAGING_DEVICE_PATH ||
DevicePathSubType(node) != MSG_MAC_ADDR_DP)
continue;
@@ -318,20 +324,24 @@ efinet_dev_init()
}
free(handles);
if (nifs == 0) {
-   free(handles2);
-   return (ENOENT);
+   err = ENOENT;
+   goto done;
}
 
err = efi_register_handles(_dev, handles2, NULL, nifs);
-   if (err != 0) {
-   free(handles2);
-   return (err);
-   }
+   if (err != 0)
+   goto done;
 
-   efinetif.netif_nifs = nifs;
efinetif.netif_ifs = calloc(nifs, sizeof(struct netif_dif));
-
stats = calloc(nifs, sizeof(struct netif_stats));
+   if (efinetif.netif_ifs == NULL || stats == NULL) {
+   free(efinetif.netif_ifs);
+   free(stats);
+   efinetif.netif_ifs = NULL;
+   err = ENOMEM;
+   goto done;
+   }
+   efinetif.netif_nifs = nifs;
 
for (i = 0; i < nifs; i++) {
 
@@ -341,9 +351,9 @@ efinet_dev_init()
dif->dif_stats = [i];
dif->dif_private = handles2[i];
}
+done:
free(handles2);
-
-   return (0);
+   return (err);
 }
 
 static int

Modified: head/sys/boot/efi/libefi/efipart.c
==
--- head/sys/boot/efi/libefi/efipart.c  Wed Jan 18 08:11:18 2017
(r312373)
+++ head/sys/boot/efi/libefi/efipart.c  Wed Jan 18 08:18:07 2017
(r312374)
@@ -130,10 +130,13 @@ efipart_init(void) 
 * we try to find the parent device and add that instead as
 * that will be the CD filesystem.
 */
-   node = efi_devpath_last_node(devpath);
+   if ((node = efi_devpath_last_node(devpath)) == NULL)
+   continue;
if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
DevicePathSubType(node) == MEDIA_CDROM_DP) {
devpathcpy = efi_devpath_trim(devpath);
+   if (devpathcpy == NULL)
+   continue;
  

svn commit: r312373 - in stable/11: lib/libstand lib/libz lib/libz/contrib lib/libz/doc lib/libz/test usr.bin/minigzip

2017-01-18 Thread Xin LI
Author: delphij
Date: Wed Jan 18 08:11:18 2017
New Revision: 312373
URL: https://svnweb.freebsd.org/changeset/base/312373

Log:
  MFC r311275: Restructure libz.

Added:
 - copied from r311275, head/contrib/zlib/
Directory Properties:
  stable/11/contrib/zlib/   (props changed)
Deleted:
  stable/11/lib/libz/ChangeLog
  stable/11/lib/libz/FAQ
  stable/11/lib/libz/README
  stable/11/lib/libz/adler32.c
  stable/11/lib/libz/compress.c
  stable/11/lib/libz/contrib/
  stable/11/lib/libz/crc32.c
  stable/11/lib/libz/crc32.h
  stable/11/lib/libz/deflate.c
  stable/11/lib/libz/deflate.h
  stable/11/lib/libz/doc/
  stable/11/lib/libz/gzclose.c
  stable/11/lib/libz/gzguts.h
  stable/11/lib/libz/gzlib.c
  stable/11/lib/libz/gzread.c
  stable/11/lib/libz/gzwrite.c
  stable/11/lib/libz/infback.c
  stable/11/lib/libz/inffast.c
  stable/11/lib/libz/inffast.h
  stable/11/lib/libz/inffixed.h
  stable/11/lib/libz/inflate.c
  stable/11/lib/libz/inflate.h
  stable/11/lib/libz/inftrees.c
  stable/11/lib/libz/inftrees.h
  stable/11/lib/libz/test/
  stable/11/lib/libz/trees.c
  stable/11/lib/libz/trees.h
  stable/11/lib/libz/uncompr.c
  stable/11/lib/libz/zconf.h
  stable/11/lib/libz/zlib.3
  stable/11/lib/libz/zlib.h
  stable/11/lib/libz/zutil.c
  stable/11/lib/libz/zutil.h
Modified:
  stable/11/lib/libstand/Makefile
  stable/11/lib/libz/FREEBSD-upgrade
  stable/11/lib/libz/Makefile
  stable/11/usr.bin/minigzip/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libstand/Makefile
==
--- stable/11/lib/libstand/Makefile Wed Jan 18 05:36:09 2017
(r312372)
+++ stable/11/lib/libstand/Makefile Wed Jan 18 08:11:18 2017
(r312373)
@@ -109,9 +109,9 @@ libstand_bzlib_private.h: bzlib_private.
sed -e 's||"stand.h"|' \
${.ALLSRC} > ${.TARGET}
 
-# decompression functionality from libz
-.PATH: ${LIBSTAND_SRC}/../libz
-CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../libz
+# decompression functionality from zlib
+.PATH: ${LIBSTAND_SRC}/../../contrib/zlib
+CFLAGS+=-DHAVE_MEMCPY -I${LIBSTAND_SRC}/../../contrib/zlib
 SRCS+= adler32.c crc32.c libstand_zutil.h libstand_gzguts.h
 
 .for file in infback.c inffast.c inflate.c inftrees.c zutil.c

Modified: stable/11/lib/libz/FREEBSD-upgrade
==
--- stable/11/lib/libz/FREEBSD-upgrade  Wed Jan 18 05:36:09 2017
(r312372)
+++ stable/11/lib/libz/FREEBSD-upgrade  Wed Jan 18 08:11:18 2017
(r312373)
@@ -1,44 +1,16 @@
 $FreeBSD$
 
-ZLib 1.2.2
-
-Original distribution from http://www.gzip.org/zlib/
-
-Vendor files removed from distribution before import:
-INDEX   configure   qnx/
-Makefilecontrib/win32/
-Makefile.in msdos/  zconf.in.h
-amiga/  old/
-as400/  projects/
-
-Vendor files imported:
-ChangeLog   example.c   minigzip.c
-FAQ gzio.c  trees.c
-README  infback.c   trees.h
-adler32.c   inffast.c   uncompr.c
-algorithm.txt   inffast.h   zconf.h
-compress.c  inffixed.h  zlib.3
-crc32.c inflate.c   zlib.h
-crc32.h inflate.h   zutil.c
-deflate.c   inftrees.c  zutil.h
-deflate.h   inftrees.h
-
-As of April, 2005, only the following three vendor files
-had non-trivial local changes:
-gzio.c   minigzip.c  zconf.h
-
-Added files (not from vendor):
-Makefilezopen.c FREEBSD-upgrade
+Original distribution from http://zlib.net/.  Currently, only trivial
+changes were made to support build of libstand and to suppress certain
+compiler warnings, we upstream our local changes whenever they would
+benefit other consumers.
 
 To Update:
   1) Unpack vendor sources into a clean directory.
-  2) Delete unnecessary files.
-  3) Import onto the vendor branch.  The 1.2.2 import was done like this:
-   cvs -d  import -ko -m "ZLib 1.2.2" src/lib/libz ZLIB v1_2_2
-  4) In a clean directory, check out a fresh copy of HEAD,
-merging in vendor changes since the last import.
-   cvs -d  co -jZLIB:yesterday -jZLIB src/lib/libz
-  5) Resolve any conflicts and commit them.
-  6) Update this file with any changes to the file list or update procedure.
+  2) Import onto the vendor area.
+  3) Merge the vendor tree to contrib/zlib, which contains a stripped down
+ version of upstream source, resolve any conflicts.
+  4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we
+ have the required changes.  Test universe and commit them.
 
-kient...@freebsd.org
+delp...@freebsd.org

Modified: stable/11/lib/libz/Makefile
==
--- stable/11/lib/libz/Makefile Wed Jan 18 05:36:09 2017(r312372)
+++