Re: svn commit: r338617 - in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern sys/netinet sys/netinet6 sys/sys tools/regression/sockets/udp_pingpong tools/regression/sockets/unix_cmsg

2018-10-01 Thread Maxim Sobolev
Thanks Alan, should be fixed now in r339066. Please let me know if you
still have any issues.

-Max

On Mon, Oct 1, 2018 at 8:31 AM Alan Somers  wrote:

> On Wed, Sep 12, 2018 at 12:52 PM Maxim Sobolev 
> wrote:
>
>> Author: sobomax
>> Date: Wed Sep 12 18:52:18 2018
>> New Revision: 338617
>> URL: https://svnweb.freebsd.org/changeset/base/338617
>>
>> Log:
>>   MFC r312296 and r323254, which is new a socket option
>>   SO_TS_CLOCK to pick from several different clock sources to
>>   return timestamps when SO_TIMESTAMP is enabled and two
>>   new nanosecond-precision timestamp types. This also fixes
>>   recvmsg32() system call to properly down-convert layout of the
>>   64-bit structures to match what 32-bit app(s) expect.
>>
>>   Bump __FreeBSD_version to indicate presence of a new
>>   functionality.
>>
>>   Differential Revision:https://reviews.freebsd.org/D9171
>>
>> Added:
>>   stable/11/tools/regression/sockets/udp_pingpong/
>>  - copied from r312296, head/tools/regression/sockets/udp_pingpong/
>> Modified:
>>   stable/11/lib/libc/sys/getsockopt.2
>>   stable/11/sys/compat/freebsd32/freebsd32.h
>>   stable/11/sys/compat/freebsd32/freebsd32_misc.c
>>   stable/11/sys/kern/uipc_socket.c
>>   stable/11/sys/kern/uipc_usrreq.c
>>   stable/11/sys/netinet/ip_input.c
>>   stable/11/sys/netinet6/ip6_input.c
>>   stable/11/sys/sys/param.h
>>   stable/11/sys/sys/socket.h
>>   stable/11/sys/sys/socketvar.h
>>   stable/11/tools/regression/sockets/unix_cmsg/Makefile
>>   stable/11/tools/regression/sockets/unix_cmsg/unix_cmsg.c
>> Directory Properties:
>>   stable/11/   (props changed)
>>
>
> This change broke the build of tools/regression/sockets/unix_cmsg on
> stable/11.  It looks like you need to MFC r309554 first.
>
>  unix_cmsg.c:55:10: fatal error: 'uc_common.h' file not found
> #include "uc_common.h"
>  ^
> 1 error
> generated.
>
> *** Error code 1
>
> Stop.
>
> -Alan
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339077 - head/lib/libc/amd64/string

2018-10-01 Thread Mateusz Guzik
Author: mjg
Date: Mon Oct  1 20:39:17 2018
New Revision: 339077
URL: https://svnweb.freebsd.org/changeset/base/339077

Log:
  amd64: reimplement libc memset and bzero with kernel memset
  
  This is a depessimization, see r334537 for an explanation. Routines
  remain significantly slower than they have to be.
  
  bzero was removed from the kernel but remains in libc. Macroify to
  accommodate differences to memset (no return value, always setting to 0).
  
  The bzero.S file is left in place due to libc build magic which pulls in
  a C variant if a matching .S file is missing.
  
  Reviewed by:  kib
  Approved by:  re (gjb)
  Differential Revision:https://reviews.freebsd.org/D17355

Modified:
  head/lib/libc/amd64/string/bzero.S
  head/lib/libc/amd64/string/memset.S

Modified: head/lib/libc/amd64/string/bzero.S
==
--- head/lib/libc/amd64/string/bzero.S  Mon Oct  1 19:00:46 2018
(r339076)
+++ head/lib/libc/amd64/string/bzero.S  Mon Oct  1 20:39:17 2018
(r339077)
@@ -1,46 +1,7 @@
-/*
- * Written by J.T. Conklin .
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden 
- */
+/* $FreeBSD */
 
 #include 
 __FBSDID("$FreeBSD$");
 
-#if 0
-   RCSID("$NetBSD: bzero.S,v 1.2 2003/07/26 19:24:38 salo Exp $")
-#endif
-
-ENTRY(bzero)
-   cld /* set fill direction forward */
-   xorq%rax,%rax   /* set fill data to 0 */
-
-   /*
-* if the string is too short, it's really not worth the overhead
-* of aligning to word boundries, etc.  So we jump to a plain
-* unaligned set.
-*/
-   cmpq$16,%rsi
-   jb  L1
-
-   movq%rdi,%rcx   /* compute misalignment */
-   negq%rcx
-   andq$7,%rcx
-   subq%rcx,%rsi
-   rep /* zero until word aligned */
-   stosb
-
-   movq%rsi,%rcx   /* zero by words */
-   shrq$3,%rcx
-   andq$7,%rsi
-   rep
-   stosq
-
-L1:movq%rsi,%rcx   /* zero remainder by bytes */
-   rep
-   stosb
-
-   ret
-END(bzero)
-
-   .section .note.GNU-stack,"",%progbits
+#define BZERO
+#include "memset.S"

Modified: head/lib/libc/amd64/string/memset.S
==
--- head/lib/libc/amd64/string/memset.S Mon Oct  1 19:00:46 2018
(r339076)
+++ head/lib/libc/amd64/string/memset.S Mon Oct  1 20:39:17 2018
(r339077)
@@ -1,63 +1,77 @@
-/*
- * Written by J.T. Conklin .
- * Public domain.
- * Adapted for NetBSD/x86_64 by Frank van der Linden 
+/*-
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * This software was developed by Mateusz Guzik 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
-#if 0
-   RCSID("$NetBSD: memset.S,v 1.3 2004/02/26 20:50:06 drochner Exp $")
-#endif
-
-ENTRY(memset)
-   movq%rsi,%rax
-   andq$0xff,%rax
+.macro MEMSET bzero
+.if \bzero == 1
+   movq%rsi,%rcx
+   movq%rsi,%rdx
+   xorl%eax,%eax
+.else
+   movq%rdi,%r9
movq%rdx,%rcx
-   movq%rdi,%r11
-
-   cld /* set fill direction forward */
-
-   /*
-* if the string is too short, it's really not worth the overhead
-* of aligning to word boundries, etc.  So we jump to a plain
-* unaligned set.
-*/
-   cmpq$0x0f,%rcx
-   jle L1
-
-   movb%al,%ah /* copy char to all 

svn commit: r339076 - head/sys/cam/scsi

2018-10-01 Thread Kenneth D. Merry
Author: ken
Date: Mon Oct  1 19:00:46 2018
New Revision: 339076
URL: https://svnweb.freebsd.org/changeset/base/339076

Log:
  Fix a da(4) driver memory leak for SCSI SMR devices.
  
  In the probe case for SCSI SMR Host Aware or Most Managed drives, be sure
  to free allocated memory.
  
  sys/cam/scsi/scsi_da.c:
In dadone_probezone(), free the data pointer before returning.
  
  MFC after:3 days
  Sponsored by: Spectra Logic
  Approved by:  re (kib)

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Mon Oct  1 18:51:39 2018(r339075)
+++ head/sys/cam/scsi/scsi_da.c Mon Oct  1 19:00:46 2018(r339076)
@@ -5674,6 +5674,9 @@ dadone_probezone(struct cam_periph *periph, union ccb 
}
}
}
+
+   free(csio->data_ptr, M_SCSIDA);
+
daprobedone(periph, done_ccb);
return;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339075 - in head/sys: sys vm

2018-10-01 Thread Mark Johnston
Author: markj
Date: Mon Oct  1 18:51:39 2018
New Revision: 339075
URL: https://svnweb.freebsd.org/changeset/base/339075

Log:
  Use an unsigned iterator for domain sets.
  
  Otherwise (iter % ds->ds_cnt) is not guaranteed to lie in the range
  [0, MAXMEMDOM).
  
  Reported by:  pho
  Reviewed by:  kib
  Approved by:  re (rgrimes)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17374

Modified:
  head/sys/sys/_domainset.h
  head/sys/vm/vm_domainset.h

Modified: head/sys/sys/_domainset.h
==
--- head/sys/sys/_domainset.h   Mon Oct  1 18:51:08 2018(r339074)
+++ head/sys/sys/_domainset.h   Mon Oct  1 18:51:39 2018(r339075)
@@ -54,7 +54,7 @@ typedef struct _domainset domainset_t;
 struct domainset;
 struct domainset_ref {
struct domainset * volatile dr_policy;
-   int dr_iterator;
+   unsigned intdr_iterator;
 };
 
 #endif /* !_SYS__DOMAINSET_H_ */

Modified: head/sys/vm/vm_domainset.h
==
--- head/sys/vm/vm_domainset.h  Mon Oct  1 18:51:08 2018(r339074)
+++ head/sys/vm/vm_domainset.h  Mon Oct  1 18:51:39 2018(r339075)
@@ -32,7 +32,7 @@
 
 struct vm_domainset_iter {
struct domainset*di_domain;
-   int *di_iter;
+   unsigned int*di_iter;
vm_pindex_t di_offset;
int di_flags;
uint16_tdi_policy;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339074 - in head/sys: arm64/arm64 arm64/include conf kern

2018-10-01 Thread Andrew Turner
Author: andrew
Date: Mon Oct  1 18:51:08 2018
New Revision: 339074
URL: https://svnweb.freebsd.org/changeset/base/339074

Log:
  Add kernel ifunc support on arm64.
  
  Tested with ifunc resolvers in the kernel and module with calls from
  kernel to kernel, module to kernel, and module to module.
  
  Reviewed by:  kib (previous version)
  Approved by:  re (gjb)
  Differential Revision:https://reviews.freebsd.org/D17370

Added:
  head/sys/arm64/include/ifunc.h   (contents, props changed)
Modified:
  head/sys/arm64/arm64/elf_machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/conf/kern.pre.mk
  head/sys/kern/link_elf.c

Modified: head/sys/arm64/arm64/elf_machdep.c
==
--- head/sys/arm64/arm64/elf_machdep.c  Mon Oct  1 18:48:33 2018
(r339073)
+++ head/sys/arm64/arm64/elf_machdep.c  Mon Oct  1 18:51:08 2018
(r339074)
@@ -133,14 +133,14 @@ bool
 elf_is_ifunc_reloc(Elf_Size r_info __unused)
 {
 
-   return (false);
+   return (ELF_R_TYPE(r_info) == R_AARCH64_IRELATIVE);
 }
 
 static int
 elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
 int type, int local, elf_lookup_fn lookup)
 {
-   Elf_Addr *where, addr, addend;
+   Elf_Addr *where, addr, addend, val;
Elf_Word rtype, symidx;
const Elf_Rel *rel;
const Elf_Rela *rela;
@@ -182,6 +182,12 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas
if (error != 0)
return (-1);
*where = addr + addend;
+   break;
+   case R_AARCH64_IRELATIVE:
+   addr = relocbase + addend;
+   val = ((Elf64_Addr (*)(void))addr)();
+   if (*where != val)
+   *where = val;
break;
default:
printf("kldload: unexpected relocation type %d\n", rtype);

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Mon Oct  1 18:48:33 2018
(r339073)
+++ head/sys/arm64/arm64/machdep.c  Mon Oct  1 18:51:08 2018
(r339074)
@@ -1004,6 +1004,7 @@ initarm(struct arm64_bootparams *abp)
 
boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0);
+   link_elf_ireloc(kmdp);
 
 #ifdef FDT
try_load_dtb(kmdp);

Added: head/sys/arm64/include/ifunc.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/include/ifunc.h  Mon Oct  1 18:51:08 2018
(r339074)
@@ -0,0 +1,51 @@
+/*-
+ * Copyright (c) 2015-2018 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __ARM64_IFUNC_H
+#define__ARM64_IFUNC_H
+
+#defineDEFINE_IFUNC(qual, ret_type, name, args, resolver_qual) 
\
+resolver_qual ret_type (*name##_resolver(void))args __used;
\
+qual ret_type name args __attribute__((ifunc(#name "_resolver"))); \
+resolver_qual ret_type (*name##_resolver(void))args
+
+#defineDEFINE_UIFUNC(qual, ret_type, name, args, resolver_qual)
\
+resolver_qual ret_type (*name##_resolver(uint64_t, uint64_t,   \
+   uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,   \
+   uint64_t))args __used;  \
+qual ret_type name args 

svn commit: r339073 - in head/sys: amd64/amd64 i386/i386

2018-10-01 Thread Mark Johnston
Author: markj
Date: Mon Oct  1 18:48:33 2018
New Revision: 339073
URL: https://svnweb.freebsd.org/changeset/base/339073

Log:
  Apply r339046 to i386.
  
  Belatedly add a comment to the amd64 pmap explaining why we initialize
  the kernel pmap's resident page count.
  
  Reviewed by:  alc, kib
  Approved by:  re (gjb)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17377

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Oct  1 18:46:35 2018(r339072)
+++ head/sys/amd64/amd64/pmap.c Mon Oct  1 18:48:33 2018(r339073)
@@ -1142,7 +1142,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 
/*
 * Initialize the kernel pmap (which is statically allocated).
-* Count bootstrap data as being resident.
+* Count bootstrap data as being resident in case any of this data is
+* later unmapped (using pmap_remove()) and freed.
 */
PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys);

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Mon Oct  1 18:46:35 2018(r339072)
+++ head/sys/i386/i386/pmap.c   Mon Oct  1 18:48:33 2018(r339073)
@@ -579,8 +579,11 @@ pmap_bootstrap(vm_paddr_t firstaddr)
vm_offset_t va;
pt_entry_t *pte, *unused;
struct pcpu *pc;
+   u_long res;
int i;
 
+   res = atop(firstaddr - (vm_paddr_t)KERNLOAD);
+
/*
 * Add a physical memory segment (vm_phys_seg) corresponding to the
 * preallocated kernel page table pages so that vm_page structures
@@ -598,11 +601,12 @@ pmap_bootstrap(vm_paddr_t firstaddr)
 * unused virtual address in addition to "firstaddr".
 */
virtual_avail = (vm_offset_t)firstaddr;
-
virtual_end = VM_MAX_KERNEL_ADDRESS;
 
/*
 * Initialize the kernel pmap (which is statically allocated).
+* Count bootstrap data as being resident in case any of this data is
+* later unmapped (using pmap_remove()) and freed.
 */
PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pdir = IdlePTD;
@@ -610,6 +614,7 @@ pmap_bootstrap(vm_paddr_t firstaddr)
kernel_pmap->pm_pdpt = IdlePDPT;
 #endif
CPU_FILL(_pmap->pm_active);  /* don't allow deactivation */
+   kernel_pmap->pm_stats.resident_count = res;
TAILQ_INIT(_pmap->pm_pvchunk);
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339072 - head/libexec/rtld-elf/powerpc

2018-10-01 Thread Andreas Tobler
Author: andreast
Date: Mon Oct  1 18:46:35 2018
New Revision: 339072
URL: https://svnweb.freebsd.org/changeset/base/339072

Log:
  This commit reverts 338930. The approach was wrong.
  
  Fix the issue with subtracting the TLS_TCB_SIZE too when we are trying to get
  the 'where' in the R_PPC_TPREL32 case. At allocation time we added an offset
  and the TLS_TCB_SIZE. This has to be subtracted as well.
  
  Now all the issues reported are fixed. Tests were done on G4 and G5 
PowerMac's.
  Additionally I ran the tls tests from the gcc test suite and made sure the
  results are as good as pre 338486.
  
  Thanks to tuexen for reporting the malfunction and for patient testing.
  Also testing thanks goes to jhibbits.
  
  Reported by:  tuexen
  Discussed with:   jhibbits, nwhitehorn
  Approved by:  re (gjb)
  Pointyhat to: andreast

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==
--- head/libexec/rtld-elf/powerpc/reloc.c   Mon Oct  1 18:26:41 2018
(r339071)
+++ head/libexec/rtld-elf/powerpc/reloc.c   Mon Oct  1 18:46:35 2018
(r339072)
@@ -258,7 +258,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *ob
 
*(Elf_Addr **)where = *where * sizeof(Elf_Addr)
+ (Elf_Addr *)(def->st_value + rela->r_addend 
-   + defobj->tlsoffset - TLS_TP_OFFSET);
+   + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE);

break;


Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==
--- head/libexec/rtld-elf/powerpc/rtld_machdep.hMon Oct  1 18:26:41 
2018(r339071)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.hMon Oct  1 18:46:35 
2018(r339072)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);
 
 #define TLS_TP_OFFSET  0x7000
 #define TLS_DTV_OFFSET 0x8000
-#define TLS_TCB_SIZE   16
+#define TLS_TCB_SIZE   8
 
 #define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-round(8, align)
+TLS_TCB_SIZE
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
 round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)((off) + (size))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339071 - head/usr.bin/nfsstat

2018-10-01 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Oct  1 18:26:41 2018
New Revision: 339071
URL: https://svnweb.freebsd.org/changeset/base/339071

Log:
  Remove references to the "new" NFS clients and servers.  The "old"
  NFS stack is long gone.
  
  Approved by:  re (gjb)
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.bin/nfsstat/nfsstat.1

Modified: head/usr.bin/nfsstat/nfsstat.1
==
--- head/usr.bin/nfsstat/nfsstat.1  Mon Oct  1 18:16:36 2018
(r339070)
+++ head/usr.bin/nfsstat/nfsstat.1  Mon Oct  1 18:26:41 2018
(r339071)
@@ -28,7 +28,7 @@
 .\" From: @(#)nfsstat.18.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd January 22, 2018
+.Dd October 1, 2018
 .Dt NFSSTAT 1
 .Os
 .Sh NAME
@@ -59,7 +59,7 @@ The options are as follows:
 .It Fl c
 Only display client side statistics.
 .It Fl d
-Display statistics for the new NFS server that are similar to those
+Display statistics for the NFS server that are similar to those
 displayed by
 .Xr iostat 8 .
 This includes kilobytes per transfer, transfers per second, and megabytes per
@@ -98,11 +98,10 @@ Extract values associated with the name list from the 
 instead of the default
 .Pa /dev/kmem .
 .It Fl m
-Report the mount options for all new NFS client mounts.
+Report the mount options for all NFS client mounts.
 This option overrides all others and
 .Nm
 will exit after completing the report.
-This option is only supported by the new NFS client.
 .It Fl N
 Extract the name list from the specified system instead of the default
 .Pa /boot/kernel/kernel .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339069 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml

2018-10-01 Thread Glen Barber
Author: gjb
Date: Mon Oct  1 18:15:25 2018
New Revision: 339069
URL: https://svnweb.freebsd.org/changeset/base/339069

Log:
  Document EN-18:09 through EN-18:12.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/share/xml/errata.xml

Changes in other areas also in this revision:
Modified:
  stable/10/release/doc/share/xml/errata.xml

Modified: stable/11/release/doc/share/xml/errata.xml
==
--- stable/11/release/doc/share/xml/errata.xml  Mon Oct  1 18:00:52 2018
(r339068)
+++ stable/11/release/doc/share/xml/errata.xml  Mon Oct  1 18:15:25 2018
(r339069)
@@ -24,6 +24,39 @@
12September2018
Regression in Lazy FPU remediation
   
+
+  
+   FreeBSD-EN-18:09.ip
+   27September2018
+   IP fragment remediation causes
+ IPv6 reassembly failure
+  
+
+  
+   FreeBSD-EN-18:10.syscall
+   27September2018
+   Null pointer dereference in
+   freebsd4_getfsstat system
+   call
+  
+
+  
+   FreeBSD-EN-18:11.listen
+   27September2018
+   Denial of service in listen
+   system call
+  
+
+  
+   FreeBSD-EN-18:12.mem
+   27September2018
+   Small kernel memory disclosures in two system
+   calls
+  
 
   
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339069 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml

2018-10-01 Thread Glen Barber
Author: gjb
Date: Mon Oct  1 18:15:25 2018
New Revision: 339069
URL: https://svnweb.freebsd.org/changeset/base/339069

Log:
  Document EN-18:09 through EN-18:12.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/share/xml/errata.xml

Changes in other areas also in this revision:
Modified:
  stable/11/release/doc/share/xml/errata.xml

Modified: stable/10/release/doc/share/xml/errata.xml
==
--- stable/10/release/doc/share/xml/errata.xml  Mon Oct  1 18:00:52 2018
(r339068)
+++ stable/10/release/doc/share/xml/errata.xml  Mon Oct  1 18:15:25 2018
(r339069)
@@ -72,6 +72,22 @@
Update timezone database
information
   
+
+  
+   FreeBSD-EN-18:11.listen
+   27September2018
+   Denial of service in listen
+   system call
+  
+
+  
+   FreeBSD-EN-18:12.mem
+   27September2018
+   Small kernel memory disclosures in two system
+   calls
+  
 
   
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339068 - in stable/10: sys/kern sys/sys tests/sys/kern

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 18:00:52 2018
New Revision: 339068
URL: https://svnweb.freebsd.org/changeset/base/339068

Log:
  MFC r337222:
  
  Fix LOCAL_PEERCRED with socketpair(2)
  
  Enable the LOCAL_PEERCRED socket option for unix domain stream sockets
  created with socketpair(2). Previously, it only worked with unix domain
  stream sockets created with socket(2)/listen(2)/connect(2)/accept(2).
  
  PR:   176419
  Reported by:  Nicholas Wilson 
  Differential Revision:https://reviews.freebsd.org/D16350

Added:
  stable/10/tests/sys/kern/unix_socketpair_test.c
 - copied unchanged from r337222, head/tests/sys/kern/unix_socketpair_test.c
Modified:
  stable/10/sys/kern/uipc_syscalls.c
  stable/10/sys/kern/uipc_usrreq.c
  stable/10/sys/sys/unpcb.h
  stable/10/tests/sys/kern/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_syscalls.c
==
--- stable/10/sys/kern/uipc_syscalls.c  Mon Oct  1 17:36:58 2018
(r339067)
+++ stable/10/sys/kern/uipc_syscalls.c  Mon Oct  1 18:00:52 2018
(r339068)
@@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #ifdef KTRACE
 #include 
@@ -758,6 +760,15 @@ kern_socketpair(struct thread *td, int domain, int typ
 error = soconnect2(so2, so1);
 if (error != 0)
goto free4;
+   } else if (so1->so_proto->pr_flags & PR_CONNREQUIRED) {
+   struct unpcb *unp, *unp2;
+   unp = sotounpcb(so1);
+   unp2 = sotounpcb(so2);
+   /* 
+* No need to lock the unps, because the sockets are brand-new.
+* No other threads can be using them yet
+*/
+   unp_copy_peercred(td, unp, unp2, unp);
}
finit(fp1, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp1->f_data,
);

Modified: stable/10/sys/kern/uipc_usrreq.c
==
--- stable/10/sys/kern/uipc_usrreq.cMon Oct  1 17:36:58 2018
(r339067)
+++ stable/10/sys/kern/uipc_usrreq.cMon Oct  1 18:00:52 2018
(r339068)
@@ -1383,26 +1383,10 @@ unp_connectat(int fd, struct socket *so, struct sockad
sa = NULL;
}
 
-   /*
-* The connector's (client's) credentials are copied from its
-* process structure at the time of connect() (which is now).
-*/
-   cru2x(td->td_ucred, >unp_peercred);
-   unp3->unp_flags |= UNP_HAVEPC;
-
-   /*
-* The receiver's (server's) credentials are copied from the
-* unp_peercred member of socket on which the former called
-* listen(); uipc_listen() cached that process's credentials
-* at that time so we can use them now.
-*/
KASSERT(unp2->unp_flags & UNP_HAVEPCCACHED,
("unp_connect: listener without cached peercred"));
-   memcpy(>unp_peercred, >unp_peercred,
-   sizeof(unp->unp_peercred));
-   unp->unp_flags |= UNP_HAVEPC;
-   if (unp2->unp_flags & UNP_WANTCRED)
-   unp3->unp_flags |= UNP_WANTCRED;
+   unp_copy_peercred(td, unp3, unp, unp2);
+
UNP_PCB_UNLOCK(unp3);
UNP_PCB_UNLOCK(unp2);
UNP_PCB_UNLOCK(unp);
@@ -1433,6 +1417,27 @@ bad:
unp->unp_flags &= ~UNP_CONNECTING;
UNP_PCB_UNLOCK(unp);
return (error);
+}
+
+/*
+ * Set socket peer credentials at connection time.
+ *
+ * The client's PCB credentials are copied from its process structure.  The
+ * server's PCB credentials are copied from the socket on which it called
+ * listen(2).  uipc_listen cached that process's credentials at the time.
+ */
+void
+unp_copy_peercred(struct thread *td, struct unpcb *client_unp,
+struct unpcb *server_unp, struct unpcb *listen_unp)
+{
+   cru2x(td->td_ucred, _unp->unp_peercred);
+   client_unp->unp_flags |= UNP_HAVEPC;
+
+   memcpy(_unp->unp_peercred, _unp->unp_peercred,
+   sizeof(server_unp->unp_peercred));
+   server_unp->unp_flags |= UNP_HAVEPC;
+   if (listen_unp->unp_flags & UNP_WANTCRED)
+   client_unp->unp_flags |= UNP_WANTCRED;
 }
 
 static int

Modified: stable/10/sys/sys/unpcb.h
==
--- stable/10/sys/sys/unpcb.h   Mon Oct  1 17:36:58 2018(r339067)
+++ stable/10/sys/sys/unpcb.h   Mon Oct  1 18:00:52 2018(r339068)
@@ -150,4 +150,13 @@ struct xunpgen {
 };
 #endif /* _SYS_SOCKETVAR_H_ */
 
+#if defined(_KERNEL)
+struct thread;
+
+/* In uipc_userreq.c */
+void
+unp_copy_peercred(struct thread *td, struct unpcb *client_unp,
+

Re: svn commit: r338617 - in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern sys/netinet sys/netinet6 sys/sys tools/regression/sockets/udp_pingpong tools/regression/sockets/unix_cmsg

2018-10-01 Thread Alan Somers
Everything's working fine now.  Thanks for the quick turnaround.

On Mon, Oct 1, 2018 at 11:51 AM Maxim Sobolev  wrote:

> Thanks Alan, should be fixed now in r339066. Please let me know if you
> still have any issues.
>
> -Max
>
> On Mon, Oct 1, 2018 at 8:31 AM Alan Somers  wrote:
>
>> On Wed, Sep 12, 2018 at 12:52 PM Maxim Sobolev 
>> wrote:
>>
>>> Author: sobomax
>>> Date: Wed Sep 12 18:52:18 2018
>>> New Revision: 338617
>>> URL: https://svnweb.freebsd.org/changeset/base/338617
>>>
>>> Log:
>>>   MFC r312296 and r323254, which is new a socket option
>>>   SO_TS_CLOCK to pick from several different clock sources to
>>>   return timestamps when SO_TIMESTAMP is enabled and two
>>>   new nanosecond-precision timestamp types. This also fixes
>>>   recvmsg32() system call to properly down-convert layout of the
>>>   64-bit structures to match what 32-bit app(s) expect.
>>>
>>>   Bump __FreeBSD_version to indicate presence of a new
>>>   functionality.
>>>
>>>   Differential Revision:https://reviews.freebsd.org/D9171
>>>
>>> Added:
>>>   stable/11/tools/regression/sockets/udp_pingpong/
>>>  - copied from r312296, head/tools/regression/sockets/udp_pingpong/
>>> Modified:
>>>   stable/11/lib/libc/sys/getsockopt.2
>>>   stable/11/sys/compat/freebsd32/freebsd32.h
>>>   stable/11/sys/compat/freebsd32/freebsd32_misc.c
>>>   stable/11/sys/kern/uipc_socket.c
>>>   stable/11/sys/kern/uipc_usrreq.c
>>>   stable/11/sys/netinet/ip_input.c
>>>   stable/11/sys/netinet6/ip6_input.c
>>>   stable/11/sys/sys/param.h
>>>   stable/11/sys/sys/socket.h
>>>   stable/11/sys/sys/socketvar.h
>>>   stable/11/tools/regression/sockets/unix_cmsg/Makefile
>>>   stable/11/tools/regression/sockets/unix_cmsg/unix_cmsg.c
>>> Directory Properties:
>>>   stable/11/   (props changed)
>>>
>>
>> This change broke the build of tools/regression/sockets/unix_cmsg on
>> stable/11.  It looks like you need to MFC r309554 first.
>>
>>  unix_cmsg.c:55:10: fatal error: 'uc_common.h' file not found
>> #include "uc_common.h"
>>  ^
>> 1 error
>> generated.
>>
>> *** Error code 1
>>
>> Stop.
>>
>> -Alan
>>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339067 - in stable/11: sys/kern sys/sys tests/sys/kern

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 17:36:58 2018
New Revision: 339067
URL: https://svnweb.freebsd.org/changeset/base/339067

Log:
  MFC r337222:
  
  Fix LOCAL_PEERCRED with socketpair(2)
  
  Enable the LOCAL_PEERCRED socket option for unix domain stream sockets
  created with socketpair(2). Previously, it only worked with unix domain
  stream sockets created with socket(2)/listen(2)/connect(2)/accept(2).
  
  PR:   176419
  Reported by:  Nicholas Wilson 
  Differential Revision:https://reviews.freebsd.org/D16350

Added:
  stable/11/tests/sys/kern/unix_socketpair_test.c
 - copied unchanged from r337222, head/tests/sys/kern/unix_socketpair_test.c
Modified:
  stable/11/sys/kern/uipc_syscalls.c
  stable/11/sys/kern/uipc_usrreq.c
  stable/11/sys/sys/unpcb.h
  stable/11/tests/sys/kern/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/uipc_syscalls.c
==
--- stable/11/sys/kern/uipc_syscalls.c  Mon Oct  1 17:26:41 2018
(r339066)
+++ stable/11/sys/kern/uipc_syscalls.c  Mon Oct  1 17:36:58 2018
(r339067)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #ifdef KTRACE
 #include 
 #endif
@@ -691,6 +693,15 @@ kern_socketpair(struct thread *td, int domain, int typ
 error = soconnect2(so2, so1);
 if (error != 0)
goto free4;
+   } else if (so1->so_proto->pr_flags & PR_CONNREQUIRED) {
+   struct unpcb *unp, *unp2;
+   unp = sotounpcb(so1);
+   unp2 = sotounpcb(so2);
+   /* 
+* No need to lock the unps, because the sockets are brand-new.
+* No other threads can be using them yet
+*/
+   unp_copy_peercred(td, unp, unp2, unp);
}
finit(fp1, FREAD | FWRITE | fflag, DTYPE_SOCKET, fp1->f_data,
);

Modified: stable/11/sys/kern/uipc_usrreq.c
==
--- stable/11/sys/kern/uipc_usrreq.cMon Oct  1 17:26:41 2018
(r339066)
+++ stable/11/sys/kern/uipc_usrreq.cMon Oct  1 17:36:58 2018
(r339067)
@@ -1424,26 +1424,10 @@ unp_connectat(int fd, struct socket *so, struct sockad
sa = NULL;
}
 
-   /*
-* The connector's (client's) credentials are copied from its
-* process structure at the time of connect() (which is now).
-*/
-   cru2x(td->td_ucred, >unp_peercred);
-   unp3->unp_flags |= UNP_HAVEPC;
-
-   /*
-* The receiver's (server's) credentials are copied from the
-* unp_peercred member of socket on which the former called
-* listen(); uipc_listen() cached that process's credentials
-* at that time so we can use them now.
-*/
KASSERT(unp2->unp_flags & UNP_HAVEPCCACHED,
("unp_connect: listener without cached peercred"));
-   memcpy(>unp_peercred, >unp_peercred,
-   sizeof(unp->unp_peercred));
-   unp->unp_flags |= UNP_HAVEPC;
-   if (unp2->unp_flags & UNP_WANTCRED)
-   unp3->unp_flags |= UNP_WANTCRED;
+   unp_copy_peercred(td, unp3, unp, unp2);
+
UNP_PCB_UNLOCK(unp3);
UNP_PCB_UNLOCK(unp2);
UNP_PCB_UNLOCK(unp);
@@ -1474,6 +1458,27 @@ bad:
unp->unp_flags &= ~UNP_CONNECTING;
UNP_PCB_UNLOCK(unp);
return (error);
+}
+
+/*
+ * Set socket peer credentials at connection time.
+ *
+ * The client's PCB credentials are copied from its process structure.  The
+ * server's PCB credentials are copied from the socket on which it called
+ * listen(2).  uipc_listen cached that process's credentials at the time.
+ */
+void
+unp_copy_peercred(struct thread *td, struct unpcb *client_unp,
+struct unpcb *server_unp, struct unpcb *listen_unp)
+{
+   cru2x(td->td_ucred, _unp->unp_peercred);
+   client_unp->unp_flags |= UNP_HAVEPC;
+
+   memcpy(_unp->unp_peercred, _unp->unp_peercred,
+   sizeof(server_unp->unp_peercred));
+   server_unp->unp_flags |= UNP_HAVEPC;
+   if (listen_unp->unp_flags & UNP_WANTCRED)
+   client_unp->unp_flags |= UNP_WANTCRED;
 }
 
 static int

Modified: stable/11/sys/sys/unpcb.h
==
--- stable/11/sys/sys/unpcb.h   Mon Oct  1 17:26:41 2018(r339066)
+++ stable/11/sys/sys/unpcb.h   Mon Oct  1 17:36:58 2018(r339067)
@@ -150,4 +150,13 @@ struct xunpgen {
 };
 #endif /* _SYS_SOCKETVAR_H_ */
 
+#if defined(_KERNEL)
+struct thread;
+
+/* In uipc_userreq.c */
+void
+unp_copy_peercred(struct thread *td, struct unpcb *client_unp,
+

svn commit: r339066 - stable/11/tools/regression/sockets/unix_cmsg

2018-10-01 Thread Maxim Sobolev
Author: sobomax
Date: Mon Oct  1 17:26:41 2018
New Revision: 339066
URL: https://svnweb.freebsd.org/changeset/base/339066

Log:
  MFC r309554 and r309631 which breaks down overly long monolithic
  souce file and reduces duplication by auto-generating functions
  that only differ in the value of the SCM_XXX constant used.
  
  This also fixes unintentional breakage introduced in earlier
  MFC in r338617 that happens to rely on some of those changes.
  
  Reported by:  asomers
  Pointy-hat goes to:   sobomax

Added:
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsg_len.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsg_len.c
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsg_len.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsg_len.h
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsgcred.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsgcred.c
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsgcred.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsgcred.h
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.c
  stable/11/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsgcred_sockcred.h
  stable/11/tools/regression/sockets/unix_cmsg/t_generic.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_generic.c
  stable/11/tools/regression/sockets/unix_cmsg/t_generic.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_generic.h
  stable/11/tools/regression/sockets/unix_cmsg/t_peercred.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_peercred.c
  stable/11/tools/regression/sockets/unix_cmsg/t_peercred.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_peercred.h
  stable/11/tools/regression/sockets/unix_cmsg/t_sockcred.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_sockcred.c
  stable/11/tools/regression/sockets/unix_cmsg/t_sockcred.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/t_sockcred.h
  stable/11/tools/regression/sockets/unix_cmsg/t_xxxtime.c.in
 - copied unchanged from r309631, 
head/tools/regression/sockets/unix_cmsg/t_xxxtime.c.in
  stable/11/tools/regression/sockets/unix_cmsg/t_xxxtime.h.in
 - copied unchanged from r309631, 
head/tools/regression/sockets/unix_cmsg/t_xxxtime.h.in
  stable/11/tools/regression/sockets/unix_cmsg/uc_common.c
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/uc_common.c
  stable/11/tools/regression/sockets/unix_cmsg/uc_common.h
 - copied unchanged from r309554, 
head/tools/regression/sockets/unix_cmsg/uc_common.h
Modified:
  stable/11/tools/regression/sockets/unix_cmsg/Makefile
  stable/11/tools/regression/sockets/unix_cmsg/unix_cmsg.c

Modified: stable/11/tools/regression/sockets/unix_cmsg/Makefile
==
--- stable/11/tools/regression/sockets/unix_cmsg/Makefile   Mon Oct  1 
16:23:00 2018(r339065)
+++ stable/11/tools/regression/sockets/unix_cmsg/Makefile   Mon Oct  1 
17:26:41 2018(r339066)
@@ -1,6 +1,11 @@
 # $FreeBSD$
 
 PROG=  unix_cmsg
+SRCS=  ${AUTOSRCS} unix_cmsg.c uc_common.h uc_common.c \
+   t_generic.h t_generic.c t_peercred.h t_peercred.c \
+   t_cmsgcred.h t_cmsgcred.c t_sockcred.h t_sockcred.c \
+   t_cmsgcred_sockcred.h t_cmsgcred_sockcred.c t_cmsg_len.h t_cmsg_len.c
+CLEANFILES+=   ${AUTOSRCS}
 MAN=
 WARNS?=3
 

Copied: stable/11/tools/regression/sockets/unix_cmsg/t_cmsg_len.c (from 
r309554, head/tools/regression/sockets/unix_cmsg/t_cmsg_len.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/tools/regression/sockets/unix_cmsg/t_cmsg_len.c   Mon Oct  1 
17:26:41 2018(r339066, copy of r309554, 
head/tools/regression/sockets/unix_cmsg/t_cmsg_len.c)
@@ -0,0 +1,138 @@
+/*-
+ * Copyright (c) 2005 Andrey Simonenko
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY 

svn commit: r339060 - in stable/10: libexec/tftpd usr.bin/tftp

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:09:20 2018
New Revision: 339060
URL: https://svnweb.freebsd.org/changeset/base/339060

Log:
  MFC r336609:
  
  Fix several Coverity warnings in tftp
  
  Some of the changes are in the libexec/tftpd directory, but to functions that
  are only used by tftp(1) (they share some code).
  
  * strcpy => strlcpy (1006793, 1006794, 1006796, 1006741)
  * Unchecked return value and TOCTTOU (1009314)
  * NULL pointer dereference (1018035, 1018036)
  
  Reported by:  Coverity
  CID:  1006793, 1006794, 1006796, 1006741, 1009314, 1018035
  CID:  1018036

Modified:
  stable/10/libexec/tftpd/tftp-io.c
  stable/10/libexec/tftpd/tftp-utils.c
  stable/10/usr.bin/tftp/main.c
  stable/10/usr.bin/tftp/tftp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tftp-io.c
==
--- stable/10/libexec/tftpd/tftp-io.c   Mon Oct  1 16:08:27 2018
(r339059)
+++ stable/10/libexec/tftpd/tftp-io.c   Mon Oct  1 16:09:20 2018
(r339060)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -191,16 +192,16 @@ send_wrq(int peer, char *filename, char *mode)
 
tp = (struct tftphdr *)buf;
tp->th_opcode = htons((u_short)WRQ);
-   size = 2;
+   size = offsetof(struct tftphdr, th_stuff);
 
bp = tp->th_stuff;
-   strcpy(bp, filename);
+   strlcpy(bp, filename, sizeof(buf) - size);
bp += strlen(filename);
*bp = 0;
bp++;
size += strlen(filename) + 1;
 
-   strcpy(bp, mode);
+   strlcpy(bp, mode, sizeof(buf) - size);
bp += strlen(mode);
*bp = 0;
bp++;
@@ -239,16 +240,16 @@ send_rrq(int peer, char *filename, char *mode)
 
tp = (struct tftphdr *)buf;
tp->th_opcode = htons((u_short)RRQ);
-   size = 2;
+   size = offsetof(struct tftphdr, th_stuff);
 
bp = tp->th_stuff;
-   strcpy(bp, filename);
+   strlcpy(bp, filename, sizeof(buf) - size);
bp += strlen(filename);
*bp = 0;
bp++;
size += strlen(filename) + 1;
 
-   strcpy(bp, mode);
+   strlcpy(bp, mode, sizeof(buf) - size);
bp += strlen(mode);
*bp = 0;
bp++;

Modified: stable/10/libexec/tftpd/tftp-utils.c
==
--- stable/10/libexec/tftpd/tftp-utils.cMon Oct  1 16:08:27 2018
(r339059)
+++ stable/10/libexec/tftpd/tftp-utils.cMon Oct  1 16:09:20 2018
(r339060)
@@ -235,14 +235,15 @@ const char *
 debug_show(int d)
 {
static char s[100];
+   size_t space = sizeof(s);
int i = 0;
 
s[0] = '\0';
while (debugs[i].name != NULL) {
if (d[i].value) {
-   if (s[0] != '\0') 
-   strcat(s, " ");
-   strcat(s, debugs[i].name);
+   if (s[0] != '\0')
+   strlcat(s, " ", space);
+   strlcat(s, debugs[i].name, space);
}
i++;
}

Modified: stable/10/usr.bin/tftp/main.c
==
--- stable/10/usr.bin/tftp/main.c   Mon Oct  1 16:08:27 2018
(r339059)
+++ stable/10/usr.bin/tftp/main.c   Mon Oct  1 16:09:20 2018
(r339060)
@@ -405,7 +405,7 @@ static void
 settftpmode(const char *newmode)
 {
 
-   strcpy(mode, newmode);
+   strlcpy(mode, newmode, sizeof(mode));
if (verbose)
printf("mode set to %s\n", mode);
 }
@@ -465,7 +465,10 @@ put(int argc, char *argv[])
return;
}
 
-   stat(cp, );
+   if (fstat(fd, ) < 0) {
+   warn("%s", cp);
+   return;
+   }
asprintf([OPT_TSIZE].o_request, "%ju", sb.st_size);
 
if (verbose)
@@ -486,7 +489,10 @@ put(int argc, char *argv[])
continue;
}
 
-   stat(cp, );
+   if (fstat(fd, ) < 0) {
+   warn("%s", argv[n]);
+   continue;
+   }
asprintf([OPT_TSIZE].o_request, "%ju", sb.st_size);
 
if (verbose)

Modified: stable/10/usr.bin/tftp/tftp.c
==
--- stable/10/usr.bin/tftp/tftp.c   Mon Oct  1 16:08:27 2018
(r339059)
+++ stable/10/usr.bin/tftp/tftp.c   Mon Oct  1 16:09:20 2018
(r339060)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -83,6 +84,7 @@ xmitfile(int peer, char *port, int fd, char *name, cha
if (port == NULL) {
struct servent *se;
 

svn commit: r339062 - stable/10/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:11:09 2018
New Revision: 339062
URL: https://svnweb.freebsd.org/changeset/base/339062

Log:
  MFC r338216:
  
  tftpd: Fix data corruption bug with netascii
  
  Transferring files in netascii format requires, among other things,
  translating all CR characters to a CR,NUL pair. tftpd does this correctly
  except when the CR occurs as the last octet of a packet. In that case, it
  erroneously drops the NUL which should be part of the following packet. The
  bug was caused by using 0 as a sentinel value in a variable that could
  legitimately hold 0. Fix it by switching the sentinel value to -1.
  
  PR:   178055
  Reported by:  Richard 
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D16853

Modified:
  stable/10/libexec/tftpd/tftp-file.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tftp-file.c
==
--- stable/10/libexec/tftpd/tftp-file.c Mon Oct  1 16:10:27 2018
(r339061)
+++ stable/10/libexec/tftpd/tftp-file.c Mon Oct  1 16:11:09 2018
(r339062)
@@ -108,10 +108,10 @@ convert_to_net(char *buffer, size_t count, int init)
 {
size_t i;
static size_t n = 0, in = 0;
-   static int newline = 0;
+   static int newline = -1;
 
if (init) {
-   newline = 0;
+   newline = -1;
n = 0;
in = 0;
return 0 ;
@@ -122,9 +122,9 @@ convert_to_net(char *buffer, size_t count, int init)
 */
i = 0;
 
-   if (newline) {
+   if (newline != -1) {
buffer[i++] = newline;
-   newline = 0;
+   newline = -1;
}
 
while (i < count) {
@@ -159,7 +159,7 @@ convert_to_net(char *buffer, size_t count, int init)
 
if (i > count) {
/*
-* Whoops... that isn't alllowed (but it will happen
+* Whoops... that isn't allowed (but it will happen
 * when there is a CR or LF at the end of the buffer)
 */
newline = buffer[i-1];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339058 - stable/10/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:07:32 2018
New Revision: 339058
URL: https://svnweb.freebsd.org/changeset/base/339058

Log:
  MFC r336587:
  
  tftpd(8): when completing an WRQ, flush the file before acknowleding receipt
  
  tftpd(8) should flush a newly written file to disk before ACKing the final 
DATA
  packet.  Otherwise there is a narrow race window when a subsequent read may 
not
  see the file.  This is somewhat related to r330710, but the race window is 
much
  smaller.  Hopefully this will fix the intermittent tests in Jenkins.
  
  Reported by:  Jenkins

Modified:
  stable/10/libexec/tftpd/tftp-transfer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tftp-transfer.c
==
--- stable/10/libexec/tftpd/tftp-transfer.c Mon Oct  1 16:04:07 2018
(r339057)
+++ stable/10/libexec/tftpd/tftp-transfer.c Mon Oct  1 16:07:32 2018
(r339058)
@@ -277,6 +277,8 @@ tftp_receive(int peer, uint16_t *block, struct tftp_st
send_error(peer, ENOSPACE);
goto abort;
}
+   if (n_data != segsize)
+   write_close();
}
 
 send_ack:
@@ -301,8 +303,6 @@ send_ack:
}
gettimeofday(&(ts->tstop), NULL);
} while (n_data == segsize);
-
-   write_close();
 
/* Don't do late packet management for the client implementation */
if (acting_as_client)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339051 - stable/11/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:47:34 2018
New Revision: 339051
URL: https://svnweb.freebsd.org/changeset/base/339051

Log:
  MFC r336605:
  
  Fix multiple Coverity warnings in tftpd(8)
  
  * Initialize uninitialized variable (CID 1006502)
  * strcpy => strlcpy (CID 1006792, 1006791, 1006790)
  * Check function return values (CID 1009442, 1009441, 1009440)
  * Delete dead code in receive_packet (not reported by Coverity)
  * Remove redundant alarm(3) in receive_packet (not reported by Coverity)
  
  Reported by:  Coverity
  CID: 1006502, 1006792, 1006791, 1006790, 1009442, 1009441, 1009440
  Differential Revision:https://reviews.freebsd.org/D11287

Modified:
  stable/11/libexec/tftpd/tftp-file.c
  stable/11/libexec/tftpd/tftp-io.c
  stable/11/libexec/tftpd/tftp-utils.c
  stable/11/libexec/tftpd/tftpd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/tftpd/tftp-file.c
==
--- stable/11/libexec/tftpd/tftp-file.c Mon Oct  1 15:45:20 2018
(r339050)
+++ stable/11/libexec/tftpd/tftp-file.c Mon Oct  1 15:47:34 2018
(r339051)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,8 @@ convert_from_net(char *buffer, size_t count)
if (buffer[i] == '\n') {
if (n == 0) {
if (ftell(file) != 0) {
-   fseek(file, -1, SEEK_END);
+   int r = fseek(file, -1, SEEK_END);
+   assert(r == 0);
convbuffer[n++] = '\n';
} else {
/* This shouldn't happen */

Modified: stable/11/libexec/tftpd/tftp-io.c
==
--- stable/11/libexec/tftpd/tftp-io.c   Mon Oct  1 15:45:20 2018
(r339050)
+++ stable/11/libexec/tftpd/tftp-io.c   Mon Oct  1 15:47:34 2018
(r339051)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -393,7 +394,7 @@ receive_packet(int peer, char *data, int size, struct 
struct sockaddr_storage *pfrom;
socklen_t fromlen;
int n;
-   static int waiting;
+   static int timed_out;
 
if (debug_PACKETS)
tftp_log(LOG_DEBUG,
@@ -401,23 +402,16 @@ receive_packet(int peer, char *data, int size, struct 
 
pkt = (struct tftphdr *)data;
 
-   waiting = 0;
signal(SIGALRM, timeout);
-   setjmp(timeoutbuf);
+   timed_out = setjmp(timeoutbuf);
alarm(thistimeout);
 
-   if (waiting > 0) {
-   alarm(0);
-   return (RP_TIMEOUT);
-   }
-
-   if (waiting > 0) {
+   if (timed_out != 0) {
tftp_log(LOG_ERR, "receive_packet: timeout");
alarm(0);
return (RP_TIMEOUT);
}
 
-   waiting++;
pfrom = (from == NULL) ? _local : from;
fromlen = sizeof(*pfrom);
n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, );
@@ -430,8 +424,6 @@ receive_packet(int peer, char *data, int size, struct 
tftp_log(LOG_ERR, "receive_packet: timeout");
return (RP_TIMEOUT);
}
-
-   alarm(0);
 
if (n < 0) {
/* No idea what could have happened if it isn't a timeout */

Modified: stable/11/libexec/tftpd/tftp-utils.c
==
--- stable/11/libexec/tftpd/tftp-utils.cMon Oct  1 15:45:20 2018
(r339050)
+++ stable/11/libexec/tftpd/tftp-utils.cMon Oct  1 15:47:34 2018
(r339051)
@@ -268,11 +268,13 @@ char *
 rp_strerror(int error)
 {
static char s[100];
+   size_t space = sizeof(s);
int i = 0;
 
while (rp_errors[i].desc != NULL) {
if (rp_errors[i].error == error) {
-   strcpy(s, rp_errors[i].desc);
+   strlcpy(s, rp_errors[i].desc, space);
+   space -= strlen(rp_errors[i].desc);
}
i++;
}

Modified: stable/11/libexec/tftpd/tftpd.c
==
--- stable/11/libexec/tftpd/tftpd.c Mon Oct  1 15:45:20 2018
(r339050)
+++ stable/11/libexec/tftpd/tftpd.c Mon Oct  1 15:47:34 2018
(r339051)
@@ -372,7 +372,10 @@ main(int argc, char *argv[])
exit(1);
}
chdir("/");
-   setgroups(1, >pw_gid);
+   if (setgroups(1, >pw_gid) != 0) {
+   tftp_log(LOG_ERR, "setgroups failed");
+   exit(1);
+   }
if 

svn commit: r339047 - head/lib/libbe

2018-10-01 Thread Kyle Evans
Author: kevans
Date: Mon Oct  1 14:57:33 2018
New Revision: 339047
URL: https://svnweb.freebsd.org/changeset/base/339047

Log:
  libbe(3): Fix BE activation promoting activated BE
  
  This allows older BEs to be destroyed as they become replaced by a BE
  created from them: e.g.
  
  bectl create -e brokenworld fixedworld
  bectl activate fixedworld
  bectl destroy brokenworld
  
  Submitted by: Shawn Webb
  Approved by:  re (gjb)
  Obtained from:HardenedBSD (5948c0581e)

Modified:
  head/lib/libbe/be.c

Modified: head/lib/libbe/be.c
==
--- head/lib/libbe/be.c Mon Oct  1 14:47:49 2018(r339046)
+++ head/lib/libbe/be.c Mon Oct  1 14:57:33 2018(r339047)
@@ -928,8 +928,9 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, 
 {
char be_path[BE_MAXPATHLEN];
char buf[BE_MAXPATHLEN];
-   uint64_t pool_guid;
nvlist_t *config, *vdevs;
+   uint64_t pool_guid;
+   zfs_handle_t *zhp;
int err;
 
be_root_concat(lbh, bootenv, be_path);
@@ -961,14 +962,19 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, 
} else {
/* Obtain bootenv zpool */
err = zpool_set_prop(lbh->active_phandle, "bootfs", be_path);
+   if (err)
+   return (-1);
 
-   switch (err) {
-   case 0:
-   return (BE_ERR_SUCCESS);
+   zhp = zfs_open(lbh->lzh, be_path, ZFS_TYPE_FILESYSTEM);
+   if (zhp == NULL)
+   return (-1);
 
-   default:
-   /* XXX TODO correct errors */
+   err = zfs_promote(zhp);
+   zfs_close(zhp);
+
+   if (err)
return (-1);
-   }
}
+
+   return (BE_ERR_SUCCESS);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339065 - stable/10/sys/compat/freebsd32

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:23:00 2018
New Revision: 339065
URL: https://svnweb.freebsd.org/changeset/base/339065

Log:
  MFC r336871, r336874
  
  r336871:
  getrusage(2): fix return value under 32-bit emulation
  
  According to the man page, getrusage(2) should return EFAULT if the rusage
  argument lies outside of the process's address space. But due to an
  oversight in r100384, that's never been the case during 32-bit emulation.
  Fix it.
  
  PR:   230153
  Reported by:  tests(7)
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D16500
  
  r336874:
  freebsd32_getrusage(2): skip freebsd32_rusage_out on error
  
  PR:   230153
  Reported by:  kib
  X-MFC-With:   336871
  Differential Revision:https://reviews.freebsd.org/D16500

Modified:
  stable/10/sys/compat/freebsd32/freebsd32_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/10/sys/compat/freebsd32/freebsd32_misc.c Mon Oct  1 16:16:05 
2018(r339064)
+++ stable/10/sys/compat/freebsd32/freebsd32_misc.c Mon Oct  1 16:23:00 
2018(r339065)
@@ -824,9 +824,7 @@ freebsd32_getrusage(struct thread *td, struct freebsd3
int error;
 
error = kern_getrusage(td, uap->who, );
-   if (error)
-   return (error);
-   if (uap->rusage != NULL) {
+   if (error == 0) {
freebsd32_rusage_out(, );
error = copyout(, uap->rusage, sizeof(s32));
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339061 - stable/10/usr.bin/tftp

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:10:27 2018
New Revision: 339061
URL: https://svnweb.freebsd.org/changeset/base/339061

Log:
  MFC r337779:
  
  tftp: Close a resource leak when putting files
  
  Reported by:  Coverity
  CID:  1394842

Modified:
  stable/10/usr.bin/tftp/main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/tftp/main.c
==
--- stable/10/usr.bin/tftp/main.c   Mon Oct  1 16:09:20 2018
(r339060)
+++ stable/10/usr.bin/tftp/main.c   Mon Oct  1 16:10:27 2018
(r339061)
@@ -475,6 +475,7 @@ put(int argc, char *argv[])
printf("putting %s to %s:%s [%s]\n",
cp, hostname, targ, mode);
xmitfile(peer, port, fd, targ, mode);
+   close(fd);
return;
}
/* this assumes the target is a directory */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339064 - head/usr.sbin/pmc

2018-10-01 Thread Ruslan Bukin
Author: br
Date: Mon Oct  1 16:16:05 2018
New Revision: 339064
URL: https://svnweb.freebsd.org/changeset/base/339064

Log:
  Fix build with GCC 8.1.
  
  GCC 8.1 failed to build LLVM's libc++ when -Wshadow is set,
  so lower down WARNS flag to 3.
  
  This is similar to dtc(1) which uses libc++ and sets WARNS to 3.
  
  Approved by:  re (gjb)
  Sponsored by: DARPA, AFRL

Modified:
  head/usr.sbin/pmc/Makefile

Modified: head/usr.sbin/pmc/Makefile
==
--- head/usr.sbin/pmc/Makefile  Mon Oct  1 16:14:38 2018(r339063)
+++ head/usr.sbin/pmc/Makefile  Mon Oct  1 16:16:05 2018(r339064)
@@ -5,6 +5,7 @@
 .include 
 PROG_CXX=  pmc
 MAN=   
+WARNS?=3
 CXXFLAGS+= -O0 -std=c++14
 CWARNFLAGS.gcc+= -Wno-redundant-decls
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339057 - stable/11/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:04:07 2018
New Revision: 339057
URL: https://svnweb.freebsd.org/changeset/base/339057

Log:
  MFC r338216:
  
  tftpd: Fix data corruption bug with netascii
  
  Transferring files in netascii format requires, among other things,
  translating all CR characters to a CR,NUL pair. tftpd does this correctly
  except when the CR occurs as the last octet of a packet. In that case, it
  erroneously drops the NUL which should be part of the following packet. The
  bug was caused by using 0 as a sentinel value in a variable that could
  legitimately hold 0. Fix it by switching the sentinel value to -1.
  
  PR:   178055
  Reported by:  Richard 
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D16853

Modified:
  stable/11/libexec/tftpd/tftp-file.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/tftpd/tftp-file.c
==
--- stable/11/libexec/tftpd/tftp-file.c Mon Oct  1 16:01:21 2018
(r339056)
+++ stable/11/libexec/tftpd/tftp-file.c Mon Oct  1 16:04:07 2018
(r339057)
@@ -108,10 +108,10 @@ convert_to_net(char *buffer, size_t count, int init)
 {
size_t i;
static size_t n = 0, in = 0;
-   static int newline = 0;
+   static int newline = -1;
 
if (init) {
-   newline = 0;
+   newline = -1;
n = 0;
in = 0;
return 0 ;
@@ -122,9 +122,9 @@ convert_to_net(char *buffer, size_t count, int init)
 */
i = 0;
 
-   if (newline) {
+   if (newline != -1) {
buffer[i++] = newline;
-   newline = 0;
+   newline = -1;
}
 
while (i < count) {
@@ -159,7 +159,7 @@ convert_to_net(char *buffer, size_t count, int init)
 
if (i > count) {
/*
-* Whoops... that isn't alllowed (but it will happen
+* Whoops... that isn't allowed (but it will happen
 * when there is a CR or LF at the end of the buffer)
 */
newline = buffer[i-1];
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339063 - stable/10/etc

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:14:38 2018
New Revision: 339063
URL: https://svnweb.freebsd.org/changeset/base/339063

Log:
  MFC r337973:
  
  Add Modbus Application Protocol to /etc/services
  
  IANA reassigned ports 502 and 802 on 2014-06-10
  
  PR:   213276
  Submitted by: mark.marti...@ijs.si

Modified:
  stable/10/etc/services
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/services
==
--- stable/10/etc/services  Mon Oct  1 16:11:09 2018(r339062)
+++ stable/10/etc/services  Mon Oct  1 16:14:38 2018(r339063)
@@ -873,8 +873,8 @@ isakmp  500/tcp
 isakmp 500/udp
 stmf   501/tcp
 stmf   501/udp
-asa-appl-proto 502/tcp
-asa-appl-proto 502/udp
+mbap   502/tcp# Modbus Application Protocol
+mbap   502/udp# Modbus Application Protocol
 intrinsa   503/tcp
 intrinsa   503/udp
 citadel504/tcp
@@ -1414,6 +1414,8 @@ mdbs_daemon   800/tcp
 mdbs_daemon800/udp
 device 801/tcp
 device 801/udp
+mbap-s 802/tcp# Modbus Application Protocol Secure
+mbap-s 802/udp# Modbus Application Protocol Secure
 fcp-udp810/tcp#FCP
 fcp-udp810/udp#FCP Datagram
 itm-mcell-s828/tcp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339045 - stable/11/contrib/traceroute

2018-10-01 Thread Mariusz Zaborski
Author: oshogbo
Date: Mon Oct  1 14:39:59 2018
New Revision: 339045
URL: https://svnweb.freebsd.org/changeset/base/339045

Log:
  MFC r315411 (mmel):
Unbreak traceroute on system built without CAPSICUM

Modified:
  stable/11/contrib/traceroute/traceroute.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/traceroute/traceroute.c
==
--- stable/11/contrib/traceroute/traceroute.c   Mon Oct  1 14:27:53 2018
(r339044)
+++ stable/11/contrib/traceroute/traceroute.c   Mon Oct  1 14:39:59 2018
(r339045)
@@ -1021,8 +1021,13 @@ main(int argc, char **argv)
 * We must connect(2) our socket before this point.
 */
if (cansandbox && cap_enter() < 0) {
-   Fprintf(stderr, "%s: cap_enter: %s\n", prog, strerror(errno));
-   exit(1);
+   if (errno != ENOSYS) {
+   Fprintf(stderr, "%s: cap_enter: %s\n", prog,
+   strerror(errno));
+   exit(1);
+   } else {
+   cansandbox = false;
+   }
}
 
cap_rights_init(, CAP_SEND, CAP_SETSOCKOPT);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339059 - stable/10/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:08:27 2018
New Revision: 339059
URL: https://svnweb.freebsd.org/changeset/base/339059

Log:
  MFC r336605:
  
  Fix multiple Coverity warnings in tftpd(8)
  
  * Initialize uninitialized variable (CID 1006502)
  * strcpy => strlcpy (CID 1006792, 1006791, 1006790)
  * Check function return values (CID 1009442, 1009441, 1009440)
  * Delete dead code in receive_packet (not reported by Coverity)
  * Remove redundant alarm(3) in receive_packet (not reported by Coverity)
  
  Reported by:  Coverity
  CID: 1006502, 1006792, 1006791, 1006790, 1009442, 1009441, 1009440
  Differential Revision:https://reviews.freebsd.org/D11287

Modified:
  stable/10/libexec/tftpd/tftp-file.c
  stable/10/libexec/tftpd/tftp-io.c
  stable/10/libexec/tftpd/tftp-utils.c
  stable/10/libexec/tftpd/tftpd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tftp-file.c
==
--- stable/10/libexec/tftpd/tftp-file.c Mon Oct  1 16:07:32 2018
(r339058)
+++ stable/10/libexec/tftpd/tftp-file.c Mon Oct  1 16:08:27 2018
(r339059)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,8 @@ convert_from_net(char *buffer, size_t count)
if (buffer[i] == '\n') {
if (n == 0) {
if (ftell(file) != 0) {
-   fseek(file, -1, SEEK_END);
+   int r = fseek(file, -1, SEEK_END);
+   assert(r == 0);
convbuffer[n++] = '\n';
} else {
/* This shouldn't happen */

Modified: stable/10/libexec/tftpd/tftp-io.c
==
--- stable/10/libexec/tftpd/tftp-io.c   Mon Oct  1 16:07:32 2018
(r339058)
+++ stable/10/libexec/tftpd/tftp-io.c   Mon Oct  1 16:08:27 2018
(r339059)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -393,7 +394,7 @@ receive_packet(int peer, char *data, int size, struct 
struct sockaddr_storage *pfrom;
socklen_t fromlen;
int n;
-   static int waiting;
+   static int timed_out;
 
if (debug_PACKETS)
tftp_log(LOG_DEBUG,
@@ -401,23 +402,16 @@ receive_packet(int peer, char *data, int size, struct 
 
pkt = (struct tftphdr *)data;
 
-   waiting = 0;
signal(SIGALRM, timeout);
-   setjmp(timeoutbuf);
+   timed_out = setjmp(timeoutbuf);
alarm(thistimeout);
 
-   if (waiting > 0) {
-   alarm(0);
-   return (RP_TIMEOUT);
-   }
-
-   if (waiting > 0) {
+   if (timed_out != 0) {
tftp_log(LOG_ERR, "receive_packet: timeout");
alarm(0);
return (RP_TIMEOUT);
}
 
-   waiting++;
pfrom = (from == NULL) ? _local : from;
fromlen = sizeof(*pfrom);
n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, );
@@ -430,8 +424,6 @@ receive_packet(int peer, char *data, int size, struct 
tftp_log(LOG_ERR, "receive_packet: timeout");
return (RP_TIMEOUT);
}
-
-   alarm(0);
 
if (n < 0) {
/* No idea what could have happened if it isn't a timeout */

Modified: stable/10/libexec/tftpd/tftp-utils.c
==
--- stable/10/libexec/tftpd/tftp-utils.cMon Oct  1 16:07:32 2018
(r339058)
+++ stable/10/libexec/tftpd/tftp-utils.cMon Oct  1 16:08:27 2018
(r339059)
@@ -268,11 +268,13 @@ char *
 rp_strerror(int error)
 {
static char s[100];
+   size_t space = sizeof(s);
int i = 0;
 
while (rp_errors[i].desc != NULL) {
if (rp_errors[i].error == error) {
-   strcpy(s, rp_errors[i].desc);
+   strlcpy(s, rp_errors[i].desc, space);
+   space -= strlen(rp_errors[i].desc);
}
i++;
}

Modified: stable/10/libexec/tftpd/tftpd.c
==
--- stable/10/libexec/tftpd/tftpd.c Mon Oct  1 16:07:32 2018
(r339058)
+++ stable/10/libexec/tftpd/tftpd.c Mon Oct  1 16:08:27 2018
(r339059)
@@ -372,7 +372,10 @@ main(int argc, char *argv[])
exit(1);
}
chdir("/");
-   setgroups(1, >pw_gid);
+   if (setgroups(1, >pw_gid) != 0) {
+   tftp_log(LOG_ERR, "setgroups failed");
+   exit(1);
+   }
if 

svn commit: r339053 - stable/11/share/man/man9

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:56:42 2018
New Revision: 339053
URL: https://svnweb.freebsd.org/changeset/base/339053

Log:
  MFC r337482:
  
  Bring VOP_LOOKUP(9) up to date
  
  * Remove the cn_hash field (removed by r51906)
  * Add the cn_lkflags field (added by r144285)
  * Remove duplicate definition of cnp.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D16629

Modified:
  stable/11/share/man/man9/VOP_LOOKUP.9
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/VOP_LOOKUP.9
==
--- stable/11/share/man/man9/VOP_LOOKUP.9   Mon Oct  1 15:49:43 2018
(r339052)
+++ stable/11/share/man/man9/VOP_LOOKUP.9   Mon Oct  1 15:56:42 2018
(r339053)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 17, 2017
+.Dd August 8, 2018
 .Dt VOP_LOOKUP 9
 .Os
 .Sh NAME
@@ -51,10 +51,7 @@ The locked vnode of the directory to search.
 The address of a variable where the resulting locked vnode should be stored.
 .It Fa cnp
 The pathname component to be searched for.
-.El
-.Pp
-.Fa Cnp
-is a pointer to a componentname structure defined as follows:
+It is a pointer to a componentname structure defined as follows:
 .Bd -literal
 struct componentname {
/*
@@ -64,13 +61,13 @@ struct componentname {
u_long  cn_flags;   /* flags to namei */
struct  thread *cn_thread;  /* thread requesting lookup */
struct  ucred *cn_cred; /* credentials */
+   int cn_lkflags; /* Lock flags LK_EXCLUSIVE or LK_SHARED */
/*
 * Shared between lookup and commit routines.
 */
char*cn_pnbuf;  /* pathname buffer */
char*cn_nameptr;/* pointer to looked up name */
longcn_namelen; /* length of looked up component */
-   u_long  cn_hash;/* hash value of looked up name */
 };
 .Ed
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339056 - stable/11/etc

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 16:01:21 2018
New Revision: 339056
URL: https://svnweb.freebsd.org/changeset/base/339056

Log:
  MFC r337973:
  
  Add Modbus Application Protocol to /etc/services
  
  IANA reassigned ports 502 and 802 on 2014-06-10
  
  PR:   213276
  Submitted by: mark.marti...@ijs.si

Modified:
  stable/11/etc/services
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/services
==
--- stable/11/etc/services  Mon Oct  1 15:59:06 2018(r339055)
+++ stable/11/etc/services  Mon Oct  1 16:01:21 2018(r339056)
@@ -873,8 +873,8 @@ isakmp  500/tcp
 isakmp 500/udp
 stmf   501/tcp
 stmf   501/udp
-asa-appl-proto 502/tcp
-asa-appl-proto 502/udp
+mbap   502/tcp# Modbus Application Protocol
+mbap   502/udp# Modbus Application Protocol
 intrinsa   503/tcp
 intrinsa   503/udp
 citadel504/tcp
@@ -1414,6 +1414,8 @@ mdbs_daemon   800/tcp
 mdbs_daemon800/udp
 device 801/tcp
 device 801/udp
+mbap-s 802/tcp# Modbus Application Protocol Secure
+mbap-s 802/udp# Modbus Application Protocol Secure
 fcp-udp810/tcp#FCP
 fcp-udp810/udp#FCP Datagram
 itm-mcell-s828/tcp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339055 - stable/11/tests/sys/opencrypto

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:59:06 2018
New Revision: 339055
URL: https://svnweb.freebsd.org/changeset/base/339055

Log:
  MFC r337911:
  
  Fix the sys/opencrypto/runtests test when aesni(4) is already loaded
  
  Apparently kldstat requires the full module name, including busname
  
  Reported by:  Jenkins

Modified:
  stable/11/tests/sys/opencrypto/runtests.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tests/sys/opencrypto/runtests.sh
==
--- stable/11/tests/sys/opencrypto/runtests.sh  Mon Oct  1 15:57:49 2018
(r339054)
+++ stable/11/tests/sys/opencrypto/runtests.sh  Mon Oct  1 15:59:06 2018
(r339055)
@@ -50,9 +50,9 @@ cleanup_tests()
 }
 trap cleanup_tests EXIT INT TERM
 
-for required_module in aesni cryptodev; do
+for required_module in nexus/aesni cryptodev; do
if ! kldstat -q -m $required_module; then
-   kldload $required_module
+   kldload ${required_module#nexus/}
loaded_modules="$loaded_modules $required_module"
fi
 done
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339052 - stable/11/sys/compat/freebsd32

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:49:43 2018
New Revision: 339052
URL: https://svnweb.freebsd.org/changeset/base/339052

Log:
  MFC r336871, r336874
  
  r336871:
  getrusage(2): fix return value under 32-bit emulation
  
  According to the man page, getrusage(2) should return EFAULT if the rusage
  argument lies outside of the process's address space. But due to an
  oversight in r100384, that's never been the case during 32-bit emulation.
  Fix it.
  
  PR:   230153
  Reported by:  tests(7)
  Reviewed by:  cem
  Differential Revision:https://reviews.freebsd.org/D16500
  
  r336874:
  freebsd32_getrusage(2): skip freebsd32_rusage_out on error
  
  PR:   230153
  Reported by:  kib
  X-MFC-With:   336871
  Differential Revision:https://reviews.freebsd.org/D16500

Modified:
  stable/11/sys/compat/freebsd32/freebsd32_misc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/11/sys/compat/freebsd32/freebsd32_misc.c Mon Oct  1 15:47:34 
2018(r339051)
+++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Mon Oct  1 15:49:43 
2018(r339052)
@@ -724,9 +724,7 @@ freebsd32_getrusage(struct thread *td, struct freebsd3
int error;
 
error = kern_getrusage(td, uap->who, );
-   if (error)
-   return (error);
-   if (uap->rusage != NULL) {
+   if (error == 0) {
freebsd32_rusage_out(, );
error = copyout(, uap->rusage, sizeof(s32));
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339054 - stable/11/usr.bin/tftp

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:57:49 2018
New Revision: 339054
URL: https://svnweb.freebsd.org/changeset/base/339054

Log:
  MFC r337779:
  
  tftp: Close a resource leak when putting files
  
  Reported by:  Coverity
  CID:  1394842

Modified:
  stable/11/usr.bin/tftp/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/tftp/main.c
==
--- stable/11/usr.bin/tftp/main.c   Mon Oct  1 15:56:42 2018
(r339053)
+++ stable/11/usr.bin/tftp/main.c   Mon Oct  1 15:57:49 2018
(r339054)
@@ -472,6 +472,7 @@ put(int argc, char *argv[])
printf("putting %s to %s:%s [%s]\n",
cp, hostname, targ, mode);
xmitfile(peer, port, fd, targ, mode);
+   close(fd);
return;
}
/* this assumes the target is a directory */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339043 - in head/sys: kern vm x86/acpica

2018-10-01 Thread Andrew Gallatin
Author: gallatin
Date: Mon Oct  1 14:14:21 2018
New Revision: 339043
URL: https://svnweb.freebsd.org/changeset/base/339043

Log:
  Allow empty NUMA memory domains to support Threadripper2
  
  The AMD Threadripper 2990WX is basically a slightly crippled Epyc.
  Rather than having 4 memory controllers, one per NUMA domain, it has
  only 2  memory controllers enabled. This means that only 2 of the
  4 NUMA domains can be populated with physical memory, and the
  others are empty.
  
  Add support to FreeBSD for empty NUMA domains by:
  
  - creating empty memory domains when parsing the SRAT table,
  rather than failing to parse the table
  - not running the pageout deamon threads in empty domains
  - adding defensive code to UMA to avoid allocating from empty domains
  - adding defensive code to cpuset to avoid binding to an empty domain
  Thanks to Jeff for suggesting this strategy.
  
  Reviewed by:  alc, markj
  Approved by:  re (gjb@)
  Differential Revision:https://reviews.freebsd.org/D1683

Modified:
  head/sys/kern/kern_cpuset.c
  head/sys/vm/uma_core.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pagequeue.h
  head/sys/x86/acpica/srat.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Mon Oct  1 14:05:31 2018(r339042)
+++ head/sys/kern/kern_cpuset.c Mon Oct  1 14:14:21 2018(r339043)
@@ -65,7 +65,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 
 #ifdef DDB
 #include 
@@ -479,6 +484,26 @@ _domainset_create(struct domainset *domain, struct dom
 }
 
 /*
+ * Are any of the domains in the mask empty? If so, silently
+ * remove them.  If only empty domains are present, we must
+ * return failure.
+ */
+static bool
+domainset_empty_vm(struct domainset *domain)
+{
+   int i, max;
+
+   max = DOMAINSET_FLS(>ds_mask) + 1;
+   for (i = 0; i < max; i++) {
+   if (DOMAINSET_ISSET(i, >ds_mask) &&
+   VM_DOMAIN_EMPTY(i))
+   DOMAINSET_CLR(i, >ds_mask);
+   }
+
+   return (DOMAINSET_EMPTY(>ds_mask));
+}
+
+/*
  * Create or lookup a domainset based on the key held in 'domain'.
  */
 struct domainset *
@@ -1360,6 +1385,7 @@ domainset_zero(void)
DOMAINSET_SET(i, >ds_mask);
dset->ds_policy = DOMAINSET_POLICY_FIRSTTOUCH;
dset->ds_prefer = -1;
+   (void)domainset_empty_vm(dset);
curthread->td_domain.dr_policy = _domainset_create(dset, NULL);
 
domainset_copy(dset, );
@@ -2086,6 +2112,13 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le
/* This will be constrained by domainset_shadow(). */
DOMAINSET_FILL(_mask);
}
+
+   /*
+*  When given an impossible policy, fall back to interleaving
+*  across all domains
+*/
+   if (domainset_empty_vm())
+   domainset_copy(, );
 
switch (level) {
case CPU_LEVEL_ROOT:

Modified: head/sys/vm/uma_core.c
==
--- head/sys/vm/uma_core.c  Mon Oct  1 14:05:31 2018(r339042)
+++ head/sys/vm/uma_core.c  Mon Oct  1 14:14:21 2018(r339043)
@@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2469,9 +2470,11 @@ zalloc_start:
if (bucket != NULL)
bucket_free(zone, bucket, udata);
 
-   if (zone->uz_flags & UMA_ZONE_NUMA)
+   if (zone->uz_flags & UMA_ZONE_NUMA) {
domain = PCPU_GET(domain);
-   else
+   if (VM_DOMAIN_EMPTY(domain))
+   domain = UMA_ANYDOMAIN;
+   } else
domain = UMA_ANYDOMAIN;
 
/* Short-circuit for zones without buckets and low memory. */
@@ -2647,7 +2650,11 @@ keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdo
rdomain = 0;
rr = rdomain == UMA_ANYDOMAIN;
if (rr) {
-   keg->uk_cursor = (keg->uk_cursor + 1) % vm_ndomains;
+   start = keg->uk_cursor;
+   do {
+   keg->uk_cursor = (keg->uk_cursor + 1) % vm_ndomains;
+   domain = keg->uk_cursor;
+   } while (VM_DOMAIN_EMPTY(domain) && domain != start);
domain = start = keg->uk_cursor;
/* Only block on the second pass. */
if ((flags & (M_WAITOK | M_NOVM)) == M_WAITOK)
@@ -2698,8 +2705,11 @@ again:
LIST_INSERT_HEAD(>ud_part_slab, slab, us_link);
return (slab);
}
-   if (rr)
-   domain = (domain + 1) % vm_ndomains;
+   if (rr) {
+   do {
+   domain = (domain + 1) % vm_ndomains;
+  

Re: svn commit: r335584 - head/sys/crypto/aesni

2018-10-01 Thread Alan Somers
On Sat, Jun 23, 2018 at 12:20 PM Conrad Meyer  wrote:

> Author: cem
> Date: Sat Jun 23 18:20:17 2018
> New Revision: 335584
> URL: https://svnweb.freebsd.org/changeset/base/335584
>
> Log:
>   aesni(4): Fix {de,en}crypt operations that allocated a buffer
>
>   aesni(4) allocates a contiguous buffer for the data it processes if the
>   provided input was not already virtually contiguous, and copies the input
>   there.  It performs encryption or decryption in-place.
>
>   r324037 removed the logic that then copied the processed data back to the
>   user-provided input buffer, breaking {de,enc}crypt for mbuf chains or
>   iovecs with more than a single descriptor.
>
>   PR:   228094 (probably, not confirmed)
>   Submitted by: Sean Fagan 
>   Reported by:  Emeric POUPON 
>   X-MFC-With:   324037
>   Security: could result in plaintext being output by "encrypt"
> operation
>
> Modified:
>   head/sys/crypto/aesni/aesni.c
>

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


svn commit: r339041 - head/libexec/rtld-elf/aarch64

2018-10-01 Thread Andrew Turner
Author: andrew
Date: Mon Oct  1 14:02:29 2018
New Revision: 339041
URL: https://svnweb.freebsd.org/changeset/base/339041

Log:
  Add STT_GNU_IFUNC and R_AARCH64_IRELATIVE support on arm64.
  
  This is based on the amd64 implementation. Support for both PLT and
  non-PLT (e.g. a global variable initilised with a pointer to an ifunc)
  cases are supported.
  
  We don't pass anything to the resolver as it is expected they will read
  the ID registers directly, with the number of registers with CPU info
  likely to increase in the future.
  
  Reviewed by:  kib
  Approved by:  re (gjb)
  Differential Revision:https://reviews.freebsd.org/D17341

Modified:
  head/libexec/rtld-elf/aarch64/reloc.c
  head/libexec/rtld-elf/aarch64/rtld_machdep.h

Modified: head/libexec/rtld-elf/aarch64/reloc.c
==
--- head/libexec/rtld-elf/aarch64/reloc.c   Mon Oct  1 13:09:18 2018
(r339040)
+++ head/libexec/rtld-elf/aarch64/reloc.c   Mon Oct  1 14:02:29 2018
(r339041)
@@ -218,6 +218,9 @@ reloc_plt(Obj_Entry *obj)
case R_AARCH64_TLSDESC:
reloc_tlsdesc(obj, rela, where);
break;
+   case R_AARCH64_IRELATIVE:
+   obj->irelative = true;
+   break;
default:
_rtld_error("Unknown relocation type %u in PLT",
(unsigned int)ELF_R_TYPE(rela->r_info));
@@ -242,19 +245,22 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
 
relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
for (rela = obj->pltrela; rela < relalim; rela++) {
-   Elf_Addr *where;
+   Elf_Addr *where, target;
 
where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
switch(ELF_R_TYPE(rela->r_info)) {
case R_AARCH64_JUMP_SLOT:
def = find_symdef(ELF_R_SYM(rela->r_info), obj,
, SYMLOOK_IN_PLT | flags, NULL, lockstate);
-   if (def == NULL) {
-   dbg("reloc_jmpslots: sym not found");
+   if (def == NULL)
return (-1);
+   if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) {
+   obj->gnu_ifunc = true;
+   continue;
}
-
-   *where = (Elf_Addr)(defobj->relocbase + def->st_value);
+   target = (Elf_Addr)(defobj->relocbase + def->st_value);
+   reloc_jmpslot(where, target, defobj, obj,
+   (const Elf_Rel *)rela);
break;
case R_AARCH64_TLSDESC:
if (ELF_R_SYM(rela->r_info) != 0) {
@@ -277,8 +283,24 @@ reloc_jmpslots(Obj_Entry *obj, int flags, RtldLockStat
 int
 reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate)
 {
+   const Elf_Rela *relalim;
+   const Elf_Rela *rela;
+   Elf_Addr *where, target, *ptr;
 
-   /* XXX not implemented */
+   if (!obj->irelative)
+   return (0);
+   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   for (rela = obj->pltrela;  rela < relalim;  rela++) {
+   if (ELF_R_TYPE(rela->r_info) == R_AARCH64_IRELATIVE) {
+   ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend);
+   where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
+   lock_release(rtld_bind_lock, lockstate);
+   target = call_ifunc_resolver(ptr);
+   wlock_acquire(rtld_bind_lock, lockstate);
+   *where = target;
+   }
+   }
+   obj->irelative = false;
return (0);
 }
 
@@ -286,8 +308,32 @@ int
 reloc_gnu_ifunc(Obj_Entry *obj, int flags,
struct Struct_RtldLockState *lockstate)
 {
+   const Elf_Rela *relalim;
+   const Elf_Rela *rela;
+   Elf_Addr *where, target;
+   const Elf_Sym *def;
+   const Obj_Entry *defobj;
 
-   /* XXX not implemented */
+   if (!obj->gnu_ifunc)
+   return (0);
+   relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize);
+   for (rela = obj->pltrela;  rela < relalim;  rela++) {
+   if (ELF_R_TYPE(rela->r_info) == R_AARCH64_JUMP_SLOT) {
+   where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
+   def = find_symdef(ELF_R_SYM(rela->r_info), obj, ,
+   SYMLOOK_IN_PLT | flags, NULL, lockstate);
+   if (def == NULL)
+   return (-1);
+   if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC)
+   continue;
+   

svn commit: r339050 - stable/11/contrib/netbsd-tests/fs

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:45:20 2018
New Revision: 339050
URL: https://svnweb.freebsd.org/changeset/base/339050

Log:
  MFC r336594:
  
  Fix tmpfs detection in the sys/fs/tmpfs tests
  
  This code was originally written for NetBSD.  r306031 tried to adapt it to
  FreeBSD, but didn't correctly handle the case that tmpfs was available, but
  not already loaded.  Fix the logic to load the module if necessary.  The
  tmpfs tests shouldn't be skipped anymore.
  
  Also, fix a comment that was dislocated by r306031.
  
  Reported by:  Jenkins

Modified:
  stable/11/contrib/netbsd-tests/fs/h_funcs.subr
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/netbsd-tests/fs/h_funcs.subr
==
--- stable/11/contrib/netbsd-tests/fs/h_funcs.subr  Mon Oct  1 15:43:56 
2018(r339049)
+++ stable/11/contrib/netbsd-tests/fs/h_funcs.subr  Mon Oct  1 15:45:20 
2018(r339050)
@@ -43,17 +43,17 @@ require_fs() {
atf_require_prog mount_${name}
atf_require_prog umount
 
-   # if we have autoloadable modules, just assume the file system
-   atf_require_prog sysctl
# Begin FreeBSD
if true; then
-   if kldstat -m ${name}; then
+   if kldload -n ${name}; then
found=yes
else
found=no
fi
else
# End FreeBSD
+   # if we have autoloadable modules, just assume the file system
+   atf_require_prog sysctl
autoload=$(sysctl -n kern.module.autoload)
[ "${autoload}" = "1" ] && return 0
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339049 - stable/11/libexec/tftpd

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:43:56 2018
New Revision: 339049
URL: https://svnweb.freebsd.org/changeset/base/339049

Log:
  MFC r336587:
  
  tftpd(8): when completing an WRQ, flush the file before acknowleding receipt
  
  tftpd(8) should flush a newly written file to disk before ACKing the final 
DATA
  packet.  Otherwise there is a narrow race window when a subsequent read may 
not
  see the file.  This is somewhat related to r330710, but the race window is 
much
  smaller.  Hopefully this will fix the intermittent tests in Jenkins.
  
  Reported by:  Jenkins

Modified:
  stable/11/libexec/tftpd/tftp-transfer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/tftpd/tftp-transfer.c
==
--- stable/11/libexec/tftpd/tftp-transfer.c Mon Oct  1 15:40:06 2018
(r339048)
+++ stable/11/libexec/tftpd/tftp-transfer.c Mon Oct  1 15:43:56 2018
(r339049)
@@ -277,6 +277,8 @@ tftp_receive(int peer, uint16_t *block, struct tftp_st
send_error(peer, ENOSPACE);
goto abort;
}
+   if (n_data != segsize)
+   write_close();
}
 
 send_ack:
@@ -301,8 +303,6 @@ send_ack:
}
gettimeofday(&(ts->tstop), NULL);
} while (n_data == segsize);
-
-   write_close();
 
/* Don't do late packet management for the client implementation */
if (acting_as_client)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339048 - stable/11/usr.sbin/makefs/tests

2018-10-01 Thread Alan Somers
Author: asomers
Date: Mon Oct  1 15:40:06 2018
New Revision: 339048
URL: https://svnweb.freebsd.org/changeset/base/339048

Log:
  MFC r336582:
  
  makefs(8): add test case for PR 229929
  
  Fix two failing makefs test cases by adding "-M 1m", which was already used
  for every other FFS test case.  Add a new test case for the underlying
  issue: with no -M, -m, or -s options, makefs can underestimate image size.
  
  PR:   229929
  Reported by:  Jenkins

Modified:
  stable/11/usr.sbin/makefs/tests/makefs_ffs_tests.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/makefs/tests/makefs_ffs_tests.sh
==
--- stable/11/usr.sbin/makefs/tests/makefs_ffs_tests.sh Mon Oct  1 14:57:33 
2018(r339047)
+++ stable/11/usr.sbin/makefs/tests/makefs_ffs_tests.sh Mon Oct  1 15:40:06 
2018(r339048)
@@ -53,6 +53,29 @@ check_ffs_image_contents()
check_image_contents "$@"
 }
 
+# With no -M, -m, or -s options, makefs should autocalculate the image size
+atf_test_case autocalculate_image_size cleanup
+autocalculate_image_size_body()
+{
+   atf_expect_fail "PR 229929 makefs(8) can underestimate image size"
+   create_test_inputs
+
+   atf_check -e empty -o save:$TEST_SPEC_FILE -s exit:0 \
+   mtree -c -k "$DEFAULT_MTREE_KEYWORDS" -p $TEST_INPUTS_DIR
+
+   cd $TEST_INPUTS_DIR
+   atf_check -e empty -o not-empty -s exit:0 \
+   $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
+   cd -
+
+   mount_image
+   check_ffs_image_contents
+}
+autocalculate_image_size_cleanup()
+{
+   common_cleanup
+}
+
 atf_test_case D_flag cleanup
 D_flag_body()
 {
@@ -109,7 +132,7 @@ from_mtree_spec_file_body()
 
cd $TEST_INPUTS_DIR
atf_check -e empty -o not-empty -s exit:0 \
-   $MAKEFS $TEST_IMAGE $TEST_SPEC_FILE
+   $MAKEFS -M 1m $TEST_IMAGE $TEST_SPEC_FILE
cd -
 
mount_image
@@ -132,7 +155,7 @@ from_multiple_dirs_body()
touch $test_inputs_dir2/multiple_dirs_test_file
 
atf_check -e empty -o not-empty -s exit:0 \
-   $MAKEFS $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
+   $MAKEFS -M 1m $TEST_IMAGE $TEST_INPUTS_DIR $test_inputs_dir2
 
mount_image
check_image_contents -d $test_inputs_dir2
@@ -224,6 +247,8 @@ o_flag_version_2_cleanup()
 
 atf_init_test_cases()
 {
+
+   atf_add_test_case autocalculate_image_size
 
atf_add_test_case D_flag
atf_add_test_case F_flag
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r338617 - in stable/11: lib/libc/sys sys/compat/freebsd32 sys/kern sys/netinet sys/netinet6 sys/sys tools/regression/sockets/udp_pingpong tools/regression/sockets/unix_cmsg

2018-10-01 Thread Alan Somers
On Wed, Sep 12, 2018 at 12:52 PM Maxim Sobolev  wrote:

> Author: sobomax
> Date: Wed Sep 12 18:52:18 2018
> New Revision: 338617
> URL: https://svnweb.freebsd.org/changeset/base/338617
>
> Log:
>   MFC r312296 and r323254, which is new a socket option
>   SO_TS_CLOCK to pick from several different clock sources to
>   return timestamps when SO_TIMESTAMP is enabled and two
>   new nanosecond-precision timestamp types. This also fixes
>   recvmsg32() system call to properly down-convert layout of the
>   64-bit structures to match what 32-bit app(s) expect.
>
>   Bump __FreeBSD_version to indicate presence of a new
>   functionality.
>
>   Differential Revision:https://reviews.freebsd.org/D9171
>
> Added:
>   stable/11/tools/regression/sockets/udp_pingpong/
>  - copied from r312296, head/tools/regression/sockets/udp_pingpong/
> Modified:
>   stable/11/lib/libc/sys/getsockopt.2
>   stable/11/sys/compat/freebsd32/freebsd32.h
>   stable/11/sys/compat/freebsd32/freebsd32_misc.c
>   stable/11/sys/kern/uipc_socket.c
>   stable/11/sys/kern/uipc_usrreq.c
>   stable/11/sys/netinet/ip_input.c
>   stable/11/sys/netinet6/ip6_input.c
>   stable/11/sys/sys/param.h
>   stable/11/sys/sys/socket.h
>   stable/11/sys/sys/socketvar.h
>   stable/11/tools/regression/sockets/unix_cmsg/Makefile
>   stable/11/tools/regression/sockets/unix_cmsg/unix_cmsg.c
> Directory Properties:
>   stable/11/   (props changed)
>

This change broke the build of tools/regression/sockets/unix_cmsg on
stable/11.  It looks like you need to MFC r309554 first.

 unix_cmsg.c:55:10: fatal error: 'uc_common.h' file not found
#include "uc_common.h"
 ^
1 error
generated.

*** Error code 1

Stop.

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


Re: svn commit: r339043 - in head/sys: kern vm x86/acpica

2018-10-01 Thread Andrew Gallatin

On 10/1/18 10:14 AM, Andrew Gallatin wrote:

Author: gallatin
Date: Mon Oct  1 14:14:21 2018
New Revision: 339043
URL: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__svnweb.freebsd.org_changeset_base_339043=DwIDaQ=imBPVzF25OnBgGmVOlcsiEgHoG1i6YHLR0Sj_gZ4adc=Ed-falealxPeqc22ehgAUCLh8zlZbibZLSMWJeZro4A=vFxrWMxnRsVgXYUUeDU3mY3EdLAlur-SanLWzMxFWow=a6s6FleHIdYhZF1D_SqEOf9apgxdQ2RBvF0HcKicCus=

Log:
   Allow empty NUMA memory domains to support Threadripper2
   
   The AMD Threadripper 2990WX is basically a slightly crippled Epyc.

   Rather than having 4 memory controllers, one per NUMA domain, it has
   only 2  memory controllers enabled. This means that only 2 of the
   4 NUMA domains can be populated with physical memory, and the
   others are empty.
   
   Add support to FreeBSD for empty NUMA domains by:
   
   - creating empty memory domains when parsing the SRAT table,

   rather than failing to parse the table
   - not running the pageout deamon threads in empty domains
   - adding defensive code to UMA to avoid allocating from empty domains
   - adding defensive code to cpuset to avoid binding to an empty domain
   Thanks to Jeff for suggesting this strategy.
   
   Reviewed by:	alc, markj

   Approved by: re (gjb@)
   Differential Revision:   https://reviews.freebsd.org/D1683


Whoops, cut-and-paste error.  The Differential Revision should have 
been: https://reviews.freebsd.org/D16836


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


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

2018-10-01 Thread Mark Johnston
Author: markj
Date: Mon Oct  1 14:47:49 2018
New Revision: 339046
URL: https://svnweb.freebsd.org/changeset/base/339046

Log:
  Count bootstrap data as resident in the kernel pmap.
  
  Such data may later be unmapped.  This occurs, for example, when a
  loader-provided microcode update file is discarded.
  
  Reviewed by:  alc, kib
  Approved by:  re (gjb)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17340

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Oct  1 14:39:59 2018(r339045)
+++ head/sys/amd64/amd64/pmap.c Mon Oct  1 14:47:49 2018(r339046)
@@ -1098,9 +1098,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
vm_offset_t va;
pt_entry_t *pte;
uint64_t cr4;
+   u_long res;
int i;
 
KERNend = *firstaddr;
+   res = atop(KERNend - (vm_paddr_t)kernphys);
 
if (!pti)
pg_g = X86_PG_G;
@@ -1120,10 +1122,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
vm_phys_add_seg(KPTphys, KPTphys + ptoa(nkpt));
 
virtual_avail = (vm_offset_t) KERNBASE + *firstaddr;
-
virtual_end = VM_MAX_KERNEL_ADDRESS;
 
-
/*
 * Enable PG_G global pages, then switch to the kernel page
 * table from the bootstrap page table.  After the switch, it
@@ -1142,6 +1142,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 
/*
 * Initialize the kernel pmap (which is statically allocated).
+* Count bootstrap data as being resident.
 */
PMAP_LOCK_INIT(kernel_pmap);
kernel_pmap->pm_pml4 = (pdp_entry_t *)PHYS_TO_DMAP(KPML4phys);
@@ -1149,6 +1150,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
kernel_pmap->pm_ucr3 = PMAP_NO_CR3;
CPU_FILL(_pmap->pm_active);  /* don't allow deactivation */
TAILQ_INIT(_pmap->pm_pvchunk);
+   kernel_pmap->pm_stats.resident_count = res;
kernel_pmap->pm_flags = pmap_flags;
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339044 - head/sys/arm64/include

2018-10-01 Thread Emmanuel Vadot
Author: manu
Date: Mon Oct  1 14:27:53 2018
New Revision: 339044
URL: https://svnweb.freebsd.org/changeset/base/339044

Log:
  arm64: Raise again L3 table for early devmap
  
  The initial raise in r336519 wasn't enough for using big resolution
  (1920 x 1200 for example). Raise it again.
  
  Reported by:  bob prohaska 
  Tested by:bob prohaska 
  Approved by:  re (gjb@)

Modified:
  head/sys/arm64/include/pte.h

Modified: head/sys/arm64/include/pte.h
==
--- head/sys/arm64/include/pte.hMon Oct  1 14:14:21 2018
(r339043)
+++ head/sys/arm64/include/pte.hMon Oct  1 14:27:53 2018
(r339044)
@@ -109,7 +109,7 @@ typedef uint64_tpt_entry_t; /* page 
table entry */
/* 0x2 also marks an invalid address */
 #defineL3_PAGE 0x3
 
-#definePMAP_MAPDEV_EARLY_SIZE  (L2_SIZE * 4)
+#definePMAP_MAPDEV_EARLY_SIZE  (L2_SIZE * 8)
 
 #defineL0_ENTRIES_SHIFT 9
 #defineL0_ENTRIES  (1 << L0_ENTRIES_SHIFT)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r339042 - head/sys/netinet

2018-10-01 Thread Michael Tuexen
> On 1. Oct 2018, at 16:05, Michael Tuexen  wrote:
> 
> Author: tuexen
> Date: Mon Oct  1 14:05:31 2018
> New Revision: 339042
> URL: https://svnweb.freebsd.org/changeset/base/339042
> 
> Log:
>  Mitigate providing a timing signal if the COOKIE or AUTH
>  validation fails.
>  Thanks to jmg@ for reporting the issue, which was discussed in
>  https://admbugs.freebsd.org/show_bug.cgi?id=878
> 
>  Approved by:re (TBD@)
Should have been re (gjb@).

Best regards
Michael
>  MFC after:  1 week
> 
> Modified:
>  head/sys/netinet/sctp_auth.c
>  head/sys/netinet/sctp_input.c
> 
> Modified: head/sys/netinet/sctp_auth.c
> ==
> --- head/sys/netinet/sctp_auth.c  Mon Oct  1 14:02:29 2018
> (r339041)
> +++ head/sys/netinet/sctp_auth.c  Mon Oct  1 14:05:31 2018
> (r339042)
> @@ -1706,7 +1706,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au
>   m, offset, computed_digest);
> 
>   /* compare the computed digest with the one in the AUTH chunk */
> - if (memcmp(digest, computed_digest, digestlen) != 0) {
> + if (timingsafe_bcmp(digest, computed_digest, digestlen) != 0) {
>   SCTP_STAT_INCR(sctps_recvauthfailed);
>   SCTPDBG(SCTP_DEBUG_AUTH1,
>   "SCTP Auth: HMAC digest check failed\n");
> 
> Modified: head/sys/netinet/sctp_input.c
> ==
> --- head/sys/netinet/sctp_input.c Mon Oct  1 14:02:29 2018
> (r339041)
> +++ head/sys/netinet/sctp_input.c Mon Oct  1 14:05:31 2018
> (r339042)
> @@ -2554,7 +2554,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
>   return (NULL);
>   }
>   /* compare the received digest with the computed digest */
> - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) {
> + if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) {
>   /* try the old cookie? */
>   if ((cookie->time_entered.tv_sec == 
> (long)ep->time_of_secret_change) &&
>   (ep->current_secret_number != ep->last_secret_number)) {
> @@ -2563,7 +2563,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
>   (uint8_t 
> *)ep->secret_key[(int)ep->last_secret_number],
>   SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0);
>   /* compare */
> - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0)
> + if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) 
> == 0)
>   cookie_ok = 1;
>   }
>   } else {
> 

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


svn commit: r339042 - head/sys/netinet

2018-10-01 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct  1 14:05:31 2018
New Revision: 339042
URL: https://svnweb.freebsd.org/changeset/base/339042

Log:
  Mitigate providing a timing signal if the COOKIE or AUTH
  validation fails.
  Thanks to jmg@ for reporting the issue, which was discussed in
  https://admbugs.freebsd.org/show_bug.cgi?id=878
  
  Approved by:re (TBD@)
  MFC after:  1 week

Modified:
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_auth.c
==
--- head/sys/netinet/sctp_auth.cMon Oct  1 14:02:29 2018
(r339041)
+++ head/sys/netinet/sctp_auth.cMon Oct  1 14:05:31 2018
(r339042)
@@ -1706,7 +1706,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au
m, offset, computed_digest);
 
/* compare the computed digest with the one in the AUTH chunk */
-   if (memcmp(digest, computed_digest, digestlen) != 0) {
+   if (timingsafe_bcmp(digest, computed_digest, digestlen) != 0) {
SCTP_STAT_INCR(sctps_recvauthfailed);
SCTPDBG(SCTP_DEBUG_AUTH1,
"SCTP Auth: HMAC digest check failed\n");

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Mon Oct  1 14:02:29 2018
(r339041)
+++ head/sys/netinet/sctp_input.c   Mon Oct  1 14:05:31 2018
(r339042)
@@ -2554,7 +2554,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
return (NULL);
}
/* compare the received digest with the computed digest */
-   if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) {
+   if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) != 0) {
/* try the old cookie? */
if ((cookie->time_entered.tv_sec == 
(long)ep->time_of_secret_change) &&
(ep->current_secret_number != ep->last_secret_number)) {
@@ -2563,7 +2563,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in
(uint8_t 
*)ep->secret_key[(int)ep->last_secret_number],
SCTP_SECRET_SIZE, m, cookie_offset, calc_sig, 0);
/* compare */
-   if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) == 0)
+   if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) 
== 0)
cookie_ok = 1;
}
} else {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339040 - head/sys/netinet

2018-10-01 Thread Michael Tuexen
Author: tuexen
Date: Mon Oct  1 13:09:18 2018
New Revision: 339040
URL: https://svnweb.freebsd.org/changeset/base/339040

Log:
  After allocating chunks set the fields in a consistent way.
  This removes two assignments for the flags field being done
  twice and adds one, which was missing.
  Thanks to Felix Weinrank for reporting the issue he found
  by using fuzz testing of the userland stack.
  
  Approved by:re (kib@)
  MFC after:  1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Mon Oct  1 10:46:00 2018
(r339039)
+++ head/sys/netinet/sctp_output.c  Mon Oct  1 13:09:18 2018
(r339040)
@@ -8975,14 +8975,15 @@ sctp_queue_op_err(struct sctp_tcb *stcb, struct mbuf *
return;
}
chk->copy_by_ref = 0;
+   chk->rec.chunk_id.id = SCTP_OPERATION_ERROR;
+   chk->rec.chunk_id.can_take_data = 0;
+   chk->flags = 0;
chk->send_size = (uint16_t)chunk_length;
chk->sent = SCTP_DATAGRAM_UNSENT;
chk->snd_count = 0;
chk->asoc = >asoc;
chk->data = op_err;
chk->whoTo = NULL;
-   chk->rec.chunk_id.id = SCTP_OPERATION_ERROR;
-   chk->rec.chunk_id.can_take_data = 0;
hdr = mtod(op_err, struct sctp_chunkhdr *);
hdr->chunk_type = SCTP_OPERATION_ERROR;
hdr->chunk_flags = 0;
@@ -9204,7 +9205,6 @@ sctp_send_shutdown_ack(struct sctp_tcb *stcb, struct s
chk->send_size = sizeof(struct sctp_chunkhdr);
chk->sent = SCTP_DATAGRAM_UNSENT;
chk->snd_count = 0;
-   chk->flags = 0;
chk->asoc = >asoc;
chk->data = m_shutdown_ack;
chk->whoTo = net;
@@ -9259,7 +9259,6 @@ sctp_send_shutdown(struct sctp_tcb *stcb, struct sctp_
chk->send_size = sizeof(struct sctp_shutdown_chunk);
chk->sent = SCTP_DATAGRAM_UNSENT;
chk->snd_count = 0;
-   chk->flags = 0;
chk->asoc = >asoc;
chk->data = m_shutdown;
chk->whoTo = net;
@@ -12168,7 +12167,6 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb,
chk->book_size = sizeof(struct sctp_chunkhdr);
chk->send_size = SCTP_SIZE32(chk->book_size);
chk->book_size_scale = 0;
-
chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
if (chk->data == NULL) {
sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339038 - head/sys/dev/iwm

2018-10-01 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Oct  1 10:44:33 2018
New Revision: 339038
URL: https://svnweb.freebsd.org/changeset/base/339038

Log:
  Fix the MODULE_PNP_INFO() for iwm(4) where I got the bus and module
  arguments wrong in r339020.
  
  PR:   231625
  Reported by:  Yuri Pankov (yuripv yuripv.net)
  Reviewed by:  cem, Yuri Pankov (yuripv yuripv.net)
  Approved by:  re (kib)
  Pointyhat to: bz (a rather big one for this one)

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Oct  1 09:40:41 2018(r339037)
+++ head/sys/dev/iwm/if_iwm.c   Mon Oct  1 10:44:33 2018(r339038)
@@ -6460,7 +6460,7 @@ static driver_t iwm_pci_driver = {
 static devclass_t iwm_devclass;
 
 DRIVER_MODULE(iwm, pci, iwm_pci_driver, iwm_devclass, NULL, NULL);
-MODULE_PNP_INFO("U16:device;P:#;T:vendor=0x8086", iwm_pci_driver, iwm,
+MODULE_PNP_INFO("U16:device;P:#;T:vendor=0x8086", pci, iwm_pci_driver,
 iwm_devices, nitems(iwm_devices));
 MODULE_DEPEND(iwm, firmware, 1, 1, 1);
 MODULE_DEPEND(iwm, pci, 1, 1, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339039 - head/sys/netinet

2018-10-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Oct  1 10:46:00 2018
New Revision: 339039
URL: https://svnweb.freebsd.org/changeset/base/339039

Log:
  Add INP_INFO_WUNLOCK_ASSERT() macro and use it instead of
  INP_INFO_UNLOCK_ASSERT() in TCP-related code. For encapsulated traffic
  it is possible, that the code is running in net_epoch_preempt section,
  and INP_INFO_UNLOCK_ASSERT() is very strict assertion for such case.
  
  PR:   231428
  Reviewed by:  mmacy, tuexen
  Approved by:  re (kib)
  Differential Revision:https://reviews.freebsd.org/D17335

Modified:
  head/sys/netinet/in_pcb.h
  head/sys/netinet/siftr.c
  head/sys/netinet/tcp_hpts.c
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Mon Oct  1 10:44:33 2018(r339038)
+++ head/sys/netinet/in_pcb.h   Mon Oct  1 10:46:00 2018(r339039)
@@ -642,6 +642,8 @@ int inp_so_options(const struct inpcb *inp);
 #defineINP_INFO_LOCK_ASSERT(ipi)   
MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_lock))
 #define INP_INFO_RLOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt))
 #define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_lock, MA_OWNED)
+#define INP_INFO_WUNLOCK_ASSERT(ipi)   \
+   mtx_assert(&(ipi)->ipi_lock, MA_NOTOWNED)
 #define INP_INFO_UNLOCK_ASSERT(ipi)MPASS(!in_epoch(net_epoch_preempt) && 
!mtx_owned(&(ipi)->ipi_lock))
 
 #define INP_LIST_LOCK_INIT(ipi, d) \

Modified: head/sys/netinet/siftr.c
==
--- head/sys/netinet/siftr.cMon Oct  1 10:44:33 2018(r339038)
+++ head/sys/netinet/siftr.cMon Oct  1 10:46:00 2018(r339039)
@@ -710,7 +710,7 @@ siftr_findinpcb(int ipver, struct ip *ip, struct mbuf 
struct inpcb *inp;
 
/* We need the tcbinfo lock. */
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
 
if (dir == PFIL_IN)
inp = (ipver == INP_IPV4 ?

Modified: head/sys/netinet/tcp_hpts.c
==
--- head/sys/netinet/tcp_hpts.c Mon Oct  1 10:44:33 2018(r339038)
+++ head/sys/netinet/tcp_hpts.c Mon Oct  1 10:46:00 2018(r339039)
@@ -1282,7 +1282,7 @@ out:
 * lock again but we also need some kasserts
 * here.
 */
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
INP_UNLOCK_ASSERT(inp);
m = n;
if (m)
@@ -1324,7 +1324,7 @@ out:
INP_WUNLOCK(inp);
if (ti_locked == TI_RLOCKED)
INP_INFO_RUNLOCK_ET(_tcbinfo, et);
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
INP_UNLOCK_ASSERT(inp);
ti_locked = TI_UNLOCKED;
mtx_lock(>p_mtx);

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cMon Oct  1 10:44:33 2018
(r339038)
+++ head/sys/netinet/tcp_input.cMon Oct  1 10:46:00 2018
(r339039)
@@ -800,7 +800,7 @@ findpcb:
if (ti_locked == TI_RLOCKED) {
INP_INFO_RLOCK_ASSERT(_tcbinfo);
} else {
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
}
 #endif
 #ifdef INET6
@@ -1358,7 +1358,7 @@ tfo_socket_result:
INP_INFO_RUNLOCK_ET(_tcbinfo, et);
ti_locked = TI_UNLOCKED;
}
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
return (IPPROTO_DONE);
} else if (tp->t_state == TCPS_LISTEN) {
/*
@@ -1405,7 +1405,7 @@ dropwithreset:
else {
KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropwithreset "
"ti_locked: %d", __func__, ti_locked));
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
}
 #endif
 
@@ -1429,7 +1429,7 @@ dropunlock:
else {
KASSERT(ti_locked == TI_UNLOCKED, ("%s: dropunlock "
"ti_locked: %d", __func__, ti_locked));
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
}
 #endif
 
@@ -1437,7 +1437,7 @@ dropunlock:
INP_WUNLOCK(inp);
 
 drop:
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
+   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
if (s != NULL)
free(s, M_TCPLOG);
if (m != NULL)

svn commit: r339037 - stable/11/sys/netinet

2018-10-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Oct  1 09:40:41 2018
New Revision: 339037
URL: https://svnweb.freebsd.org/changeset/base/339037

Log:
  MFC r313168 (by pkelsey):
Fix VIMAGE-related bugs in TFO.  The autokey callout vnet context was
not being initialized, and the per-vnet fastopen context was only
being initialized for the default vnet.
  
PR: 216613

Modified:
  stable/11/sys/netinet/tcp_fastopen.c
  stable/11/sys/netinet/tcp_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_fastopen.c
==
--- stable/11/sys/netinet/tcp_fastopen.cMon Oct  1 08:49:47 2018
(r339036)
+++ stable/11/sys/netinet/tcp_fastopen.cMon Oct  1 09:40:41 2018
(r339037)
@@ -209,6 +209,7 @@ tcp_fastopen_init(void)
rm_init(_tcp_fastopen_keylock, "tfo_keylock");
callout_init_rm(_tcp_fastopen_autokey_ctx.c,
_tcp_fastopen_keylock, 0);
+   V_tcp_fastopen_autokey_ctx.v = curvnet;
V_tcp_fastopen_keys.newest = TCP_FASTOPEN_MAX_KEYS - 1;
 }
 

Modified: stable/11/sys/netinet/tcp_subr.c
==
--- stable/11/sys/netinet/tcp_subr.cMon Oct  1 08:49:47 2018
(r339036)
+++ stable/11/sys/netinet/tcp_subr.cMon Oct  1 09:40:41 2018
(r339037)
@@ -655,6 +655,10 @@ tcp_init(void)
V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 
+#ifdef TCP_RFC7413
+   tcp_fastopen_init();
+#endif
+
/* Skip initialization of globals for non-default instances. */
if (!IS_DEFAULT_VNET(curvnet))
return;
@@ -707,10 +711,6 @@ tcp_init(void)
EVENTHANDLER_PRI_ANY);
 #ifdef TCPPCAP
tcp_pcap_init();
-#endif
-
-#ifdef TCP_RFC7413
-   tcp_fastopen_init();
 #endif
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339036 - stable/11/sbin/ifconfig

2018-10-01 Thread Andrey V. Elsukov
Author: ae
Date: Mon Oct  1 08:49:47 2018
New Revision: 339036
URL: https://svnweb.freebsd.org/changeset/base/339036

Log:
  MFC r338890:
Update ifr_name before invoking IPSECSREQID ioctl, this fixes the case,
when `ifconfig ipsec create reqid N` command invoked without interface
unit number. The "name" global variable is updated after interface
cloning in the ifclonecreate() and contains actual interface name.
  
Reported by:lev

Modified:
  stable/11/sbin/ifconfig/ifipsec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ifconfig/ifipsec.c
==
--- stable/11/sbin/ifconfig/ifipsec.c   Mon Oct  1 07:49:16 2018
(r339035)
+++ stable/11/sbin/ifconfig/ifipsec.c   Mon Oct  1 08:49:47 2018
(r339036)
@@ -72,6 +72,7 @@ DECL_CMD_FUNC(setreqid, val, arg)
warn("Invalid reqid value %s", val);
return;
}
+   strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_data = (char *)
if (ioctl(s, IPSECSREQID, ) == -1) {
warn("ioctl(IPSECSREQID)");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r339035 - stable/11/sys/netinet

2018-10-01 Thread Steven Hartland
Author: smh
Date: Mon Oct  1 07:49:16 2018
New Revision: 339035
URL: https://svnweb.freebsd.org/changeset/base/339035

Log:
  MFC r336165:
  
  Removed pointless NULL check in rip_pcblist.
  
  Sponsored by: Multiplay

Modified:
  stable/11/sys/netinet/raw_ip.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/raw_ip.c
==
--- stable/11/sys/netinet/raw_ip.c  Mon Oct  1 04:08:47 2018
(r339034)
+++ stable/11/sys/netinet/raw_ip.c  Mon Oct  1 07:49:16 2018
(r339035)
@@ -1053,8 +1053,6 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
return (error);
 
inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
-   if (inp_list == NULL)
-   return (ENOMEM);
 
INP_INFO_RLOCK(_ripcbinfo);
for (inp = LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp && i < n;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"