svn commit: r316754 - in head/sys/boot: common i386/libi386

2017-04-13 Thread Roger Pau Monné
Author: royger
Date: Thu Apr 13 09:59:12 2017
New Revision: 316754
URL: https://svnweb.freebsd.org/changeset/base/316754

Log:
  loader/multiboot: fix multiboot loading
  
  The current multiboot loader code doesn't clean the metadata added to the
  kernel after the bi_load64 dry run, which breaks accounting of the required
  memory for the metadata.
  
  This issue didn't show itself before because all the metadata items where 
small
  (8bytes), but after r316343 there's a big blob in the metadata, which triggers
  this. Fix it by cleaning the metadata added to the kernel after the bi_load64
  dry run. Also add a comment describing the memory layout when booting using
  multiboot (Xen Dom0).
  
  This unbreaks booting a FreeBSD/Xen Dom0 after r316343.
  
  MFC after:3 weeks
  Sponsored by: Citrix Systems R&D

Modified:
  head/sys/boot/common/bootstrap.h
  head/sys/boot/common/module.c
  head/sys/boot/i386/libi386/multiboot.c

Modified: head/sys/boot/common/bootstrap.h
==
--- head/sys/boot/common/bootstrap.hThu Apr 13 08:21:29 2017
(r316753)
+++ head/sys/boot/common/bootstrap.hThu Apr 13 09:59:12 2017
(r316754)
@@ -228,6 +228,7 @@ void file_discard(struct preloaded_file 
 void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void 
*p);
 int  file_addmodule(struct preloaded_file *fp, char *modname, int version,
struct kernel_module **newmp);
+void file_removemetadata(struct preloaded_file *fp);
 
 /* MI module loaders */
 #ifdef __elfN

Modified: head/sys/boot/common/module.c
==
--- head/sys/boot/common/module.c   Thu Apr 13 08:21:29 2017
(r316753)
+++ head/sys/boot/common/module.c   Thu Apr 13 09:59:12 2017
(r316754)
@@ -663,6 +663,22 @@ file_findmetadata(struct preloaded_file 
 return(md);
 }
 
+/*
+ * Remove all metadata from the file.
+ */
+void
+file_removemetadata(struct preloaded_file *fp)
+{
+struct file_metadata *md, *next;
+
+for (md = fp->f_metadata; md != NULL; md = next)
+{
+   next = md->md_next;
+   free(md);
+}
+fp->f_metadata = NULL;
+}
+
 struct file_metadata *
 metadata_next(struct file_metadata *md, int type)
 {

Modified: head/sys/boot/i386/libi386/multiboot.c
==
--- head/sys/boot/i386/libi386/multiboot.c  Thu Apr 13 08:21:29 2017
(r316753)
+++ head/sys/boot/i386/libi386/multiboot.c  Thu Apr 13 09:59:12 2017
(r316754)
@@ -267,7 +267,39 @@ multiboot_exec(struct preloaded_file *fp
 * information is placed at the start of the second module and
 * the original modulep value is saved together with the other
 * metadata, so we can relocate everything.
+*
+* Native layout:
+*   fp->f_addr + fp->f_size
+* +-+++
+* | |||
+* | Kernel  |Modules |  Metadata  |
+* | |||
+* +-+++
+* fp->f_addr modulep  kernend
+*
+* Xen layout:
+*
+* Initial:
+*  fp->f_addr + fp->f_size
+* +-+--+++
+* | |  |||
+* | Kernel  | Reserved |Modules |  Metadata  |
+* | |  ||  dry run   |
+* +-+--+++
+* fp->f_addr
+*
+* After metadata polacement (ie: final):
+*  fp->f_addr + fp->f_size
+* +---+-+--++
+* |   | |  ||
+* |  Kernel   |  Free   | Metadata |Modules |
+* |   | |  ||
+* +---+-+--++
+* fp->f_addrmodulep kernend
+* \__/  \__/
+*  Multiboot module 0Multiboot module 1
 */
+
fp = file_findfile(NULL, "elf kernel");
if (fp == NULL) {
printf("No FreeBSD kernel provided, aborting\n");
@@ -275,6 +307,13 @@ multiboot_exec(struct preloaded_file *fp
goto error;
}
 
+   if (fp->f_metadata != NULL) {
+   printf("FreeBSD kernel already contains metadata, aborting\n");
+   error = EINVAL;
+   goto error;
+   }
+
+
mb_mod = malloc(sizeof(struct multiboot_mod_list) * NUM_MODULES);
if (mb_mod == NULL) {
error = ENOMEM;
@@ -312,6 +351,9 @@ mu

Re: svn commit: r316746 - head/share/examples/bhyve

2017-04-13 Thread Rodney W. Grimes
> Author: allanjude
> Date: Thu Apr 13 00:07:39 2017
> New Revision: 316746
> URL: https://svnweb.freebsd.org/changeset/base/316746
> 
> Log:
>   Add UEFI support to vmrun.sh
>   
>   Adds:
>-E: Use UEFI mode
>-f: path to UEFI firmware image (default: path to uefi-edk2-bhyve package)
>-F: UEFI framebuffer size (default: w=1024,h=768)
>-L: IP to listen for VNC connections on (default: 127.0.0.1)
>-P: Port to listen for VNC connections on (default: 5900)
>-T: Enable tablnet device (for VNC)
>-v: Wait for VNC client before booting VM
>   
>   Submitted by:   Shawn Webb 
>   MFC after:  2 weeks
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D10378

This spent 15 minutes in differtial?  Something is wrong if that is how
we use the diffential process.  That isnt even enough time for someone
to have reacted to a notice this was there.
We do mailing list CC: for bugzilla for when bugs are related to areas,
do we do anything like that in reviews.freebsd.org?  Or just the projects
lists?

As a general not I dont think we want vmrun.sh to become a too relied upon
way to start bhyve vm's, a million options to this and you still wont have
it doing what needs done, and the more we add to this the more we are going
to have to keep it around and support it.  I would like to see vmrun.sh
go away sooner rather than later with the use of config files.

> Modified:
>   head/share/examples/bhyve/vmrun.sh
> 
> Modified: head/share/examples/bhyve/vmrun.sh
> ==
> --- head/share/examples/bhyve/vmrun.shWed Apr 12 21:37:12 2017
> (r316745)
> +++ head/share/examples/bhyve/vmrun.shThu Apr 13 00:07:39 2017
> (r316746)
> @@ -46,10 +46,12 @@ errmsg() {
>  usage() {
>   local msg=$1
>  
> - echo "Usage: vmrun.sh [-ahi] [-c ] [-C ] [-d  file>]"
> - echo "[-e ] [-g  ] [-H 
> ]"
> + echo "Usage: vmrun.sh [-aEhiTv] [-c ] [-C ] [-d  file>]"
> + echo "[-e ] [-f ] [-F 
> ]"
> + echo "[-g  ] [-H ]"
>   echo "[-I ] [-l ]"
> - echo "[-m ] [-t ] "
> + echo "[-L ]"
> + echo "[-m ] [-P ] [-t ] "
>   echo ""
>   echo "   -h: display this help message"
>   echo "   -a: force memory mapped local APIC access"
> @@ -57,15 +59,22 @@ usage() {
>   echo "   -C: console device (default is ${DEFAULT_CONSOLE})"
>   echo "   -d: virtio diskdev file (default is 
> ${DEFAULT_VIRTIO_DISK})"
>   echo "   -e: set FreeBSD loader environment variable"
> + echo "   -E: Use UEFI mode"
> + echo "   -f: Use a specific UEFI firmware"
> + echo "   -F: Use a custom UEFI GOP framebuffer size (default: 
> w=1024,h=768)"
>   echo "   -g: listen for connection from kgdb at "
>   echo "   -H: host filesystem to export to the loader"
>   echo "   -i: force boot of the Installation CDROM image"
>   echo "   -I: Installation CDROM image location (default is 
> ${DEFAULT_ISOFILE})"
>   echo "   -l: the OS loader to use (default is /boot/userboot.so)"
> + echo "   -L: IP address for UEFI GOP VNC server (default: 
> 127.0.0.1)"
>   echo "   -m: memory size (default is ${DEFAULT_MEMSIZE})"
>   echo "   -p: pass-through a host PCI device at bus/slot/func (e.g. 
> 10/0/0)"
> + echo "   -P: UEFI GOP VNC port (default: 5900)"
>   echo "   -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)"
> + echo "   -T: Enable tablet device (for UEFI GOP)"
>   echo "   -u: RTC keeps UTC time"
> + echo "   -v: Wait for VNC client connection before booting VM"
>   echo "   -w: ignore unimplemented MSRs"
>   echo ""
>   [ -n "$msg" ] && errmsg "$msg"
> @@ -95,7 +104,16 @@ loader_opt=""
>  bhyverun_opt="-H -A -P"
>  pass_total=0
>  
> -while getopts ac:C:d:e:g:hH:iI:l:m:p:t:uw c ; do
> +# EFI-specific options
> +efi_mode=0
> +efi_firmware="/usr/local/share/uefi-firmware/BHYVE_UEFI.fd"

Hard coding /usr/local in the base system is not a good idea, as far
as I know this has never been acceptable as the user is allowed to
load ports to any PREFIX they prefer.

> +vncwait=""
> +vnchost="127.0.0.1"
> +vncport=5900
> +fbsize="w=1024,h=768"

These already have defaults inside the binaries, duplicating
them here only leads to maintanance issues.

> +tablet=""
> +
> +while getopts ac:C:d:e:Ef:F:g:hH:iI:l:m:p:P:t:Tuvw c ; do
>   case $c in
>   a)
>   bhyverun_opt="${bhyverun_opt} -a"
> @@ -116,6 +134,15 @@ while getopts ac:C:d:e:g:hH:iI:l:m:p:t:u
>   e)
>   loader_opt="${loader_opt} -e ${OPTARG}"
>   ;;
> + E)
> + efi_mode=1
> + ;;
> + f)
> + efi_firmware="${OPTARG}"
> + ;;
> + F)
> + fbsize

svn commit: r316755 - in head/sys/arm64: arm64 include

2017-04-13 Thread Andrew Turner
Author: andrew
Date: Thu Apr 13 11:56:27 2017
New Revision: 316755
URL: https://svnweb.freebsd.org/changeset/base/316755

Log:
  Add SCTLR bits added in ARMv8.1 and ARMv8.2 and start to use them in the
  early boot code.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Thu Apr 13 09:59:12 2017
(r316754)
+++ head/sys/arm64/arm64/locore.S   Thu Apr 13 11:56:27 2017
(r316755)
@@ -626,12 +626,13 @@ tcr:
TCR_CACHE_ATTRS | TCR_SMP_ATTRS)
 sctlr_set:
/* Bits to set */
-   .quad (SCTLR_UCI | SCTLR_nTWE | SCTLR_nTWI | SCTLR_UCT | SCTLR_DZE | \
+   .quad (SCTLR_LSMAOE | SCTLR_nTLSMD | SCTLR_UCI | SCTLR_SPAN | \
+   SCTLR_nTWE | SCTLR_nTWI | SCTLR_UCT | SCTLR_DZE | \
SCTLR_I | SCTLR_SED | SCTLR_SA0 | SCTLR_SA | SCTLR_C | SCTLR_M)
 sctlr_clear:
/* Bits to clear */
-   .quad (SCTLR_EE | SCTLR_EOE | SCTLR_WXN | SCTLR_UMA | SCTLR_ITD | \
-   SCTLR_THEE | SCTLR_CP15BEN | SCTLR_A)
+   .quad (SCTLR_EE | SCTLR_EOE | SCTLR_IESB | SCTLR_WXN | SCTLR_UMA | \
+   SCTLR_ITD | SCTLR_THEE | SCTLR_CP15BEN | SCTLR_A)
 
.globl abort
 abort:

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Thu Apr 13 09:59:12 2017
(r316754)
+++ head/sys/arm64/include/armreg.h Thu Apr 13 11:56:27 2017
(r316755)
@@ -384,8 +384,8 @@
 #definePAR_S_MASK  (0x1 << PAR_S_SHIFT)
 
 /* SCTLR_EL1 - System Control Register */
-#defineSCTLR_RES0  0xc8222400  /* Reserved, write 0 */
-#defineSCTLR_RES1  0x30d00800  /* Reserved, write 1 */
+#defineSCTLR_RES0  0xc8222400  /* Reserved ARMv8.0, write 0 */
+#defineSCTLR_RES1  0x30d00800  /* Reserved ARMv8.0, write 1 */
 
 #defineSCTLR_M 0x0001
 #defineSCTLR_A 0x0002
@@ -403,9 +403,13 @@
 #defineSCTLR_nTWI  0x0001
 #defineSCTLR_nTWE  0x0004
 #defineSCTLR_WXN   0x0008
+#defineSCTLR_IESB  0x0020
+#defineSCTLR_SPAN  0x0080
 #defineSCTLR_EOE   0x0100
 #defineSCTLR_EE0x0200
 #defineSCTLR_UCI   0x0400
+#defineSCTLR_nTLSMD0x1000
+#defineSCTLR_LSMAOE0x2000
 
 /* SPSR_EL1 */
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316756 - in head/sys/arm64: arm64 include

2017-04-13 Thread Andrew Turner
Author: andrew
Date: Thu Apr 13 13:46:01 2017
New Revision: 316756
URL: https://svnweb.freebsd.org/changeset/base/316756

Log:
  In ARMv8.1 ARM has added a process state bit to disable access to userspace
  from the kernel. Make use of this to restrict accessing userspace to just
  the functions that explicitly handle crossing the user kernel boundary.
  
  Reported by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10371

Modified:
  head/sys/arm64/arm64/copyinout.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/support.S
  head/sys/arm64/include/armreg.h
  head/sys/arm64/include/asm.h
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/copyinout.S
==
--- head/sys/arm64/arm64/copyinout.SThu Apr 13 11:56:27 2017
(r316755)
+++ head/sys/arm64/arm64/copyinout.SThu Apr 13 13:46:01 2017
(r316756)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
  */
 ENTRY(copyio_fault)
SET_FAULT_HANDLER(xzr, x1) /* Clear the handler */
+   EXIT_USER_ACCESS_CHECK(w0, x1)
 copyio_fault_nopcb:
mov x0, #EFAULT
ret
@@ -99,6 +100,7 @@ ENTRY(copyinstr)
 
adr x6, copyio_fault /* Get the handler address */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */
+   ENTER_USER_ACCESS(w6, x7)
 
ldr x7, =VM_MAXUSER_ADDRESS
 1: cmp x0, x7
@@ -111,7 +113,9 @@ ENTRY(copyinstr)
sub x2, x2, #1  /* len-- */
cbnzx2, 1b
 
-2: SET_FAULT_HANDLER(xzr, x7) /* Clear the handler */
+2: EXIT_USER_ACCESS(w6)
+   SET_FAULT_HANDLER(xzr, x7) /* Clear the handler */
+
 
 3: cbz x3, 4f  /* Check if done != NULL */
str x5, [x3]/* done = count */
@@ -145,7 +149,7 @@ END(copyinstr)
 copycommon:
adr x6, copyio_fault /* Get the handler address */
SET_FAULT_HANDLER(x6, x7) /* Set the handler */
-
+   ENTER_USER_ACCESS(w6, x7)
 
/* Check alignment */
orr x3, x0, x1
@@ -214,6 +218,7 @@ last_byte:
strbw3, [x1]
 
 ending:
+   EXIT_USER_ACCESS_CHECK(w6, x7)
SET_FAULT_HANDLER(xzr, x7) /* Clear the handler */
 
mov x0, xzr /* return 0 */

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Thu Apr 13 11:56:27 2017
(r316755)
+++ head/sys/arm64/arm64/machdep.c  Thu Apr 13 13:46:01 2017
(r316756)
@@ -118,6 +118,7 @@ int64_t dcache_line_size;   /* The minimum
 int64_t icache_line_size;  /* The minimum I cache line size */
 int64_t idcache_line_size; /* The minimum cache line size */
 int64_t dczva_line_size;   /* The size of cache line the dc zva zeroes */
+int has_pan;
 
 /* pagezero_* implementations are provided in support.S */
 void pagezero_simple(void *);
@@ -127,6 +128,37 @@ void pagezero_cache(void *);
 void (*pagezero)(void *p) = pagezero_simple;
 
 static void
+pan_setup(void)
+{
+   uint64_t id_aa64mfr1;
+
+   id_aa64mfr1 = READ_SPECIALREG(id_aa64mmfr1_el1);
+   if (ID_AA64MMFR1_PAN(id_aa64mfr1) != ID_AA64MMFR1_PAN_NONE)
+   has_pan = 1;
+}
+
+void
+pan_enable(void)
+{
+
+   /*
+* The LLVM integrated assembler doesn't understand the PAN
+* PSTATE field. Because of this we need to manually create
+* the instruction in an asm block. This is equivalent to:
+* msr pan, #1
+*
+* This sets the PAN bit, stopping the kernel from accessing
+* memory when userspace can also access it unless the kernel
+* uses the userspace load/store instructions.
+*/
+   if (has_pan) {
+   WRITE_SPECIALREG(sctlr_el1,
+   READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN);
+   __asm __volatile(".inst 0xd500409f | (0x1 << 8)");
+   }
+}
+
+static void
 cpu_startup(void *dummy)
 {
 
@@ -997,6 +1029,7 @@ initarm(struct arm64_bootparams *abp)
init_param1();
 
cache_setup();
+   pan_setup();
 
/* Bootstrap enough of pmap  to enter the kernel proper */
pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt,
@@ -1019,6 +1052,7 @@ initarm(struct arm64_bootparams *abp)
 
dbg_monitor_init();
kdb_init();
+   pan_enable();
 
early_boot = 0;
 }

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Thu Apr 13 11:56:27 2017
(r316755)
+++ head/sys/arm64/arm64/mp_machdep.c   Thu Apr 13 13:46:01 2017
(r316756)
@@ -272,6 +272,7 @@ init_secondary(uint64_t cpu)
 #endif
 
dbg_monitor_init();
+   pan_enable();
 
/* Enable interrupts */
intr_enable();

Modified: head/sys/arm64/arm64/support.S
=

svn commit: r316757 - in head/sys: arm/arm arm64/arm64

2017-04-13 Thread Alexander Kabaev
Author: kan
Date: Thu Apr 13 14:23:27 2017
New Revision: 316757
URL: https://svnweb.freebsd.org/changeset/base/316757

Log:
  Use proper fields to check for interrupt trigger mode.

Modified:
  head/sys/arm/arm/gic.c
  head/sys/arm64/arm64/gic_v3.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Thu Apr 13 13:46:01 2017(r316756)
+++ head/sys/arm/arm/gic.c  Thu Apr 13 14:23:27 2017(r316757)
@@ -987,7 +987,7 @@ arm_gic_setup_intr(device_t dev, struct 
gi->gi_trig = trig;
 
/* Edge triggered interrupts need an early EOI sent */
-   if (gi->gi_pol == INTR_TRIGGER_EDGE)
+   if (gi->gi_trig == INTR_TRIGGER_EDGE)
gi->gi_flags |= GI_FLAG_EARLY_EOI;
}
 

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Thu Apr 13 13:46:01 2017
(r316756)
+++ head/sys/arm64/arm64/gic_v3.c   Thu Apr 13 14:23:27 2017
(r316757)
@@ -437,11 +437,11 @@ arm_gic_v3_intr(void *arg)
 #endif
} else if (active_irq >= GIC_FIRST_PPI &&
active_irq <= GIC_LAST_SPI) {
-   if (gi->gi_pol == INTR_TRIGGER_EDGE)
+   if (gi->gi_trig == INTR_TRIGGER_EDGE)
gic_icc_write(EOIR1, gi->gi_irq);
 
if (intr_isrc_dispatch(&gi->gi_isrc, tf) != 0) {
-   if (gi->gi_pol != INTR_TRIGGER_EDGE)
+   if (gi->gi_trig != INTR_TRIGGER_EDGE)
gic_icc_write(EOIR1, gi->gi_irq);
gic_v3_disable_intr(sc->dev, &gi->gi_isrc);
device_printf(sc->dev,
@@ -781,7 +781,7 @@ gic_v3_post_filter(device_t dev, struct 
 {
struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc;
 
-   if (gi->gi_pol == INTR_TRIGGER_EDGE)
+   if (gi->gi_trig == INTR_TRIGGER_EDGE)
return;
 
gic_icc_write(EOIR1, gi->gi_irq);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316758 - head/sys/dev/sound/pci/hda

2017-04-13 Thread Alexander Motin
Author: mav
Date: Thu Apr 13 14:40:48 2017
New Revision: 316758
URL: https://svnweb.freebsd.org/changeset/base/316758

Log:
  Update list of Conexant and Realtek codecs.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/sound/pci/hda/hdac.h
  head/sys/dev/sound/pci/hda/hdacc.c

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Thu Apr 13 14:23:27 2017
(r316757)
+++ head/sys/dev/sound/pci/hda/hdac.h   Thu Apr 13 14:40:48 2017
(r316758)
@@ -339,7 +339,13 @@
 /* Realtek */
 #define REALTEK_VENDORID   0x10ec
 #define HDA_CODEC_ALC221   HDA_CODEC_CONSTRUCT(REALTEK, 0x0221)
+#define HDA_CODEC_ALC225   HDA_CODEC_CONSTRUCT(REALTEK, 0x0225)
+#define HDA_CODEC_ALC231   HDA_CODEC_CONSTRUCT(REALTEK, 0x0231)
 #define HDA_CODEC_ALC233   HDA_CODEC_CONSTRUCT(REALTEK, 0x0233)
+#define HDA_CODEC_ALC234   HDA_CODEC_CONSTRUCT(REALTEK, 0x0234)
+#define HDA_CODEC_ALC235   HDA_CODEC_CONSTRUCT(REALTEK, 0x0235)
+#define HDA_CODEC_ALC255   HDA_CODEC_CONSTRUCT(REALTEK, 0x0255)
+#define HDA_CODEC_ALC256   HDA_CODEC_CONSTRUCT(REALTEK, 0x0256)
 #define HDA_CODEC_ALC260   HDA_CODEC_CONSTRUCT(REALTEK, 0x0260)
 #define HDA_CODEC_ALC262   HDA_CODEC_CONSTRUCT(REALTEK, 0x0262)
 #define HDA_CODEC_ALC267   HDA_CODEC_CONSTRUCT(REALTEK, 0x0267)
@@ -348,8 +354,23 @@
 #define HDA_CODEC_ALC270   HDA_CODEC_CONSTRUCT(REALTEK, 0x0270)
 #define HDA_CODEC_ALC272   HDA_CODEC_CONSTRUCT(REALTEK, 0x0272)
 #define HDA_CODEC_ALC273   HDA_CODEC_CONSTRUCT(REALTEK, 0x0273)
+#define HDA_CODEC_ALC274   HDA_CODEC_CONSTRUCT(REALTEK, 0x0274)
 #define HDA_CODEC_ALC275   HDA_CODEC_CONSTRUCT(REALTEK, 0x0275)
 #define HDA_CODEC_ALC276   HDA_CODEC_CONSTRUCT(REALTEK, 0x0276)
+#define HDA_CODEC_ALC280   HDA_CODEC_CONSTRUCT(REALTEK, 0x0280)
+#define HDA_CODEC_ALC282   HDA_CODEC_CONSTRUCT(REALTEK, 0x0282)
+#define HDA_CODEC_ALC283   HDA_CODEC_CONSTRUCT(REALTEK, 0x0283)
+#define HDA_CODEC_ALC284   HDA_CODEC_CONSTRUCT(REALTEK, 0x0284)
+#define HDA_CODEC_ALC285   HDA_CODEC_CONSTRUCT(REALTEK, 0x0285)
+#define HDA_CODEC_ALC286   HDA_CODEC_CONSTRUCT(REALTEK, 0x0286)
+#define HDA_CODEC_ALC288   HDA_CODEC_CONSTRUCT(REALTEK, 0x0288)
+#define HDA_CODEC_ALC290   HDA_CODEC_CONSTRUCT(REALTEK, 0x0290)
+#define HDA_CODEC_ALC292   HDA_CODEC_CONSTRUCT(REALTEK, 0x0292)
+#define HDA_CODEC_ALC293   HDA_CODEC_CONSTRUCT(REALTEK, 0x0293)
+#define HDA_CODEC_ALC294   HDA_CODEC_CONSTRUCT(REALTEK, 0x0294)
+#define HDA_CODEC_ALC295   HDA_CODEC_CONSTRUCT(REALTEK, 0x0295)
+#define HDA_CODEC_ALC298   HDA_CODEC_CONSTRUCT(REALTEK, 0x0298)
+#define HDA_CODEC_ALC299   HDA_CODEC_CONSTRUCT(REALTEK, 0x0299)
 #define HDA_CODEC_ALC292   HDA_CODEC_CONSTRUCT(REALTEK, 0x0292)
 #define HDA_CODEC_ALC295   HDA_CODEC_CONSTRUCT(REALTEK, 0x0295)
 #define HDA_CODEC_ALC660   HDA_CODEC_CONSTRUCT(REALTEK, 0x0660)
@@ -357,7 +378,11 @@
 #define HDA_CODEC_ALC663   HDA_CODEC_CONSTRUCT(REALTEK, 0x0663)
 #define HDA_CODEC_ALC665   HDA_CODEC_CONSTRUCT(REALTEK, 0x0665)
 #define HDA_CODEC_ALC670   HDA_CODEC_CONSTRUCT(REALTEK, 0x0670)
+#define HDA_CODEC_ALC671   HDA_CODEC_CONSTRUCT(REALTEK, 0x0671)
 #define HDA_CODEC_ALC680   HDA_CODEC_CONSTRUCT(REALTEK, 0x0680)
+#define HDA_CODEC_ALC700   HDA_CODEC_CONSTRUCT(REALTEK, 0x0700)
+#define HDA_CODEC_ALC701   HDA_CODEC_CONSTRUCT(REALTEK, 0x0701)
+#define HDA_CODEC_ALC703   HDA_CODEC_CONSTRUCT(REALTEK, 0x0703)
 #define HDA_CODEC_ALC861   HDA_CODEC_CONSTRUCT(REALTEK, 0x0861)
 #define HDA_CODEC_ALC861VD HDA_CODEC_CONSTRUCT(REALTEK, 0x0862)
 #define HDA_CODEC_ALC880   HDA_CODEC_CONSTRUCT(REALTEK, 0x0880)
@@ -370,6 +395,7 @@
 #define HDA_CODEC_ALC892   HDA_CODEC_CONSTRUCT(REALTEK, 0x0892)
 #define HDA_CODEC_ALC899   HDA_CODEC_CONSTRUCT(REALTEK, 0x0899)
 #define HDA_CODEC_ALC1150  HDA_CODEC_CONSTRUCT(REALTEK, 0x0900)
+#define HDA_CODEC_ALC1220  HDA_CODEC_CONSTRUCT(REALTEK, 0x1220)
 #define HDA_CODEC_ALC  HDA_CODEC_CONSTRUCT(REALTEK, 0x)
 
 /* Motorola */
@@ -546,6 +572,17 @@
 #define HDA_CODEC_CX20652  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50ac)
 #define HDA_CODEC_CX20664  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b8)
 #define HDA_CODEC_CX20665  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b9)
+#define HDA_CODEC_CX21722  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f1)
+#define HDA_CODEC_CX20722  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f2)
+#define HDA_CODEC_CX21724  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f3)
+#define HDA_CODEC_CX20724  HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f4)
+#define HDA_CODEC_CX20751  HDA_CODEC_CONSTRUCT(CONEXANT, 0x510f)
+#define HDA_CODEC_CX20751_2HDA_CODEC_CONSTRUCT(CONEXANT, 0x5110)
+#define HDA_CODEC_CX20753  HDA_CODEC_CONSTRUCT(CONEXANT, 0x5111)
+#define HDA_CODEC_CX20755  HDA_CODEC_CONSTRUCT(CONEXANT, 0x5113)
+#define HDA_CODEC_CX20756  

svn commit: r316759 - in head: lib/libipsec sbin/setkey sys/netipsec

2017-04-13 Thread Andrey V. Elsukov
Author: ae
Date: Thu Apr 13 14:44:17 2017
New Revision: 316759
URL: https://svnweb.freebsd.org/changeset/base/316759

Log:
  Add large replay widow support to setkey(8) and libipsec.
  
  When the replay window size is large than UINT8_MAX, add to the request
  the SADB_X_EXT_SA_REPLAY extension header that was added in r309144.
  
  Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT,
  SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR,
  SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST
  extension headers to the key_debug that is used by `setkey -x`.
  
  Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting.
  And modify kdebug_sadb_x_policy() to show policy scope and priority.
  
  Reviewed by:  gnn, Emeric Poupon
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D10375

Modified:
  head/lib/libipsec/pfkey.c
  head/sbin/setkey/Makefile
  head/sbin/setkey/parse.y
  head/sys/netipsec/key_debug.c

Modified: head/lib/libipsec/pfkey.c
==
--- head/lib/libipsec/pfkey.c   Thu Apr 13 14:40:48 2017(r316758)
+++ head/lib/libipsec/pfkey.c   Thu Apr 13 14:44:17 2017(r316759)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -69,6 +70,7 @@ static caddr_t pfkey_setsadbmsg(caddr_t,
u_int, u_int32_t, pid_t);
 static caddr_t pfkey_setsadbsa(caddr_t, caddr_t, u_int32_t, u_int,
u_int, u_int, u_int32_t);
+static caddr_t pfkey_setsadbxreplay(caddr_t, caddr_t, uint32_t);
 static caddr_t pfkey_setsadbaddr(caddr_t, caddr_t, u_int,
struct sockaddr *, u_int, u_int);
 static caddr_t pfkey_setsadbkey(caddr_t, caddr_t, u_int, caddr_t, u_int);
@@ -1196,6 +1198,13 @@ pfkey_send_x1(so, type, satype, mode, sr
+ sizeof(struct sadb_lifetime)
+ sizeof(struct sadb_lifetime);
 
+   if (wsize > UINT8_MAX) {
+   if (wsize > (UINT32_MAX - 32) >> 3) {
+   __ipsec_errcode = EIPSEC_INVAL_ARGUMENT;
+   return (-1);
+   }
+   len += sizeof(struct sadb_x_sa_replay);
+   }
if (e_type != SADB_EALG_NONE)
len += (sizeof(struct sadb_key) + PFKEY_ALIGN8(e_keylen));
if (a_type != SADB_AALG_NONE)
@@ -1223,6 +1232,13 @@ pfkey_send_x1(so, type, satype, mode, sr
free(newmsg);
return -1;
}
+   if (wsize > UINT8_MAX) {
+   p = pfkey_setsadbxreplay(p, ep, wsize);
+   if (!p) {
+   free(newmsg);
+   return (-1);
+   }
+   }
p = pfkey_setsadbaddr(p, ep, SADB_EXT_ADDRESS_SRC, src, plen,
IPSEC_ULPROTO_ANY);
if (!p) {
@@ -1982,7 +1998,7 @@ pfkey_setsadbsa(buf, lim, spi, wsize, au
p->sadb_sa_len = PFKEY_UNIT64(len);
p->sadb_sa_exttype = SADB_EXT_SA;
p->sadb_sa_spi = spi;
-   p->sadb_sa_replay = wsize;
+   p->sadb_sa_replay = wsize > UINT8_MAX ? UINT8_MAX: wsize;
p->sadb_sa_state = SADB_SASTATE_LARVAL;
p->sadb_sa_auth = auth;
p->sadb_sa_encrypt = enc;
@@ -1992,6 +2008,31 @@ pfkey_setsadbsa(buf, lim, spi, wsize, au
 }
 
 /*
+ * Set data into sadb_x_sa_replay.
+ * `buf' must has been allocated sufficiently.
+ */
+static caddr_t
+pfkey_setsadbxreplay(caddr_t buf, caddr_t lim, uint32_t wsize)
+{
+   struct sadb_x_sa_replay *p;
+   u_int len;
+
+   p = (struct sadb_x_sa_replay *)buf;
+   len = sizeof(struct sadb_x_sa_replay);
+
+   if (buf + len > lim)
+   return (NULL);
+
+   memset(p, 0, len);
+   p->sadb_x_sa_replay_len = PFKEY_UNIT64(len);
+   p->sadb_x_sa_replay_exttype = SADB_X_EXT_SA_REPLAY;
+   /* Convert wsize from bytes to number of packets. */
+   p->sadb_x_sa_replay_replay = wsize << 3;
+
+   return (buf + len);
+}
+
+/*
  * set data into sadb_address.
  * `buf' must has been allocated sufficiently.
  * prefixlen is in bits.

Modified: head/sbin/setkey/Makefile
==
--- head/sbin/setkey/Makefile   Thu Apr 13 14:40:48 2017(r316758)
+++ head/sbin/setkey/Makefile   Thu Apr 13 14:44:17 2017(r316759)
@@ -51,6 +51,9 @@ CFLAGS+= -I${SRCTOP}/sys
 SRCS+= y.tab.h
 y.tab.h: parse.y
 CFLAGS+= -DIPSEC_DEBUG -DYY_NO_UNPUT
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DINET
+.endif
 .if ${MK_INET6_SUPPORT} != "no"
 CFLAGS+= -DINET6
 .endif

Modified: head/sbin/setkey/parse.y
==
--- head/sbin/setkey/parse.yThu Apr 13 14:40:48 2017(r316758)
+++ head/sbin/setkey/parse.yThu Apr 13 14:44:17 2017(r316759)
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -513,6 +514

svn commit: r316760 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2017-04-13 Thread Alan Somers
Author: asomers
Date: Thu Apr 13 14:51:34 2017
New Revision: 316760
URL: https://svnweb.freebsd.org/changeset/base/316760

Log:
  Fix vdev_geom_attach_by_guids for partitioned disks
  
  When opening a vdev whose path is unknown, vdev_geom must find a geom
  provider with a label whose guids match the desired vdev. However, due to
  partitioning, it is possible that two non-synonomous providers will share
  some labels. For example, if the first partition starts at the beginning of
  the drive, then ada0 and ada0p1 will share the first label. More troubling,
  if the last partition runs to the end of the drive, then ada0p3 and ada0
  will share the last label. If vdev_geom opens ada0 when it should've opened
  ada0p3, then the pool won't be readable. If it opens ada0 when it should've
  opened ada0p1, then it will corrupt some other partition when it writes the
  3rd and 4th labels.
  
  The easiest way to reproduce this problem is to install a mirrored root pool
  with the default partition layout, then swap the positions of the two boot
  drives and reboot.  Whether the bug manifests depends on the order in which
  geom lists its providers, which is arbitrary.
  
  Fix this situation by modifying the search algorithm to prefer geom
  providers that have all four labels intact. If no such provider exists, then
  open whichever provider has the most.
  
  Reviewed by:  mav
  MFC after:3 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D10365

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 
13 14:44:17 2017(r316759)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Apr 
13 14:51:34 2017(r316760)
@@ -400,12 +400,17 @@ vdev_geom_io(struct g_consumer *cp, int 
kmem_free(bios, bios_size);
 }
 
+/* 
+ * Read the vdev config from a device.  Return the number of valid labels that
+ * were found.  The vdev config will be returned in config if and only if at
+ * least one valid label was found.
+ */
 static int
 vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
 {
struct g_provider *pp;
vdev_phys_t *vdev_lists[VDEV_LABELS];
-   char *p, *buf;
+   char *buf;
size_t buflen;
uint64_t psize, state, txg;
off_t offsets[VDEV_LABELS];
@@ -413,7 +418,7 @@ vdev_geom_read_config(struct g_consumer 
off_t sizes[VDEV_LABELS];
int cmds[VDEV_LABELS];
int errors[VDEV_LABELS];
-   int l, len;
+   int l, nlabels;
 
g_topology_assert_not();
 
@@ -444,6 +449,7 @@ vdev_geom_read_config(struct g_consumer 
VDEV_LABELS);
 
/* Parse the labels */
+   nlabels = 0;
for (l = 0; l < VDEV_LABELS; l++) {
if (errors[l] != 0)
continue;
@@ -469,14 +475,14 @@ vdev_geom_read_config(struct g_consumer 
continue;
}
 
-   break;
+   nlabels++;
}
 
/* Free the label storage */
for (l = 0; l < VDEV_LABELS; l++)
kmem_free(vdev_lists[l], size);
 
-   return (*config == NULL ? ENOENT : 0);
+   return (nlabels);
 }
 
 static void
@@ -559,7 +565,7 @@ vdev_geom_read_pool_label(const char *na
struct g_consumer *zcp;
nvlist_t *vdev_cfg;
uint64_t pool_guid;
-   int error;
+   int error, nlabels;
 
DROP_GIANT();
g_topology_lock();
@@ -580,10 +586,10 @@ vdev_geom_read_pool_label(const char *na
if (zcp == NULL)
continue;
g_topology_unlock();
-   error = vdev_geom_read_config(zcp, &vdev_cfg);
+   nlabels = vdev_geom_read_config(zcp, &vdev_cfg);
g_topology_lock();
vdev_geom_detach(zcp, B_TRUE);
-   if (error)
+   if (nlabels == 0)
continue;
ZFS_LOG(1, "successfully read vdev config");
 
@@ -599,9 +605,13 @@ vdev_geom_read_pool_label(const char *na
 }
 
 enum match {
-   NO_MATCH,
-   TOP_MATCH,
-   FULL_MATCH
+   NO_MATCH = 0,   /* No matching labels found */
+   TOPGUID_MATCH = 1,  /* Labels match top guid, not vdev guid*/
+   ZERO_MATCH = 1, /* Should never be returned */
+   ONE_MATCH = 2,  /* 1 label matching the vdev_guid */
+   TWO_MATCH = 3,  /* 2 label matching the vdev_guid */
+   THREE_MATCH = 4,/* 3 label matching the vdev_guid */
+   FULL_MATC

svn commit: r316761 - head/sys/arm64/arm64

2017-04-13 Thread Andrew Turner
Author: andrew
Date: Thu Apr 13 15:03:03 2017
New Revision: 316761
URL: https://svnweb.freebsd.org/changeset/base/316761

Log:
  Set the arm64 Execute-never bits in more places.
  
  We need to set the Execute-never bits when mapping device memory as the
  hardware may perform speculative instruction fetches.
  
  Set the Privileged Execute-ever bit on userspace memory to stop the kernel
  if it is tricked into executing it.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10382

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Apr 13 14:51:34 2017(r316760)
+++ head/sys/arm64/arm64/pmap.c Thu Apr 13 15:03:03 2017(r316761)
@@ -1127,7 +1127,7 @@ static void
 pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode)
 {
pd_entry_t *pde;
-   pt_entry_t *pte;
+   pt_entry_t *pte, attr;
vm_offset_t va;
int lvl;
 
@@ -1138,6 +1138,10 @@ pmap_kenter(vm_offset_t sva, vm_size_t s
KASSERT((size & PAGE_MASK) == 0,
("pmap_kenter: Mapping is not page-sized"));
 
+   attr = ATTR_DEFAULT | ATTR_IDX(mode) | L3_PAGE;
+   if (mode == DEVICE_MEMORY)
+   attr |= ATTR_XN;
+
va = sva;
while (size != 0) {
pde = pmap_pde(kernel_pmap, va, &lvl);
@@ -1146,8 +1150,7 @@ pmap_kenter(vm_offset_t sva, vm_size_t s
KASSERT(lvl == 2, ("pmap_kenter: Invalid level %d", lvl));
 
pte = pmap_l2_to_l3(pde, va);
-   pmap_load_store(pte, (pa & ~L3_OFFSET) | ATTR_DEFAULT |
-   ATTR_IDX(mode) | L3_PAGE);
+   pmap_load_store(pte, (pa & ~L3_OFFSET) | attr);
PTE_SYNC(pte);
 
va += PAGE_SIZE;
@@ -1259,6 +1262,8 @@ pmap_qenter(vm_offset_t sva, vm_page_t *
m = ma[i];
pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) |
ATTR_IDX(m->md.pv_memattr) | L3_PAGE;
+   if (m->md.pv_memattr == DEVICE_MEMORY)
+   pa |= ATTR_XN;
pte = pmap_l2_to_l3(pde, va);
pmap_load_store(pte, pa);
PTE_SYNC(pte);
@@ -2719,12 +2724,12 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
L3_PAGE);
if ((prot & VM_PROT_WRITE) == 0)
new_l3 |= ATTR_AP(ATTR_AP_RO);
-   if ((prot & VM_PROT_EXECUTE) == 0)
+   if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY)
new_l3 |= ATTR_XN;
if ((flags & PMAP_ENTER_WIRED) != 0)
new_l3 |= ATTR_SW_WIRED;
if ((va >> 63) == 0)
-   new_l3 |= ATTR_AP(ATTR_AP_USER);
+   new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN;
 
CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa);
 
@@ -3127,8 +3132,10 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 
pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_IDX(m->md.pv_memattr) |
ATTR_AP(ATTR_AP_RO) | L3_PAGE;
-   if ((prot & VM_PROT_EXECUTE) == 0)
+   if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY)
pa |= ATTR_XN;
+   else if (va < VM_MAXUSER_ADDRESS)
+   pa |= ATTR_PXN;
 
/*
 * Now validate mapping with RO protection
@@ -4263,6 +4270,8 @@ pmap_change_attr_locked(vm_offset_t va, 
l3 = pmap_load(pte);
l3 &= ~ATTR_IDX_MASK;
l3 |= ATTR_IDX(mode);
+   if (mode == DEVICE_MEMORY)
+   l3 |= ATTR_XN;
 
pmap_update_entry(kernel_pmap, pte, l3, tmpva,
PAGE_SIZE);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316764 - head/sys/kern

2017-04-13 Thread Andrew Turner
Author: andrew
Date: Thu Apr 13 15:43:44 2017
New Revision: 316764
URL: https://svnweb.freebsd.org/changeset/base/316764

Log:
  Don't prefix zero with 0x in assym.s.
  
  The arm64 binutils only accepts 0 as an offset to the Load-Acquire Register
  instructions where llvm will acceps both 0 and 0x0. The thread switching
  code uses these with SCHED_ULE to block waiting for a lock to be released.
  As the offset of the data to be loaded is zero this is safe, however it is
  useful to keep the offset in the instruction to document what is being
  loaded.
  
  To work around this issue in binutils only generate the 0x prefix for
  non-zero values.
  
  Reported by:  kan
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/genassym.sh

Modified: head/sys/kern/genassym.sh
==
--- head/sys/kern/genassym.sh   Thu Apr 13 15:40:57 2017(r316763)
+++ head/sys/kern/genassym.sh   Thu Apr 13 15:43:44 2017(r316764)
@@ -32,12 +32,15 @@ work()
sub("^0*", "", w)
if (w == "")
w = "0"
+   hex = ""
+   if (w != "0")
+   hex = "0x"
sub("w3$", "", $3)
# This still has minor problems representing INT_MIN, etc. 
# E.g.,
# with 32-bit 2''s complement ints, this prints -0x8000,
# which has the wrong type (unsigned int).
-   printf("#define\t%s\t%s0x%s\n", $3, sign, w)
+   printf("#define\t%s\t%s%s%s\n", $3, sign, hex, w)
} '
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316766 - head/lib/libutil

2017-04-13 Thread Brooks Davis
Author: brooks
Date: Thu Apr 13 15:49:32 2017
New Revision: 316766
URL: https://svnweb.freebsd.org/changeset/base/316766

Log:
  Correct an out of bounds read with HN_AUTOSCALE and very large numbers.
  
  The maximum scale is 6 (K, M, G, T, P, E) (B is 0).
  
  Overly large explict scales were checked correctly, but for sufficently
  large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
  read.
  
  Found with humanize_number_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10376

Modified:
  head/lib/libutil/humanize_number.c

Modified: head/lib/libutil/humanize_number.c
==
--- head/lib/libutil/humanize_number.c  Thu Apr 13 15:47:58 2017
(r316765)
+++ head/lib/libutil/humanize_number.c  Thu Apr 13 15:49:32 2017
(r316766)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-static const int maxscale = 7;
+static const int maxscale = 6;
 
 int
 humanize_number(char *buf, size_t len, int64_t quotient,
@@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i
return (-1);
if (scale < 0)
return (-1);
-   else if (scale >= maxscale &&
+   else if (scale > maxscale &&
((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0))
return (-1);
if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316767 - head/sys/amd64/amd64

2017-04-13 Thread Konstantin Belousov
Author: kib
Date: Thu Apr 13 15:49:55 2017
New Revision: 316767
URL: https://svnweb.freebsd.org/changeset/base/316767

Log:
  Map DMAP as nx.
  
  Demotions preserve PG_NX, so it is enough to set nx bit for initial
  lowest-level paging entries.
  
  Suggested and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Apr 13 15:49:32 2017(r316766)
+++ head/sys/amd64/amd64/pmap.c Thu Apr 13 15:49:55 2017(r316767)
@@ -933,14 +933,14 @@ create_pagetables(vm_paddr_t *firstaddr)
pd_p[j] = (vm_paddr_t)i << PDRSHIFT;
/* Preset PG_M and PG_A because demotion expects it. */
pd_p[j] |= X86_PG_RW | X86_PG_V | PG_PS | X86_PG_G |
-   X86_PG_M | X86_PG_A;
+   X86_PG_M | X86_PG_A | pg_nx;
}
pdp_p = (pdp_entry_t *)DMPDPphys;
for (i = 0; i < ndm1g; i++) {
pdp_p[i] = (vm_paddr_t)i << PDPSHIFT;
/* Preset PG_M and PG_A because demotion expects it. */
pdp_p[i] |= X86_PG_RW | X86_PG_V | PG_PS | X86_PG_G |
-   X86_PG_M | X86_PG_A;
+   X86_PG_M | X86_PG_A | pg_nx;
}
for (j = 0; i < ndmpdp; i++, j++) {
pdp_p[i] = DMPDphys + ptoa(j);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-13 Thread Brooks Davis
Author: brooks
Date: Thu Apr 13 15:52:45 2017
New Revision: 316768
URL: https://svnweb.freebsd.org/changeset/base/316768

Log:
  Fix an out-of-bounds write when a zero-length buffer is passed.
  
  Found with ttyname_test and CHERI bounds checking.
  
  Reviewed by:  emaste
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D10377

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

Modified: head/lib/libc/gen/ttyname.c
==
--- head/lib/libc/gen/ttyname.c Thu Apr 13 15:49:55 2017(r316767)
+++ head/lib/libc/gen/ttyname.c Thu Apr 13 15:52:45 2017(r316768)
@@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len)
 {
size_t used;
 
+   /* Don't write off the end of a zero-length buffer. */
+   if (len < 1)
+   return (ERANGE);
+
*buf = '\0';
 
/* Must be a terminal. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r316766 - head/lib/libutil

2017-04-13 Thread Brooks Davis
On Thu, Apr 13, 2017 at 03:49:33PM +, Brooks Davis wrote:
> Author: brooks
> Date: Thu Apr 13 15:49:32 2017
> New Revision: 316766
> URL: https://svnweb.freebsd.org/changeset/base/316766
> 
> Log:
>   Correct an out of bounds read with HN_AUTOSCALE and very large numbers.
>   
>   The maximum scale is 6 (K, M, G, T, P, E) (B is 0).
>   
>   Overly large explict scales were checked correctly, but for sufficently
>   large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
>   read.
>   
>   Found with humanize_number_test and CHERI bounds checking.

IMO the real cause of this off-by-one error is the failure to use a
proper array of prefixes.  FreeBSD makes the case worse than the NetBSD
code we started from by adding Ki, Mi, etc so the prefixes strings are
all three characters per suffix making the code unreadable.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r316769 - head/sys/arm64/arm64

2017-04-13 Thread Andrew Turner
Author: andrew
Date: Thu Apr 13 16:57:02 2017
New Revision: 316769
URL: https://svnweb.freebsd.org/changeset/base/316769

Log:
  Rather than checking if the top bit in a virtual address is a 0 or 1
  compare against VM_MAXUSER_ADDRESS as we should have been doing.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Apr 13 15:52:45 2017(r316768)
+++ head/sys/arm64/arm64/pmap.c Thu Apr 13 16:57:02 2017(r316769)
@@ -2728,7 +2728,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
new_l3 |= ATTR_XN;
if ((flags & PMAP_ENTER_WIRED) != 0)
new_l3 |= ATTR_SW_WIRED;
-   if ((va >> 63) == 0)
+   if (va < VM_MAXUSER_ADDRESS)
new_l3 |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN;
 
CTR2(KTR_PMAP, "pmap_enter: %.16lx -> %.16lx", va, pa);

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Thu Apr 13 15:52:45 2017(r316768)
+++ head/sys/arm64/arm64/trap.c Thu Apr 13 16:57:02 2017(r316769)
@@ -184,7 +184,7 @@ data_abort(struct trapframe *frame, uint
map = &p->p_vmspace->vm_map;
else {
/* The top bit tells us which range to use */
-   if ((far >> 63) == 1) {
+   if (far >= VM_MAXUSER_ADDRESS) {
map = kernel_map;
} else {
map = &p->p_vmspace->vm_map;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316770 - in head/sys: netinet netinet6

2017-04-13 Thread Andrey V. Elsukov
Author: ae
Date: Thu Apr 13 17:03:57 2017
New Revision: 316770
URL: https://svnweb.freebsd.org/changeset/base/316770

Log:
  Clear h/w csum flags on mbuf handled by UDP.
  
  When checksums of received IP and UDP header already checked, UDP uses
  sbappendaddr_locked() to pass received data to the socket.
  sbappendaddr_locked() uses given mbuf as is, and if NIC supports checksum
  offloading, mbuf contains csum_data and csum_flags that were calculated
  for already stripped headers. Some NICs support only limited checksums
  offloading and do not use CSUM_PSEUDO_HDR flag, and csum_data contains
  some value that UDP/TCP should use for pseudo header checksum calculation.
  
  When L2TP is used for tunneling with mpd5, ng_ksocket receives mbuf with
  filled csum_flags and csum_data, that were calculated for outer headers.
  When L2TP header is stripped, a packet that was tunneled goes to the IP
  layer and due to presence of csum_flags (without CSUM_PSEUDO_HDR) and
  csum_data, the UDP/TCP checksum check fails for this packet.
  
  Reported by:  Irina Liakh 
  Tested by:Irina Liakh 
  MFC after:1 week

Modified:
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Thu Apr 13 16:57:02 2017
(r316769)
+++ head/sys/netinet/udp_usrreq.c   Thu Apr 13 17:03:57 2017
(r316770)
@@ -372,6 +372,9 @@ udp_append(struct inpcb *inp, struct ip 
append_sa = (struct sockaddr *)&udp_in[0];
m_adj(n, off);
 
+   /* Clear any h/w csum flags as they are no longer valid. */
+   n->m_pkthdr.csum_flags &= ~(CSUM_DATA_VALID | CSUM_IP_VALID);
+
so = inp->inp_socket;
SOCKBUF_LOCK(&so->so_rcv);
if (sbappendaddr_locked(&so->so_rcv, append_sa, n, opts) == 0) {

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Thu Apr 13 16:57:02 2017
(r316769)
+++ head/sys/netinet6/udp6_usrreq.c Thu Apr 13 17:03:57 2017
(r316770)
@@ -187,6 +187,9 @@ udp6_append(struct inpcb *inp, struct mb
}
m_adj(n, off + sizeof(struct udphdr));
 
+   /* Clear any h/w csum flags as they are no longer valid. */
+   n->m_pkthdr.csum_flags &= ~CSUM_DATA_VALID;
+
so = inp->inp_socket;
SOCKBUF_LOCK(&so->so_rcv);
if (sbappendaddr_locked(&so->so_rcv, (struct sockaddr *)&fromsa[0], n,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316771 - head/sys/boot/common

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Thu Apr 13 17:11:49 2017
New Revision: 316771
URL: https://svnweb.freebsd.org/changeset/base/316771

Log:
  loader: Avoid possible overflow via environment variable
  
  Reported by:  Coverity (CWE-120)
  CID:  1006704
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/boot/common/commands.c

Modified: head/sys/boot/common/commands.c
==
--- head/sys/boot/common/commands.c Thu Apr 13 17:03:57 2017
(r316770)
+++ head/sys/boot/common/commands.c Thu Apr 13 17:11:49 2017
(r316771)
@@ -132,7 +132,7 @@ command_help(int argc, char *argv[]) 
 char   *topic, *subtopic, *t, *s, *d;
 
 /* page the help text from our load path */
-sprintf(buf, "%s/boot/loader.help", getenv("loaddev"));
+snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev"));
 if ((hfd = open(buf, O_RDONLY)) < 0) {
printf("Verbose help not available, use '?' to list commands\n");
return(CMD_OK);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316774 - in head/sys/dev/cxgbe: . common

2017-04-13 Thread Navdeep Parhar
Author: np
Date: Thu Apr 13 17:16:36 2017
New Revision: 316774
URL: https://svnweb.freebsd.org/changeset/base/316774

Log:
  cxgbe: Query some more RDMA related parameters from the firmware.
  
  MFC after:3 days
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/offload.h
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Thu Apr 13 17:13:08 2017
(r316773)
+++ head/sys/dev/cxgbe/common/common.h  Thu Apr 13 17:16:36 2017
(r316774)
@@ -366,6 +366,9 @@ struct adapter_params {
 
unsigned int ofldq_wr_cred;
unsigned int eo_wr_cred;
+
+   unsigned int max_ordird_qp;
+   unsigned int max_ird_adapter;
 };
 
 #define CHELSIO_T4 0x4

Modified: head/sys/dev/cxgbe/offload.h
==
--- head/sys/dev/cxgbe/offload.hThu Apr 13 17:13:08 2017
(r316773)
+++ head/sys/dev/cxgbe/offload.hThu Apr 13 17:16:36 2017
(r316774)
@@ -121,6 +121,7 @@ struct t4_virt_res {
struct t4_range pbl;
struct t4_range qp;
struct t4_range cq;
+   struct t4_range srq;
struct t4_range ocq;
struct t4_range l2t;
 };

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cThu Apr 13 17:13:08 2017
(r316773)
+++ head/sys/dev/cxgbe/t4_main.cThu Apr 13 17:16:36 2017
(r316774)
@@ -3494,6 +3494,21 @@ get_params__post_init(struct adapter *sc
sc->vres.cq.size = val[3] - val[2] + 1;
sc->vres.ocq.start = val[4];
sc->vres.ocq.size = val[5] - val[4] + 1;
+
+   param[0] = FW_PARAM_PFVF(SRQ_START);
+   param[1] = FW_PARAM_PFVF(SRQ_END);
+   param[2] = FW_PARAM_DEV(MAXORDIRD_QP);
+   param[3] = FW_PARAM_DEV(MAXIRD_ADAPTER);
+   rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 4, param, val);
+   if (rc != 0) {
+   device_printf(sc->dev,
+   "failed to query RDMA parameters(3): %d.\n", rc);
+   return (rc);
+   }
+   sc->vres.srq.start = val[0];
+   sc->vres.srq.size = val[1] - val[0] + 1;
+   sc->params.max_ordird_qp = val[2];
+   sc->params.max_ird_adapter = val[3];
}
if (sc->iscsicaps) {
param[0] = FW_PARAM_PFVF(ISCSI_START);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316776 - head/sys/compat/linux

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Thu Apr 13 17:34:51 2017
New Revision: 316776
URL: https://svnweb.freebsd.org/changeset/base/316776

Log:
  linux_ioctl: Refactor some v4l2 struct converters
  
  According to the C standard, it is invalid to copy beyond the end of an
  object, even if that object is obviously a member of a larger object (a
  struct, in this case).
  
  Appease the standard and Coverity by refactoring the copy in a
  straightforward way.  No functional change.
  
  Reported by:  Coverity (CWE-120)
  CIDs: 1007819, 1007820, 1007821, 1007822, 1009668, 1009669
  Security: no (false positive detection)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Thu Apr 13 17:30:33 2017
(r316775)
+++ head/sys/compat/linux/linux_ioctl.c Thu Apr 13 17:34:51 2017
(r316776)
@@ -3185,7 +3185,12 @@ linux_to_bsd_v4l2_standard(struct l_v4l2
 {
vstd->index = lvstd->index;
vstd->id = lvstd->id;
-   memcpy(&vstd->name, &lvstd->name, sizeof(*lvstd) - offsetof(struct 
l_v4l2_standard, name));
+   CTASSERT(sizeof(vstd->name) == sizeof(lvstd->name));
+   memcpy(vstd->name, lvstd->name, sizeof(vstd->name));
+   vstd->frameperiod = lvstd->frameperiod;
+   vstd->framelines = lvstd->framelines;
+   CTASSERT(sizeof(vstd->reserved) == sizeof(lvstd->reserved));
+   memcpy(vstd->reserved, lvstd->reserved, sizeof(vstd->reserved));
return (0);
 }
 
@@ -3194,7 +3199,12 @@ bsd_to_linux_v4l2_standard(struct v4l2_s
 {
lvstd->index = vstd->index;
lvstd->id = vstd->id;
-   memcpy(&lvstd->name, &vstd->name, sizeof(*lvstd) - offsetof(struct 
l_v4l2_standard, name));
+   CTASSERT(sizeof(vstd->name) == sizeof(lvstd->name));
+   memcpy(lvstd->name, vstd->name, sizeof(lvstd->name));
+   lvstd->frameperiod = vstd->frameperiod;
+   lvstd->framelines = vstd->framelines;
+   CTASSERT(sizeof(vstd->reserved) == sizeof(lvstd->reserved));
+   memcpy(lvstd->reserved, vstd->reserved, sizeof(lvstd->reserved));
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316777 - head/sys/netpfil/ipfw

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Thu Apr 13 17:47:44 2017
New Revision: 316777
URL: https://svnweb.freebsd.org/changeset/base/316777

Log:
  dummynet: Use strlcpy to appease static checkers
  
  Some dummynet modules used strcpy() to copy from a larger buffer
  (dn_aqm->name) to a smaller buffer (dn_extra_parms->name).  It happens that
  the lengths of the strings in the dn_aqm buffers were always hardcoded to be
  smaller than the dn_extra_parms buffer ("CODEL", "PIE").
  
  Use strlcpy() instead, to appease static checkers.  No functional change.
  
  Reported by:  Coverity
  CIDs: 1356163, 1356165
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/netpfil/ipfw/dn_aqm_codel.c
  head/sys/netpfil/ipfw/dn_aqm_pie.c

Modified: head/sys/netpfil/ipfw/dn_aqm_codel.c
==
--- head/sys/netpfil/ipfw/dn_aqm_codel.cThu Apr 13 17:34:51 2017
(r316776)
+++ head/sys/netpfil/ipfw/dn_aqm_codel.cThu Apr 13 17:47:44 2017
(r316777)
@@ -416,7 +416,7 @@ aqm_codel_getconfig(struct dn_fsk *fs, s
struct dn_aqm_codel_parms *ccfg;
 
if (fs->aqmcfg) {
-   strcpy(ep->name, codel_desc.name);
+   strlcpy(ep->name, codel_desc.name, sizeof(ep->name));
ccfg = fs->aqmcfg;
ep->par[0] = ccfg->target / AQM_TIME_1US;
ep->par[1] = ccfg->interval / AQM_TIME_1US;

Modified: head/sys/netpfil/ipfw/dn_aqm_pie.c
==
--- head/sys/netpfil/ipfw/dn_aqm_pie.c  Thu Apr 13 17:34:51 2017
(r316776)
+++ head/sys/netpfil/ipfw/dn_aqm_pie.c  Thu Apr 13 17:47:44 2017
(r316777)
@@ -755,7 +755,7 @@ aqm_pie_getconfig (struct dn_fsk *fs, st
 {
struct dn_aqm_pie_parms *pcfg;
if (fs->aqmcfg) {
-   strcpy(ep->name, pie_desc.name);
+   strlcpy(ep->name, pie_desc.name, sizeof(ep->name));
pcfg = fs->aqmcfg;
ep->par[0] = pcfg->qdelay_ref / AQM_TIME_1US;
ep->par[1] = pcfg->tupdate / AQM_TIME_1US;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316778 - head/sys/netpfil/ipfw

2017-04-13 Thread Maxim Konovalov
Author: maxim
Date: Thu Apr 13 18:13:10 2017
New Revision: 316778
URL: https://svnweb.freebsd.org/changeset/base/316778

Log:
  o Redundant assignments removed.
  
  Found by: PVS-Stdio, V519
  Reviewed by:  ae

Modified:
  head/sys/netpfil/ipfw/ip_fw_dynamic.c
  head/sys/netpfil/ipfw/ip_fw_table_algo.c

Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c
==
--- head/sys/netpfil/ipfw/ip_fw_dynamic.c   Thu Apr 13 17:47:44 2017
(r316777)
+++ head/sys/netpfil/ipfw/ip_fw_dynamic.c   Thu Apr 13 18:13:10 2017
(r316778)
@@ -978,7 +978,6 @@ ipfw_install_state(struct ip_fw_chain *c
 
if (parent->count >= conn_limit) {
if (V_fw_verbose && last_log != time_uptime) {
-   last_log = time_uptime;
char sbuf[24];
last_log = time_uptime;
snprintf(sbuf, sizeof(sbuf),

Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c
==
--- head/sys/netpfil/ipfw/ip_fw_table_algo.cThu Apr 13 17:47:44 2017
(r316777)
+++ head/sys/netpfil/ipfw/ip_fw_table_algo.cThu Apr 13 18:13:10 2017
(r316778)
@@ -2319,7 +2319,6 @@ ta_del_ifidx(void *ta_state, struct tabl
tb = (struct ta_buf_ifidx *)ta_buf;
ifname = (char *)tei->paddr;
icfg = (struct iftable_cfg *)ta_state;
-   ife = tb->ife;
 
ife = (struct ifentry *)ipfw_objhash_lookup_name(icfg->ii, 0, ifname);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316780 - head

2017-04-13 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 13 19:27:46 2017
New Revision: 316780
URL: https://svnweb.freebsd.org/changeset/base/316780

Log:
  Pass COMPILER_FEATURES down to submakes for installworld.
  
  This is for WITH_SYSTEM_COMPILER, WITHOUT_CROSS_COMPILER, external
  compiler, etc.
  
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 13 18:28:40 2017(r316779)
+++ head/Makefile.inc1  Thu Apr 13 19:27:46 2017(r316780)
@@ -135,7 +135,8 @@ TEST_SYSTEM_COMPILER_VARS= \
MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \
WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \
WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \
-   CC COMPILER_TYPE COMPILER_VERSION COMPILER_FREEBSD_VERSION
+   CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \
+   COMPILER_FREEBSD_VERSION
 test-system-compiler: .PHONY
 .for v in ${TEST_SYSTEM_COMPILER_VARS}
${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}"
@@ -153,9 +154,11 @@ test-system-compiler: .PHONY
 .if !defined(X_COMPILER_TYPE)
 CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \
COMPILER_TYPE=${COMPILER_TYPE} \
+   COMPILER_FEATURES=${COMPILER_FEATURES} \
COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION}
 .else
 CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \
+   COMPILER_FEATURES=${X_COMPILER_FEATURES} \
COMPILER_TYPE=${X_COMPILER_TYPE} \
COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION}
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-13 Thread Rick Macklem
Author: rmacklem
Date: Thu Apr 13 20:16:29 2017
New Revision: 316782
URL: https://svnweb.freebsd.org/changeset/base/316782

Log:
  Add call to svcpool_close() for the NFSv4 callback pool (svcpool_nfscbd).
  
  A function called svcpool_close() was added to the server side krpc by
  r313735, so that a pool could be closed without destroying the data 
structures.
  This little patch adds a call to it for the callback pool (svcpool_nfscbd),
  so that the nfscbd daemon can be killed/restarted and continue to work
  correctly.
  
  MFC after:2 weeks

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

Modified: head/sys/fs/nfsclient/nfs_clkrpc.c
==
--- head/sys/fs/nfsclient/nfs_clkrpc.c  Thu Apr 13 19:48:45 2017
(r316781)
+++ head/sys/fs/nfsclient/nfs_clkrpc.c  Thu Apr 13 20:16:29 2017
(r316782)
@@ -278,6 +278,11 @@ nfsrvd_cbinit(int terminating)
while (nfs_numnfscbd > 0)
msleep(&nfs_numnfscbd, NFSDLOCKMUTEXPTR, PZERO, 
"nfscbdt", 0);
+   if (nfscbd_pool != NULL) {
+   NFSD_UNLOCK();
+   svcpool_close(nfscbd_pool);
+   NFSD_LOCK();
+   }
}
 
if (nfscbd_pool == NULL) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316792 - in head/sys: fs/nfs fs/nfsclient nfsclient

2017-04-13 Thread Rick Macklem
Author: rmacklem
Date: Thu Apr 13 21:54:19 2017
New Revision: 316792
URL: https://svnweb.freebsd.org/changeset/base/316792

Log:
  Add an NFSv4.1 mount option for "use one openowner".
  
  Some NFSv4.1 servers such as AmazonEFS can only support a small fixed number
  of open_owner4s. This patch adds a mount option called "oneopenown" that
  can be used for NFSv4.1 mounts to make the client do all Opens with the
  same open_owner4 string. This option can only be used with NFSv4.1 and
  may not work correctly when Delegations are is use.
  
  Reported by:  cperciva
  Tested by:cperciva
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D8988

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/nfsclient/nfsargs.h

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Thu Apr 13 20:36:40 2017(r316791)
+++ head/sys/fs/nfs/nfs_var.h   Thu Apr 13 21:54:19 2017(r316792)
@@ -502,8 +502,8 @@ int nfscl_open(vnode_t, u_int8_t *, int,
 int *, int *, int);
 int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *,
 NFSPROC_T *, nfsv4stateid_t *, void **);
-void nfscl_ownerrelease(struct nfsclowner *, int, int, int);
-void nfscl_openrelease(struct nfsclopen *, int, int);
+void nfscl_ownerrelease(struct nfsmount *, struct nfsclowner *, int, int, int);
+void nfscl_openrelease(struct nfsmount *, struct nfsclopen *, int, int);
 int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, int,
 struct nfsclclient **);
 struct nfsclclient *nfscl_findcl(struct nfsmount *);

Modified: head/sys/fs/nfs/nfsport.h
==
--- head/sys/fs/nfs/nfsport.h   Thu Apr 13 20:36:40 2017(r316791)
+++ head/sys/fs/nfs/nfsport.h   Thu Apr 13 21:54:19 2017(r316792)
@@ -929,6 +929,8 @@ int newnfs_realign(struct mbuf **, int);
 #defineNFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT)
 #defineNFSHASSESSPERSIST(n)((n)->nm_state & NFSSTA_SESSPERSIST)
 #defineNFSHASPNFS(n)   ((n)->nm_state & NFSSTA_PNFS)
+#defineNFSHASONEOPENOWN(n) (((n)->nm_flag & NFSMNT_ONEOPENOWN) != 
0 && \
+   (n)->nm_minorvers > 0)
 
 /*
  * Gets the stats field out of the mount structure.

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Thu Apr 13 20:36:40 2017
(r316791)
+++ head/sys/fs/nfsclient/nfs_clport.c  Thu Apr 13 21:54:19 2017
(r316792)
@@ -634,7 +634,7 @@ nfscl_filllockowner(void *id, u_int8_t *
struct proc *p;
 
if (id == NULL) {
-   printf("NULL id\n");
+   /* Return the single open_owner of all 0 bytes. */
bzero(cp, NFSV4CL_LOCKNAMELEN);
return;
}
@@ -1255,7 +1255,14 @@ nfscl_procdoesntexist(u_int8_t *own)
} tl;
struct proc *p;
pid_t pid;
-   int ret = 0;
+   int i, ret = 0;
+
+   /* For the single open_owner of all 0 bytes, just return 0. */
+   for (i = 0; i < NFSV4CL_LOCKNAMELEN; i++)
+   if (own[i] != 0)
+   break;
+   if (i == NFSV4CL_LOCKNAMELEN)
+   return (0);
 
tl.cval[0] = *own++;
tl.cval[1] = *own++;

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cThu Apr 13 20:36:40 2017
(r316791)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cThu Apr 13 21:54:19 2017
(r316792)
@@ -347,7 +347,7 @@ else printf(" fhl=0\n");
 */
if (!error)
op->nfso_opencnt++;
-   nfscl_openrelease(op, error, newone);
+   nfscl_openrelease(nmp, op, error, newone);
if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID ||
error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
error == NFSERR_BADSESSION) {
@@ -1893,7 +1893,7 @@ nfsrpc_create(vnode_t dvp, char *name, i
if (dp != NULL)
(void) nfscl_deleg(nmp->nm_mountp, owp->nfsow_clp,
(*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, &dp);
-   nfscl_ownerrelease(owp, error, newone, unlocked);
+   nfscl_ownerrelease(nmp, owp, error, newone, unlocked);
if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID ||
error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
error == NFSERR_BADSESSION) {
@@ -2198,7 

svn commit: r316793 - head/sbin/mount_nfs

2017-04-13 Thread Rick Macklem
Author: rmacklem
Date: Thu Apr 13 22:05:24 2017
New Revision: 316793
URL: https://svnweb.freebsd.org/changeset/base/316793

Log:
  Document the "oneopenown" option added by r316792.
  
  This is a content change.
  
  MFC after:2 weeks

Modified:
  head/sbin/mount_nfs/mount_nfs.8

Modified: head/sbin/mount_nfs/mount_nfs.8
==
--- head/sbin/mount_nfs/mount_nfs.8 Thu Apr 13 21:54:19 2017
(r316792)
+++ head/sbin/mount_nfs/mount_nfs.8 Thu Apr 13 22:05:24 2017
(r316793)
@@ -28,7 +28,7 @@
 .\"@(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd September 10, 2016
+.Dd April 13, 2017
 .Dt MOUNT_NFS 8
 .Os
 .Sh NAME
@@ -201,6 +201,14 @@ The only minor version currently support
 This option is only meaningful when used with the
 .Cm nfsv4
 option.
+.It Cm oneopenown
+Make a minor version 1 of the NFS Version 4 protocol mount use a single 
OpenOwner
+for all Opens.
+This may be useful for a server with a very low limit on OpenOwners, such as
+AmazonEFS.
+It can only be used with an NFSv4.1 mount.
+It may not work correctly when Delegations are being issued by a server,
+but note that the AmazonEFS server does not issued delegations at this time.
 .It Cm pnfs
 Enable support for parallel NFS (pNFS) for minor version 1 of the
 NFS Version 4 protocol.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316794 - head

2017-04-13 Thread Bryan Drewery
Author: bdrewery
Date: Thu Apr 13 22:07:34 2017
New Revision: 316794
URL: https://svnweb.freebsd.org/changeset/base/316794

Log:
  Cache compiler metadata and reuse it at installworld time.
  
  Right after cross-tools, a compiler-metadata.mk file is created that
  stores all of the bsd.compiler.mk metadata.  It is then read in
  with a fail-safe during installworld time.
  
  The file is explicitly removed when invoking cross-tools to ensure that
  a stale file is not left around from odd manual 'make _cross-tools' ->
  'make installworld' invocations.
  
  This fixes several issues:
  - With WITH_SYSTEM_COMPILER (default yes on head and no on releng/11.0):
If you build on a system where the bootstrap compiler does not
build due to the host compiler matching the in-tree one, but then
installworld on another system where that logic fails (a
bootstrap compiler is needed), the installworld immediately fails
with:
 sh: cc: not found
Note that fixing this logic may then hit a case where a rebuild is
attempted in installworld.  Normally cc would be ran with
'CFLAGS+=ERROR-tried-to-rebuild-during-make-install' to cause an
error such as:
cc: error: no such file or directory: 
'ERROR-tried-to-rebuild-during-make-install'
However, now it will just fail with the 'cc: not found' error.
Inspection of the compile line will show
'ERROR-tried-to-rebuild-during-make-install';  It's not useful to
set CC to anything other than 'cc' during install as it is more
helpful to see the attempted compile rather than some other bogus
error.
  - This now avoids running bsd.compiler.mk (cc executions) even more
during installworld.  There are compiler-dependent SUBDIR in the
tree which required having a compiler during install.
  
  There is at least 1 case where CC is still executed in the install,
  such as from a LOOKUP!= in secure/lib/libcrypto/Makefile.inc checking
  for 'vzeroall' support.  This is not significant for installworld
  as the lookup has a fallback (and hides its error) and only modifies CFLAGS,
  thus it's not worth fixing.
  
  PR:   212877
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/Makefile
  head/Makefile.inc1

Modified: head/Makefile
==
--- head/Makefile   Thu Apr 13 22:05:24 2017(r316793)
+++ head/Makefile   Thu Apr 13 22:07:34 2017(r316794)
@@ -127,7 +127,7 @@ TGTS=   all all-man buildenv buildenvvars 
installworld kernel-toolchain libraries lint maninstall \
obj objlink rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
-   _build-tools _cross-tools _includes _libraries \
+   _build-tools _compiler-metadata _cross-tools _includes _libraries \
build32 distribute32 install32 buildsoft distributesoft installsoft \
builddtb xdev xdev-build xdev-install \
xdev-links native-xtools stageworld stagekernel stage-packages \

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Apr 13 22:05:24 2017(r316793)
+++ head/Makefile.inc1  Thu Apr 13 22:07:34 2017(r316794)
@@ -78,6 +78,19 @@ MK_CLANG_BOOTSTRAP=  no
 MK_GCC_BOOTSTRAP=  no
 .endif
 
+MAKEOBJDIRPREFIX?= /usr/obj
+.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && 
!defined(CROSS_BUILD_TESTING)
+OBJTREE=   ${MAKEOBJDIRPREFIX}
+.else
+OBJTREE=   ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
+.endif
+
+# Pull in compiler metadata from buildworld/toolchain if possible to avoid
+# running CC from bsd.compiler.mk.
+.if make(installworld) || make(install)
+.-include "${OBJTREE}${.CURDIR}/compiler-metadata.mk"
+.endif
+
 # Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early.
 .include 
 .include "share/mk/src.opts.mk"
@@ -163,6 +176,20 @@ CROSSENV+= COMPILER_VERSION=${X_COMPILER
COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION}
 .endif
 .endif
+# Store some compiler metadata for use in installworld where we don't
+# want to invoke CC at all.
+_COMPILER_METADATA_VARS=   COMPILER_VERSION \
+   COMPILER_TYPE \
+   COMPILER_FEATURES \
+   COMPILER_FREEBSD_VERSION
+compiler-metadata.mk: .PHONY .META
+   @: > ${.TARGET}
+   @echo ".info Using cached compiler metadata from build at $$(hostname) 
on $$(date)" \
+   > ${.TARGET}
+.for v in ${_COMPILER_METADATA_VARS}
+   @echo "${v}=${${v}}" >> ${.TARGET}
+.endfor
+   @echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET}
 
 # Handle external binutils.
 .if defined(CROSS_TOOLCHAIN_PREFIX)
@@ -304,7 +331,6 @@ SVN=   ${_P}/${_S}
 .endif
 SVNFLAGS?= -r HEAD
 

svn commit: r316795 - in head/usr.sbin/ctm: ctm_dequeue ctm_smail

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Thu Apr 13 22:59:17 2017
New Revision: 316795
URL: https://svnweb.freebsd.org/changeset/base/316795

Log:
  ctm: Fix some trivial argv buffer overruns
  
  It may not do the right thing with these obviously wrong inputs, but at
  least it won't smash the stack.
  
  Reported by:  Coverity (CWE-120)
  CIDs: 1006697, 1006698
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c
  head/usr.sbin/ctm/ctm_smail/ctm_smail.c

Modified: head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c
==
--- head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Thu Apr 13 22:07:34 2017
(r316794)
+++ head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Thu Apr 13 22:59:17 2017
(r316795)
@@ -115,7 +115,8 @@ main(int argc, char **argv)
if (ftsent->fts_info != FTS_F || ftsent->fts_name[0] == '.')
continue;
 
-   sprintf(filename, "%s/%s", queue_dir, ftsent->fts_name);
+   snprintf(filename, sizeof(filename), "%s/%s", queue_dir,
+   ftsent->fts_name);
fd = open(filename, O_RDONLY);
if (fd < 0)
{

Modified: head/usr.sbin/ctm/ctm_smail/ctm_smail.c
==
--- head/usr.sbin/ctm/ctm_smail/ctm_smail.c Thu Apr 13 22:07:34 2017
(r316794)
+++ head/usr.sbin/ctm/ctm_smail/ctm_smail.c Thu Apr 13 22:59:17 2017
(r316795)
@@ -190,13 +190,13 @@ chop_and_send(FILE *dfp, char *delta, lo
  * Construct the tmp queue file name of a delta piece.
  */
 #define mk_tmp_name(fn,qd,p) \
-sprintf((fn), "%s/.%08ld.%03d", (qd), (long)getpid(), (p))
+snprintf((fn), sizeof(fn), "%s/.%08ld.%03d", (qd), (long)getpid(), (p))
 
 /*
  * Construct the final queue file name of a delta piece.
  */
 #define mk_queue_name(fn,qd,d,p,n) \
-sprintf((fn), "%s/%s+%03d-%03d", (qd), (d), (p), (n))
+snprintf((fn), sizeof(fn), "%s/%s+%03d-%03d", (qd), (d), (p), (n))
 
 /*
  * Carve our CTM delta into pieces, encode them, and queue them.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-04-13 Thread Jung-uk Kim
Author: jkim
Date: Thu Apr 13 23:00:26 2017
New Revision: 316796
URL: https://svnweb.freebsd.org/changeset/base/316796

Log:
  Attempt to clear logos more thoroughly.
  
  PR:   202288
  Reviewed by:  cem

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

Modified: head/sys/dev/vt/vt_cpulogos.c
==
--- head/sys/dev/vt/vt_cpulogos.c   Thu Apr 13 22:59:17 2017
(r316795)
+++ head/sys/dev/vt/vt_cpulogos.c   Thu Apr 13 23:00:26 2017
(r316796)
@@ -153,6 +153,7 @@ vt_fini_logos(void *dummy __unused)
struct winsize wsz;
term_pos_t size;
unsigned int i;
+   int row;
 
if (!vt_draw_logo_cpus)
return;
@@ -170,7 +171,7 @@ vt_fini_logos(void *dummy __unused)
vt_draw_logo_cpus = 0;
VT_UNLOCK(vd);
 
-   for (i = 0; i < VT_MAXWINDOWS; i++) {
+   for (i = row = 0; i < VT_MAXWINDOWS; i++) {
vw = vd->vd_windows[i];
if (vw == NULL)
continue;
@@ -193,11 +194,16 @@ vt_fini_logos(void *dummy __unused)
vt_compute_drawable_area(vw);
 
if (vd->vd_curwindow == vw) {
+   row = vw->vw_draw_area.tr_begin.tp_row;
vd->vd_flags |= VDF_INVALID;
vt_resume_flush_timer(vd, 0);
}
VT_UNLOCK(vd);
}
+
+   if (row > 0 && vd->vd_driver->vd_drawrect != NULL)
+   vd->vd_driver->vd_drawrect(vd, 0, 0, vd->vd_width, row - 1,
+   1, TC_BLACK);
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316797 - head/usr.bin/banner

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Thu Apr 13 23:22:18 2017
New Revision: 316797
URL: https://svnweb.freebsd.org/changeset/base/316797

Log:
  banner(6): Squash a harmless coverity warning
  
  The destination buffer is sized as the sum of program argument lengths, so
  it has plenty of room for *argv.  Appease Coverity by using strlcpy instead
  of strcpy.  Similar to a nearby cleanup performed in r316500.
  
  No functional change.
  
  Reported by:  Coverity (CWE-120)
  CID:  1006703
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/banner/banner.c

Modified: head/usr.bin/banner/banner.c
==
--- head/usr.bin/banner/banner.cThu Apr 13 23:00:26 2017
(r316796)
+++ head/usr.bin/banner/banner.cThu Apr 13 23:22:18 2017
(r316797)
@@ -1062,7 +1062,7 @@ main(int argc, char *argv[])
j += strlen(argv[i]) + 1;
if ((message = malloc((size_t)j)) == NULL) 
err(1, "malloc");
-   strcpy(message, *argv);
+   strlcpy(message, *argv, j);
while (*++argv) {
strlcat(message, " ", j);
strlcat(message, *argv, j);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316799 - head/sbin/restore

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Fri Apr 14 00:14:40 2017
New Revision: 316799
URL: https://svnweb.freebsd.org/changeset/base/316799

Log:
  restore(8): Prevent some heap overflows
  
  The environment variable TMPDIR was copied unchecked into a fixed-size heap
  buffer.  Use a length-limiting snprintf in place of ordinary sprintf to
  prevent the overflow.  Long TMPDIR variables can still cause odd truncated
  filenames, which may be undesirable.
  
  Reported by:  Coverity (CWE-120)
  CIDs: 1006706, 1006707
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/restore/dirs.c

Modified: head/sbin/restore/dirs.c
==
--- head/sbin/restore/dirs.cFri Apr 14 00:13:33 2017(r316798)
+++ head/sbin/restore/dirs.cFri Apr 14 00:14:40 2017(r316799)
@@ -140,7 +140,8 @@ extractdirs(int genmode)
vprintf(stdout, "Extract directories from tape\n");
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
-   (void) sprintf(dirfile, "%s/rstdir%jd", tmpdir, (intmax_t)dumpdate);
+   (void) snprintf(dirfile, sizeof(dirfile), "%s/rstdir%jd", tmpdir,
+   (intmax_t)dumpdate);
if (command != 'r' && command != 'R') {
(void) strcat(dirfile, "-XX");
fd = mkstemp(dirfile);
@@ -153,8 +154,8 @@ extractdirs(int genmode)
done(1);
}
if (genmode != 0) {
-   (void) sprintf(modefile, "%s/rstmode%jd", tmpdir,
-   (intmax_t)dumpdate);
+   (void) snprintf(modefile, sizeof(modefile), "%s/rstmode%jd",
+   tmpdir, (intmax_t)dumpdate);
if (command != 'r' && command != 'R') {
(void) strcat(modefile, "-XX");
fd = mkstemp(modefile);
@@ -568,8 +569,8 @@ setdirmodes(int flags)
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
tmpdir = _PATH_TMP;
if (command == 'r' || command == 'R')
-   (void) sprintf(modefile, "%s/rstmode%jd", tmpdir,
-   (intmax_t)dumpdate);
+   (void) snprintf(modefile, sizeof(modefile), "%s/rstmode%jd",
+   tmpdir, (intmax_t)dumpdate);
if (modefile[0] == '#') {
panic("modefile not defined\n");
fprintf(stderr, "directory mode, owner, and times not set\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r316435 - in head: sbin/ipfw sys/conf sys/modules sys/modules/ipfw_pmod sys/netpfil/ipfw/pmod

2017-04-13 Thread Gleb Smirnoff
On Mon, Apr 03, 2017 at 10:12:11PM +0800, Julian Elischer wrote:
J> On 3/4/17 11:07 am, Andrey V. Elsukov wrote:
J> > Author: ae
J> > Date: Mon Apr  3 03:07:48 2017
J> > New Revision: 316435
J> > URL: https://svnweb.freebsd.org/changeset/base/316435
J> 
J> it was always my intention to hook netgraph modules into ipfw in this way

Yes, ng_tcpmss (written in 2004) and ng_ipfw (written in 2005) allow to do that.
However, this comes with extra CPU cycles, and design flaws. Packet filter is
functional and synchronous, while netgraph isn't. Coupling them requires
hacks.

So nothing wrong in ipfw module.


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


svn commit: r316801 - head/sbin/fsck

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Fri Apr 14 00:22:28 2017
New Revision: 316801
URL: https://svnweb.freebsd.org/changeset/base/316801

Log:
  fsck(8): Don't overrun mount device buffer
  
  Apply a very similar fix to r299460 (fsck_ffs) to apparently duplicated code
  in fsck.
  
  Reported by:  Coverity
  CID:  1006789
  Sponsored by: Dell EMC Isilon

Modified:
  head/sbin/fsck/fsutil.c

Modified: head/sbin/fsck/fsutil.c
==
--- head/sbin/fsck/fsutil.c Fri Apr 14 00:15:34 2017(r316800)
+++ head/sbin/fsck/fsutil.c Fri Apr 14 00:22:28 2017(r316801)
@@ -172,6 +172,9 @@ getmntpt(const char *name)
statfsp = &mntbuf[i];
dev_name = statfsp->f_mntfromname;
if (*dev_name != '/') {
+   if (strlen(_PATH_DEV) + strlen(dev_name) + 1 >
+   sizeof(statfsp->f_mntfromname))
+   continue;
strcpy(device, _PATH_DEV);
strcat(device, dev_name);
strcpy(statfsp->f_mntfromname, device);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316802 - head/usr.sbin/bsdinstall/partedit

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Fri Apr 14 00:36:45 2017
New Revision: 316802
URL: https://svnweb.freebsd.org/changeset/base/316802

Log:
  bsdinstall(8): Sprinkle a snprintf to fixed size buffer
  
  Use a snprintf to write an environment variable to a fixed-size buffer to
  avoid stack overflow.
  
  Reported by:  Coverity (CWE-120)
  CID:  1238926
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Fri Apr 14 00:22:28 
2017(r316801)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Fri Apr 14 00:36:45 
2017(r316802)
@@ -146,7 +146,7 @@ newfs_command(const char *fstype, char *
strcpy(command, "zpool create -f -m none ");
if (getenv("BSDINSTALL_TMPBOOT") != NULL) {
char zfsboot_path[MAXPATHLEN];
-   sprintf(zfsboot_path, "%s/zfs",
+   snprintf(zfsboot_path, sizeof(zfsboot_path), "%s/zfs",
getenv("BSDINSTALL_TMPBOOT"));
mkdir(zfsboot_path, S_IRWXU | S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316803 - head/contrib/tcp_wrappers

2017-04-13 Thread Conrad Meyer
Author: cem
Date: Fri Apr 14 00:45:09 2017
New Revision: 316803
URL: https://svnweb.freebsd.org/changeset/base/316803

Log:
  tcp_wrappers: Sprinkle some bounds-checked string copying
  
  It isn't clear if tcpd.c is even compiled in FreeBSD.
  
  Reported by:  Coverity
  CIDs: 1006710, 1006804
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/tcp_wrappers/tcpd.c

Modified: head/contrib/tcp_wrappers/tcpd.c
==
--- head/contrib/tcp_wrappers/tcpd.cFri Apr 14 00:36:45 2017
(r316802)
+++ head/contrib/tcp_wrappers/tcpd.cFri Apr 14 00:45:09 2017
(r316803)
@@ -62,10 +62,10 @@ char  **argv;
  */
 
 if (argv[0][0] == '/') {
-   strcpy(path, argv[0]);
+   strlcpy(path, argv[0], sizeof(path));
argv[0] = strrchr(argv[0], '/') + 1;
 } else {
-   sprintf(path, "%s/%s", REAL_DAEMON_DIR, argv[0]);
+   snprintf(path, sizeof(path), "%s/%s", REAL_DAEMON_DIR, argv[0]);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316804 - head/sys/netpfil/pf

2017-04-13 Thread Gleb Smirnoff
Author: glebius
Date: Fri Apr 14 01:56:15 2017
New Revision: 316804
URL: https://svnweb.freebsd.org/changeset/base/316804

Log:
  Fix potential NULL deref.
  
  Found by: PVS Studio

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Fri Apr 14 00:45:09 2017
(r316803)
+++ head/sys/netpfil/pf/pf_ioctl.c  Fri Apr 14 01:56:15 2017
(r316804)
@@ -2428,11 +2428,12 @@ DIOCGETSTATES_full:
 
 #undef ERROUT
 DIOCCHANGEADDR_error:
-   if (newpa->kif)
-   pfi_kif_unref(newpa->kif);
-   PF_RULES_WUNLOCK();
-   if (newpa != NULL)
+   if (newpa != NULL) {
+   if (newpa->kif)
+   pfi_kif_unref(newpa->kif);
free(newpa, M_PFRULE);
+   }
+   PF_RULES_WUNLOCK();
if (kif != NULL)
free(kif, PFI_MTYPE);
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316805 - head/sys/dev/ae

2017-04-13 Thread Pyun YongHyeon
Author: yongari
Date: Fri Apr 14 02:24:02 2017
New Revision: 316805
URL: https://svnweb.freebsd.org/changeset/base/316805

Log:
  Fix a potentially forever loop.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/ae/if_ae.c

Modified: head/sys/dev/ae/if_ae.c
==
--- head/sys/dev/ae/if_ae.c Fri Apr 14 01:56:15 2017(r316804)
+++ head/sys/dev/ae/if_ae.c Fri Apr 14 02:24:02 2017(r316805)
@@ -1696,7 +1696,7 @@ ae_stop_txmac(ae_softc_t *sc)
/*
 * Wait for IDLE state.
 */
-   for (i = 0; i < AE_IDLE_TIMEOUT; i--) {
+   for (i = 0; i < AE_IDLE_TIMEOUT; i++) {
val = AE_READ_4(sc, AE_IDLE_REG);
if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0)
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316806 - head/sys/dev/fxp

2017-04-13 Thread Pyun YongHyeon
Author: yongari
Date: Fri Apr 14 02:33:26 2017
New Revision: 316806
URL: https://svnweb.freebsd.org/changeset/base/316806

Log:
  Remove unnecessary comparison.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Fri Apr 14 02:24:02 2017(r316805)
+++ head/sys/dev/fxp/if_fxp.c   Fri Apr 14 02:33:26 2017(r316806)
@@ -2212,18 +2212,15 @@ fxp_stop(struct fxp_softc *sc)
 * Release any xmit buffers.
 */
txp = sc->fxp_desc.tx_list;
-   if (txp != NULL) {
-   for (i = 0; i < FXP_NTXCB; i++) {
-   if (txp[i].tx_mbuf != NULL) {
-   bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map,
-   BUS_DMASYNC_POSTWRITE);
-   bus_dmamap_unload(sc->fxp_txmtag,
-   txp[i].tx_map);
-   m_freem(txp[i].tx_mbuf);
-   txp[i].tx_mbuf = NULL;
-   /* clear this to reset csum offload bits */
-   txp[i].tx_cb->tbd[0].tb_addr = 0;
-   }
+   for (i = 0; i < FXP_NTXCB; i++) {
+   if (txp[i].tx_mbuf != NULL) {
+   bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map,
+   BUS_DMASYNC_POSTWRITE);
+   bus_dmamap_unload(sc->fxp_txmtag, txp[i].tx_map);
+   m_freem(txp[i].tx_mbuf);
+   txp[i].tx_mbuf = NULL;
+   /* clear this to reset csum offload bits */
+   txp[i].tx_cb->tbd[0].tb_addr = 0;
}
}
bus_dmamap_sync(sc->cbl_tag, sc->cbl_map,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316807 - head/contrib/gcc/config/rs6000

2017-04-13 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 14 03:20:34 2017
New Revision: 316807
URL: https://svnweb.freebsd.org/changeset/base/316807

Log:
  Default powerpcspe processor target to 8540
  
  This prevents internal compiler errors when -mcpu is omitted.

Modified:
  head/contrib/gcc/config/rs6000/freebsdspe.h

Modified: head/contrib/gcc/config/rs6000/freebsdspe.h
==
--- head/contrib/gcc/config/rs6000/freebsdspe.h Fri Apr 14 02:33:26 2017
(r316806)
+++ head/contrib/gcc/config/rs6000/freebsdspe.h Fri Apr 14 03:20:34 2017
(r316807)
@@ -28,6 +28,7 @@
 #undef TARGET_DEFAULT
 #defineTARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS | 
MASK_STRICT_ALIGN)
 
+#undef PROCESSOR_DEFAULT
 #undef TARGET_SPE_ABI
 #undef TARGET_SPE
 #undef TARGET_E500
@@ -36,6 +37,7 @@
 #undef TARGET_E500_SINGLE
 #undef TARGET_E500_DOUBLE
 
+#define PROCESSOR_DEFAULT PROCESSOR_PPC8540
 #define TARGET_SPE_ABI rs6000_spe_abi
 #define TARGET_SPE rs6000_spe
 #define TARGET_E500 (rs6000_cpu == PROCESSOR_PPC8540)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316808 - head/sys/dev/txp

2017-04-13 Thread Pyun YongHyeon
Author: yongari
Date: Fri Apr 14 03:23:03 2017
New Revision: 316808
URL: https://svnweb.freebsd.org/changeset/base/316808

Log:
  Remove unnecessary check aginst NULL.  txp_ext_command() with
  TXP_CMD_WAIT argument allocates a response buffer.  If the allocation
  fails, txp_ext_command() returns an error and it's handed in caller.
  
  Found by: PVS-Studio

Modified:
  head/sys/dev/txp/if_txp.c

Modified: head/sys/dev/txp/if_txp.c
==
--- head/sys/dev/txp/if_txp.c   Fri Apr 14 03:20:34 2017(r316807)
+++ head/sys/dev/txp/if_txp.c   Fri Apr 14 03:23:03 2017(r316808)
@@ -400,8 +400,7 @@ txp_attach(device_t dev)
"Unknown Typhoon sleep image version: %u:0x%08x\n",
rsp->rsp_numdesc, p2);
}
-   if (rsp != NULL)
-   free(rsp, M_DEVBUF);
+   free(rsp, M_DEVBUF);
 
sc->sc_xcvr = TXP_XCVR_AUTO;
txp_command(sc, TXP_CMD_XCVR_SELECT, TXP_XCVR_AUTO, 0, 0,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316809 - head/sys/contrib/ipfilter/netinet

2017-04-13 Thread Cy Schubert
Author: cy
Date: Fri Apr 14 03:54:36 2017
New Revision: 316809
URL: https://svnweb.freebsd.org/changeset/base/316809

Log:
  Fix a use after free panic in ipfilter's fragment processing.
  Memory is malloc'd, then a search for a match in the fragment table
  is made and if the fragment matches, the wrong fragment table is
  freed, causing a use after free panic. This commit fixes this.
  
  A symptom of the problem is a kernel page fault in bcopy() called by
  ipf_frag_lookup() at line 715 in ip_frag.c. Another symptom is a
  kernel page fault in ipf_frag_delete() when called by ipf_frag_expire()
  via ipf_slowtimer().
  
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_frag.c

Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c
==
--- head/sys/contrib/ipfilter/netinet/ip_frag.c Fri Apr 14 03:23:03 2017
(r316808)
+++ head/sys/contrib/ipfilter/netinet/ip_frag.c Fri Apr 14 03:54:36 2017
(r316809)
@@ -474,7 +474,7 @@ ipfr_frag_new(softc, softf, fin, pass, t
  IPFR_CMPSZ)) {
RWLOCK_EXIT(lock);
FBUMPD(ifs_exists);
-   KFREE(fra);
+   KFREE(fran);
return NULL;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r316809 - head/sys/contrib/ipfilter/netinet

2017-04-13 Thread Cy Schubert
In message <201704140354.v3e3sawz005...@repo.freebsd.org>, Cy Schubert 
writes:
> Author: cy
> Date: Fri Apr 14 03:54:36 2017
> New Revision: 316809
> URL: https://svnweb.freebsd.org/changeset/base/316809
> 
> Log:
>   Fix a use after free panic in ipfilter's fragment processing.
>   Memory is malloc'd, then a search for a match in the fragment table
>   is made and if the fragment matches, the wrong fragment table is
>   freed, causing a use after free panic. This commit fixes this.
>   
>   A symptom of the problem is a kernel page fault in bcopy() called by
>   ipf_frag_lookup() at line 715 in ip_frag.c. Another symptom is a
>   kernel page fault in ipf_frag_delete() when called by ipf_frag_expire()
>   via ipf_slowtimer().
>   
>   MFC after:  1 week
> 
> Modified:
>   head/sys/contrib/ipfilter/netinet/ip_frag.c
> 
> Modified: head/sys/contrib/ipfilter/netinet/ip_frag.c
> =
> =
> --- head/sys/contrib/ipfilter/netinet/ip_frag.c   Fri Apr 14 03:23:03 201
> 7 (r316808)
> +++ head/sys/contrib/ipfilter/netinet/ip_frag.c   Fri Apr 14 03:54:36 201
> 7 (r316809)
> @@ -474,7 +474,7 @@ ipfr_frag_new(softc, softf, fin, pass, t
> IPFR_CMPSZ)) {
>   RWLOCK_EXIT(lock);
>   FBUMPD(ifs_exists);
> - KFREE(fra);
> + KFREE(fran);
>   return NULL;
>   }
>  
> 

It's surprising how few people/sites have encountered this panic. I only 
encounter this problem on the ShawOpen network anywhere in Edmonton, AB, 
Canada. However all other networks, including ShawOpen networks in other 
cities in Canada don't pass fragments that cause this panic, which by 
looking at the code should happen frequently. There is a similar panic, 
with a sometimes similar backtrace to the panics I experiences in FreeBSD, 
documented in NetBSD-7.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


svn commit: r316810 - head/sys/contrib/ipfilter/netinet

2017-04-13 Thread Cy Schubert
Author: cy
Date: Fri Apr 14 05:12:01 2017
New Revision: 316810
URL: https://svnweb.freebsd.org/changeset/base/316810

Log:
  Keep state incorrectly assumes keep frags. This is counter to the
  ipfilter man pages. This also currently restricts keep frags to only when
  keep state is used, which is redundant because keep state currently
  assumes keep frags. This commit fixes this.
  
  To the user this change means that to maintain the current behaviour
  one must add keep frags to any ipfilter keep state rule (as documented
  in the man pages).
  
  This patch also allows the flexability to specify and use keep frags
  separate from keep state, as documented in an example in ipf.conf.5,
  instead of the currently broken behaviour.
  
  Relnotes: yes

Modified:
  head/sys/contrib/ipfilter/netinet/fil.c
  head/sys/contrib/ipfilter/netinet/ip_state.c

Modified: head/sys/contrib/ipfilter/netinet/fil.c
==
--- head/sys/contrib/ipfilter/netinet/fil.c Fri Apr 14 03:54:36 2017
(r316809)
+++ head/sys/contrib/ipfilter/netinet/fil.c Fri Apr 14 05:12:01 2017
(r316810)
@@ -2786,7 +2786,7 @@ ipf_firewall(fin, passp)
 * If the rule has "keep frag" and the packet is actually a fragment,
 * then create a fragment state entry.
 */
-   if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) {
+   if (pass & FR_KEEPFRAG) {
if (fin->fin_flx & FI_FRAG) {
if (ipf_frag_new(softc, fin, pass) == -1) {
LBUMP(ipf_stats[out].fr_bnfr);

Modified: head/sys/contrib/ipfilter/netinet/ip_state.c
==
--- head/sys/contrib/ipfilter/netinet/ip_state.cFri Apr 14 03:54:36 
2017(r316809)
+++ head/sys/contrib/ipfilter/netinet/ip_state.cFri Apr 14 05:12:01 
2017(r316810)
@@ -3414,7 +3414,8 @@ ipf_state_check(fin, passp)
 * If this packet is a fragment and the rule says to track fragments,
 * then create a new fragment cache entry.
 */
-   if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass))
+   if (((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass)) &&
+  ((is->is_pass & FR_KEEPFRAG)))
(void) ipf_frag_new(softc, fin, is->is_pass);
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316811 - head/sys/contrib/ipfilter/netinet

2017-04-13 Thread Cy Schubert
Author: cy
Date: Fri Apr 14 05:13:50 2017
New Revision: 316811
URL: https://svnweb.freebsd.org/changeset/base/316811

Log:
  Add missing free()'s after calls to randomize().
  
  PR:   NetBSD PR/50559
  Obtained from:Netbsd radix_ipf.c r1.6
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/radix_ipf.c

Modified: head/sys/contrib/ipfilter/netinet/radix_ipf.c
==
--- head/sys/contrib/ipfilter/netinet/radix_ipf.c   Fri Apr 14 05:12:01 
2017(r316810)
+++ head/sys/contrib/ipfilter/netinet/radix_ipf.c   Fri Apr 14 05:13:50 
2017(r316811)
@@ -38,7 +38,7 @@ static void buildnodes __P((addrfamily_t
 static ipf_rdx_node_t *ipf_rx_find_addr __P((ipf_rdx_node_t *, u_32_t *));
 static ipf_rdx_node_t *ipf_rx_lookup __P((ipf_rdx_head_t *, addrfamily_t *,
  addrfamily_t *));
-static ipf_rdx_node_t *ipf_rx_match __P((ipf_rdx_head_t *, addrfamily_t *));
+/* $NetBSD: radix_ipf.c,v 1.6 2015/12/15 12:30:34 christos Exp $   */
 
 /*
  * Foreword.
@@ -1509,6 +1509,8 @@ random_add(rnh)
add_addr(rnh, i, order[i]);
checktree(rnh);
}
+
+   free(order);
 }
 
 
@@ -1526,5 +1528,7 @@ random_delete(rnh)
delete_addr(rnh, i);
checktree(rnh);
}
+
+   free(order);
 }
 #endif /* RDX_DEBUG */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316812 - head/sys/dev/hyperv/input

2017-04-13 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Apr 14 05:18:42 2017
New Revision: 316812
URL: https://svnweb.freebsd.org/changeset/base/316812

Log:
  hyperv/kbd: Remove unnecessary assignment.
  
  Reported by:  PVS
  MFC after:3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/input/hv_kbdc.c

Modified: head/sys/dev/hyperv/input/hv_kbdc.c
==
--- head/sys/dev/hyperv/input/hv_kbdc.c Fri Apr 14 05:13:50 2017
(r316811)
+++ head/sys/dev/hyperv/input/hv_kbdc.c Fri Apr 14 05:18:42 2017
(r316812)
@@ -298,7 +298,6 @@ hv_kbd_read_channel(struct vmbus_channel
int ret = 0;
 
hv_kbd_sc *sc = (hv_kbd_sc*)context;
-   channel = vmbus_get_channel(sc->dev);
buf = sc->buf;
buflen = sc->buflen;
for (;;) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316814 - head

2017-04-13 Thread Cy Schubert
Author: cy
Date: Fri Apr 14 05:25:40 2017
New Revision: 316814
URL: https://svnweb.freebsd.org/changeset/base/316814

Log:
  Document change in (incorrect) ipfilter behaviour fixed by r316810.
  Keep frags can be used with keep state independently.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Fri Apr 14 05:25:21 2017(r316813)
+++ head/UPDATING   Fri Apr 14 05:25:40 2017(r316814)
@@ -51,6 +51,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
 
 ** SPECIAL WARNING: **
 
+20170413:
+   As of r316810 for ipfilter, keep frags is no longer assumed when
+   keep state is specified in a rule. r316810 aligns ipfilter with
+   documentation in man pages separating keep frags from keep state.
+   This allows keep state to specified without forcing keep frags
+   and allows keep frags to be specified independently of keep state.
+   To maintain previous behaviour, also specify keep frags with
+   keep state (as documented in ipf.conf.5.
+
 20170407:
arm64 builds now use the base system LLD 4.0.0 linker by default,
instead of requiring that the aarch64-binutils port or package be
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316813 - head/sys/dev/hyperv/storvsc

2017-04-13 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Apr 14 05:25:21 2017
New Revision: 316813
URL: https://svnweb.freebsd.org/changeset/base/316813

Log:
  hyperv/storvsc: Use ULL for 64bits value shift.
  
  Reported by:  PVS
  MFC after:3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Apr 14 
05:18:42 2017(r316812)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Apr 14 
05:25:21 2017(r316813)
@@ -1771,7 +1771,7 @@ storvsc_check_bounce_buffer_sgl(bus_dma_
}
pre_aligned = TRUE;
} else {
-   tmp_bits |= 1 << i;
+   tmp_bits |= 1ULL << i;
if (!pre_aligned) {
if (phys_addr != vtophys(sgl[i-1].ds_addr +
sgl[i-1].ds_len)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316815 - head/sys/dev/hyperv/utilities

2017-04-13 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Apr 14 05:29:27 2017
New Revision: 316815
URL: https://svnweb.freebsd.org/changeset/base/316815

Log:
  hyperv/kvp: Remove always false condition.
  
  Reported by:  PVS
  MFC after:3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/utilities/hv_kvp.c

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Fri Apr 14 05:25:40 2017
(r316814)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Fri Apr 14 05:29:27 2017
(r316815)
@@ -516,7 +516,7 @@ hv_kvp_convert_usermsg_to_hostmsg(struct
/* Use values by string */
host_exchg_data->value_type = HV_REG_SZ;
 
-   if ((hkey_len < 0) || (hvalue_len < 0))
+   if (hvalue_len < 0)
return (EINVAL);
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316816 - head

2017-04-13 Thread Cy Schubert
Author: cy
Date: Fri Apr 14 05:32:03 2017
New Revision: 316816
URL: https://svnweb.freebsd.org/changeset/base/316816

Log:
  Add missing bracket (typo).

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Fri Apr 14 05:29:27 2017(r316815)
+++ head/UPDATING   Fri Apr 14 05:32:03 2017(r316816)
@@ -58,7 +58,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12
This allows keep state to specified without forcing keep frags
and allows keep frags to be specified independently of keep state.
To maintain previous behaviour, also specify keep frags with
-   keep state (as documented in ipf.conf.5.
+   keep state (as documented in ipf.conf.5).
 
 20170407:
arm64 builds now use the base system LLD 4.0.0 linker by default,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316817 - head/etc/pam.d

2017-04-13 Thread Ngie Cooper
Author: ngie
Date: Fri Apr 14 06:33:15 2017
New Revision: 316817
URL: https://svnweb.freebsd.org/changeset/base/316817

Log:
  Derive {AT,RCMDS}{DIR,MODE} from FILE{DIR,MODE}
  
  This reduces duplicity a bit.
  
  MFC after:7 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/etc/pam.d/Makefile

Modified: head/etc/pam.d/Makefile
==
--- head/etc/pam.d/Makefile Fri Apr 14 05:32:03 2017(r316816)
+++ head/etc/pam.d/Makefile Fri Apr 14 06:33:15 2017(r316817)
@@ -17,24 +17,25 @@ FILES=  README \
telnetd \
xdm
 
+FILESDIR=  /etc/pam.d
+FILESMODE= 644
+
 .if ${MK_AT} != "no"
 FILESGROUPS+=  AT
 AT+=   atrun
 ATPACKAGE+=at
-ATDIR= /etc/pam.d
-ATMODE=644
+ATDIR= ${FILESDIR}
+ATMODE=${FILESMODE}
 .endif
 
 .if ${MK_RCMDS} != "no"
 FILESGROUPS+=  RCMDS
 RCMDS+=rsh
 RCMDSPACKAGE+= rcmds
-RCMDSDIR=  /etc/pam.d
-RCMDSMODE= 644
+RCMDSDIR=  ${FILESDIR}
+RCMDSMODE= ${FILESMODE}
 .endif
 
-FILESDIR=  /etc/pam.d
-FILESMODE= 644
 FILESMODE_README=  444
 LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r316818 - in head: etc/pam.d tools/build/mk

2017-04-13 Thread Ngie Cooper
Author: ngie
Date: Fri Apr 14 06:42:46 2017
New Revision: 316818
URL: https://svnweb.freebsd.org/changeset/base/316818

Log:
  Conditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd
  
  /etc/pam.d/ftp* should be installed with MK_FTP != no and
  /etc/pam.d/telnetd should be installed when MK_TELNET != no.
  
  MFC after:7 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/etc/pam.d/Makefile
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/etc/pam.d/Makefile
==
--- head/etc/pam.d/Makefile Fri Apr 14 06:33:15 2017(r316817)
+++ head/etc/pam.d/Makefile Fri Apr 14 06:42:46 2017(r316818)
@@ -8,13 +8,11 @@ FILESGROUPS=  FILES
 
 FILES= README \
cron \
-   ftpd \
imap \
login \
other \
passwd pop3 \
sshd su system \
-   telnetd \
xdm
 
 FILESDIR=  /etc/pam.d
@@ -28,6 +26,15 @@ ATDIR=   ${FILESDIR}
 ATMODE=${FILESMODE}
 .endif
 
+.if ${MK_FTP} != "no"
+FILESGROUPS+=  FTP
+FTP+=  ftpd
+FTPPACKAGE+=   ftp
+FTPDIR=${FILESDIR}
+FTPMODE=   ${FILESMODE}
+LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
+.endif
+
 .if ${MK_RCMDS} != "no"
 FILESGROUPS+=  RCMDS
 RCMDS+=rsh
@@ -36,7 +43,14 @@ RCMDSDIR=${FILESDIR}
 RCMDSMODE= ${FILESMODE}
 .endif
 
+.if ${MK_TELNET} != "no"
+FILESGROUPS+=  TELNET
+TELNET+=   telnetd
+TELNETPACKAGE+=telnet
+TELNETDIR= ${FILESDIR}
+TELNETMODE=${FILESMODE}
+.endif
+
 FILESMODE_README=  444
-LINKS= ${FILESDIR}/ftpd ${FILESDIR}/ftp
 
 .include 

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Apr 14 06:33:15 
2017(r316817)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Fri Apr 14 06:42:46 
2017(r316818)
@@ -1613,6 +1613,8 @@ OLD_FILES+=usr/share/man/man8/fmtree.8.g
 
 .if ${MK_FTP} == no
 OLD_FILES+=etc/ftpusers
+OLD_FILES+=etc/pam.d/ftp
+OLD_FILES+=etc/pam.d/ftpd
 OLD_FILES+=etc/rc.d/ftpd
 OLD_FILES+=usr/bin/ftp
 OLD_FILES+=usr/bin/gate-ftp
@@ -8037,6 +8039,7 @@ OLD_FILES+=usr/share/nls/uk_UA.UTF-8/tcs
 .endif
 
 .if ${MK_TELNET} == no
+OLD_FILES+=etc/pam.d/telnetd
 OLD_FILES+=usr/bin/telnet
 OLD_FILES+=usr/libexec/telnetd
 OLD_FILES+=usr/share/man/man1/telnet.1.gz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"