svn commit: r324657 - head/usr.sbin/wlandebug

2017-10-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Oct 16 07:01:27 2017
New Revision: 324657
URL: https://svnweb.freebsd.org/changeset/base/324657

Log:
  wlandebug(8): obtain original interface name via ifconfig_get_orig_name()

Modified:
  head/usr.sbin/wlandebug/Makefile
  head/usr.sbin/wlandebug/wlandebug.c

Modified: head/usr.sbin/wlandebug/Makefile
==
--- head/usr.sbin/wlandebug/MakefileMon Oct 16 06:54:26 2017
(r324656)
+++ head/usr.sbin/wlandebug/MakefileMon Oct 16 07:01:27 2017
(r324657)
@@ -3,6 +3,8 @@
 PROG=  wlandebug
 MAN=   wlandebug.8
 
+LIBADD+=   ifconfig
+
 WARNS?=2
 
 .include 

Modified: head/usr.sbin/wlandebug/wlandebug.c
==
--- head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 06:54:26 2017
(r324656)
+++ head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:01:27 2017
(r324657)
@@ -43,6 +43,8 @@
 #include 
 #include 
 
+#include 
+
 #defineN(a)(sizeof(a)/sizeof(a[0]))
 
 const char *progname;
@@ -160,6 +162,21 @@ setoid(char oid[], size_t oidlen, const char *wlan)
 #endif
 }
 
+static void
+get_orig_iface_name(char *oid, size_t oid_size, char *name)
+{
+   struct ifconfig_handle *h;
+   char *orig_name;
+
+   h = ifconfig_open();
+   if (ifconfig_get_orig_name(h, name, &orig_name) < 0)
+   errc(1, ifconfig_err_errno(h), "cannot get interface name");
+
+   ifconfig_close(h);
+   setoid(oid, oid_size, orig_name);
+   free(orig_name);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -179,9 +196,7 @@ main(int argc, char *argv[])
} else if (strcmp(argv[1], "-i") == 0) {
if (argc <= 2)
errx(1, "missing interface name for -i option");
-   if (strncmp(argv[2], "wlan", 4) != 0)
-   errx(1, "expecting a wlan interface name");
-   setoid(oid, sizeof(oid), argv[2]);
+   get_orig_iface_name(oid, sizeof(oid), argv[2]);
argc -= 2, argv += 2;
} else if (strcmp(argv[1], "-?") == 0)
usage();
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324658 - head/usr.sbin/wlandebug

2017-10-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Oct 16 07:15:50 2017
New Revision: 324658
URL: https://svnweb.freebsd.org/changeset/base/324658

Log:
  wlandebug(8): add a sanity check.

Modified:
  head/usr.sbin/wlandebug/wlandebug.c

Modified: head/usr.sbin/wlandebug/wlandebug.c
==
--- head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:01:27 2017
(r324657)
+++ head/usr.sbin/wlandebug/wlandebug.c Mon Oct 16 07:15:50 2017
(r324658)
@@ -172,6 +172,9 @@ get_orig_iface_name(char *oid, size_t oid_size, char *
if (ifconfig_get_orig_name(h, name, &orig_name) < 0)
errc(1, ifconfig_err_errno(h), "cannot get interface name");
 
+   if (strlen(orig_name) < strlen("wlan") + 1)
+   errx(1, "expecting a wlan interface name");
+
ifconfig_close(h);
setoid(oid, oid_size, orig_name);
free(orig_name);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324656 - head/lib/libifconfig

2017-10-16 Thread Baptiste Daroussin
On Mon, Oct 16, 2017 at 06:54:26AM +, Andriy Voskoboinyk wrote:
> Author: avos
> Date: Mon Oct 16 06:54:26 2017
> New Revision: 324656
> URL: https://svnweb.freebsd.org/changeset/base/324656
> 
> Log:
>   libifconfig: allow to get original interface name via 
> ifconfig_get_orig_name()
>   
>   Uses the same method as in tools/tools/ifinfo/ifinfo.c
>   (via net.link.generic sysctl).
>   
>   Tested with modified wlandebug(8).
>   
>   Differential Revision:  https://reviews.freebsd.org/D12554
> 
> Modified:
>   head/lib/libifconfig/libifconfig.c
>   head/lib/libifconfig/libifconfig.h
> 
> Modified: head/lib/libifconfig/libifconfig.c
> ==
> --- head/lib/libifconfig/libifconfig.cMon Oct 16 04:46:28 2017
> (r324655)
> +++ head/lib/libifconfig/libifconfig.cMon Oct 16 06:54:26 2017
> (r324656)
> @@ -61,9 +61,43 @@
>   * $FreeBSD$
>   */
>  
> + /*
> + * Copyright 1996 Massachusetts Institute of Technology
> + *
1996?

This file was already under a BSD license, why adding an extra MIT license to
it? It would be better to keep it under BSD license imho

Best regards,
Bapt


signature.asc
Description: PGP signature


Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Andrew Turner

> On 16 Oct 2017, at 04:59, Warner Losh  wrote:
> 
> Author: imp
> Date: Mon Oct 16 03:59:11 2017
> New Revision: 324646
> URL: https://svnweb.freebsd.org/changeset/base/324646
> 
> Log:
>  Unify boot1 with loader
> 
>  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
>  to use the common efi_main.c.
> 
>  Submitted by: Eric McCorkle
>  Differential Revision: https://reviews.freebsd.org/D10447
> 
> Added:
>  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
> - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
> Deleted:
>  head/sys/boot/efi/boot1/boot_module.h
>  head/sys/boot/efi/boot1/ufs_module.c
>  head/sys/boot/efi/boot1/zfs_module.c
>  head/sys/boot/efi/loader/efi_main.c
> Modified:
>  head/sys/boot/efi/boot1/Makefile
>  head/sys/boot/efi/boot1/boot1.c
>  head/sys/boot/efi/libefi/Makefile
>  head/sys/boot/efi/loader/Makefile

Hello Warner,

After this change I’m getting the following panic on various test VMs.

Andrew

>> FreeBSD EFI boot block

   Loader path: /boot/loader.efi

   Load Path: \EFI\BOOT\BOOTAA64.EFI
   Load Device: 
VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-AA0A-15EFE1BBB7CF,0x3,0x640)
panic: Couldn't trim device path
--> Press a key on the console to reboot <--

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

Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Warner Losh
I'll take a look, but I've also ccd Eric so he can figure out what went
wrong with is code in your environment. What env is That?

Warnee

On Oct 16, 2017 3:26 AM, "Andrew Turner"  wrote:

>
> > On 16 Oct 2017, at 04:59, Warner Losh  wrote:
> >
> > Author: imp
> > Date: Mon Oct 16 03:59:11 2017
> > New Revision: 324646
> > URL: https://svnweb.freebsd.org/changeset/base/324646
> >
> > Log:
> >  Unify boot1 with loader
> >
> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
> >  to use the common efi_main.c.
> >
> >  Submitted by: Eric McCorkle
> >  Differential Revision: https://reviews.freebsd.org/D10447
> >
> > Added:
> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
> > Deleted:
> >  head/sys/boot/efi/boot1/boot_module.h
> >  head/sys/boot/efi/boot1/ufs_module.c
> >  head/sys/boot/efi/boot1/zfs_module.c
> >  head/sys/boot/efi/loader/efi_main.c
> > Modified:
> >  head/sys/boot/efi/boot1/Makefile
> >  head/sys/boot/efi/boot1/boot1.c
> >  head/sys/boot/efi/libefi/Makefile
> >  head/sys/boot/efi/loader/Makefile
>
> Hello Warner,
>
> After this change I’m getting the following panic on various test VMs.
>
> Andrew
>
> >> FreeBSD EFI boot block
>
>Loader path: /boot/loader.efi
>
>Load Path: \EFI\BOOT\BOOTAA64.EFI
>Load Device: VenHw(837DCA9E-E874-4D82-B29A-
> 23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-
> AA0A-15EFE1BBB7CF,0x3,0x640)
> panic: Couldn't trim device path
> --> Press a key on the console to reboot <--
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r324659 - head/share/man/man4

2017-10-16 Thread Alexander Motin
Author: mav
Date: Mon Oct 16 12:32:57 2017
New Revision: 324659
URL: https://svnweb.freebsd.org/changeset/base/324659

Log:
  Update details of interface capabilities changed by bridge(4).
  
  PR:   221122
  MFC after:1 week

Modified:
  head/share/man/man4/bridge.4

Modified: head/share/man/man4/bridge.4
==
--- head/share/man/man4/bridge.4Mon Oct 16 07:15:50 2017
(r324658)
+++ head/share/man/man4/bridge.4Mon Oct 16 12:32:57 2017
(r324659)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 27, 2013
+.Dd October 16, 2017
 .Dt IF_BRIDGE 4
 .Os
 .Sh NAME
@@ -129,8 +129,11 @@ in
 The MTU of the first member interface to be added is used as the bridge MTU.
 All additional members are required to have exactly the same value.
 .Pp
-The TXCSUM capability is disabled for any interface added to the bridge, and it
-is restored when the interface is removed again.
+The TOE, TSO, TXCSUM and TXCSUM6 capabilities on all interfaces added to the
+bridge are disabled if any of the interfaces doesn't support/enable them.
+The LRO capability is always disabled.
+All the capabilities are restored when the interface is removed from bridge.
+Changing capabilities in run time may cause NIC reinit and the link flap.
 .Pp
 The bridge supports
 .Dq monitor mode ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324660 - in head: lib/libc/arm/gen sys/arm/arm sys/arm/include

2017-10-16 Thread Michal Meloun
Author: mmel
Date: Mon Oct 16 12:53:54 2017
New Revision: 324660
URL: https://svnweb.freebsd.org/changeset/base/324660

Log:
  Save VFP state in getcontext(3) on ARM.
  This is a last followup of r315974, which fixes userland part
  of VFP save/restore problems described in PR 217611.
  
  PR:   217611
  MFC after:2 weeks

Added:
  head/lib/libc/arm/gen/getcontextx.c   (contents, props changed)
Modified:
  head/lib/libc/arm/gen/Makefile.inc
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/include/machdep.h
  head/sys/arm/include/sysarch.h

Modified: head/lib/libc/arm/gen/Makefile.inc
==
--- head/lib/libc/arm/gen/Makefile.inc  Mon Oct 16 12:32:57 2017
(r324659)
+++ head/lib/libc/arm/gen/Makefile.inc  Mon Oct 16 12:53:54 2017
(r324660)
@@ -5,7 +5,7 @@ SRCS+=  _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.
infinity.c ldexp.c makecontext.c \
__aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S flt_rounds.c \
arm_initfini.c \
-   trivial-getcontextx.c
+   getcontextx.c
 
 .if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == 
"")
 SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \

Added: head/lib/libc/arm/gen/getcontextx.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/arm/gen/getcontextx.c Mon Oct 16 12:53:54 2017
(r324660)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017 Michal Meloun 
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct ucontextx {
+   ucontext_t  ucontext;
+   mcontext_vfp_t  mcontext_vfp;
+};
+
+int
+__getcontextx_size(void)
+{
+
+   return (sizeof(struct ucontextx));
+}
+
+int
+__fillcontextx2(char *ctx)
+{
+   struct ucontextx *ucxp;
+   ucontext_t   *ucp;
+   mcontext_vfp_t   *mvp;
+   struct arm_get_vfpstate_args vfp_arg;
+
+   ucxp = (struct ucontextx *)ctx;
+   ucp = &ucxp->ucontext;
+   mvp = &ucxp->mcontext_vfp;
+
+   vfp_arg.mc_vfp_size = sizeof(mcontext_vfp_t);
+   vfp_arg.mc_vfp = mvp;
+   if (sysarch(ARM_GET_VFPSTATE, &vfp_arg) == -1)
+   return (-1);
+   ucp->uc_mcontext.mc_vfp_size = sizeof(mcontext_vfp_t);
+   ucp->uc_mcontext.mc_vfp_ptr = mvp;
+   return (0);
+}
+
+int
+__fillcontextx(char *ctx)
+{
+   struct ucontextx *ucxp;
+
+   ucxp = (struct ucontextx *)ctx;
+   if (getcontext(&ucxp->ucontext) == -1)
+   return (-1);
+   __fillcontextx2(ctx);
+   return (0);
+}
+
+__weak_reference(__getcontextx, getcontextx);
+
+ucontext_t *
+__getcontextx(void)
+{
+   char *ctx;
+   int error;
+
+   ctx = malloc(__getcontextx_size());
+   if (ctx == NULL)
+   return (NULL);
+   if (__fillcontextx(ctx) == -1) {
+   error = errno;
+   free(ctx);
+   errno = error;
+   return (NULL);
+   }
+   return ((ucontext_t *)ctx);
+}

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Mon Oct 16 12:32:57 2017(r324659)
+++ head/sys/arm/arm/machdep.c  Mon Oct 16 12:53:54 2017(r324660)
@@ -443,6 +443,30 @@ set_vfpcontext(struct thread *td, mcontext_vfp_t *vfp)
 }
 #endif
 
+int
+arm_get_vfpstate(struct thread *td, void *args)
+{
+   int rv;
+   struct arm_get_vfpstate_args ua;
+   mcontext_vfp_t  mcontext_vfp

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

2017-10-16 Thread Alexander Motin
Author: mav
Date: Mon Oct 16 12:54:53 2017
New Revision: 324661
URL: https://svnweb.freebsd.org/changeset/base/324661

Log:
  Add Creative vendor ID.
  
  MFC after:1 week

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

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Mon Oct 16 12:53:54 2017
(r324660)
+++ head/sys/dev/sound/pci/hda/hdac.c   Mon Oct 16 12:54:53 2017
(r324661)
@@ -175,6 +175,7 @@ static const struct {
{ HDA_NVIDIA_ALL, "NVIDIA", 0, 0 },
{ HDA_ATI_ALL,"ATI",0, 0 },
{ HDA_AMD_ALL,"AMD",0, 0 },
+   { HDA_CREATIVE_ALL,"Creative",  0, 0 },
{ HDA_VIA_ALL,"VIA",0, 0 },
{ HDA_SIS_ALL,"SiS",0, 0 },
{ HDA_ULI_ALL,"ULI",0, 0 },

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Mon Oct 16 12:53:54 2017
(r324660)
+++ head/sys/dev/sound/pci/hda/hdac.h   Mon Oct 16 12:54:53 2017
(r324661)
@@ -150,6 +150,10 @@
 #define RDC_VENDORID   0x17f3
 #define HDA_RDC_M3010  HDA_MODEL_CONSTRUCT(RDC, 0x3010)
 
+/* Creative */
+#define CREATIVE_VENDORID  0x1102
+#define HDA_CREATIVE_ALL   HDA_MODEL_CONSTRUCT(CREATIVE, 0x)
+
 /* VIA */
 #define VIA_VENDORID   0x1106
 #define HDA_VIA_VT82XX HDA_MODEL_CONSTRUCT(VIA, 0x3288)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324662 - head/tests/sys/netpfil/pf

2017-10-16 Thread Kristof Provost
Author: kp
Date: Mon Oct 16 15:01:49 2017
New Revision: 324662
URL: https://svnweb.freebsd.org/changeset/base/324662

Log:
  pf: test set-tos
  
  Introduce tests for the set-tos feature of pf. Teach pft_ping.py to send
  and verify ToS flags.

Added:
  head/tests/sys/netpfil/pf/set_tos.sh   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile
  head/tests/sys/netpfil/pf/pft_ping.py

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Mon Oct 16 12:54:53 2017
(r324661)
+++ head/tests/sys/netpfil/pf/Makefile  Mon Oct 16 15:01:49 2017
(r324662)
@@ -5,7 +5,8 @@ PACKAGE=tests
 TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
 
 ATF_TESTS_SH+= pass_block \
-   forward
+   forward \
+   set_tos
 
 ${PACKAGE}FILES+=  utils.subr \
pft_ping.py

Modified: head/tests/sys/netpfil/pf/pft_ping.py
==
--- head/tests/sys/netpfil/pf/pft_ping.py   Mon Oct 16 12:54:53 2017
(r324661)
+++ head/tests/sys/netpfil/pf/pft_ping.py   Mon Oct 16 15:01:49 2017
(r324662)
@@ -18,7 +18,7 @@ class Sniffer(threading.Thread):
def run(self):
self.packets = sp.sniff(iface=self._recvif, timeout=3)
 
-def check_ping_request(packet, dst_ip):
+def check_ping_request(packet, dst_ip, args):
"""
Verify that the packet matches what we'd have sent
"""
@@ -40,13 +40,27 @@ def check_ping_request(packet, dst_ip):
if raw.load != str(PAYLOAD_MAGIC):
return False
 
+   # Wait to check expectations until we've established this is the packet 
we
+   # sent.
+   if args.expect_tos:
+   if ip.tos != int(args.expect_tos[0]):
+   print "Unexpected ToS value %d, expected %s" \
+   % (ip.tos, args.expect_tos[0])
+   return False
+
+
return True
 
-def ping(send_if, dst_ip):
-   req = sp.Ether() \
-   / sp.IP(dst=dst_ip) \
-   / sp.ICMP(type='echo-request') \
-   / sp.Raw(PAYLOAD_MAGIC)
+def ping(send_if, dst_ip, args):
+   ether = sp.Ether()
+   ip = sp.IP(dst=dst_ip)
+   icmp = sp.ICMP(type='echo-request')
+   raw = sp.Raw(PAYLOAD_MAGIC)
+
+   if args.send_tos:
+   ip.tos = int(args.send_tos[0])
+
+   req = ether / ip / icmp / raw
sp.sendp(req, iface=send_if, verbose=False)
 
 def main():
@@ -61,19 +75,27 @@ def main():
required=True,
help='The destination IP address for the ICMP echo request')
 
+   # Packet settings
+   parser.add_argument('--send-tos', nargs=1,
+   help='Set the ToS value for the transmitted packet')
+
+   # Expectations
+   parser.add_argument('--expect-tos', nargs=1,
+   help='The expected ToS value in the received packet')
+
args = parser.parse_args()
 
sniffer = None
if not args.recvif is None:
sniffer = Sniffer(args.recvif[0])
 
-   ping(args.sendif[0], args.to[0])
+   ping(args.sendif[0], args.to[0], args)
 
if sniffer:
sniffer.join()
 
for packet in sniffer.packets:
-   if check_ping_request(packet, args.to[0]):
+   if check_ping_request(packet, args.to[0], args):
sys.exit(0)
 
# We did not get the packet we expected

Added: head/tests/sys/netpfil/pf/set_tos.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/set_tos.shMon Oct 16 15:01:49 2017
(r324662)
@@ -0,0 +1,92 @@
+# $FreeBSD$
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "v4" "cleanup"
+v4_head()
+{
+   atf_set descr 'set-tos test'
+   atf_set require.user root
+
+   # We need scapy to be installed for out test scripts to work
+   atf_set require.progs scapy
+}
+
+v4_body()
+{
+   pft_init
+
+   epair_send=$(pft_mkepair)
+   ifconfig ${epair_send}a 192.0.2.1/24 up
+
+   epair_recv=$(pft_mkepair)
+   ifconfig ${epair_recv}a up
+
+   pft_mkjail alcatraz ${epair_send}b ${epair_recv}b
+   jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up
+   jexec alcatraz ifconfig ${epair_recv}b 198.51.100.2/24 up
+   jexec alcatraz sysctl net.inet.ip.forwarding=1
+   jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05
+   route add -net 198.51.100.0/24 192.0.2.2
+
+   # No change is done if not requested
+   printf "scrub out proto icmp\n" | jexec alcatraz pfctl -ef -
+   atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \
+   --sendif ${epair_send}a \

svn commit: r324663 - head/tests/sys/netpfil/pf

2017-10-16 Thread Kristof Provost
Author: kp
Date: Mon Oct 16 15:03:45 2017
New Revision: 324663
URL: https://svnweb.freebsd.org/changeset/base/324663

Log:
  pf tests: Basic IPv6 forwarding tests
  
  Pass/block packets in the forwarding path with pf.
  
  Introduce the pft_set_rules() helper function, because we need to
  remember to flush states between individual tests. If not we can get
  packets passing despite rules blocking them because they match states
  created in a previous test.
  
  Extend pft_ping.py to be able to send IPv6 echo requests.

Modified:
  head/tests/sys/netpfil/pf/forward.sh
  head/tests/sys/netpfil/pf/pft_ping.py
  head/tests/sys/netpfil/pf/utils.subr

Modified: head/tests/sys/netpfil/pf/forward.sh
==
--- head/tests/sys/netpfil/pf/forward.shMon Oct 16 15:01:49 2017
(r324662)
+++ head/tests/sys/netpfil/pf/forward.shMon Oct 16 15:03:45 2017
(r324663)
@@ -61,7 +61,87 @@ v4_cleanup()
pft_cleanup
 }
 
+atf_test_case "v6" "cleanup"
+v6_head()
+{
+   atf_set descr 'Basic IPv6 forwarding test'
+   atf_set require.user root
+   atf_set require.progs scapy
+}
+
+v6_body()
+{
+   pft_init
+
+   epair_send=$(pft_mkepair)
+   epair_recv=$(pft_mkepair)
+
+   ifconfig ${epair_send}a inet6 2001:db8:42::1/64 up no_dad -ifdisabled
+   ifconfig ${epair_recv}a up
+
+   pft_mkjail alcatraz ${epair_send}b ${epair_recv}b
+
+   jexec alcatraz ifconfig ${epair_send}b inet6 2001:db8:42::2/64 up no_dad
+   jexec alcatraz ifconfig ${epair_recv}b inet6 2001:db8:43::2/64 up no_dad
+   jexec alcatraz sysctl net.inet6.ip6.forwarding=1
+   jexec alcatraz ndp -s 2001:db8:43::3 00:01:02:03:04:05
+   route add -6 2001:db8:43::/64 2001:db8:42::2
+
+   # Sanity check, can we forward ICMP echo requests without pf?
+   atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+   --ip6 \
+   --sendif ${epair_send}a \
+   --to 2001:db8:43::3 \
+   --recvif ${epair_recv}a
+
+   jexec alcatraz pfctl -e
+
+   # Block incoming echo request packets
+   pft_set_rules alcatraz \
+   "block in inet6 proto icmp6 icmp6-type echoreq"
+   atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+   --ip6 \
+   --sendif ${epair_send}a \
+   --to 2001:db8:43::3 \
+   --recvif ${epair_recv}a
+
+   # Block outgoing echo request packets
+   pft_set_rules alcatraz \
+   "block out inet6 proto icmp6 icmp6-type echoreq"
+   atf_check -s exit:1 -e ignore $(atf_get_srcdir)/pft_ping.py \
+   --ip6 \
+   --sendif ${epair_send}a \
+   --to 2001:db8:43::3 \
+   --recvif ${epair_recv}a
+
+   # Allow ICMPv6 but nothing else
+   pft_set_rules alcatraz \
+   "block out" \
+   "pass out inet6 proto icmp6"
+   atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
+   --ip6 \
+   --sendif ${epair_send}a \
+   --to 2001:db8:43::3 \
+   --recvif ${epair_recv}a
+
+   # Allowing ICMPv4 does not allow ICMPv6
+   pft_set_rules alcatraz \
+   "block out inet6 proto icmp6 icmp6-type echoreq" \
+   "pass in proto icmp"
+   atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
+   --ip6 \
+   --sendif ${epair_send}a \
+   --to 2001:db8:43::3 \
+   --recvif ${epair_recv}a
+}
+
+v6_cleanup()
+{
+   pft_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "v4"
+   atf_add_test_case "v6"
 }

Modified: head/tests/sys/netpfil/pf/pft_ping.py
==
--- head/tests/sys/netpfil/pf/pft_ping.py   Mon Oct 16 15:01:49 2017
(r324662)
+++ head/tests/sys/netpfil/pf/pft_ping.py   Mon Oct 16 15:03:45 2017
(r324663)
@@ -19,6 +19,12 @@ class Sniffer(threading.Thread):
self.packets = sp.sniff(iface=self._recvif, timeout=3)
 
 def check_ping_request(packet, dst_ip, args):
+   if args.ip6:
+   return check_ping6_request(packet, dst_ip, args)
+   else:
+   return check_ping4_request(packet, dst_ip, args)
+
+def check_ping4_request(packet, dst_ip, args):
"""
Verify that the packet matches what we'd have sent
"""
@@ -51,6 +57,24 @@ def check_ping_request(packet, dst_ip, args):
 
return True
 
+def check_ping6_request(packet, dst_ip, args):
+   """
+   Verify that the packet matches what we'd have sent
+   """
+   ip = packet.getlayer(sp.IPv6)
+   if not ip:
+   return False
+   if ip.dst != dst_ip:
+   return False
+
+   icmp = packet.getlayer(sp.ICMPv6EchoRequest)
+   if not icmp:
+   return False
+   if icmp.data != str(PAYLOAD_MAGIC):

svn commit: r324664 - head/tests/sys/netpfil/pf

2017-10-16 Thread Kristof Provost
Author: kp
Date: Mon Oct 16 15:05:32 2017
New Revision: 324664
URL: https://svnweb.freebsd.org/changeset/base/324664

Log:
  pf tests: Use pft_set_rules everywhere
  
  We now have a utility function to set pf rules in the jail. Use it
  whenever we need to set the pf rules in the test jail.

Modified:
  head/tests/sys/netpfil/pf/forward.sh
  head/tests/sys/netpfil/pf/pass_block.sh
  head/tests/sys/netpfil/pf/set_tos.sh

Modified: head/tests/sys/netpfil/pf/forward.sh
==
--- head/tests/sys/netpfil/pf/forward.shMon Oct 16 15:03:45 2017
(r324663)
+++ head/tests/sys/netpfil/pf/forward.shMon Oct 16 15:05:32 2017
(r324664)
@@ -35,21 +35,23 @@ v4_body()
--to 198.51.100.3 \
--recvif ${epair_recv}a
 
+   jexec alcatraz pfctl -e
+
# Forward with pf enabled
-   printf "block in\n" | jexec alcatraz pfctl -ef -
+   pft_set_rules alcatraz "block in"
atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.3 \
--recvif ${epair_recv}a
 
-   printf "block out\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block out"
atf_check -s exit:1 $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.3 \
--recv ${epair_recv}a
 
# Allow ICMP
-   printf "block in\npass in proto icmp\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in" "pass in proto icmp"
atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.3 \

Modified: head/tests/sys/netpfil/pf/pass_block.sh
==
--- head/tests/sys/netpfil/pf/pass_block.sh Mon Oct 16 15:03:45 2017
(r324663)
+++ head/tests/sys/netpfil/pf/pass_block.sh Mon Oct 16 15:05:32 2017
(r324664)
@@ -28,11 +28,11 @@ v4_body()
atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2
 
# Block everything
-   printf "block in\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in"
atf_check -s exit:2 -o ignore ping -c 1 -t 1 192.0.2.2
 
# Block everything but ICMP
-   printf "block in\npass in proto icmp\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in" "pass in proto icmp"
atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.2
 }
 
@@ -67,15 +67,15 @@ v6_body()
atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
 
# Block everything
-   printf "block in\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in"
atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
 
# Block everything but ICMP
-   printf "block in\npass in proto icmp6\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in" "pass in proto icmp6"
atf_check -s exit:0 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
 
# Allowing ICMPv4 does not allow ICMPv6
-   printf "block in\npass in proto icmp\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "block in" "pass in proto icmp"
atf_check -s exit:2 -o ignore ping6 -c 1 -x 1 2001:db8:42::2
 }
 

Modified: head/tests/sys/netpfil/pf/set_tos.sh
==
--- head/tests/sys/netpfil/pf/set_tos.shMon Oct 16 15:03:45 2017
(r324663)
+++ head/tests/sys/netpfil/pf/set_tos.shMon Oct 16 15:05:32 2017
(r324664)
@@ -29,8 +29,10 @@ v4_body()
jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05
route add -net 198.51.100.0/24 192.0.2.2
 
+   jexec alcatraz pfctl -e
+
# No change is done if not requested
-   printf "scrub out proto icmp\n" | jexec alcatraz pfctl -ef -
+   pft_set_rules alcatraz "scrub out proto icmp"
atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.3 \
@@ -38,7 +40,7 @@ v4_body()
--expect-tos 42
 
# The requested ToS is set
-   printf "scrub out proto icmp set-tos 42\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "scrub out proto icmp set-tos 42"
atf_check -s exit:0 $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.3 \
@@ -46,7 +48,7 @@ v4_body()
--expect-tos 42
 
# ToS is not changed if the scrub rule does not match
-   printf "scrub out proto tcp set-tos 42\n" | jexec alcatraz pfctl -f -
+   pft_set_rules alcatraz "scrub out proto tcp set-tos 42"
atf_check -s exit:1 -o ignore $(atf_get_srcdir)/pft_ping.py \
--sendif ${epair_send}a \
--to 198.51.100.

svn commit: r324665 - in head/sys/amd64: amd64 include

2017-10-16 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 16 15:16:24 2017
New Revision: 324665
URL: https://svnweb.freebsd.org/changeset/base/324665

Log:
  Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().
  
  For processing, reclaim_pv_chunk() removes the pv_chunk from the lru
  list, which makes pc_lru linkage invalid.  Then the pmap lock is
  released, which allows for other thread to free the last pv entry
  allocated from the chunk and call free_pv_chunk(), which tries to
  modify the invalid linkage.
  
  Similarly, the chunk is inserted into the private tailq new_tail
  temporary.  Again, free_pv_chunk() might be run and corrupt the
  linkage for the new_tail after the pmap lock is dropped.
  
  This is a consequence of r299788 elimination of pvh_global_lock, which
  allowed for reclaim to run in parallel with other pmap calls which
  free pv chunks.
  
  As a fix, do not remove the chunk from pc_lru queue, use a marker to
  remember the position in the queue iteration.  We can safely operate
  on the chunks after the chunk's pmap is locked, we fetched the chunk
  after the marker, and we checked that chunk pmap is same as we have
  locked, because chunk removal from pc_lru requires both pv_chunk_mutex
  and the pmap mutex owned.
  
  Note that the fix lost an optimization which was present in the
  previous algorithm.  Namely, new_tail requeueing rotated the pv chunks
  list so that reclaim didn't scan the same pv chunks that couldn't be
  freed (because they contained a wired and/or superpage mapping) on
  every invocation.  An additional change is planned which would improve
  this.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Oct 16 15:05:32 2017(r324664)
+++ head/sys/amd64/amd64/pmap.c Mon Oct 16 15:16:24 2017(r324665)
@@ -2888,11 +2888,11 @@ reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked
 static vm_page_t
 reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp)
 {
-   struct pch new_tail;
-   struct pv_chunk *pc;
+   struct pv_chunk *pc, *pc_marker;
+   struct pv_chunk_header pc_marker_b;
struct md_page *pvh;
pd_entry_t *pde;
-   pmap_t pmap;
+   pmap_t next_pmap, pmap;
pt_entry_t *pte, tpte;
pt_entry_t PG_G, PG_A, PG_M, PG_RW;
pv_entry_t pv;
@@ -2909,7 +2909,8 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
m_pc = NULL;
PG_G = PG_A = PG_M = PG_RW = 0;
SLIST_INIT(&free);
-   TAILQ_INIT(&new_tail);
+   bzero(&pc_marker_b, sizeof(pc_marker_b));
+   pc_marker = (struct pv_chunk *)&pc_marker_b;
 
/*
 * A delayed invalidation block should already be active if
@@ -2919,30 +2920,52 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l
start_di = pmap_not_in_di();
 
mtx_lock(&pv_chunks_mutex);
-   while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && SLIST_EMPTY(&free)) {
-   TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
+   TAILQ_INSERT_HEAD(&pv_chunks, pc_marker, pc_lru);
+   while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != NULL &&
+   SLIST_EMPTY(&free)) {
+   next_pmap = pc->pc_pmap;
+   if (next_pmap == NULL)  /* marker */
+   goto next_chunk;
mtx_unlock(&pv_chunks_mutex);
-   if (pmap != pc->pc_pmap) {
+
+   /*
+* A pv_chunk can only be removed from the pc_lru list
+* when both pc_chunks_mutex is owned and the
+* corresponding pmap is locked.
+*/
+   if (pmap != next_pmap) {
reclaim_pv_chunk_leave_pmap(pmap, locked_pmap,
start_di);
-   pmap = pc->pc_pmap;
+   pmap = next_pmap;
/* Avoid deadlock and lock recursion. */
if (pmap > locked_pmap) {
RELEASE_PV_LIST_LOCK(lockp);
PMAP_LOCK(pmap);
-   } else if (pmap != locked_pmap &&
-   !PMAP_TRYLOCK(pmap)) {
-   pmap = NULL;
-   TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru);
+   if (start_di)
+   pmap_delayed_invl_started();
mtx_lock(&pv_chunks_mutex);
continue;
-   }
+   } else if (pmap != locked_pmap) {
+   if (PMAP_TRYLOCK(pmap)) {
+   if (start_di)
+ 

Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Andrew Turner
I have a local Jenkins setup that builds images & tries to run under various 
simulators. The final image is built with mkimg. I’m running it under qemu.

Andrew

> On 16 Oct 2017, at 13:19, Warner Losh  wrote:
> 
> I'll take a look, but I've also ccd Eric so he can figure out what went wrong 
> with is code in your environment. What env is That?
> 
> Warnee
> 
> On Oct 16, 2017 3:26 AM, "Andrew Turner"  > wrote:
> 
> > On 16 Oct 2017, at 04:59, Warner Losh  wrote:
> >
> > Author: imp
> > Date: Mon Oct 16 03:59:11 2017
> > New Revision: 324646
> > URL: https://svnweb.freebsd.org/changeset/base/324646 
> > 
> >
> > Log:
> >  Unify boot1 with loader
> >
> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
> >  to use the common efi_main.c.
> >
> >  Submitted by: Eric McCorkle
> >  Differential Revision: https://reviews.freebsd.org/D10447 
> > 
> >
> > Added:
> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
> > Deleted:
> >  head/sys/boot/efi/boot1/boot_module.h
> >  head/sys/boot/efi/boot1/ufs_module.c
> >  head/sys/boot/efi/boot1/zfs_module.c
> >  head/sys/boot/efi/loader/efi_main.c
> > Modified:
> >  head/sys/boot/efi/boot1/Makefile
> >  head/sys/boot/efi/boot1/boot1.c
> >  head/sys/boot/efi/libefi/Makefile
> >  head/sys/boot/efi/loader/Makefile
> 
> Hello Warner,
> 
> After this change I’m getting the following panic on various test VMs.
> 
> Andrew
> 
> >> FreeBSD EFI boot block
> 
>Loader path: /boot/loader.efi
> 
>Load Path: \EFI\BOOT\BOOTAA64.EFI
>Load Device: 
> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-AA0A-15EFE1BBB7CF,0x3,0x640)
> panic: Couldn't trim device path
> --> Press a key on the console to reboot <--
> 

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

Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Warner Losh
So this is on aarch64? Is this running a standardish qemu setup as
documented on https://wiki.freebsd.org/arm64/QEMU ? Or are there tricks
that we need to cope with...

If we can't get good resoltuion on this today, I plan on backing out the
entire change.

Warner

On Mon, Oct 16, 2017 at 9:38 AM, Andrew Turner  wrote:

> I have a local Jenkins setup that builds images & tries to run under
> various simulators. The final image is built with mkimg. I’m running it
> under qemu.
>
> Andrew
>
> On 16 Oct 2017, at 13:19, Warner Losh  wrote:
>
> I'll take a look, but I've also ccd Eric so he can figure out what went
> wrong with is code in your environment. What env is That?
>
> Warnee
>
> On Oct 16, 2017 3:26 AM, "Andrew Turner"  wrote:
>
>>
>> > On 16 Oct 2017, at 04:59, Warner Losh  wrote:
>> >
>> > Author: imp
>> > Date: Mon Oct 16 03:59:11 2017
>> > New Revision: 324646
>> > URL: https://svnweb.freebsd.org/changeset/base/324646
>> >
>> > Log:
>> >  Unify boot1 with loader
>> >
>> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
>> >  to use the common efi_main.c.
>> >
>> >  Submitted by: Eric McCorkle
>> >  Differential Revision: https://reviews.freebsd.org/D10447
>> >
>> > Added:
>> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
>> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
>> > Deleted:
>> >  head/sys/boot/efi/boot1/boot_module.h
>> >  head/sys/boot/efi/boot1/ufs_module.c
>> >  head/sys/boot/efi/boot1/zfs_module.c
>> >  head/sys/boot/efi/loader/efi_main.c
>> > Modified:
>> >  head/sys/boot/efi/boot1/Makefile
>> >  head/sys/boot/efi/boot1/boot1.c
>> >  head/sys/boot/efi/libefi/Makefile
>> >  head/sys/boot/efi/loader/Makefile
>>
>> Hello Warner,
>>
>> After this change I’m getting the following panic on various test VMs.
>>
>> Andrew
>>
>> >> FreeBSD EFI boot block
>>
>>Loader path: /boot/loader.efi
>>
>>Load Path: \EFI\BOOT\BOOTAA64.EFI
>>Load Device: VenHw(837DCA9E-E874-4D82-B29A-
>> 23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-A
>> A0A-15EFE1BBB7CF,0x3,0x640)
>> panic: Couldn't trim device path
>> --> Press a key on the console to reboot <--
>>
>>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Re: svn commit: r324656 - head/lib/libifconfig

2017-10-16 Thread Alan Somers
On Mon, Oct 16, 2017 at 12:54 AM, Andriy Voskoboinyk  wrote:
> Author: avos
> Date: Mon Oct 16 06:54:26 2017
> New Revision: 324656
> URL: https://svnweb.freebsd.org/changeset/base/324656
>
> Log:
>   libifconfig: allow to get original interface name via 
> ifconfig_get_orig_name()
>
>   Uses the same method as in tools/tools/ifinfo/ifinfo.c
>   (via net.link.generic sysctl).
>
>   Tested with modified wlandebug(8).
>
>   Differential Revision:https://reviews.freebsd.org/D12554
>
> Modified:
>   head/lib/libifconfig/libifconfig.c
>   head/lib/libifconfig/libifconfig.h

The original author of libifconfig keeps her work at Github.  To
reduce divergence, we should submit changes there first, or else
convince her to start using our SVN repository.  Did you at least ask
her for review?
https://github.com/savagedlight/libifconfig

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


Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Andrew Turner
Correct, it is aarch64. It runs a similar qemu command, however I also see it 
under the ARM Foundation model so it seems to not be simulator specific.

Andrew

> On 16 Oct 2017, at 16:56, Warner Losh  wrote:
> 
> So this is on aarch64? Is this running a standardish qemu setup as documented 
> on https://wiki.freebsd.org/arm64/QEMU  
> ? Or are there tricks that we need to cope with...
> 
> If we can't get good resoltuion on this today, I plan on backing out the 
> entire change.
> 
> Warner
> 
> On Mon, Oct 16, 2017 at 9:38 AM, Andrew Turner  > wrote:
> I have a local Jenkins setup that builds images & tries to run under various 
> simulators. The final image is built with mkimg. I’m running it under qemu.
> 
> Andrew
> 
>> On 16 Oct 2017, at 13:19, Warner Losh > > wrote:
>> 
>> I'll take a look, but I've also ccd Eric so he can figure out what went 
>> wrong with is code in your environment. What env is That?
>> 
>> Warnee
>> 
>> On Oct 16, 2017 3:26 AM, "Andrew Turner" > > wrote:
>> 
>> > On 16 Oct 2017, at 04:59, Warner Losh > > > wrote:
>> >
>> > Author: imp
>> > Date: Mon Oct 16 03:59:11 2017
>> > New Revision: 324646
>> > URL: https://svnweb.freebsd.org/changeset/base/324646 
>> > 
>> >
>> > Log:
>> >  Unify boot1 with loader
>> >
>> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
>> >  to use the common efi_main.c.
>> >
>> >  Submitted by: Eric McCorkle
>> >  Differential Revision: https://reviews.freebsd.org/D10447 
>> > 
>> >
>> > Added:
>> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
>> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
>> > Deleted:
>> >  head/sys/boot/efi/boot1/boot_module.h
>> >  head/sys/boot/efi/boot1/ufs_module.c
>> >  head/sys/boot/efi/boot1/zfs_module.c
>> >  head/sys/boot/efi/loader/efi_main.c
>> > Modified:
>> >  head/sys/boot/efi/boot1/Makefile
>> >  head/sys/boot/efi/boot1/boot1.c
>> >  head/sys/boot/efi/libefi/Makefile
>> >  head/sys/boot/efi/loader/Makefile
>> 
>> Hello Warner,
>> 
>> After this change I’m getting the following panic on various test VMs.
>> 
>> Andrew
>> 
>> >> FreeBSD EFI boot block
>> 
>>Loader path: /boot/loader.efi
>> 
>>Load Path: \EFI\BOOT\BOOTAA64.EFI
>>Load Device: 
>> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-AA0A-15EFE1BBB7CF,0x3,0x640)
>> panic: Couldn't trim device path
>> --> Press a key on the console to reboot <--
>> 
> 
> 

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

svn commit: r324666 - head/sys/kern

2017-10-16 Thread Matt Joras
Author: mjoras
Date: Mon Oct 16 16:14:50 2017
New Revision: 324666
URL: https://svnweb.freebsd.org/changeset/base/324666

Log:
  Properly reset the fields in clean_unrhdr.
  
  In r324542 I neglected to reset the first and last fields of struct
  unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with
  DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr.
  While here, change a loop to use TAILQ_FOREACH_SAFE since it is more
  readable and equally fast.
  
  Reported by:  David Wolfskill 
  Approved by:  rstone (mentor)
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/subr_unit.c

Modified: head/sys/kern/subr_unit.c
==
--- head/sys/kern/subr_unit.c   Mon Oct 16 15:16:24 2017(r324665)
+++ head/sys/kern/subr_unit.c   Mon Oct 16 16:14:50 2017(r324666)
@@ -373,18 +373,17 @@ clear_unrhdr(struct unrhdr *uh)
 
KASSERT(TAILQ_EMPTY(&uh->ppfree),
("unrhdr has postponed item for free"));
-   up = TAILQ_FIRST(&uh->head);
-   while (up != NULL) {
-   uq = TAILQ_NEXT(up, list);
+   TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) {
if (up->ptr != uh) {
Free(up->ptr);
}
Free(up);
-   up = uq;
}
-   TAILQ_INIT(&uh->head);
uh->busy = 0;
uh->alloc = 0;
+   init_unrhdr(uh, uh->low, uh->high, uh->mtx);
+
+   check_unrhdr(uh, __LINE__);
 }
 
 static __inline int
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-10-16 Thread Matt Joras
On 10/16/2017 09:14, Matt Joras wrote:
> Author: mjoras
> Date: Mon Oct 16 16:14:50 2017
> New Revision: 324666
> URL: https://svnweb.freebsd.org/changeset/base/324666
>
> Log:
>   Properly reset the fields in clean_unrhdr.
>   
>   In r324542 I neglected to reset the first and last fields of struct
>   unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with
>   DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr.
>   While here, change a loop to use TAILQ_FOREACH_SAFE since it is more
>   readable and equally fast.
>   
>   Reported by:David Wolfskill 
>   Approved by:rstone (mentor)
>   Sponsored by:   Dell EMC Isilon
>
Differential Revision: https://reviews.freebsd.org/D12662

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


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

2017-10-16 Thread Jonathan Looney
Hi Julien,

I apologize for just getting to this, but your code just made it into my
local tree.

The non-INVARIANTS case looks incorrect. Because tw stays on the list, it
can end up stuck at the front of the queue and block everything behind it.

Personally, I would be more comfortable just panic'ing here. This indicates
a problem. And, depending on the way things got corrupted, you could end up
with other hard-to-debug problems if you continue with a corrupted state.

Jonathan

On Sun, Oct 1, 2017 at 5:20 PM, Julien Charbon  wrote:

> Author: jch
> Date: Sun Oct  1 21:20:28 2017
> New Revision: 324179
> URL: https://svnweb.freebsd.org/changeset/base/324179
>
> Log:
>   Fix an infinite loop in tcp_tw_2msl_scan() when an INP_TIMEWAIT inp has
>   been destroyed before its tcptw with INVARIANTS undefined.
>
>   This is a symmetric change of r307551:
>
>   A INP_TIMEWAIT inp should not be destroyed before its tcptw, and
> INVARIANTS
>   will catch this case.  If INVARIANTS is undefined it will emit a
> log(LOG_ERR)
>   and avoid a hard to debug infinite loop in tcp_tw_2msl_scan().
>
>   Reported by:  Ben Rubson, hselasky
>   Submitted by: hselasky
>   Tested by:Ben Rubson, jch
>   MFC after:1 week
>   Sponsored by: Verisign, inc
>   Differential Revision:https://reviews.freebsd.org/D12267
>
> Modified:
>   head/sys/netinet/tcp_timewait.c
>
> Modified: head/sys/netinet/tcp_timewait.c
> 
> ==
> --- head/sys/netinet/tcp_timewait.c Sun Oct  1 20:12:30 2017
> (r324178)
> +++ head/sys/netinet/tcp_timewait.c Sun Oct  1 21:20:28 2017
> (r324179)
> @@ -709,10 +709,29 @@ tcp_tw_2msl_scan(int reuse)
> INP_WLOCK(inp);
> tw = intotw(inp);
> if (in_pcbrele_wlocked(inp)) {
> -   KASSERT(tw == NULL, ("%s: held last inp "
> -   "reference but tw not NULL",
> __func__));
> -   INP_INFO_RUNLOCK(&V_tcbinfo);
> -   continue;
> +   if (__predict_true(tw == NULL)) {
> +   INP_INFO_RUNLOCK(&V_tcbinfo);
> +   continue;
> +   } else {
> +   /* This should not happen as in
> TIMEWAIT
> +* state the inp should not be
> destroyed
> +* before its tcptw. If INVARIANTS
> is
> +* defined panic.
> +*/
> +#ifdef INVARIANTS
> +   panic("%s: Panic before an
> infinite "
> +   "loop: INP_TIMEWAIT &&
> (INP_FREED "
> +   "|| inp last reference) && tw
> != "
> +   "NULL", __func__);
> +#else
> +   log(LOG_ERR, "%s: Avoid an
> infinite "
> +   "loop: INP_TIMEWAIT &&
> (INP_FREED "
> +   "|| inp last reference) && tw
> != "
> +   "NULL", __func__);
> +#endif
> +   INP_INFO_RUNLOCK(&V_tcbinfo);
> +   break;
> +   }
> }
>
> if (tw == NULL) {
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324667 - head/lib/libgeom

2017-10-16 Thread Romain Tartière
Author: romain (ports committer)
Date: Mon Oct 16 17:21:52 2017
New Revision: 324667
URL: https://svnweb.freebsd.org/changeset/base/324667

Log:
  Add a quick description of the geom_getxml(3), geom_xml2tree(3),
  geom_gettree(3) and geom_deletetree(3) functions provided by libgeom and are
  not documented in libgeom(3).
  
  Reviewed by:  mav, bjk, allanjude
  Approved by:  allanjude
  Differential Revision:https://reviews.freebsd.org/D12679

Modified:
  head/lib/libgeom/Makefile
  head/lib/libgeom/libgeom.3

Modified: head/lib/libgeom/Makefile
==
--- head/lib/libgeom/Makefile   Mon Oct 16 16:14:50 2017(r324666)
+++ head/lib/libgeom/Makefile   Mon Oct 16 17:21:52 2017(r324667)
@@ -33,6 +33,10 @@ MLINKS+= \
libgeom.3 gctl_issue.3 \
libgeom.3 gctl_free.3 \
libgeom.3 gctl_dump.3 \
+   libgeom.3 geom_getxml.3 \
+   libgeom.3 geom_xml2tree.3 \
+   libgeom.3 geom_gettree.3 \
+   libgeom.3 geom_deletetree.3 \
libgeom.3 g_close.3 \
libgeom.3 g_delete.3 \
libgeom.3 g_device_path.3 \

Modified: head/lib/libgeom/libgeom.3
==
--- head/lib/libgeom/libgeom.3  Mon Oct 16 16:14:50 2017(r324666)
+++ head/lib/libgeom/libgeom.3  Mon Oct 16 17:21:52 2017(r324667)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 22, 2017
+.Dd October 16, 2017
 .Dt LIBGEOM 3
 .Os
 .Sh NAME
@@ -46,6 +46,10 @@
 .Nm gctl_issue ,
 .Nm gctl_free ,
 .Nm gctl_dump ,
+.Nm geom_getxml ,
+.Nm geom_xml2tree ,
+.Nm geom_gettree ,
+.Nm geom_deletetree ,
 .Nm g_open ,
 .Nm g_close ,
 .Nm g_mediasize ,
@@ -99,7 +103,15 @@
 .Ft void
 .Fn gctl_dump "struct gctl_req *req" "FILE *f"
 .Ss "Utility Functions"
+.Ft "char *"
+.Fn geom_getxml void
 .Ft int
+.Fn geom_xml2tree "struct gmesh *gmp" "char *p"
+.Ft int
+.Fn geom_gettree "struct gmesh *gmp"
+.Ft void
+.Fn geom_deletetree "struct gmesh *gmp"
+.Ft int
 .Fn g_open "const char *name" "int dowrite"
 .Ft int
 .Fn g_close "int fd"
@@ -278,6 +290,46 @@ which returns
 on success, or an error message corresponding to the
 first error which happened.
 .Ss "Utility Functions"
+The
+.Fn geom_getxml
+function is a wrapper around
+.Xr sysctl 3
+that fetches the
+.Ar kern.geom.confxml
+OID, and returns it's value.
+The allocated memory should be released with
+.Xr free 2
+after use.
+.Pp
+The
+.Fn geom_xml2tree
+function parses the XML representation of a GEOM topology passed as
+.Ar p ,
+allocates the needed data structures to access this information and fills in
+the passed
+.Ar gmp
+data structure.
+Memory allocated during this transformation should be released
+using
+.Fn geom_deletetree
+after use.
+.Pp
+The
+.Fn geom_gettree
+function is a wrapper around the
+.Fn geom_getxml
+and
+.Fn geom_xml2tree
+functions.
+Memory allocated during this operation should be released using
+.Fn geom_deletetree
+after use.
+.Pp
+The
+.Fn geom_deletetree
+function releases memory allocated for storing the data-structures referenced 
by
+.Ar gmp .
+.Pp
 The
 .Fn g_*
 functions are used to communicate with GEOM providers.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Toomas Soome

The arm (uboot) has a bit different approach on block device(s), see 
efipart_hdinfo_add_filepath() in efipart.c; the code needs to check for 
MEDIA_FILEPATH_DP, I think.

rgds,
toomas


> On 16 Oct 2017, at 19:07, Andrew Turner  wrote:
> 
> Correct, it is aarch64. It runs a similar qemu command, however I also see it 
> under the ARM Foundation model so it seems to not be simulator specific.
> 
> Andrew
> 
>> On 16 Oct 2017, at 16:56, Warner Losh > > wrote:
>> 
>> So this is on aarch64? Is this running a standardish qemu setup as 
>> documented on https://wiki.freebsd.org/arm64/QEMU 
>>  ? Or are there tricks that we need to 
>> cope with...
>> 
>> If we can't get good resoltuion on this today, I plan on backing out the 
>> entire change.
>> 
>> Warner
>> 
>> On Mon, Oct 16, 2017 at 9:38 AM, Andrew Turner > > wrote:
>> I have a local Jenkins setup that builds images & tries to run under various 
>> simulators. The final image is built with mkimg. I’m running it under qemu.
>> 
>> Andrew
>> 
>>> On 16 Oct 2017, at 13:19, Warner Losh >> > wrote:
>>> 
>>> I'll take a look, but I've also ccd Eric so he can figure out what went 
>>> wrong with is code in your environment. What env is That?
>>> 
>>> Warnee
>>> 
>>> On Oct 16, 2017 3:26 AM, "Andrew Turner" >> > wrote:
>>> 
>>> > On 16 Oct 2017, at 04:59, Warner Losh >> > > wrote:
>>> >
>>> > Author: imp
>>> > Date: Mon Oct 16 03:59:11 2017
>>> > New Revision: 324646
>>> > URL: https://svnweb.freebsd.org/changeset/base/324646 
>>> > 
>>> >
>>> > Log:
>>> >  Unify boot1 with loader
>>> >
>>> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
>>> >  to use the common efi_main.c.
>>> >
>>> >  Submitted by: Eric McCorkle
>>> >  Differential Revision: https://reviews.freebsd.org/D10447 
>>> > 
>>> >
>>> > Added:
>>> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
>>> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
>>> > Deleted:
>>> >  head/sys/boot/efi/boot1/boot_module.h
>>> >  head/sys/boot/efi/boot1/ufs_module.c
>>> >  head/sys/boot/efi/boot1/zfs_module.c
>>> >  head/sys/boot/efi/loader/efi_main.c
>>> > Modified:
>>> >  head/sys/boot/efi/boot1/Makefile
>>> >  head/sys/boot/efi/boot1/boot1.c
>>> >  head/sys/boot/efi/libefi/Makefile
>>> >  head/sys/boot/efi/loader/Makefile
>>> 
>>> Hello Warner,
>>> 
>>> After this change I’m getting the following panic on various test VMs.
>>> 
>>> Andrew
>>> 
>>> >> FreeBSD EFI boot block
>>> 
>>>Loader path: /boot/loader.efi
>>> 
>>>Load Path: \EFI\BOOT\BOOTAA64.EFI
>>>Load Device: 
>>> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-AA0A-15EFE1BBB7CF,0x3,0x640)
>>> panic: Couldn't trim device path
>>> --> Press a key on the console to reboot <--
>>> 
>> 
>> 
> 

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

Re: svn commit: r324646 - in head/sys/boot/efi: boot1 libefi loader

2017-10-16 Thread Emmanuel Vadot
On Mon, 16 Oct 2017 20:08:19 +0300
Toomas Soome  wrote:

> 
> The arm (uboot) has a bit different approach on block device(s), see 
> efipart_hdinfo_add_filepath() in efipart.c; the code needs to check for 
> MEDIA_FILEPATH_DP, I think.
> 
> rgds,
> toomas

 I'm pretty sure that qemu doesn't use u-boot but EDK2 directly.

> 
> > On 16 Oct 2017, at 19:07, Andrew Turner  wrote:
> > 
> > Correct, it is aarch64. It runs a similar qemu command, however I also see 
> > it under the ARM Foundation model so it seems to not be simulator specific.
> > 
> > Andrew
> > 
> >> On 16 Oct 2017, at 16:56, Warner Losh  >> > wrote:
> >> 
> >> So this is on aarch64? Is this running a standardish qemu setup as 
> >> documented on https://wiki.freebsd.org/arm64/QEMU 
> >>  ? Or are there tricks that we need 
> >> to cope with...
> >> 
> >> If we can't get good resoltuion on this today, I plan on backing out the 
> >> entire change.
> >> 
> >> Warner
> >> 
> >> On Mon, Oct 16, 2017 at 9:38 AM, Andrew Turner  >> > wrote:
> >> I have a local Jenkins setup that builds images & tries to run under 
> >> various simulators. The final image is built with mkimg. I?m running it 
> >> under qemu.
> >> 
> >> Andrew
> >> 
> >>> On 16 Oct 2017, at 13:19, Warner Losh  >>> > wrote:
> >>> 
> >>> I'll take a look, but I've also ccd Eric so he can figure out what went 
> >>> wrong with is code in your environment. What env is That?
> >>> 
> >>> Warnee
> >>> 
> >>> On Oct 16, 2017 3:26 AM, "Andrew Turner"  >>> > wrote:
> >>> 
> >>> > On 16 Oct 2017, at 04:59, Warner Losh  >>> > > wrote:
> >>> >
> >>> > Author: imp
> >>> > Date: Mon Oct 16 03:59:11 2017
> >>> > New Revision: 324646
> >>> > URL: https://svnweb.freebsd.org/changeset/base/324646 
> >>> > 
> >>> >
> >>> > Log:
> >>> >  Unify boot1 with loader
> >>> >
> >>> >  Refactor boot1 to use the same I/O code as /boot/loader uses. Refactor
> >>> >  to use the common efi_main.c.
> >>> >
> >>> >  Submitted by: Eric McCorkle
> >>> >  Differential Revision: https://reviews.freebsd.org/D10447 
> >>> > 
> >>> >
> >>> > Added:
> >>> >  head/sys/boot/efi/libefi/efi_main.c   (contents, props changed)
> >>> > - copied, changed from r324645, head/sys/boot/efi/loader/efi_main.c
> >>> > Deleted:
> >>> >  head/sys/boot/efi/boot1/boot_module.h
> >>> >  head/sys/boot/efi/boot1/ufs_module.c
> >>> >  head/sys/boot/efi/boot1/zfs_module.c
> >>> >  head/sys/boot/efi/loader/efi_main.c
> >>> > Modified:
> >>> >  head/sys/boot/efi/boot1/Makefile
> >>> >  head/sys/boot/efi/boot1/boot1.c
> >>> >  head/sys/boot/efi/libefi/Makefile
> >>> >  head/sys/boot/efi/loader/Makefile
> >>> 
> >>> Hello Warner,
> >>> 
> >>> After this change I?m getting the following panic on various test VMs.
> >>> 
> >>> Andrew
> >>> 
> >>> >> FreeBSD EFI boot block
> >>> 
> >>>Loader path: /boot/loader.efi
> >>> 
> >>>Load Path: \EFI\BOOT\BOOTAA64.EFI
> >>>Load Device: 
> >>> VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003C000A)/HD(1,GPT,DD40E9C6-B247-11E7-AA0A-15EFE1BBB7CF,0x3,0x640)
> >>> panic: Couldn't trim device path
> >>> --> Press a key on the console to reboot <--
> >>> 
> >> 
> >> 
> > 
> 


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


svn commit: r324668 - head/tests/sys/kern

2017-10-16 Thread Bryan Drewery
Author: bdrewery
Date: Mon Oct 16 20:06:24 2017
New Revision: 324668
URL: https://svnweb.freebsd.org/changeset/base/324668

Log:
  This child is expected to exit on SIGTRAP, don't leave a core behind.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/tests/sys/kern/ptrace_test.c

Modified: head/tests/sys/kern/ptrace_test.c
==
--- head/tests/sys/kern/ptrace_test.c   Mon Oct 16 17:21:52 2017
(r324667)
+++ head/tests/sys/kern/ptrace_test.c   Mon Oct 16 20:06:24 2017
(r324668)
@@ -2467,12 +2467,16 @@ ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_with_sigtrap_s
 ATF_TC_BODY(ptrace__PT_CONTINUE_with_sigtrap_system_call_entry, tc)
 {
struct ptrace_lwpinfo pl;
+   struct rlimit rl;
pid_t fpid, wpid;
int status;
 
ATF_REQUIRE((fpid = fork()) != -1);
if (fpid == 0) {
trace_me();
+   /* SIGTRAP expected to cause exit on syscall entry. */
+   rl.rlim_cur = rl.rlim_max = 0;
+   ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
getpid();
exit(1);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324669 - head/sys/kern

2017-10-16 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 16 20:11:29 2017
New Revision: 324669
URL: https://svnweb.freebsd.org/changeset/base/324669

Log:
  Style.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cMon Oct 16 20:06:24 2017(r324668)
+++ head/sys/kern/kern_sig.cMon Oct 16 20:11:29 2017(r324669)
@@ -2786,15 +2786,15 @@ issignal(struct thread *td)
struct sigacts *ps;
struct sigqueue *queue;
sigset_t sigpending;
-   int sig, prop;
ksiginfo_t ksi;
+   int prop, sig, traced;
 
p = td->td_proc;
ps = p->p_sigacts;
mtx_assert(&ps->ps_mtx, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
for (;;) {
-   int traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG);
+   traced = (p->p_flag & P_TRACED) || (p->p_stops & S_SIG);
 
sigpending = td->td_sigqueue.sq_signals;
SIGSETOR(sigpending, p->p_sigqueue.sq_signals);
@@ -2982,11 +2982,10 @@ thread_stopped(struct proc *p)
  * from the current set of pending signals.
  */
 int
-postsig(sig)
-   int sig;
+postsig(int sig)
 {
-   struct thread *td = curthread;
-   struct proc *p = td->td_proc;
+   struct thread *td;
+   struct proc *p;
struct sigacts *ps;
sig_t action;
ksiginfo_t ksi;
@@ -2994,6 +2993,8 @@ postsig(sig)
 
KASSERT(sig != 0, ("postsig"));
 
+   td = curthread;
+   p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
ps = p->p_sigacts;
mtx_assert(&ps->ps_mtx, MA_OWNED);
@@ -3010,7 +3011,7 @@ postsig(sig)
ktrpsig(sig, action, td->td_pflags & TDP_OLDMASK ?
&td->td_oldsigmask : &td->td_sigmask, ksi.ksi_code);
 #endif
-   if (p->p_stops & S_SIG) {
+   if ((p->p_stops & S_SIG) != 0) {
mtx_unlock(&ps->ps_mtx);
stopevent(p, S_SIG, sig);
mtx_lock(&ps->ps_mtx);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324670 - head/sys/kern

2017-10-16 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 16 20:15:19 2017
New Revision: 324670
URL: https://svnweb.freebsd.org/changeset/base/324670

Log:
  Improve assertion that an ignored or blocked signal is not delivered.
  
  Split two conditions into separate asserts.  Print additional details,
  like the signal number and action value.
  
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cMon Oct 16 20:11:29 2017(r324669)
+++ head/sys/kern/kern_sig.cMon Oct 16 20:15:19 2017(r324670)
@@ -3030,8 +3030,10 @@ postsig(int sig)
/*
 * If we get here, the signal must be caught.
 */
-   KASSERT(action != SIG_IGN && !SIGISMEMBER(td->td_sigmask, sig),
-   ("postsig action"));
+   KASSERT(action != SIG_IGN, ("postsig action %p", action));
+   KASSERT(!SIGISMEMBER(td->td_sigmask, sig),
+   ("postsig action: blocked sig %d", sig));
+
/*
 * Set the new mask value and also defer further
 * occurrences of this signal.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324671 - head/sys/kern

2017-10-16 Thread Konstantin Belousov
Author: kib
Date: Mon Oct 16 20:21:51 2017
New Revision: 324671
URL: https://svnweb.freebsd.org/changeset/base/324671

Log:
  Re-evaluate thread' signal mask after ptracestop().
  
  The stop drops process lock, which allows the signal mask to be
  changed and our selected signal might become blocked, i.e. should be
  returned to the process queue instead of delivery.
  
  Also, for the existing check of the process no longer having an
  attached debugger, we should not loose the signal, but requeue it.
  
  Reported and tested by:   bdrewery
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cMon Oct 16 20:15:19 2017(r324670)
+++ head/sys/kern/kern_sig.cMon Oct 16 20:21:51 2017(r324671)
@@ -2855,15 +2855,32 @@ issignal(struct thread *td)
mtx_lock(&ps->ps_mtx);
 
/* 
-* Keep looking if the debugger discarded the signal
-* or replaced it with a masked signal.
-*
-* If the traced bit got turned off, go back up
-* to the top to rescan signals.  This ensures
-* that p_sig* and p_sigact are consistent.
+* Keep looking if the debugger discarded or
+* replaced the signal.
 */
-   if (sig == 0 || (p->p_flag & P_TRACED) == 0)
+   if (sig == 0)
continue;
+
+   /*
+* If the signal became masked, re-queue it.
+*/
+   if (SIGISMEMBER(td->td_sigmask, sig)) {
+   ksi.ksi_flags |= KSI_HEAD;
+   sigqueue_add(&p->p_sigqueue, sig, &ksi);
+   continue;
+   }
+
+   /*
+* If the traced bit got turned off, requeue
+* the signal and go back up to the top to
+* rescan signals.  This ensures that p_sig*
+* and p_sigact are consistent.
+*/
+   if ((p->p_flag & P_TRACED) == 0) {
+   ksi.ksi_flags |= KSI_HEAD;
+   sigqueue_add(queue, sig, &ksi);
+   continue;
+   }
}
 
prop = sigprop(sig);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r324656 - head/lib/libifconfig

2017-10-16 Thread Andriy Voskoboinyk
Mon, 16 Oct 2017 19:06:55 +0300 було написано Alan Somers  
:


On Mon, Oct 16, 2017 at 12:54 AM, Andriy Voskoboinyk   
wrote:

Author: avos
Date: Mon Oct 16 06:54:26 2017
New Revision: 324656
URL: https://svnweb.freebsd.org/changeset/base/324656

Log:
  libifconfig: allow to get original interface name via  
ifconfig_get_orig_name()


  Uses the same method as in tools/tools/ifinfo/ifinfo.c
  (via net.link.generic sysctl).

  Tested with modified wlandebug(8).

  Differential Revision:https://reviews.freebsd.org/D12554

Modified:
  head/lib/libifconfig/libifconfig.c
  head/lib/libifconfig/libifconfig.h


The original author of libifconfig keeps her work at Github.  To
reduce divergence, we should submit changes there first, or else
convince her to start using our SVN repository.  Did you at least ask
her for review?
https://github.com/savagedlight/libifconfig


It was placed at https://github.com/Savagedlight/libifconfig/pull/52;
should I back this change out until it will be reviewed?



-Alan

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

svn commit: r324672 - head/sys/net

2017-10-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Oct 16 21:21:31 2017
New Revision: 324672
URL: https://svnweb.freebsd.org/changeset/base/324672

Log:
  ifnet(9): split ifc_alloc_unit() (should simplify code flow)
  
  Allocate smallest unit number from pool via ifc_alloc_unit_next()
  and exact unit number (if available) via ifc_alloc_unit_specific().
  
  While here, address possible deadlock (mentioned in PR).
  
  PR:   217401
  MFC after:5 days
  Differential Revision:https://reviews.freebsd.org/D12551

Modified:
  head/sys/net/if_clone.c

Modified: head/sys/net/if_clone.c
==
--- head/sys/net/if_clone.c Mon Oct 16 20:21:51 2017(r324671)
+++ head/sys/net/if_clone.c Mon Oct 16 21:21:31 2017(r324672)
@@ -595,44 +595,56 @@ ifc_name2unit(const char *name, int *unit)
return (0);
 }
 
-int
-ifc_alloc_unit(struct if_clone *ifc, int *unit)
+static int
+ifc_alloc_unit_specific(struct if_clone *ifc, int *unit)
 {
char name[IFNAMSIZ];
-   int wildcard;
 
-   wildcard = (*unit < 0);
-retry:
if (*unit > ifc->ifc_maxunit)
return (ENOSPC);
-   if (*unit < 0) {
-   *unit = alloc_unr(ifc->ifc_unrhdr);
-   if (*unit == -1)
-   return (ENOSPC);
-   } else {
-   *unit = alloc_unr_specific(ifc->ifc_unrhdr, *unit);
-   if (*unit == -1) {
-   if (wildcard) {
-   (*unit)++;
-   goto retry;
-   } else
-   return (EEXIST);
-   }
-   }
 
+   if (alloc_unr_specific(ifc->ifc_unrhdr, *unit) == -1)
+   return (EEXIST);
+
snprintf(name, IFNAMSIZ, "%s%d", ifc->ifc_name, *unit);
if (ifunit(name) != NULL) {
free_unr(ifc->ifc_unrhdr, *unit);
-   if (wildcard) {
-   (*unit)++;
-   goto retry;
-   } else
-   return (EEXIST);
+   return (EEXIST);
}
 
IF_CLONE_ADDREF(ifc);
 
return (0);
+}
+
+static int
+ifc_alloc_unit_next(struct if_clone *ifc, int *unit)
+{
+   int error;
+
+   *unit = alloc_unr(ifc->ifc_unrhdr);
+   if (*unit == -1)
+   return (ENOSPC);
+
+   free_unr(ifc->ifc_unrhdr, *unit);
+   for (;;) {
+   error = ifc_alloc_unit_specific(ifc, unit);
+   if (error != EEXIST)
+   break;
+
+   (*unit)++;
+   }
+
+   return (error);
+}
+
+int
+ifc_alloc_unit(struct if_clone *ifc, int *unit)
+{
+   if (*unit < 0)
+   return (ifc_alloc_unit_next(ifc, unit));
+   else
+   return (ifc_alloc_unit_specific(ifc, unit));
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-10-16 Thread Julien Charbon

 Hi Jonathan,

On 10/16/17 7:04 PM, Jonathan Looney wrote:
> I apologize for just getting to this, but your code just made it into my
> local tree.
> 
> The non-INVARIANTS case looks incorrect. Because tw stays on the list,
> it can end up stuck at the front of the queue and block everything
> behind it.
> 
> Personally, I would be more comfortable just panic'ing here. This
> indicates a problem. And, depending on the way things got corrupted, you
> could end up with other hard-to-debug problems if you continue with a
> corrupted state.

 Good remark, actually, this logic:

#ifdef INVARIANTS -> panic()
#else INVARIANTS -> log(LOG_ERR)

 was introduced with the main fix:
https://reviews.freebsd.org/rS307551

 Why not panic()-ing in both cases INVARIANTS and !INVARIANTS already?
The rational is that r307551 fixes an issue introduced with r185775,
pushed 8 years before:
https://reviews.freebsd.org/rS185775

 Obviously, this double free is either rarely reproduced and/or has only
minor effects for most of people (like a connection closes sooner than
expected), only few people got annoying kernel panic/infinite loop.
Thus before introducing a panic() that could potentially impact a fair
amount of people, better introducing a log(LOG_ERR) first.

 Now, when replace these log(LOG_ERR) calls by a proper panic()?  I
would say when 11.0 (which is the last supported release without the
r307551 fix) reaches the EoL state:  End of October 2017 I believe.  And
so far, so good, no log(LOG_ERR)/panic()/similar issues have been
witness with r307551 fix.

 Of course, if you think it is too cautious, you can create a review
with the panic() calls change to get wider point of views.

 My 2 cents.

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


svn commit: r324673 - head/sys/kern

2017-10-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Oct 16 21:46:11 2017
New Revision: 324673
URL: https://svnweb.freebsd.org/changeset/base/324673

Log:
  mbuf(9): unbreak m_fragment()
  
  - Fix it by replacing m_cat() with m_prev->m_next = m_new
  (m_cat() will try to append data - as a result, there will be no
  fragmentation).
  - Move some constants out of the loop.
  
  Was previously tested with D4077.
  
  Differential Revision:https://reviews.freebsd.org/D4090

Modified:
  head/sys/kern/uipc_mbuf.c

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Mon Oct 16 21:21:31 2017(r324672)
+++ head/sys/kern/uipc_mbuf.c   Mon Oct 16 21:46:11 2017(r324673)
@@ -1449,62 +1449,59 @@ bad:
 struct mbuf *
 m_fragment(struct mbuf *m0, int how, int length)
 {
-   struct mbuf *m_new = NULL, *m_final = NULL;
-   int progress = 0;
+   struct mbuf *m_first, *m_last;
+   int divisor = 255, progress = 0, fraglen;
 
if (!(m0->m_flags & M_PKTHDR))
return (m0);
 
-   if ((length == 0) || (length < -2))
+   if (length == 0 || length < -2)
return (m0);
+   if (length > MCLBYTES)
+   length = MCLBYTES;
+   if (length < 0 && divisor > MCLBYTES)
+   divisor = MCLBYTES;
+   if (length == -1)
+   length = 1 + (arc4random() % divisor);
+   if (length > 0)
+   fraglen = length;
 
m_fixhdr(m0); /* Needed sanity check */
 
-   m_final = m_getcl(how, MT_DATA, M_PKTHDR);
-
-   if (m_final == NULL)
+   m_first = m_getcl(how, MT_DATA, M_PKTHDR);
+   if (m_first == NULL)
goto nospace;
 
-   if (m_dup_pkthdr(m_final, m0, how) == 0)
+   if (m_dup_pkthdr(m_first, m0, how) == 0)
goto nospace;
 
-   m_new = m_final;
+   m_last = m_first;
 
-   if (length == -1)
-   length = 1 + (arc4random() & 255);
-
while (progress < m0->m_pkthdr.len) {
-   int fraglen;
-
-   if (length > 0)
-   fraglen = length;
-   else
-   fraglen = 1 + (arc4random() & 255);
+   if (length == -2)
+   fraglen = 1 + (arc4random() % divisor);
if (fraglen > m0->m_pkthdr.len - progress)
fraglen = m0->m_pkthdr.len - progress;
 
-   if (fraglen > MCLBYTES)
-   fraglen = MCLBYTES;
-
-   if (m_new == NULL) {
-   m_new = m_getcl(how, MT_DATA, 0);
+   if (progress != 0) {
+   struct mbuf *m_new = m_getcl(how, MT_DATA, 0);
if (m_new == NULL)
goto nospace;
+
+   m_last->m_next = m_new;
+   m_last = m_new;
}
 
-   m_copydata(m0, progress, fraglen, mtod(m_new, caddr_t));
+   m_copydata(m0, progress, fraglen, mtod(m_last, caddr_t));
progress += fraglen;
-   m_new->m_len = fraglen;
-   if (m_new != m_final)
-   m_cat(m_final, m_new);
-   m_new = NULL;
+   m_last->m_len = fraglen;
}
m_freem(m0);
-   m0 = m_final;
+   m0 = m_first;
return (m0);
 nospace:
-   if (m_final)
-   m_freem(m_final);
+   if (m_first)
+   m_freem(m_first);
/* Return the original chain on failure */
return (m0);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2017-10-16 Thread Bryan Drewery
On 10/16/2017 2:46 PM, Andriy Voskoboinyk wrote:
> Author: avos
> Date: Mon Oct 16 21:46:11 2017
> New Revision: 324673
> URL: https://svnweb.freebsd.org/changeset/base/324673
> 
> Log:
>   mbuf(9): unbreak m_fragment()

How was it broken and since when?

>   
>   - Fix it by replacing m_cat() with m_prev->m_next = m_new
>   (m_cat() will try to append data - as a result, there will be no
>   fragmentation).
>   - Move some constants out of the loop.
>   
>   Was previously tested with D4077.
>   
>   Differential Revision:  https://reviews.freebsd.org/D4090


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r324656 - head/lib/libifconfig

2017-10-16 Thread Andriy Voskoboinyk

On Mon, Oct 16, 2017 at 06:54:26AM +, Andriy Voskoboinyk wrote:

Author: avos
Date: Mon Oct 16 06:54:26 2017
New Revision: 324656
URL: https://svnweb.freebsd.org/changeset/base/324656

Log:
  libifconfig: allow to get original interface name via  
ifconfig_get_orig_name()


  Uses the same method as in tools/tools/ifinfo/ifinfo.c
  (via net.link.generic sysctl).

  Tested with modified wlandebug(8).

  Differential Revision:https://reviews.freebsd.org/D12554

Modified:
  head/lib/libifconfig/libifconfig.c
  head/lib/libifconfig/libifconfig.h

Modified: head/lib/libifconfig/libifconfig.c
==
--- head/lib/libifconfig/libifconfig.c	Mon Oct 16 04:46:28  
2017	(r324655)
+++ head/lib/libifconfig/libifconfig.c	Mon Oct 16 06:54:26  
2017	(r324656)

@@ -61,9 +61,43 @@
  * $FreeBSD$
  */

+ /*
+ * Copyright 1996 Massachusetts Institute of Technology
+ *

1996?

This file was already under a BSD license, why adding an extra MIT  
license to

it? It would be better to keep it under BSD license imho


This one came unchanged from tools/tools/ifinfo/ifinfo.c (with
modified code from it); I'm not sure if it can be just omitted.



Best regards,
Bapt

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


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

2017-10-16 Thread Andriy Voskoboinyk
Tue, 17 Oct 2017 00:53:28 +0300 було написано Bryan Drewery  
:



On 10/16/2017 2:46 PM, Andriy Voskoboinyk wrote:

Author: avos
Date: Mon Oct 16 21:46:11 2017
New Revision: 324673
URL: https://svnweb.freebsd.org/changeset/base/324673

Log:
  mbuf(9): unbreak m_fragment()


How was it broken


Due to m_cat() usage reason (as described below); this part was
not changed since function creation in r119644.


and since when?


No idea here - probably, it was partially working until m_cat()
improvement in r242256.

P.S. Just checked with m_fragment(m, M_NOWAIT, -2) placed
right before ieee80211_mbuf_defrag() (from D4077) and
various m_len printf's before and after - it defragments
frames before this change and works as intended after it.





  - Fix it by replacing m_cat() with m_prev->m_next = m_new
  (m_cat() will try to append data - as a result, there will be no
  fragmentation).
  - Move some constants out of the loop.

  Was previously tested with D4077.

  Differential Revision:https://reviews.freebsd.org/D4090



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

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

2017-10-16 Thread Rick Macklem
Author: rmacklem
Date: Mon Oct 16 23:28:12 2017
New Revision: 324676
URL: https://svnweb.freebsd.org/changeset/base/324676

Log:
  Use taskqueue(9) to do writes/commits to mirrored DSs concurrently.
  
  When the NFSv4.1 pNFS client is using a Flexible File Layout specifying
  mirrored Data Servers, it must do the writes and commits to all mirrors.
  This patch modifies the client to use a taskqueue to perform these writes
  and commits concurrently.
  The number of threads can't be changed for taskqueue(9), so it is set
  to 4 * mp_ncpus by default, but this can be overridden by setting the
  sysctl vfs.nfs.pnfsiothreads.
  
  Differential Revision:https://reviews.freebsd.org/D12632

Modified:
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfs/nfs_commonport.c
==
--- head/sys/fs/nfs/nfs_commonport.cMon Oct 16 21:55:31 2017
(r324675)
+++ head/sys/fs/nfs/nfs_commonport.cMon Oct 16 23:28:12 2017
(r324676)
@@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$");
  * to this BSD variant.
  */
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -68,6 +70,8 @@ int nfsrv_lughashsize = 100;
 void (*nfsd_call_servertimer)(void) = NULL;
 void (*ncl_call_invalcaches)(struct vnode *) = NULL;
 
+int nfs_pnfsio(task_fn_t *, void *);
+
 static int nfs_realign_test;
 static int nfs_realign_count;
 static struct ext_nfsstats oldnfsstats;
@@ -84,6 +88,9 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, debuglevel, CTLFLAG_RW,
 0, "Debug level for NFS client");
 SYSCTL_INT(_vfs_nfs, OID_AUTO, userhashsize, CTLFLAG_RDTUN, &nfsrv_lughashsize,
 0, "Size of hash tables for uid/name mapping");
+int nfs_pnfsiothreads = 0;
+SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsiothreads, CTLFLAG_RW, &nfs_pnfsiothreads,
+0, "Number of pNFS mirror I/O threads");
 
 /*
  * Defines for malloc
@@ -689,6 +696,50 @@ nfs_supportsnfsv4acls(struct vnode *vp)
if (error == 0 && retval != 0)
return (1);
return (0);
+}
+
+/*
+ * These are the first fields of all the context structures passed into
+ * nfs_pnfsio().
+ */
+struct pnfsio {
+   int done;
+   int inprog;
+   struct task tsk;
+};
+
+/*
+ * Do a mirror I/O on a pNFS thread.
+ */
+int
+nfs_pnfsio(task_fn_t *func, void *context)
+{
+   struct pnfsio *pio;
+   int ret;
+   static struct taskqueue *pnfsioq = NULL;
+
+   pio = (struct pnfsio *)context;
+   if (pnfsioq == NULL) {
+   if (nfs_pnfsiothreads == 0)
+   nfs_pnfsiothreads = mp_ncpus * 4;
+   pnfsioq = taskqueue_create("pnfsioq", M_WAITOK,
+   taskqueue_thread_enqueue, &pnfsioq);
+   if (pnfsioq == NULL)
+   return (ENOMEM);
+   ret = taskqueue_start_threads(&pnfsioq, nfs_pnfsiothreads,
+   0, "pnfsiot");
+   if (ret != 0) {
+   taskqueue_free(pnfsioq);
+   pnfsioq = NULL;
+   return (ret);
+   }
+   }
+   pio->inprog = 1;
+   TASK_INIT(&pio->tsk, 0, func, context);
+   ret = taskqueue_enqueue(pnfsioq, &pio->tsk);
+   if (ret != 0)
+   pio->inprog = 0;
+   return (ret);
 }
 
 extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *);

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cMon Oct 16 21:55:31 2017
(r324675)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cMon Oct 16 23:28:12 2017
(r324676)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 SYSCTL_DECL(_vfs_nfs);
 
@@ -64,6 +65,7 @@ extern nfstype nfsv34_type[9];
 extern int nfsrv_useacl;
 extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
 extern int nfscl_debuglevel;
+extern int nfs_pnfsiothreads;
 NFSCLSTATEMUTEX;
 int nfstest_outofseq = 0;
 int nfscl_assumeposixlocks = 1;
@@ -87,6 +89,30 @@ enum nfsclds_state {
NFSDSP_NOTFOUND = 2,
 };
 
+/*
+ * Do a write RPC on a DS data file, using this structure for the arguments,
+ * so that this function can be executed by a separate kernel process.
+ */
+struct nfsclwritedsdorpc {
+   int done;
+   int inprog;
+   struct task tsk;
+   struct vnode*vp;
+   int iomode;
+   int must_commit;
+   nfsv4stateid_t  *stateidp;
+   struct nfsclds  *dsp;
+   uint64_toff;
+   int len;
+   struct nfsfh*fhp;
+   struct mbuf *m;
+   int vers;
+   int minorvers;
+   struct ucred*cred;
+   NFSPROC_T 

svn commit: r324680 - head/sys/gdb

2017-10-16 Thread Ryan Libby
Author: rlibby
Date: Tue Oct 17 01:12:17 2017
New Revision: 324680
URL: https://svnweb.freebsd.org/changeset/base/324680

Log:
  gdb kernel server: fixup Search:memory style
  
  This is a NFC patch to move around the Search:memory implementation so
  that it doesn't exceed the standard column width and doesn't take so
  much vertical space in gdb_trap.
  
  Submitted by: Daniel O'Connor 
  Reviewed by:  cem, jhb
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D12684

Modified:
  head/sys/gdb/gdb_main.c

Modified: head/sys/gdb/gdb_main.c
==
--- head/sys/gdb/gdb_main.c Tue Oct 17 00:25:44 2017(r324679)
+++ head/sys/gdb/gdb_main.c Tue Oct 17 01:12:17 2017(r324680)
@@ -94,6 +94,33 @@ gdb_init(void)
return (cur_pri);
 }
 
+static void
+gdb_do_mem_search(void)
+{
+   size_t patlen;
+   intmax_t addr, size;
+   const unsigned char *found;
+
+   if (gdb_rx_varhex(&addr) || gdb_rx_char() != ';' ||
+   gdb_rx_varhex(&size) || gdb_rx_char() != ';' ||
+   gdb_rx_bindata(gdb_bindata, sizeof(gdb_bindata), &patlen)) {
+   gdb_tx_err(EINVAL);
+   return;
+   }
+   if (gdb_search_mem((char *)(uintptr_t)addr, size, gdb_bindata,
+   patlen, &found)) {
+   if (found == 0ULL)
+   gdb_tx_begin('0');
+   else {
+   gdb_tx_begin('1');
+   gdb_tx_char(',');
+   gdb_tx_hex((intmax_t)(uintptr_t)found, 8);
+   }
+   gdb_tx_end();
+   } else
+   gdb_tx_err(EIO);
+}
+
 static int
 gdb_trap(int type, int code)
 {
@@ -257,27 +284,7 @@ gdb_trap(int type, int code)
gdb_tx_end();
}
} else if (gdb_rx_equal("Search:memory:")) {
-   size_t patlen;
-   intmax_t addr, size;
-   const unsigned char *found;
-   if (gdb_rx_varhex(&addr) || gdb_rx_char() != 
';' ||
-   gdb_rx_varhex(&size) || gdb_rx_char() != 
';' ||
-   gdb_rx_bindata(gdb_bindata, 
sizeof(gdb_bindata), &patlen)) {
-   gdb_tx_err(EINVAL);
-   break;
-   }
-   if (gdb_search_mem((char *)(uintptr_t)addr, 
size, gdb_bindata, patlen, &found)) {
-   if (found == 0ULL)
-   gdb_tx_begin('0');
-   else {
-   gdb_tx_begin('1');
-   gdb_tx_char(',');
-   
gdb_tx_hex((intmax_t)(uintptr_t)found, 8);
-   }
-   gdb_tx_end();
-   } else
-   gdb_tx_err(EIO);
-   break;
+   gdb_do_mem_search();
} else if (!gdb_cpu_query())
gdb_tx_empty();
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324681 - in head/etc: defaults periodic/daily

2017-10-16 Thread Cy Schubert
Author: cy
Date: Tue Oct 17 01:15:13 2017
New Revision: 324681
URL: https://svnweb.freebsd.org/changeset/base/324681

Log:
  Provide an option to run the anticongestion ntpd leapfile fetch in
  the background.
  
  Original patch submitted by feld@. I added the "optional" bit.
  
  Submitted by: feld (original patch)
  MFC after:2 weeks

Modified:
  head/etc/defaults/periodic.conf
  head/etc/periodic/daily/480.leapfile-ntpd

Modified: head/etc/defaults/periodic.conf
==
--- head/etc/defaults/periodic.conf Tue Oct 17 01:12:17 2017
(r324680)
+++ head/etc/defaults/periodic.conf Tue Oct 17 01:15:13 2017
(r324681)
@@ -141,6 +141,8 @@ daily_status_mail_rejects_shorten="NO"  
# Shorten out
 
 # 480.leapfile-ntpd
 daily_ntpd_leapfile_enable="YES"   # Fetch NTP leapfile
+daily_ntpd_leapfile_background="NO"# Fetch NTP leapfile
+   # in the background
 
 # 480.status-ntpd
 daily_status_ntpd_enable="NO"  # Check NTP status

Modified: head/etc/periodic/daily/480.leapfile-ntpd
==
--- head/etc/periodic/daily/480.leapfile-ntpd   Tue Oct 17 01:12:17 2017
(r324680)
+++ head/etc/periodic/daily/480.leapfile-ntpd   Tue Oct 17 01:15:13 2017
(r324681)
@@ -13,8 +13,15 @@ fi
 
 case "$daily_ntpd_leapfile_enable" in
 [Yy][Ee][Ss])
-anticongestion
-service ntpd onefetch
+   case "$daily_ntpd_leapfile_background" in
+   [Yy][Ee][Ss])
+   (anticongestion && service ntpd onefetch) &
+   ;;
+   *)
+   anticongestion
+   service ntpd onefetch
+   ;;
+   esac
 ;;
 esac
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324682 - head/etc/periodic/daily

2017-10-16 Thread Cy Schubert
Author: cy
Date: Tue Oct 17 01:15:55 2017
New Revision: 324682
URL: https://svnweb.freebsd.org/changeset/base/324682

Log:
  Style. Replace 8 spaces with a tab.
  
  MFC after:2 weeks (with prior commit to this file)

Modified:
  head/etc/periodic/daily/480.leapfile-ntpd

Modified: head/etc/periodic/daily/480.leapfile-ntpd
==
--- head/etc/periodic/daily/480.leapfile-ntpd   Tue Oct 17 01:15:13 2017
(r324681)
+++ head/etc/periodic/daily/480.leapfile-ntpd   Tue Oct 17 01:15:55 2017
(r324682)
@@ -22,7 +22,7 @@ case "$daily_ntpd_leapfile_enable" in
service ntpd onefetch
;;
esac
-;;
+   ;;
 esac
 
 exit $rc
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324683 - in head/lib: libc/sys libstand

2017-10-16 Thread Ed Maste
Author: emaste
Date: Tue Oct 17 02:51:45 2017
New Revision: 324683
URL: https://svnweb.freebsd.org/changeset/base/324683

Log:
  write.2: correct maximum nbytes size for EINVAL error
  
  In FreeBSD 11 and later debug.iosize_max_clamp defaults to 0, and the
  maximum nbytes count for write(2) is SSIZE_MAX. Update the man page to
  document this, and mention the sysctl that can be set to obtain the
  previous behaviour.
  
  PR:   19
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Added:
  head/lib/libstand/
 - copied from r324627, head/lib/libstand/
Modified:
  head/lib/libc/sys/write.2

Modified: head/lib/libc/sys/write.2
==
--- head/lib/libc/sys/write.2   Tue Oct 17 01:15:55 2017(r324682)
+++ head/lib/libc/sys/write.2   Tue Oct 17 02:51:45 2017(r324683)
@@ -28,7 +28,7 @@
 .\" @(#)write.28.5 (Berkeley) 4/2/94
 .\" $FreeBSD$
 .\"
-.Dd December 15, 2015
+.Dd October 16, 2017
 .Dt WRITE 2
 .Os
 .Sh NAME
@@ -199,7 +199,12 @@ to enable writing on the disk label area.
 The value
 .Fa nbytes
 is greater than
-.Dv INT_MAX .
+.Dv SSIZE_MAX
+(or greater than
+.Dv INT_MAX ,
+if the sysctl
+.Va debug.iosize_max_clamp
+is non-zero).
 .El
 .Pp
 In addition,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r324684 - head/lib/libstand

2017-10-16 Thread Ed Maste
Author: emaste
Date: Tue Oct 17 02:53:42 2017
New Revision: 324684
URL: https://svnweb.freebsd.org/changeset/base/324684

Log:
  Remove lib/libstand again, accidentally readded in r324683

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