svn commit: r346786 - stable/11/sys/modules/opensolaris

2019-04-26 Thread Mark Johnston
Author: markj
Date: Sat Apr 27 05:35:51 2019
New Revision: 346786
URL: https://svnweb.freebsd.org/changeset/base/346786

Log:
  MFC r346440:
  Export cpu_core from opensolaris.ko.
  
  PR:   191462

Modified:
  stable/11/sys/modules/opensolaris/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/modules/opensolaris/Makefile
==
--- stable/11/sys/modules/opensolaris/Makefile  Sat Apr 27 05:35:20 2019
(r346785)
+++ stable/11/sys/modules/opensolaris/Makefile  Sat Apr 27 05:35:51 2019
(r346786)
@@ -27,6 +27,8 @@ CFLAGS+=  -I${SYSDIR}/cddl/compat/opensolaris 
\
-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
-I${SYSDIR}
 
+EXPORT_SYMS=   cpu_core
+
 IGNORE_PRAGMA= 1
 
 .include 
___
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: r346785 - stable/12/sys/modules/opensolaris

2019-04-26 Thread Mark Johnston
Author: markj
Date: Sat Apr 27 05:35:20 2019
New Revision: 346785
URL: https://svnweb.freebsd.org/changeset/base/346785

Log:
  MFC r346440:
  Export cpu_core from opensolaris.ko.
  
  PR:   191462

Modified:
  stable/12/sys/modules/opensolaris/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/modules/opensolaris/Makefile
==
--- stable/12/sys/modules/opensolaris/Makefile  Sat Apr 27 04:51:57 2019
(r346784)
+++ stable/12/sys/modules/opensolaris/Makefile  Sat Apr 27 05:35:20 2019
(r346785)
@@ -27,6 +27,8 @@ CFLAGS+=  -I${SYSDIR}/cddl/compat/opensolaris 
\
-I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
-I${SYSDIR}
 
+EXPORT_SYMS=   cpu_core
+
 IGNORE_PRAGMA= 1
 
 .include 
___
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: r346784 - in stable: 11/sys/sys 12/sys/sys

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:51:57 2019
New Revision: 346784
URL: https://svnweb.freebsd.org/changeset/base/346784

Log:
  Bump __FreeBSD_version for ether_gen_addr availability
  
  This is a direct commit to stable branches as the bump wasn't present in
  head.

Modified:
  stable/12/sys/sys/param.h

Changes in other areas also in this revision:
Modified:
  stable/11/sys/sys/param.h

Modified: stable/12/sys/sys/param.h
==
--- stable/12/sys/sys/param.h   Sat Apr 27 04:39:41 2019(r346783)
+++ stable/12/sys/sys/param.h   Sat Apr 27 04:51:57 2019(r346784)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200507  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200508  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346784 - in stable: 11/sys/sys 12/sys/sys

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:51:57 2019
New Revision: 346784
URL: https://svnweb.freebsd.org/changeset/base/346784

Log:
  Bump __FreeBSD_version for ether_gen_addr availability
  
  This is a direct commit to stable branches as the bump wasn't present in
  head.

Modified:
  stable/11/sys/sys/param.h

Changes in other areas also in this revision:
Modified:
  stable/12/sys/sys/param.h

Modified: stable/11/sys/sys/param.h
==
--- stable/11/sys/sys/param.h   Sat Apr 27 04:39:41 2019(r346783)
+++ stable/11/sys/sys/param.h   Sat Apr 27 04:51:57 2019(r346784)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1102507  /* Master, propagated to newvers */
+#define __FreeBSD_version 1102508  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346783 - in stable: 11/sys/conf 11/sys/net 12/sys/conf 12/sys/net

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:39:41 2019
New Revision: 346783
URL: https://svnweb.freebsd.org/changeset/base/346783

Log:
  MFC r345139, r345151, r346324, r346328: ether_gen_addr KPI
  
  if_bridge and if_vxlan conversion to this deterministic MAC address KPI has
  been MFC as well.  This is potentially error prone as the generated address
  range for these has decreased, but I've deemed this acceptable for stable
  branches due to collisions for thees interfaces being easily remedied.
  
  I have no intention of switching anything else to this KPI in any stable
  branches.
  
  r345139:
  ether: centralize fake hwaddr generation
  
  We currently have two places with identical fake hwaddr generation --
  if_vxlan and if_bridge. Lift it into if_ethersubr for reuse in other
  interfaces that may also need a fake addr.
  
  r345151:
  ether_fakeaddr: Use 'b' 's' 'd' for the prefix
  
  This has the advantage of being obvious to sniff out the designated prefix
  by eye and it has all the right bits set. Comment stolen from ffec.
  
  I've removed bryanv@'s pending question of using the FreeBSD OUI range --
  no one has followed up on this with a definitive action, and there's no
  particular reason to shoot for it and the administrative overhead that comes
  with deciding exactly how to use it.
  
  r346324:
  net: adjust randomized address bits
  
  Give devices that need a MAC a 16-bit allocation out of the FreeBSD
  Foundation OUI range. Change the name ether_fakeaddr to ether_gen_addr now
  that we're dealing real MAC addresses with a real OUI rather than random
  locally-administered addresses.
  
  r346328:
  Compile sha1.c when ether support is included
  
  sha1 is used by ether_gen_addr after r346324. Perhaps in an ideal world we
  could detect that the kernel's been compiled without sha1_* bits included
  and silently fallback to arc4random instead because these platforms/kernel
  configs are far and few between. It's fairly lightweight, though, so just
  include it for now.

Modified:
  stable/12/sys/conf/files
  stable/12/sys/net/ethernet.h
  stable/12/sys/net/ieee_oui.h
  stable/12/sys/net/if_bridge.c
  stable/12/sys/net/if_ethersubr.c
  stable/12/sys/net/if_vxlan.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/conf/files
  stable/11/sys/net/ethernet.h
  stable/11/sys/net/ieee_oui.h
  stable/11/sys/net/if_bridge.c
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/if_vxlan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesSat Apr 27 04:16:15 2019(r346782)
+++ stable/12/sys/conf/filesSat Apr 27 04:39:41 2019(r346783)
@@ -678,8 +678,8 @@ crypto/rijndael/rijndael-alg-fst.c optional crypto | e
 crypto/rijndael/rijndael-api-fst.c optional ekcd | geom_bde | random 
!random_loadable
 crypto/rijndael/rijndael-api.c optional crypto | ipsec | ipsec_support | \
wlan_ccmp
-crypto/sha1.c  optional carp | crypto | ipsec | \
-   ipsec_support | netgraph_mppc_encryption | sctp 
+crypto/sha1.c  optional carp | crypto | ether | ipsec | \
+   ipsec_support | netgraph_mppc_encryption | sctp
 crypto/sha2/sha256c.c  optional crypto | ekcd | geom_bde | ipsec | \
ipsec_support | random !random_loadable | sctp | zfs
 crypto/sha2/sha512c.c  optional crypto | geom_bde | ipsec | \

Modified: stable/12/sys/net/ethernet.h
==
--- stable/12/sys/net/ethernet.hSat Apr 27 04:16:15 2019
(r346782)
+++ stable/12/sys/net/ethernet.hSat Apr 27 04:39:41 2019
(r346783)
@@ -422,6 +422,7 @@ voidether_vlan_mtap(struct bpf_if *, struct mbuf *,
 struct mbuf  *ether_vlanencap(struct mbuf *, uint16_t);
 bool   ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
uint16_t vid, uint8_t pcp);
+void   ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr);
 
 #ifdef _SYS_EVENTHANDLER_H_
 /* new ethernet interface attached event */

Modified: stable/12/sys/net/ieee_oui.h
==
--- stable/12/sys/net/ieee_oui.hSat Apr 27 04:16:15 2019
(r346782)
+++ stable/12/sys/net/ieee_oui.hSat Apr 27 04:39:41 2019
(r346783)
@@ -67,3 +67,14 @@
 /* Allocate 20 bits to bhyve */
 #define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD(0x01)
 #define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD(0x0f)
+
+/*
+ * Allocate 16 bits for a pool to give to various interfaces that need a
+ * generated address, but don't quite need to slice off a whole section of
+ * the OUI (e.g. cloned interfaces, one-off NICs of various vendors).
+ *
+ * ether_gen_addr should be used to generate an address from this pool.
+ */

svn commit: r346783 - in stable: 11/sys/conf 11/sys/net 12/sys/conf 12/sys/net

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:39:41 2019
New Revision: 346783
URL: https://svnweb.freebsd.org/changeset/base/346783

Log:
  MFC r345139, r345151, r346324, r346328: ether_gen_addr KPI
  
  if_bridge and if_vxlan conversion to this deterministic MAC address KPI has
  been MFC as well.  This is potentially error prone as the generated address
  range for these has decreased, but I've deemed this acceptable for stable
  branches due to collisions for thees interfaces being easily remedied.
  
  I have no intention of switching anything else to this KPI in any stable
  branches.
  
  r345139:
  ether: centralize fake hwaddr generation
  
  We currently have two places with identical fake hwaddr generation --
  if_vxlan and if_bridge. Lift it into if_ethersubr for reuse in other
  interfaces that may also need a fake addr.
  
  r345151:
  ether_fakeaddr: Use 'b' 's' 'd' for the prefix
  
  This has the advantage of being obvious to sniff out the designated prefix
  by eye and it has all the right bits set. Comment stolen from ffec.
  
  I've removed bryanv@'s pending question of using the FreeBSD OUI range --
  no one has followed up on this with a definitive action, and there's no
  particular reason to shoot for it and the administrative overhead that comes
  with deciding exactly how to use it.
  
  r346324:
  net: adjust randomized address bits
  
  Give devices that need a MAC a 16-bit allocation out of the FreeBSD
  Foundation OUI range. Change the name ether_fakeaddr to ether_gen_addr now
  that we're dealing real MAC addresses with a real OUI rather than random
  locally-administered addresses.
  
  r346328:
  Compile sha1.c when ether support is included
  
  sha1 is used by ether_gen_addr after r346324. Perhaps in an ideal world we
  could detect that the kernel's been compiled without sha1_* bits included
  and silently fallback to arc4random instead because these platforms/kernel
  configs are far and few between. It's fairly lightweight, though, so just
  include it for now.

Modified:
  stable/11/sys/conf/files
  stable/11/sys/net/ethernet.h
  stable/11/sys/net/ieee_oui.h
  stable/11/sys/net/if_bridge.c
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/if_vxlan.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/conf/files
  stable/12/sys/net/ethernet.h
  stable/12/sys/net/ieee_oui.h
  stable/12/sys/net/if_bridge.c
  stable/12/sys/net/if_ethersubr.c
  stable/12/sys/net/if_vxlan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/conf/files
==
--- stable/11/sys/conf/filesSat Apr 27 04:16:15 2019(r346782)
+++ stable/11/sys/conf/filesSat Apr 27 04:39:41 2019(r346783)
@@ -656,8 +656,8 @@ crypto/rijndael/rijndael-alg-fst.c optional crypto | g
 crypto/rijndael/rijndael-api-fst.c optional geom_bde | random !random_loadable
 crypto/rijndael/rijndael-api.c optional crypto | ipsec | ipsec_support | \
wlan_ccmp
-crypto/sha1.c  optional carp | crypto | ipsec | \
-   ipsec_support | netgraph_mppc_encryption | sctp 
+crypto/sha1.c  optional carp | crypto | ether | ipsec | \
+   ipsec_support | netgraph_mppc_encryption | sctp
 crypto/sha2/sha256c.c  optional crypto | geom_bde | ipsec | \
ipsec_support | random !random_loadable | sctp | zfs
 crypto/sha2/sha512c.c  optional crypto | geom_bde | ipsec | \

Modified: stable/11/sys/net/ethernet.h
==
--- stable/11/sys/net/ethernet.hSat Apr 27 04:16:15 2019
(r346782)
+++ stable/11/sys/net/ethernet.hSat Apr 27 04:39:41 2019
(r346783)
@@ -422,6 +422,7 @@ voidether_vlan_mtap(struct bpf_if *, struct mbuf *,
 struct mbuf  *ether_vlanencap(struct mbuf *, uint16_t);
 bool   ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p,
uint16_t vid, uint8_t pcp);
+void   ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr);
 
 #ifdef _SYS_EVENTHANDLER_H_
 /* new ethernet interface attached event */

Modified: stable/11/sys/net/ieee_oui.h
==
--- stable/11/sys/net/ieee_oui.hSat Apr 27 04:16:15 2019
(r346782)
+++ stable/11/sys/net/ieee_oui.hSat Apr 27 04:39:41 2019
(r346783)
@@ -65,3 +65,14 @@
 /* Allocate 20 bits to bhyve */
 #define OUI_FREEBSD_BHYVE_LOW  OUI_FREEBSD(0x01)
 #define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD(0x0f)
+
+/*
+ * Allocate 16 bits for a pool to give to various interfaces that need a
+ * generated address, but don't quite need to slice off a whole section of
+ * the OUI (e.g. cloned interfaces, one-off NICs of various vendors).
+ *
+ * ether_gen_addr should be used to generate an address from this pool.
+ */
+#define

svn commit: r346782 - in stable: 11/usr.bin/dtc 12/usr.bin/dtc

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:16:15 2019
New Revision: 346782
URL: https://svnweb.freebsd.org/changeset/base/346782

Log:
  MFC r346469: dtc(1): Pull in fix for segfault-upon-error condition
  
  Specifically, parse errors within a node would lead to a segfault due to
  an unconditional dereference after emitting the error.

Modified:
  stable/11/usr.bin/dtc/fdt.cc
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.bin/dtc/fdt.cc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.bin/dtc/fdt.cc
==
--- stable/11/usr.bin/dtc/fdt.ccSat Apr 27 04:12:32 2019
(r346781)
+++ stable/11/usr.bin/dtc/fdt.ccSat Apr 27 04:16:15 2019
(r346782)
@@ -1622,7 +1622,10 @@ device_tree::parse_file(text_input_buffer ,
}
input.next_token();
n = node::parse(input, *this, std::move(name), 
string_set(), string(), );
-   n->name_is_path_reference = name_is_path_reference;
+   if (n)
+   {
+   n->name_is_path_reference = 
name_is_path_reference;
+   }
}
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: r346782 - in stable: 11/usr.bin/dtc 12/usr.bin/dtc

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:16:15 2019
New Revision: 346782
URL: https://svnweb.freebsd.org/changeset/base/346782

Log:
  MFC r346469: dtc(1): Pull in fix for segfault-upon-error condition
  
  Specifically, parse errors within a node would lead to a segfault due to
  an unconditional dereference after emitting the error.

Modified:
  stable/12/usr.bin/dtc/fdt.cc
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.bin/dtc/fdt.cc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.bin/dtc/fdt.cc
==
--- stable/12/usr.bin/dtc/fdt.ccSat Apr 27 04:12:32 2019
(r346781)
+++ stable/12/usr.bin/dtc/fdt.ccSat Apr 27 04:16:15 2019
(r346782)
@@ -1622,7 +1622,10 @@ device_tree::parse_file(text_input_buffer ,
}
input.next_token();
n = node::parse(input, *this, std::move(name), 
string_set(), string(), );
-   n->name_is_path_reference = name_is_path_reference;
+   if (n)
+   {
+   n->name_is_path_reference = 
name_is_path_reference;
+   }
}
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: r346781 - in stable/12: share/man/man4 sys/conf

2019-04-26 Thread Kyle Evans
Author: kevans
Date: Sat Apr 27 04:12:32 2019
New Revision: 346781
URL: https://svnweb.freebsd.org/changeset/base/346781

Log:
  MFC r346307, r346618: Further DTB building consolidation/documentation
  
  r346307:
  fdt: further consolidate DTB building and revise manpage
  
  FDT_DTS_FILE was built separately with a rule in sys/conf/files and
  recreated the rules we used in dtb.mk. Now that we have other infrastructure
  to build a DTB along with the kernel, fold FDT_DTS_FILE into that since it
  doesn't have any special requirements.
  
  fdt(4) never got revised to mention the DTS/DTSO make options, so do that
  now.
  
  r346618:
  fdt: stop installing FDT_DTS_FILE
  
  r346307 inadvertently started installing FDT_DTS_FILE along with the kernel.
  While this isn't necessarily bad, it was not intended or discussed and it
  actively breaks some current setups that don't anticipate any .dtb being
  installed when it's using static fdt. This change could be reconsidered down
  the line, but it needs to be done with prior discussion.
  
  Fix it by pushing FDT_DTS_FILE build down into the raw dtb.build.mk bits.
  This technically allows modules building DTS to accidentally specify an
  FDT_DTS_FILE that gets built but isn't otherwise useful (since it's not
  installed), but I suspect this isn't a big deal and would get caught with
  any kind of testing -- and perhaps this might end up useful in some other
  way, for example by some module wanting to embed fdt in some other way than
  our current/normal mechanism.

Modified:
  stable/12/share/man/man4/fdt.4
  stable/12/sys/conf/dtb.build.mk
  stable/12/sys/conf/files
  stable/12/sys/conf/kern.post.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/fdt.4
==
--- stable/12/share/man/man4/fdt.4  Sat Apr 27 04:00:50 2019
(r346780)
+++ stable/12/share/man/man4/fdt.4  Sat Apr 27 04:12:32 2019
(r346781)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 12, 2010
+.Dd March 28, 2019
 .Dt FDT 4
 .Os
 .Sh NAME
@@ -139,6 +139,21 @@ support at the
 .Fx
 kernel level.
 .Bl -tag -width Ar
+.It Va makeoptions DTS+=.dts
+Specifies device tree source (DTS) files for a given kernel.
+The indicated DTS files will be converted (compiled) into a binary form
+along with building the kernel itself.
+Any DTS file names not written as an absolute path must be specified relative
+to the default location of DTS sources i.e.,
+.Pa sys/dts .
+.It Va makeoptions DTSO+=.dtso
+Specifies device tree source overlay (DTSO) files for a given kernel.
+Overlay files will be built with the kernel as with the makeoption
+.Va DTS
+described above.
+Overlay files specified as relative paths will be relative to the default
+location of DTS overlays for the platform being built i.e.,
+.Pa sys/dts/arm/overlays .
 .It Va options FDT
 The primary option for enabling
 .Nm
@@ -153,10 +168,9 @@ drivers, as well as helper routines and libraries.
 .It Va makeoptions FDT_DTS_FILE=.dts
 Specifies a preferred (default) device tree source (DTS) file for a given
 kernel.
-The indicated DTS file will be converted (compiled) into a binary form
-along with building the kernel itself.
-The DTS file name is relative to the default location of DTS sources i.e.
-.Pa sys/dts .
+It will be built along with the kernel as if it were supplied via the 
makeoption
+.Va DTS
+described above.
 This makeoption is not mandatory unless FDT_DTB_STATIC is also defined (see
 below).
 .It Va options FDT_DTB_STATIC

Modified: stable/12/sys/conf/dtb.build.mk
==
--- stable/12/sys/conf/dtb.build.mk Sat Apr 27 04:00:50 2019
(r346780)
+++ stable/12/sys/conf/dtb.build.mk Sat Apr 27 04:12:32 2019
(r346781)
@@ -43,7 +43,7 @@ DTBO=${DTSO:T:R:S/$/.dtbo/}
 
 # Add dependencies on the source file so that out-of-tree things can be 
included
 # without any .PATH additions.
-.for _dts in ${DTS}
+.for _dts in ${DTS} ${FDT_DTS_FILE}
 ${_dts:R:T}.dtb: ${_dts}
 .endfor
 

Modified: stable/12/sys/conf/files
==
--- stable/12/sys/conf/filesSat Apr 27 04:00:50 2019(r346780)
+++ stable/12/sys/conf/filesSat Apr 27 04:12:32 2019(r346781)
@@ -19,17 +19,9 @@ bhnd_nvram_map_data.hoptional bhnd   
   \
compile-with"sh $S/dev/bhnd/tools/nvram_map_gen.sh 
$S/dev/bhnd/nvram/nvram_map -d" \
no-obj no-implicit-rule before-depend  \
clean   "bhnd_nvram_map_data.h"
-#
-# The 'fdt_dtb_file' target covers an actual DTB file name, which is derived
-# from the specified source (DTS) file: .dts -> .dtb
-#
-fdt_dtb_file   optional fdt fdt_dtb_static \
-   compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtb.sh 

svn commit: r346780 - stable/12/usr.sbin/pkg

2019-04-26 Thread Colin Percival
Author: cperciva
Date: Sat Apr 27 04:00:50 2019
New Revision: 346780
URL: https://svnweb.freebsd.org/changeset/base/346780

Log:
  MFC r346628: Split the pkg configuration file FreeBSD.conf into versions
  for {latest, quarterly} and use Makefile logic to decide which one to
  install (right now, unconditionally "latest").
  
  Discussed with:   gjb

Added:
  stable/12/usr.sbin/pkg/FreeBSD.conf.latest
 - copied unchanged from r346628, head/usr.sbin/pkg/FreeBSD.conf.latest
  stable/12/usr.sbin/pkg/FreeBSD.conf.quarterly
 - copied unchanged from r346628, head/usr.sbin/pkg/FreeBSD.conf.quarterly
Deleted:
  stable/12/usr.sbin/pkg/FreeBSD.conf
Modified:
  stable/12/usr.sbin/pkg/Makefile
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/usr.sbin/pkg/FreeBSD.conf.latest (from r346628, 
head/usr.sbin/pkg/FreeBSD.conf.latest)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/usr.sbin/pkg/FreeBSD.conf.latest  Sat Apr 27 04:00:50 2019
(r346780, copy of r346628, head/usr.sbin/pkg/FreeBSD.conf.latest)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+#
+# To disable this repository, instead of modifying or removing this file,
+# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
+#
+#   mkdir -p /usr/local/etc/pkg/repos
+#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
+#
+
+FreeBSD: {
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
+  mirror_type: "srv",
+  signature_type: "fingerprints",
+  fingerprints: "/usr/share/keys/pkg",
+  enabled: yes
+}

Copied: stable/12/usr.sbin/pkg/FreeBSD.conf.quarterly (from r346628, 
head/usr.sbin/pkg/FreeBSD.conf.quarterly)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/usr.sbin/pkg/FreeBSD.conf.quarterly   Sat Apr 27 04:00:50 
2019(r346780, copy of r346628, head/usr.sbin/pkg/FreeBSD.conf.quarterly)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+#
+# To disable this repository, instead of modifying or removing this file,
+# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
+#
+#   mkdir -p /usr/local/etc/pkg/repos
+#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
+#
+
+FreeBSD: {
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
+  mirror_type: "srv",
+  signature_type: "fingerprints",
+  fingerprints: "/usr/share/keys/pkg",
+  enabled: yes
+}

Modified: stable/12/usr.sbin/pkg/Makefile
==
--- stable/12/usr.sbin/pkg/Makefile Sat Apr 27 02:43:27 2019
(r346779)
+++ stable/12/usr.sbin/pkg/Makefile Sat Apr 27 04:00:50 2019
(r346780)
@@ -1,6 +1,8 @@
 # $FreeBSD$
 
-CONFS= FreeBSD.conf
+PKGCONFBRANCH?=latest
+CONFS= FreeBSD.conf.${PKGCONFBRANCH}
+CONFSNAME= FreeBSD.conf
 CONFSDIR=  /etc/pkg
 CONFSMODE= 644
 PROG=  pkg
___
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: r346779 - in stable/10/sys: fs/nfsserver modules/nfsd

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 02:43:27 2019
New Revision: 346779
URL: https://svnweb.freebsd.org/changeset/base/346779

Log:
  MFC: r346191
  Add support for INET6 addresses to the kernel code that dumps open/lock state.
  
  PR#223036 reported that INET6 callback addresses were not printed by
  nfsdumpstate(8). This kernel patch adds INET6 addresses to the dump structure,
  so that nfsdumpstate(8) can print them out, post-r346190.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/10/sys/modules/nfsd/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 02:34:10 2019
(r346778)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 02:43:27 2019
(r346779)
@@ -34,6 +34,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
 /*
  * nfs version 2, 3 and 4 server calls to vnode ops
  * - these routines generally have 3 phases
@@ -3426,8 +3428,16 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
int i;
int error = 0, idlen;
struct nfsclient *clp = NULL;
-   struct sockaddr_in *rad;
-   u_char *verf, *ucp, *ucp2, addrbuf[24];
+#ifdef INET
+   struct sockaddr_in *rin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *rin6;
+#endif
+#if defined(INET) || defined(INET6)
+   u_char *ucp, *ucp2;
+#endif
+   u_char *verf, *addrbuf;
nfsquad_t clientid, confirm;
 
if ((nd->nd_flag & ND_NFSV41) != 0) {
@@ -3454,8 +3464,9 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
clp->lc_stateid = malloc(sizeof(struct nfsstatehead) *
nfsrv_statehashsize, M_NFSDCLIENT, M_WAITOK);
NFSINITSOCKMUTEX(>lc_req.nr_mtx);
-   NFSSOCKADDRALLOC(clp->lc_req.nr_nam);
-   NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in));
+   /* Allocated large enough for an AF_INET or AF_INET6 socket. */
+   clp->lc_req.nr_nam = malloc(sizeof(struct sockaddr_in6), M_SONAME,
+   M_WAITOK | M_ZERO);
clp->lc_req.nr_cred = NULL;
NFSBCOPY(verf, clp->lc_verf, NFSX_VERF);
clp->lc_idlen = idlen;
@@ -3497,17 +3508,46 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
 */
nd->nd_repstat = nfsrv_setclient(nd, , , , p);
if (nd->nd_repstat == NFSERR_CLIDINUSE) {
-   if (clp->lc_flags & LCL_TCPCALLBACK)
-   (void) nfsm_strtom(nd, "tcp", 3);
-   else 
-   (void) nfsm_strtom(nd, "udp", 3);
-   rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *);
-   ucp = (u_char *)>sin_addr.s_addr;
-   ucp2 = (u_char *)>sin_port;
-   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
-   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
-   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   /*
+* 8 is the maximum length of the port# string.
+*/
+   addrbuf = malloc(INET6_ADDRSTRLEN + 8, M_TEMP, M_WAITOK);
+   switch (clp->lc_req.nr_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp", 3);
+   else 
+   (void) nfsm_strtom(nd, "udp", 3);
+   rin = (struct sockaddr_in *)clp->lc_req.nr_nam;
+   ucp = (u_char *)>sin_addr.s_addr;
+   ucp2 = (u_char *)>sin_port;
+   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
+   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
+   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp6", 4);
+   else 
+   (void) nfsm_strtom(nd, "udp6", 4);
+   rin6 = (struct sockaddr_in6 *)clp->lc_req.nr_nam;
+   ucp = inet_ntop(AF_INET6, >sin6_addr, addrbuf,
+   INET6_ADDRSTRLEN);
+   if (ucp != NULL)
+   i = strlen(ucp);
+   else
+   i = 0;
+   ucp2 = (u_char *)>sin6_port;
+   sprintf([i], ".%d.%d", ucp2[0] & 0xff,
+   ucp2[1] & 0xff);
+   break;
+#endif
+   }
(void) nfsm_strtom(nd, addrbuf, strlen(addrbuf));
+   free(addrbuf, M_TEMP);
}
if (clp) {
   

svn commit: r346778 - stable/10/usr.sbin/nfsdumpstate

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 02:34:10 2019
New Revision: 346778
URL: https://svnweb.freebsd.org/changeset/base/346778

Log:
  MFC: r346190
  Fix nfsdumpstate(8) so that it can print out INET6 callback addresses.
  
  The patch adds support for printing of INET6 callback addresses.
  It also adds the #ifdef INET, INET6 as requested by bz@.

Modified:
  stable/10/usr.sbin/nfsdumpstate/Makefile
  stable/10/usr.sbin/nfsdumpstate/nfsdumpstate.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/nfsdumpstate/Makefile
==
--- stable/10/usr.sbin/nfsdumpstate/MakefileSat Apr 27 02:33:49 2019
(r346777)
+++ stable/10/usr.sbin/nfsdumpstate/MakefileSat Apr 27 02:34:10 2019
(r346778)
@@ -1,6 +1,15 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  nfsdumpstate
 MAN=   nfsdumpstate.8
+
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DINET
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
 
 .include 

Modified: stable/10/usr.sbin/nfsdumpstate/nfsdumpstate.c
==
--- stable/10/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 02:33:49 
2019(r346777)
+++ stable/10/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 02:34:10 
2019(r346778)
@@ -121,13 +121,14 @@ dump_openstate(void)
 {
struct nfsd_dumplist dumplist;
int cnt, i;
+   char nbuf[INET6_ADDRSTRLEN];
 
dumplist.ndl_size = DUMPSIZE;
dumplist.ndl_list = (void *)dp;
if (nfssvc(NFSSVC_DUMPCLIENTS, ) < 0)
errx(1, "Can't perform dump clients syscall");
 
-   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n",
+   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-45s %s\n",
"Flags", "OpenOwner", "Open", "LockOwner",
"Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID");
/*
@@ -143,9 +144,23 @@ dump_openstate(void)
dp[cnt].ndcl_nlocks,
dp[cnt].ndcl_ndelegs,
dp[cnt].ndcl_nolddelegs);
-   if (dp[cnt].ndcl_addrfam == AF_INET)
-   printf("%-15s ",
+   switch (dp[cnt].ndcl_addrfam) {
+#ifdef INET
+   case AF_INET:
+   printf("%-45s ",
inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr));
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (inet_ntop(AF_INET6, [cnt].ndcl_cbaddr.sin6_addr,
+   nbuf, sizeof(nbuf)) != NULL)
+   printf("%-45s ", nbuf);
+   else
+   printf("%-45s ", " ");
+   break;
+#endif
+   }
for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++)
printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]);
printf("\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"


svn commit: r346777 - in head/sys/powerpc: aim include powerpc

2019-04-26 Thread Justin Hibbits
Author: jhibbits
Date: Sat Apr 27 02:33:49 2019
New Revision: 346777
URL: https://svnweb.freebsd.org/changeset/base/346777

Log:
  powerpc: Add POWER8NVL definition
  
  The POWER8NVL (POWER8 NVLink) architecturally behaves identically to the
  POWER8, with a different PVR identifier.  Mark it as such, so it shows up
  appropriately to the user.
  
  Reported by:  Alexey Kardashevskiy
  MFC after:2 weeks

Modified:
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/mp_cpudep.c
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Sat Apr 27 02:24:58 2019
(r346776)
+++ head/sys/powerpc/aim/aim_machdep.c  Sat Apr 27 02:33:49 2019
(r346777)
@@ -213,6 +213,7 @@ aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_of
case IBMPOWER7PLUS:
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
/* XXX: get from ibm,slb-size in device tree */
n_slbs = 32;

Modified: head/sys/powerpc/aim/mp_cpudep.c
==
--- head/sys/powerpc/aim/mp_cpudep.cSat Apr 27 02:24:58 2019
(r346776)
+++ head/sys/powerpc/aim/mp_cpudep.cSat Apr 27 02:33:49 2019
(r346777)
@@ -85,6 +85,7 @@ cpudep_ap_early_bootstrap(void)
break;
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
 #ifdef __powerpc64__
if (mfmsr() & PSL_HV) {
@@ -404,6 +405,7 @@ cpudep_ap_setup()
case IBMPOWER7PLUS:
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
 #ifdef __powerpc64__
if (mfmsr() & PSL_HV) {

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat Apr 27 02:24:58 2019
(r346776)
+++ head/sys/powerpc/include/spr.h  Sat Apr 27 02:33:49 2019
(r346777)
@@ -188,6 +188,7 @@
 #define  IBMPOWERPCA20x0049
 #define  IBMPOWER7PLUS   0x004a
 #define  IBMPOWER8E  0x004b
+#define  IBMPOWER8NVL0x004c
 #define  IBMPOWER8   0x004d
 #define  IBMPOWER9   0x004e
 #define  MPC860  0x0050

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Sat Apr 27 02:24:58 2019
(r346776)
+++ head/sys/powerpc/powerpc/cpu.c  Sat Apr 27 02:33:49 2019
(r346777)
@@ -171,6 +171,13 @@ static const struct cputab models[] = {
   PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
   PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
   PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
+{ "IBM POWER8NVL", IBMPOWER8NVL,   REVFMT_MAJMIN,
+  PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+  PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
+  PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
+  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
+  PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
 { "IBM POWER8",IBMPOWER8,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
@@ -670,6 +677,7 @@ cpu_powerx_setup(int cpuid, uint16_t vers)
switch (vers) {
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
cpu_idle_hook = cpu_idle_powerx;
mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET);
isync();
___
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: r346776 - in stable/11/sys: fs/nfsserver modules/nfsd

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 02:24:58 2019
New Revision: 346776
URL: https://svnweb.freebsd.org/changeset/base/346776

Log:
  MFC: r346191
  Add support for INET6 addresses to the kernel code that dumps open/lock state.
  
  PR#223036 reported that INET6 callback addresses were not printed by
  nfsdumpstate(8). This kernel patch adds INET6 addresses to the dump structure,
  so that nfsdumpstate(8) can print them out, post-r346190.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/11/sys/modules/nfsd/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 02:13:15 2019
(r346775)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 02:24:58 2019
(r346776)
@@ -34,6 +34,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
 /*
  * nfs version 2, 3 and 4 server calls to vnode ops
  * - these routines generally have 3 phases
@@ -3455,8 +3457,16 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
int i;
int error = 0, idlen;
struct nfsclient *clp = NULL;
-   struct sockaddr_in *rad;
-   u_char *verf, *ucp, *ucp2, addrbuf[24];
+#ifdef INET
+   struct sockaddr_in *rin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *rin6;
+#endif
+#if defined(INET) || defined(INET6)
+   u_char *ucp, *ucp2;
+#endif
+   u_char *verf, *addrbuf;
nfsquad_t clientid, confirm;
 
if ((nd->nd_flag & ND_NFSV41) != 0) {
@@ -3483,8 +3493,9 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
clp->lc_stateid = malloc(sizeof(struct nfsstatehead) *
nfsrv_statehashsize, M_NFSDCLIENT, M_WAITOK);
NFSINITSOCKMUTEX(>lc_req.nr_mtx);
-   NFSSOCKADDRALLOC(clp->lc_req.nr_nam);
-   NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in));
+   /* Allocated large enough for an AF_INET or AF_INET6 socket. */
+   clp->lc_req.nr_nam = malloc(sizeof(struct sockaddr_in6), M_SONAME,
+   M_WAITOK | M_ZERO);
clp->lc_req.nr_cred = NULL;
NFSBCOPY(verf, clp->lc_verf, NFSX_VERF);
clp->lc_idlen = idlen;
@@ -3526,17 +3537,46 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
 */
nd->nd_repstat = nfsrv_setclient(nd, , , , p);
if (nd->nd_repstat == NFSERR_CLIDINUSE) {
-   if (clp->lc_flags & LCL_TCPCALLBACK)
-   (void) nfsm_strtom(nd, "tcp", 3);
-   else 
-   (void) nfsm_strtom(nd, "udp", 3);
-   rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *);
-   ucp = (u_char *)>sin_addr.s_addr;
-   ucp2 = (u_char *)>sin_port;
-   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
-   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
-   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   /*
+* 8 is the maximum length of the port# string.
+*/
+   addrbuf = malloc(INET6_ADDRSTRLEN + 8, M_TEMP, M_WAITOK);
+   switch (clp->lc_req.nr_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp", 3);
+   else 
+   (void) nfsm_strtom(nd, "udp", 3);
+   rin = (struct sockaddr_in *)clp->lc_req.nr_nam;
+   ucp = (u_char *)>sin_addr.s_addr;
+   ucp2 = (u_char *)>sin_port;
+   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
+   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
+   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp6", 4);
+   else 
+   (void) nfsm_strtom(nd, "udp6", 4);
+   rin6 = (struct sockaddr_in6 *)clp->lc_req.nr_nam;
+   ucp = inet_ntop(AF_INET6, >sin6_addr, addrbuf,
+   INET6_ADDRSTRLEN);
+   if (ucp != NULL)
+   i = strlen(ucp);
+   else
+   i = 0;
+   ucp2 = (u_char *)>sin6_port;
+   sprintf([i], ".%d.%d", ucp2[0] & 0xff,
+   ucp2[1] & 0xff);
+   break;
+#endif
+   }
(void) nfsm_strtom(nd, addrbuf, strlen(addrbuf));
+   free(addrbuf, M_TEMP);
}
if (clp) {
   

svn commit: r346775 - stable/11/usr.sbin/nfsdumpstate

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 02:13:15 2019
New Revision: 346775
URL: https://svnweb.freebsd.org/changeset/base/346775

Log:
  MFC: r346190
  Fix nfsdumpstate(8) so that it can print out INET6 callback addresses.
  
  The patch adds support for printing of INET6 callback addresses.
  It also adds the #ifdef INET, INET6 as requested by bz@.

Modified:
  stable/11/usr.sbin/nfsdumpstate/Makefile
  stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/nfsdumpstate/Makefile
==
--- stable/11/usr.sbin/nfsdumpstate/MakefileSat Apr 27 02:05:04 2019
(r346774)
+++ stable/11/usr.sbin/nfsdumpstate/MakefileSat Apr 27 02:13:15 2019
(r346775)
@@ -1,6 +1,15 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  nfsdumpstate
 MAN=   nfsdumpstate.8
+
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DINET
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
 
 .include 

Modified: stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c
==
--- stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 02:05:04 
2019(r346774)
+++ stable/11/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 02:13:15 
2019(r346775)
@@ -121,13 +121,14 @@ dump_openstate(void)
 {
struct nfsd_dumplist dumplist;
int cnt, i;
+   char nbuf[INET6_ADDRSTRLEN];
 
dumplist.ndl_size = DUMPSIZE;
dumplist.ndl_list = (void *)dp;
if (nfssvc(NFSSVC_DUMPCLIENTS, ) < 0)
errx(1, "Can't perform dump clients syscall");
 
-   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n",
+   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-45s %s\n",
"Flags", "OpenOwner", "Open", "LockOwner",
"Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID");
/*
@@ -143,9 +144,23 @@ dump_openstate(void)
dp[cnt].ndcl_nlocks,
dp[cnt].ndcl_ndelegs,
dp[cnt].ndcl_nolddelegs);
-   if (dp[cnt].ndcl_addrfam == AF_INET)
-   printf("%-15s ",
+   switch (dp[cnt].ndcl_addrfam) {
+#ifdef INET
+   case AF_INET:
+   printf("%-45s ",
inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr));
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (inet_ntop(AF_INET6, [cnt].ndcl_cbaddr.sin6_addr,
+   nbuf, sizeof(nbuf)) != NULL)
+   printf("%-45s ", nbuf);
+   else
+   printf("%-45s ", " ");
+   break;
+#endif
+   }
for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++)
printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]);
printf("\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"


svn commit: r346774 - stable/12/usr.bin/nfsstat

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 02:05:04 2019
New Revision: 346774
URL: https://svnweb.freebsd.org/changeset/base/346774

Log:
  MFC: r346192
  Fix printing of the line that starts with "LocalOpen...".
  
  When "nfsstat -E -c" was done, the title line starting with "LocalOpen..."
  was not being displayed. This was introduced by r328588.

Modified:
  stable/12/usr.bin/nfsstat/nfsstat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/nfsstat/nfsstat.c
==
--- stable/12/usr.bin/nfsstat/nfsstat.c Sat Apr 27 01:58:51 2019
(r346773)
+++ stable/12/usr.bin/nfsstat/nfsstat.c Sat Apr 27 02:05:04 2019
(r346774)
@@ -790,7 +790,7 @@ exp_intpr(int clientOnly, int serverOnly, int nfs41)
(uintmax_t)ext_nfsstats.cllocalopenowners);
 
xo_emit("{T:LocalOpen/%13.13s}{T:LocalLown/%13.13s}"
-   "{T:LocalLock\n");
+   "{T:LocalLock/%13.13s}\n");
xo_emit("{:localopen/%13ju}{:locallown/%13ju}"
"{:locallock/%13ju}\n",
(uintmax_t)ext_nfsstats.cllocalopens,
___
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: r346773 - in stable/12/sys: fs/nfsserver modules/nfsd

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 01:58:51 2019
New Revision: 346773
URL: https://svnweb.freebsd.org/changeset/base/346773

Log:
  MFC: r346191
  Add support for INET6 addresses to the kernel code that dumps open/lock state.
  
  PR#223036 reported that INET6 callback addresses were not printed by
  nfsdumpstate(8). This kernel patch adds INET6 addresses to the dump structure,
  so that nfsdumpstate(8) can print them out, post-r346190.

Modified:
  stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
  stable/12/sys/modules/nfsd/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdserv.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 01:50:09 2019
(r346772)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdserv.c   Sat Apr 27 01:58:51 2019
(r346773)
@@ -36,6 +36,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_inet.h"
+#include "opt_inet6.h"
 /*
  * nfs version 2, 3 and 4 server calls to vnode ops
  * - these routines generally have 3 phases
@@ -3655,8 +3657,16 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
int i;
int error = 0, idlen;
struct nfsclient *clp = NULL;
-   struct sockaddr_in *rad;
-   u_char *verf, *ucp, *ucp2, addrbuf[24];
+#ifdef INET
+   struct sockaddr_in *rin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *rin6;
+#endif
+#if defined(INET) || defined(INET6)
+   u_char *ucp, *ucp2;
+#endif
+   u_char *verf, *addrbuf;
nfsquad_t clientid, confirm;
 
if ((nd->nd_flag & ND_NFSV41) != 0) {
@@ -3683,9 +3693,9 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
clp->lc_stateid = malloc(sizeof(struct nfsstatehead) *
nfsrv_statehashsize, M_NFSDCLIENT, M_WAITOK);
NFSINITSOCKMUTEX(>lc_req.nr_mtx);
-   clp->lc_req.nr_nam = malloc(sizeof(*clp->lc_req.nr_nam), M_SONAME,
+   /* Allocated large enough for an AF_INET or AF_INET6 socket. */
+   clp->lc_req.nr_nam = malloc(sizeof(struct sockaddr_in6), M_SONAME,
M_WAITOK | M_ZERO);
-   NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in));
clp->lc_req.nr_cred = NULL;
NFSBCOPY(verf, clp->lc_verf, NFSX_VERF);
clp->lc_idlen = idlen;
@@ -3727,17 +3737,46 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused
 */
nd->nd_repstat = nfsrv_setclient(nd, , , , p);
if (nd->nd_repstat == NFSERR_CLIDINUSE) {
-   if (clp->lc_flags & LCL_TCPCALLBACK)
-   (void) nfsm_strtom(nd, "tcp", 3);
-   else 
-   (void) nfsm_strtom(nd, "udp", 3);
-   rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *);
-   ucp = (u_char *)>sin_addr.s_addr;
-   ucp2 = (u_char *)>sin_port;
-   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
-   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
-   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   /*
+* 8 is the maximum length of the port# string.
+*/
+   addrbuf = malloc(INET6_ADDRSTRLEN + 8, M_TEMP, M_WAITOK);
+   switch (clp->lc_req.nr_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp", 3);
+   else 
+   (void) nfsm_strtom(nd, "udp", 3);
+   rin = (struct sockaddr_in *)clp->lc_req.nr_nam;
+   ucp = (u_char *)>sin_addr.s_addr;
+   ucp2 = (u_char *)>sin_port;
+   sprintf(addrbuf, "%d.%d.%d.%d.%d.%d", ucp[0] & 0xff,
+   ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff,
+   ucp2[0] & 0xff, ucp2[1] & 0xff);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (clp->lc_flags & LCL_TCPCALLBACK)
+   (void) nfsm_strtom(nd, "tcp6", 4);
+   else 
+   (void) nfsm_strtom(nd, "udp6", 4);
+   rin6 = (struct sockaddr_in6 *)clp->lc_req.nr_nam;
+   ucp = inet_ntop(AF_INET6, >sin6_addr, addrbuf,
+   INET6_ADDRSTRLEN);
+   if (ucp != NULL)
+   i = strlen(ucp);
+   else
+   i = 0;
+   ucp2 = (u_char *)>sin6_port;
+   sprintf([i], ".%d.%d", ucp2[0] & 0xff,
+   ucp2[1] & 0xff);
+   break;
+#endif
+   }
(void) nfsm_strtom(nd, addrbuf, strlen(addrbuf));
+   free(addrbuf, M_TEMP);
   

svn commit: r346772 - stable/12/usr.sbin/nfsdumpstate

2019-04-26 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 27 01:50:09 2019
New Revision: 346772
URL: https://svnweb.freebsd.org/changeset/base/346772

Log:
  MFC: r346190
  Fix nfsdumpstate(8) so that it can print out INET6 callback addresses.
  
  The patch adds support for printing of INET6 callback addresses.
  It also adds the #ifdef INET, INET6 as requested by bz@.

Modified:
  stable/12/usr.sbin/nfsdumpstate/Makefile
  stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/nfsdumpstate/Makefile
==
--- stable/12/usr.sbin/nfsdumpstate/MakefileSat Apr 27 00:53:41 2019
(r346771)
+++ stable/12/usr.sbin/nfsdumpstate/MakefileSat Apr 27 01:50:09 2019
(r346772)
@@ -1,6 +1,15 @@
 # $FreeBSD$
 
+.include 
+
 PROG=  nfsdumpstate
 MAN=   nfsdumpstate.8
+
+.if ${MK_INET_SUPPORT} != "no"
+CFLAGS+= -DINET
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+= -DINET6
+.endif
 
 .include 

Modified: stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c
==
--- stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 00:53:41 
2019(r346771)
+++ stable/12/usr.sbin/nfsdumpstate/nfsdumpstate.c  Sat Apr 27 01:50:09 
2019(r346772)
@@ -121,13 +121,14 @@ dump_openstate(void)
 {
struct nfsd_dumplist dumplist;
int cnt, i;
+   char nbuf[INET6_ADDRSTRLEN];
 
dumplist.ndl_size = DUMPSIZE;
dumplist.ndl_list = (void *)dp;
if (nfssvc(NFSSVC_DUMPCLIENTS, ) < 0)
errx(1, "Can't perform dump clients syscall");
 
-   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-15s %s\n",
+   printf("%-13s %9.9s %9.9s %9.9s %9.9s %9.9s %9.9s %-45s %s\n",
"Flags", "OpenOwner", "Open", "LockOwner",
"Lock", "Deleg", "OldDeleg", "Clientaddr", "ClientID");
/*
@@ -143,9 +144,23 @@ dump_openstate(void)
dp[cnt].ndcl_nlocks,
dp[cnt].ndcl_ndelegs,
dp[cnt].ndcl_nolddelegs);
-   if (dp[cnt].ndcl_addrfam == AF_INET)
-   printf("%-15s ",
+   switch (dp[cnt].ndcl_addrfam) {
+#ifdef INET
+   case AF_INET:
+   printf("%-45s ",
inet_ntoa(dp[cnt].ndcl_cbaddr.sin_addr));
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (inet_ntop(AF_INET6, [cnt].ndcl_cbaddr.sin6_addr,
+   nbuf, sizeof(nbuf)) != NULL)
+   printf("%-45s ", nbuf);
+   else
+   printf("%-45s ", " ");
+   break;
+#endif
+   }
for (i = 0; i < dp[cnt].ndcl_clid.nclid_idlen; i++)
printf("%02x", dp[cnt].ndcl_clid.nclid_id[i]);
printf("\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"


svn commit: r346771 - head/sys/powerpc/powerpc

2019-04-26 Thread Justin Hibbits
Author: jhibbits
Date: Sat Apr 27 00:53:41 2019
New Revision: 346771
URL: https://svnweb.freebsd.org/changeset/base/346771

Log:
  powerpc: micro-optimize cpu_switch()
  
  Since the non-volatile registers are restored at the end of cpu_switchin (of
  the new thread) they're free for us to use for our own purposes.  Load the
  PCB_FLAGS into a non-volatile register so it's preserved across the C
  function calls that manage FPU and altivec state.  This removes 4 loads from
  each file.  Might be a trivial performance improvement (~12 clock cycles per
  context switch).
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/powerpc/swtch32.S
  head/sys/powerpc/powerpc/swtch64.S

Modified: head/sys/powerpc/powerpc/swtch32.S
==
--- head/sys/powerpc/powerpc/swtch32.S  Fri Apr 26 22:18:22 2019
(r346770)
+++ head/sys/powerpc/powerpc/swtch32.S  Sat Apr 27 00:53:41 2019
(r346771)
@@ -98,17 +98,16 @@ ENTRY(cpu_switch)
mr  %r16,%r5/* and the new lock */
mr  %r17,%r6/* and the PCB */

-   lwz %r7,PCB_FLAGS(%r17)
+   lwz %r18,PCB_FLAGS(%r17)
/* Save FPU context if needed */
-   andi.   %r7, %r7, PCB_FPU
+   andi.   %r7, %r18, PCB_FPU
beq .L1
bl  save_fpu
 
 .L1:
mr  %r3,%r14/* restore old thread ptr */
-   lwz %r7,PCB_FLAGS(%r17)
/* Save Altivec context if needed */
-   andi.   %r7, %r7, PCB_VEC
+   andi.   %r7, %r18, PCB_VEC
beq .L2
bl  save_vec

@@ -151,17 +150,16 @@ blocked_loop:
mr  %r3,%r2 /* Get new thread ptr */
bl  pmap_activate   /* Activate the new address space */
 
-   lwz %r6, PCB_FLAGS(%r17)
+   lwz %r19, PCB_FLAGS(%r17)
/* Restore FPU context if needed */
-   andi.   %r6, %r6, PCB_FPU
+   andi.   %r6, %r19, PCB_FPU
beq .L3
mr  %r3,%r2 /* Pass curthread to enable_fpu */
bl  enable_fpu
 
 .L3:
-   lwz %r6, PCB_FLAGS(%r17)
/* Restore Altivec context if needed */
-   andi.   %r6, %r6, PCB_VEC
+   andi.   %r6, %r19, PCB_VEC
beq .L4
mr  %r3,%r2 /* Pass curthread to enable_vec */
bl  enable_vec

Modified: head/sys/powerpc/powerpc/swtch64.S
==
--- head/sys/powerpc/powerpc/swtch64.S  Fri Apr 26 22:18:22 2019
(r346770)
+++ head/sys/powerpc/powerpc/swtch64.S  Sat Apr 27 00:53:41 2019
(r346771)
@@ -125,26 +125,24 @@ ENTRY(cpu_switch)

stdu%r1,-48(%r1)
 
-   lwz %r7, PCB_FLAGS(%r17)
-   andi.   %r7, %r7, PCB_CDSCR
+   lwz %r18, PCB_FLAGS(%r17)
+   andi.   %r7, %r18, PCB_CDSCR
beq .L0
/* Custom DSCR was set. Reseting it to enter kernel */
-   li  %r7, 0x0
-   mtspr   SPR_DSCR, %r7
+   li  %r6, 0x0
+   mtspr   SPR_DSCR, %r6
 
 .L0:
-   lwz %r7,PCB_FLAGS(%r17)
/* Save FPU context if needed */
-   andi.   %r7, %r7, PCB_FPU
+   andi.   %r7, %r18, PCB_FPU
beq .L1
bl  save_fpu
nop
 
 .L1:
mr  %r3,%r14/* restore old thread ptr */
-   lwz %r7,PCB_FLAGS(%r17)
/* Save Altivec context if needed */
-   andi.   %r7, %r7, PCB_VEC
+   andi.   %r7, %r18, PCB_VEC
beq .L2
bl  save_vec
nop
@@ -186,30 +184,28 @@ blocked_loop:
bl  pmap_activate   /* Activate the new address space */
nop
 
-   lwz %r6, PCB_FLAGS(%r17)
+   lwz %r19, PCB_FLAGS(%r17)
/* Restore FPU context if needed */
-   andi.   %r6, %r6, PCB_FPU
+   andi.   %r6, %r19, PCB_FPU
beq .L3
mr  %r3,%r13/* Pass curthread to enable_fpu */
bl  enable_fpu
nop
 
 .L3:
-   lwz %r6, PCB_FLAGS(%r17)
/* Restore Altivec context if needed */
-   andi.   %r6, %r6, PCB_VEC
+   andi.   %r6, %r19, PCB_VEC
beq .L31
mr  %r3,%r13/* Pass curthread to enable_vec */
bl  enable_vec
nop
 
 .L31:
-   lwz %r6, PCB_FLAGS(%r17)
/* Restore Custom DSCR if needed */
-   andi.   %r6, %r6, PCB_CDSCR
+   andi.   %r6, %r19, PCB_CDSCR
beq .L4
-   ld  %r6, PCB_DSCR(%r17) /* Load the DSCR register*/
-   mtspr   SPR_DSCR, %r6
+   ld  %r7, PCB_DSCR(%r17) /* Load the DSCR register*/
+   mtspr   SPR_DSCR, %r7
 
/* thread to restore is in r3 */
 .L4:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r346770 - in stable/11: share/man/man4 sys/netinet

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 22:18:22 2019
New Revision: 346770
URL: https://svnweb.freebsd.org/changeset/base/346770

Log:
  MFC r22: Keep CARP state as INIT when net.inet.carp.allow=0.
  
  Currently when net.inet.carp.allow=0 CARP state remains as MASTER, which is
  not very useful (if there are other masters -- it can lead to split brain,
  if there are none -- it makes no sense).  Having it as INIT makes it clear
  that carp packets are disabled.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/share/man/man4/carp.4
  stable/11/sys/netinet/ip_carp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/carp.4
==
--- stable/11/share/man/man4/carp.4 Fri Apr 26 21:44:51 2019
(r346769)
+++ stable/11/share/man/man4/carp.4 Fri Apr 26 22:18:22 2019
(r346770)
@@ -93,9 +93,11 @@ Additionally, there are a number of global parameters 
 .Xr sysctl 8 :
 .Bl -tag -width ".Va net.inet.carp.ifdown_demotion_factor"
 .It Va net.inet.carp.allow
-Accept incoming
+Allow
 .Nm
-packets.
+operation.
+When disabled, virtual hosts remain in initial state, neither sending nor
+receiving announcements or traffic.
 Enabled by default.
 .It Va net.inet.carp.preempt
 Allow virtual hosts to preempt each other.

Modified: stable/11/sys/netinet/ip_carp.c
==
--- stable/11/sys/netinet/ip_carp.c Fri Apr 26 21:44:51 2019
(r346769)
+++ stable/11/sys/netinet/ip_carp.c Fri Apr 26 22:18:22 2019
(r346770)
@@ -214,12 +214,14 @@ static VNET_DEFINE(int, carp_senderr_adj) = CARP_MAXSK
 static VNET_DEFINE(int, carp_ifdown_adj) = CARP_MAXSKEW;
 #defineV_carp_ifdown_adj   VNET(carp_ifdown_adj)
 
+static int carp_allow_sysctl(SYSCTL_HANDLER_ARGS);
 static int carp_dscp_sysctl(SYSCTL_HANDLER_ARGS);
 static int carp_demote_adj_sysctl(SYSCTL_HANDLER_ARGS);
 
 SYSCTL_NODE(_net_inet, IPPROTO_CARP,   carp,   CTLFLAG_RW, 0,  "CARP");
-SYSCTL_INT(_net_inet_carp, OID_AUTO, allow, CTLFLAG_VNET | CTLFLAG_RW,
-_NAME(carp_allow), 0, "Accept incoming CARP packets");
+SYSCTL_PROC(_net_inet_carp, OID_AUTO, allow,
+CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW, 0, 0, carp_allow_sysctl, "I",
+"Accept incoming CARP packets");
 SYSCTL_PROC(_net_inet_carp, OID_AUTO, dscp,
 CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW, 0, 0, carp_dscp_sysctl, "I",
 "DSCP value for carp packets");
@@ -1209,7 +1211,8 @@ carp_setrun(struct carp_softc *sc, sa_family_t af)
 
if ((sc->sc_carpdev->if_flags & IFF_UP) == 0 ||
sc->sc_carpdev->if_link_state != LINK_STATE_UP ||
-   (sc->sc_naddrs == 0 && sc->sc_naddrs6 == 0))
+   (sc->sc_naddrs == 0 && sc->sc_naddrs6 == 0) ||
+   !V_carp_allow)
return;
 
switch (sc->sc_state) {
@@ -1984,7 +1987,8 @@ carp_sc_state(struct carp_softc *sc)
CARP_LOCK_ASSERT(sc);
 
if (sc->sc_carpdev->if_link_state != LINK_STATE_UP ||
-   !(sc->sc_carpdev->if_flags & IFF_UP)) {
+   !(sc->sc_carpdev->if_flags & IFF_UP) ||
+   !V_carp_allow) {
callout_stop(>sc_ad_tmo);
 #ifdef INET
callout_stop(>sc_md_tmo);
@@ -2012,6 +2016,33 @@ carp_demote_adj(int adj, char *reason)
atomic_add_int(_carp_demotion, adj);
CARP_LOG("demoted by %d to %d (%s)\n", adj, V_carp_demotion, reason);
taskqueue_enqueue(taskqueue_swi, _sendall_task);
+}
+
+static int
+carp_allow_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   int new, error;
+   struct carp_softc *sc;
+
+   new = V_carp_allow;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if (error || !req->newptr)
+   return (error);
+
+   if (V_carp_allow != new) {
+   V_carp_allow = new;
+
+   mtx_lock(_mtx);
+   LIST_FOREACH(sc, _list, sc_next) {
+   CARP_LOCK(sc);
+   if (curvnet == sc->sc_carpdev->if_vnet)
+   carp_sc_state(sc);
+   CARP_UNLOCK(sc);
+   }
+   mtx_unlock(_mtx);
+   }
+
+   return (0);
 }
 
 static int
___
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: r346769 - stable/11/usr.sbin/mountd

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 21:44:51 2019
New Revision: 346769
URL: https://svnweb.freebsd.org/changeset/base/346769

Log:
  MFC r341641 (by sef): Reduce number of DNS queries in mountd.

Modified:
  stable/11/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/mountd/mountd.c
==
--- stable/11/usr.sbin/mountd/mountd.c  Fri Apr 26 21:34:08 2019
(r346768)
+++ stable/11/usr.sbin/mountd/mountd.c  Fri Apr 26 21:44:51 2019
(r346769)
@@ -1024,8 +1024,13 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
syslog(LOG_ERR, "request from unknown address family");
return;
}
-   lookup_failed = getnameinfo(saddr, saddr->sa_len, host, sizeof host, 
-   NULL, 0, 0);
+   switch (rqstp->rq_proc) {
+   case MOUNTPROC_MNT:
+   case MOUNTPROC_UMNT:
+   case MOUNTPROC_UMNTALL:
+   lookup_failed = getnameinfo(saddr, saddr->sa_len, host,
+   sizeof host, NULL, 0, 0);
+   }
getnameinfo(saddr, saddr->sa_len, numerichost,
sizeof numerichost, NULL, 0, NI_NUMERICHOST);
switch (rqstp->rq_proc) {
___
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: r346768 - in stable/11: sys/kgssapi usr.sbin/gssd

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 21:34:08 2019
New Revision: 346768
URL: https://svnweb.freebsd.org/changeset/base/346768

Log:
  MFC r344402 (by sef):
  
  * Handle SIGPIPE in gssd
  We've got some cases where the other end of gssd's AF_LOCAL socket gets
  closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
  Closing without cleaning up means the next time nfsd starts up, it hangs,
  unkillably; this allows gssd to handle that particular error.
  
  * Limit the retry cound in gssd_syscall to 5.
  The default is INT_MAX, which effectively means forever.  And it's an
  uninterruptable RPC call, so it will never stop.
  
  The two changes mitigate the problem.

Modified:
  stable/11/sys/kgssapi/gss_impl.c
  stable/11/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kgssapi/gss_impl.c
==
--- stable/11/sys/kgssapi/gss_impl.cFri Apr 26 21:21:55 2019
(r346767)
+++ stable/11/sys/kgssapi/gss_impl.cFri Apr 26 21:34:08 2019
(r346768)
@@ -116,6 +116,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal
cl = clnt_reconnect_create(nconf,
(struct sockaddr *) , GSSD, GSSDVERS,
RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+   /*
+* The number of retries defaults to INT_MAX, which effectively
+* means an infinite, uninterruptable loop.  Limiting it to
+* five retries keeps it from running forever.
+*/
+   if (cl != NULL) {
+   int retry_count = 5;
+   CLNT_CONTROL(cl, CLSET_RETRIES, _count);
+   }
} else
cl = NULL;
 

Modified: stable/11/usr.sbin/gssd/gssd.c
==
--- stable/11/usr.sbin/gssd/gssd.c  Fri Apr 26 21:21:55 2019
(r346767)
+++ stable/11/usr.sbin/gssd/gssd.c  Fri Apr 26 21:34:08 2019
(r346768)
@@ -202,6 +202,7 @@ main(int argc, char **argv)
signal(SIGHUP, SIG_IGN);
}
signal(SIGTERM, gssd_terminate);
+   signal(SIGPIPE, gssd_terminate);
 
memset(, 0, sizeof sun);
sun.sun_family = AF_LOCAL;
___
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: r346767 - stable/11/sys/net

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 21:21:55 2019
New Revision: 346767
URL: https://svnweb.freebsd.org/changeset/base/346767

Log:
  MFC r344782: bridge: Fix spurious warnings about capabilities
  
  Mask off the bits we don't care about when checking that capabilities
  of the member interfaces have been disabled as intended.

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

Modified: stable/11/sys/net/if_bridge.c
==
--- stable/11/sys/net/if_bridge.c   Fri Apr 26 21:19:06 2019
(r346766)
+++ stable/11/sys/net/if_bridge.c   Fri Apr 26 21:21:55 2019
(r346767)
@@ -931,7 +931,7 @@ bridge_set_ifcap(struct bridge_softc *sc, struct bridg
 {
struct ifnet *ifp = bif->bif_ifp;
struct ifreq ifr;
-   int error;
+   int error, mask, stuck;
 
BRIDGE_UNLOCK_ASSERT(sc);
 
@@ -944,10 +944,12 @@ bridge_set_ifcap(struct bridge_softc *sc, struct bridg
if_printf(sc->sc_ifp,
"error setting capabilities on %s: %d\n",
ifp->if_xname, error);
-   if ((ifp->if_capenable & ~set) != 0)
+   mask = BRIDGE_IFCAPS_MASK | BRIDGE_IFCAPS_STRIP;
+   stuck = ifp->if_capenable & mask & ~set;
+   if (stuck != 0)
if_printf(sc->sc_ifp,
"can't disable some capabilities on %s: 0x%x\n",
-   ifp->if_xname, ifp->if_capenable & ~set);
+   ifp->if_xname, stuck);
}
 }
 
___
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: r346766 - stable/11/sys/net

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 21:19:06 2019
New Revision: 346766
URL: https://svnweb.freebsd.org/changeset/base/346766

Log:
  MFC r317586: Make if_bridge complain if it can't disable some capabilities.

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

Modified: stable/11/sys/net/if_bridge.c
==
--- stable/11/sys/net/if_bridge.c   Fri Apr 26 20:15:47 2019
(r346765)
+++ stable/11/sys/net/if_bridge.c   Fri Apr 26 21:19:06 2019
(r346766)
@@ -942,8 +942,12 @@ bridge_set_ifcap(struct bridge_softc *sc, struct bridg
error = (*ifp->if_ioctl)(ifp, SIOCSIFCAP, (caddr_t));
if (error)
if_printf(sc->sc_ifp,
-   "error setting interface capabilities on %s\n",
-   ifp->if_xname);
+   "error setting capabilities on %s: %d\n",
+   ifp->if_xname, error);
+   if ((ifp->if_capenable & ~set) != 0)
+   if_printf(sc->sc_ifp,
+   "can't disable some capabilities on %s: 0x%x\n",
+   ifp->if_xname, ifp->if_capenable & ~set);
}
 }
 
___
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: r346765 - head/sys/modules/fusefs

2019-04-26 Thread Alan Somers
Author: asomers
Date: Fri Apr 26 20:15:47 2019
New Revision: 346765
URL: https://svnweb.freebsd.org/changeset/base/346765

Log:
  Don't symlink fusefs.ko to fuse.ko on PPC
  
  Some PPC systems (PowerNV) use msdosfs for /boot, which can't handle either
  symlinks or hardlinks. So on PPC, copy the module instead. This change fixes
  installkernel on such systems after r345350.
  
  Reported by:  Brandon Bergren 
  Reviewed by:  jhibbits, rgrimes
  MFC after:2 weeks
  MFC-With: 345350, 346441
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19993

Modified:
  head/sys/modules/fusefs/Makefile

Modified: head/sys/modules/fusefs/Makefile
==
--- head/sys/modules/fusefs/MakefileFri Apr 26 19:54:46 2019
(r346764)
+++ head/sys/modules/fusefs/MakefileFri Apr 26 20:15:47 2019
(r346765)
@@ -8,6 +8,22 @@ SRCS=  vnode_if.h \
fuse_vfsops.c fuse_vnops.c fuse_internal.c fuse_main.c
 
 # Symlink for backwards compatibility with systems installed at 12.0 or older
+.if ${MACHINE_CPUARCH} != "powerpc"
 SYMLINKS=  ${KMOD}.ko ${KMODDIR}/fuse.ko
+.else
+# Some PPC systems use msdosfs for /boot, which can't handle links or symlinks
+afterinstall: alias alias_debug
+alias: .PHONY
+   ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
+   ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/fuse.ko
+.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && 
"${MK_KERNEL_SYMBOLS}" != "no"
+alias_debug: .PHONY
+   ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
+   ${_INSTALLFLAGS} ${PROG}.debug \
+   ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/fuse.ko
+.else
+alias_debug: .PHONY
+.endif
+.endif
 
 .include 
___
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: r346762 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 19:02:21 2019
New Revision: 346762
URL: https://svnweb.freebsd.org/changeset/base/346762

Log:
  Add mutex_destroy() missed in r334844.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Fri Apr 
26 18:28:54 2019(r346761)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Fri Apr 
26 19:02:21 2019(r346762)
@@ -498,8 +498,10 @@ dsl_pool_close(dsl_pool_t *dp)
rrw_destroy(>dp_config_rwlock);
mutex_destroy(>dp_lock);
taskq_destroy(dp->dp_vnrele_taskq);
-   if (dp->dp_blkstats != NULL)
+   if (dp->dp_blkstats != NULL) {
+   mutex_destroy(>dp_blkstats->zab_lock);
kmem_free(dp->dp_blkstats, sizeof (zfs_all_blkstats_t));
+   }
kmem_free(dp, sizeof (dsl_pool_t));
 }
 
___
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: r346761 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 18:28:54 2019
New Revision: 346761
URL: https://svnweb.freebsd.org/changeset/base/346761

Log:
  Use __VGLBitmapCopy() directly to show the mouse cursor.  The mouse
  cursor must be merged with the shadow buffer on the way to the screen,
  and __VGLBitmapCopy() now has an option to do exactly that.  This is
  insignificantly less efficient.

Modified:
  head/lib/libvgl/mouse.c

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Fri Apr 26 18:25:59 2019(r346760)
+++ head/lib/libvgl/mouse.c Fri Apr 26 18:28:54 2019(r346761)
@@ -105,24 +105,11 @@ static volatile sig_atomic_t VGLMsuppressint;
 void
 VGLMousePointerShow()
 {
-  byte buf[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*4];
-  VGLBitmap buffer =
-VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, buf);
-  int pos;
-
   if (!VGLMouseVisible) {
 INTOFF();
 VGLMouseVisible = 1;
-buffer.PixelBytes = VGLDisplay->PixelBytes;
-__VGLBitmapCopy(, VGLMouseXpos, VGLMouseYpos, 
-, 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
-for (pos = 0; pos <  MOUSE_IMG_SIZE*MOUSE_IMG_SIZE; pos++)
-  if (VGLMouseAndMask->Bitmap[pos])
-bcopy(>Bitmap[pos*VGLDisplay->PixelBytes],
-  [pos*VGLDisplay->PixelBytes],
-  VGLDisplay->PixelBytes);
-__VGLBitmapCopy(, 0, 0, VGLDisplay, 
- VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
+__VGLBitmapCopy(, VGLMouseXpos, VGLMouseYpos, VGLDisplay, 
+ VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, -MOUSE_IMG_SIZE);
 INTON();
   }
 }
___
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: r346760 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 18:25:59 2019
New Revision: 346760
URL: https://svnweb.freebsd.org/changeset/base/346760

Log:
  Fix minor mismerges.
  
  No functional change.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
Fri Apr 26 17:58:44 2019(r346759)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
Fri Apr 26 18:25:59 2019(r346760)
@@ -84,7 +84,7 @@ void range_tree_init(void);
 void range_tree_fini(void);
 range_tree_t *range_tree_create_impl(range_tree_ops_t *ops, void *arg,
 int (*avl_compare)(const void*, const void*), uint64_t gap);
-   range_tree_t *range_tree_create(range_tree_ops_t *ops, void *arg);
+range_tree_t *range_tree_create(range_tree_ops_t *ops, void *arg);
 void range_tree_destroy(range_tree_t *rt);
 boolean_t range_tree_contains(range_tree_t *rt, uint64_t start, uint64_t size);
 range_seg_t *range_tree_find(range_tree_t *rt, uint64_t start, uint64_t size);
@@ -108,13 +108,6 @@ void range_tree_clear(range_tree_t *rt, uint64_t start
 void range_tree_vacate(range_tree_t *rt, range_tree_func_t *func, void *arg);
 void range_tree_walk(range_tree_t *rt, range_tree_func_t *func, void *arg);
 range_seg_t *range_tree_first(range_tree_t *rt);
-
-void rt_avl_create(range_tree_t *rt, void *arg);
-void rt_avl_destroy(range_tree_t *rt, void *arg);
-void rt_avl_add(range_tree_t *rt, range_seg_t *rs, void *arg);
-void rt_avl_remove(range_tree_t *rt, range_seg_t *rs, void *arg);
-void rt_avl_vacate(range_tree_t *rt, void *arg);
-extern struct range_tree_ops rt_avl_ops;
 
 void rt_avl_create(range_tree_t *rt, void *arg);
 void rt_avl_destroy(range_tree_t *rt, void *arg);
___
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: r346759 - in head/stand: . common efi/loader i386/loader

2019-04-26 Thread Toomas Soome
Author: tsoome
Date: Fri Apr 26 17:58:44 2019
New Revision: 346759
URL: https://svnweb.freebsd.org/changeset/base/346759

Log:
  loader: implement map-vdisk and unmap-vdisk commands
  
  illumos update: https://www.illumos.org/issues/10598
  
  Add map-vdisk and unmap-vdisk commands to create virtual disk interface on 
top of file. This will allow to use disk image from file system to load and 
start the kernel.
  
  By mapping file, we create vdiskX device, the device will be listed by lsdev 
[-v] and can be accessed directly as ls vdisk0p1:/path or can be used as value 
for currdev variable.
  
  vdisk strategy function does not use bcache as we have bcache used with 
backing file. vdisk can be unmapped when all consumers have closed the open 
files.
  
  In first iteration we do not support the zfs images because zfs pools do keep 
the device open (there is no "zpool export" mechanism). Adding zfs support is 
relatively simple, we just need to run zfs disk probe after mapping is done.
  
  Differential Revision:https://reviews.freebsd.org/D19733

Added:
  head/stand/common/vdisk.c   (contents, props changed)
Modified:
  head/stand/common/help.common
  head/stand/efi/loader/conf.c
  head/stand/i386/loader/conf.c
  head/stand/loader.mk

Modified: head/stand/common/help.common
==
--- head/stand/common/help.common   Fri Apr 26 17:28:06 2019
(r346758)
+++ head/stand/common/help.common   Fri Apr 26 17:58:44 2019
(r346759)
@@ -99,6 +99,13 @@
List loaded modules. If [-v] is specified, print more details.
 
 

+# Tmap-vdisk DMap virtual disk
+
+   map-vdisk filename
+
+   Map file as virtual disk.
+
+
 # Tmore DPage files
 
more  [ ...]
@@ -395,6 +402,13 @@
unload
 
This command removes any kernel and all loaded modules from memory.
+
+
+# Tunmap-vdisk DUnmap virtual disk
+
+   unmap-vdisk diskname
+
+   Delete virtual disk mapping.
 
 

 # Tunset DUnset a variable

Added: head/stand/common/vdisk.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/stand/common/vdisk.c   Fri Apr 26 17:58:44 2019(r346759)
@@ -0,0 +1,417 @@
+/*-
+ * Copyright 2019 Toomas Soome 
+ *
+ * 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int vdisk_init(void);
+static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *);
+static int vdisk_open(struct open_file *, ...);
+static int vdisk_close(struct open_file *);
+static int vdisk_ioctl(struct open_file *, u_long, void *);
+static int vdisk_print(int);
+
+struct devsw vdisk_dev = {
+   .dv_name = "vdisk",
+   .dv_type = DEVT_DISK,
+   .dv_init = vdisk_init,
+   .dv_strategy = vdisk_strategy,
+   .dv_open = vdisk_open,
+   .dv_close = vdisk_close,
+   .dv_ioctl = vdisk_ioctl,
+   .dv_print = vdisk_print,
+   .dv_cleanup = NULL
+};
+
+typedef STAILQ_HEAD(vdisk_info_list, vdisk_info) vdisk_info_list_t;
+
+typedef struct vdisk_info
+{
+   STAILQ_ENTRY(vdisk_info)vdisk_link; /* link in device list */
+   char*vdisk_path;
+   int   

svn commit: r346758 - stable/11/sys/cam

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 17:28:06 2019
New Revision: 346758
URL: https://svnweb.freebsd.org/changeset/base/346758

Log:
  MFC r345656: Do not map small IOCTL buffers to KVA, but copy.
  
  CAM IOCTL interfaces traditionally mapped user-space data buffers to KVA.
  It was nice originally, but now it takes too much to handle respective
  TLB shootdowns, while small kernel memory allocations up to 64KB backed
  by UMA and accompanied by copyin()/copyout() can be much cheaper.
  
  For large buffers mapping still may have sense, and unmapped I/O would
  be even better, but the last unfortunately is more tricky, since unmapped
  I/O API is too specific to struct bio now.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/sys/cam/cam_periph.c
  stable/11/sys/cam/cam_periph.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_periph.c
==
--- stable/11/sys/cam/cam_periph.c  Fri Apr 26 17:21:12 2019
(r346757)
+++ stable/11/sys/cam/cam_periph.c  Fri Apr 26 17:28:06 2019
(r346758)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -101,6 +102,9 @@ TUNABLE_INT("kern.cam.periph_noresrc_delay", _n
 static int periph_busy_delay = 500;
 TUNABLE_INT("kern.cam.periph_busy_delay", _busy_delay);
 
+static u_int periph_mapmem_thresh = 65536;
+SYSCTL_UINT(_kern_cam, OID_AUTO, mapmem_thresh, CTLFLAG_RWTUN,
+_mapmem_thresh, 0, "Threshold for user-space buffer mapping");
 
 void
 periphdriver_register(void *data)
@@ -762,12 +766,12 @@ int
 cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo,
 u_int maxmap)
 {
-   int numbufs, i, j;
-   int flags[CAM_PERIPH_MAXMAPS];
+   int numbufs, i;
u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS];
u_int32_t lengths[CAM_PERIPH_MAXMAPS];
u_int32_t dirs[CAM_PERIPH_MAXMAPS];
 
+   bzero(mapinfo, sizeof(*mapinfo));
if (maxmap == 0)
maxmap = DFLTPHYS;  /* traditional default */
else if (maxmap > MAXPHYS)
@@ -866,8 +870,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 */
for (i = 0; i < numbufs; i++) {
 
-   flags[i] = 0;
-
/*
 * The userland data pointer passed in may not be page
 * aligned.  vmapbuf() truncates the address to a page
@@ -885,15 +887,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
   (u_long)maxmap);
return(E2BIG);
}
-
-   if (dirs[i] & CAM_DIR_OUT) {
-   flags[i] = BIO_WRITE;
-   }
-
-   if (dirs[i] & CAM_DIR_IN) {
-   flags[i] = BIO_READ;
-   }
-
}
 
/*
@@ -907,7 +900,32 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
PHOLD(curproc);
 
for (i = 0; i < numbufs; i++) {
+
+   /* Save the user's data address. */
+   mapinfo->orig[i] = *data_ptrs[i];
+
/*
+* For small buffers use malloc+copyin/copyout instead of
+* mapping to KVA to avoid expensive TLB shootdowns.  For
+* small allocations malloc is backed by UMA, and so much
+* cheaper on SMP systems.
+*/
+   if (lengths[i] <= periph_mapmem_thresh) {
+   *data_ptrs[i] = malloc(lengths[i], M_CAMPERIPH,
+   M_WAITOK);
+   if (dirs[i] != CAM_DIR_IN) {
+   if (copyin(mapinfo->orig[i], *data_ptrs[i],
+   lengths[i]) != 0) {
+   free(*data_ptrs[i], M_CAMPERIPH);
+   *data_ptrs[i] = mapinfo->orig[i];
+   goto fail;
+   }
+   } else
+   bzero(*data_ptrs[i], lengths[i]);
+   continue;
+   }
+
+   /*
 * Get the buffer.
 */
mapinfo->bp[i] = getpbuf(NULL);
@@ -915,14 +933,12 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
/* put our pointer in the data slot */
mapinfo->bp[i]->b_data = *data_ptrs[i];
 
-   /* save the user's data address */
-   mapinfo->bp[i]->b_caller1 = *data_ptrs[i];
-
/* set the transfer length, we know it's < MAXPHYS */
mapinfo->bp[i]->b_bufsize = lengths[i];
 
/* set the direction */
-   mapinfo->bp[i]->b_iocmd = flags[i];
+   mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
+   BIO_WRITE : BIO_READ;
 
/*
 * Map the buffer into 

svn commit: r346757 - stable/12/sys/cam

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 17:21:12 2019
New Revision: 346757
URL: https://svnweb.freebsd.org/changeset/base/346757

Log:
  MFC r345656: Do not map small IOCTL buffers to KVA, but copy.
  
  CAM IOCTL interfaces traditionally mapped user-space data buffers to KVA.
  It was nice originally, but now it takes too much to handle respective
  TLB shootdowns, while small kernel memory allocations up to 64KB backed
  by UMA and accompanied by copyin()/copyout() can be much cheaper.
  
  For large buffers mapping still may have sense, and unmapped I/O would
  be even better, but the last unfortunately is more tricky, since unmapped
  I/O API is too specific to struct bio now.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/12/sys/cam/cam_periph.c
  stable/12/sys/cam/cam_periph.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_periph.c
==
--- stable/12/sys/cam/cam_periph.c  Fri Apr 26 17:09:26 2019
(r346756)
+++ stable/12/sys/cam/cam_periph.c  Fri Apr 26 17:21:12 2019
(r346757)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -104,6 +105,9 @@ TUNABLE_INT("kern.cam.periph_noresrc_delay", _n
 static int periph_busy_delay = 500;
 TUNABLE_INT("kern.cam.periph_busy_delay", _busy_delay);
 
+static u_int periph_mapmem_thresh = 65536;
+SYSCTL_UINT(_kern_cam, OID_AUTO, mapmem_thresh, CTLFLAG_RWTUN,
+_mapmem_thresh, 0, "Threshold for user-space buffer mapping");
 
 void
 periphdriver_register(void *data)
@@ -770,12 +774,12 @@ int
 cam_periph_mapmem(union ccb *ccb, struct cam_periph_map_info *mapinfo,
 u_int maxmap)
 {
-   int numbufs, i, j;
-   int flags[CAM_PERIPH_MAXMAPS];
+   int numbufs, i;
u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS];
u_int32_t lengths[CAM_PERIPH_MAXMAPS];
u_int32_t dirs[CAM_PERIPH_MAXMAPS];
 
+   bzero(mapinfo, sizeof(*mapinfo));
if (maxmap == 0)
maxmap = DFLTPHYS;  /* traditional default */
else if (maxmap > MAXPHYS)
@@ -886,8 +890,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
 */
for (i = 0; i < numbufs; i++) {
 
-   flags[i] = 0;
-
/*
 * The userland data pointer passed in may not be page
 * aligned.  vmapbuf() truncates the address to a page
@@ -905,15 +907,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
   (u_long)maxmap);
return(E2BIG);
}
-
-   if (dirs[i] & CAM_DIR_OUT) {
-   flags[i] = BIO_WRITE;
-   }
-
-   if (dirs[i] & CAM_DIR_IN) {
-   flags[i] = BIO_READ;
-   }
-
}
 
/*
@@ -927,7 +920,33 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
PHOLD(curproc);
 
for (i = 0; i < numbufs; i++) {
+
+   /* Save the user's data address. */
+   mapinfo->orig[i] = *data_ptrs[i];
+
/*
+* For small buffers use malloc+copyin/copyout instead of
+* mapping to KVA to avoid expensive TLB shootdowns.  For
+* small allocations malloc is backed by UMA, and so much
+* cheaper on SMP systems.
+*/
+   if (lengths[i] <= periph_mapmem_thresh &&
+   ccb->ccb_h.func_code != XPT_MMC_IO) {
+   *data_ptrs[i] = malloc(lengths[i], M_CAMPERIPH,
+   M_WAITOK);
+   if (dirs[i] != CAM_DIR_IN) {
+   if (copyin(mapinfo->orig[i], *data_ptrs[i],
+   lengths[i]) != 0) {
+   free(*data_ptrs[i], M_CAMPERIPH);
+   *data_ptrs[i] = mapinfo->orig[i];
+   goto fail;
+   }
+   } else
+   bzero(*data_ptrs[i], lengths[i]);
+   continue;
+   }
+
+   /*
 * Get the buffer.
 */
mapinfo->bp[i] = getpbuf(NULL);
@@ -935,14 +954,12 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma
/* put our pointer in the data slot */
mapinfo->bp[i]->b_data = *data_ptrs[i];
 
-   /* save the user's data address */
-   mapinfo->bp[i]->b_caller1 = *data_ptrs[i];
-
/* set the transfer length, we know it's < MAXPHYS */
mapinfo->bp[i]->b_bufsize = lengths[i];
 
/* set the direction */
-   mapinfo->bp[i]->b_iocmd = flags[i];
+   mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ?
+   BIO_WRITE : BIO_READ;
 
  

svn commit: r346755 - in stable/11: . share/man/man4 sys/netinet

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 17:01:56 2019
New Revision: 346755
URL: https://svnweb.freebsd.org/changeset/base/346755

Log:
  MFC r335837 (by kp): carp: Set DSCP value CS7
  
  Update carp to set DSCP value CS7(Network Traffic) in the flowlabel field of
  packets by default. Currently carp only sets TOS_LOWDELAY in IPv4 which was
  deprecated in 1998. This also implements sysctl that can revert carp back to
  it's old behavior if desired.
  
  This will allow implementation of QOS on modern network devices to make sure
  carp packets aren't dropped during interface contention.
  
  Submitted by: Nick Wolff 
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D14536

Modified:
  stable/11/UPDATING
  stable/11/share/man/man4/carp.4
  stable/11/sys/netinet/ip.h
  stable/11/sys/netinet/ip6.h
  stable/11/sys/netinet/ip_carp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/UPDATING
==
--- stable/11/UPDATING  Fri Apr 26 16:38:23 2019(r346754)
+++ stable/11/UPDATING  Fri Apr 26 17:01:56 2019(r346755)
@@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20190426:
+   CARP now sets DSCP value CS7(Network Traffic) in the flowlabel field
+   of packets by default instead of only setting TOS_LOWDELAY in IPv4,
+   which was deprecated in 1998.  Original behavior can be restored by
+   setting sysctl net.inet.carp.dscp=4.
+
 20190416:
Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to
8.0.0.  Please see the 20141231 entry below for information about

Modified: stable/11/share/man/man4/carp.4
==
--- stable/11/share/man/man4/carp.4 Fri Apr 26 16:38:23 2019
(r346754)
+++ stable/11/share/man/man4/carp.4 Fri Apr 26 17:01:56 2019
(r346755)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 21, 2013
+.Dd July 1, 2018
 .Dt CARP 4
 .Os
 .Sh NAME
@@ -102,6 +102,12 @@ Allow virtual hosts to preempt each other.
 When enabled, a vhid in a backup state would preempt a master that
 is announcing itself with a lower advskew.
 Disabled by default.
+.It Va net.inet.carp.dscp
+DSCP value in carp packet.
+Valid Values are 0 to 63.
+A value of 4 is equivalent to the old standard of TOS LOW_DELAY.
+TOS values were deprecated and replaced by DSCP in 1998.
+The default value is 56 (CS7/Network Control).
 .It Va net.inet.carp.log
 Determines what events relating to
 .Nm

Modified: stable/11/sys/netinet/ip.h
==
--- stable/11/sys/netinet/ip.h  Fri Apr 26 16:38:23 2019(r346754)
+++ stable/11/sys/netinet/ip.h  Fri Apr 26 17:01:56 2019(r346755)
@@ -92,6 +92,11 @@ struct ip {
 #defineIPTOS_PREC_ROUTINE  IPTOS_DSCP_CS0
 
 /*
+ * Offset of Diffserv decimal value to convert it to tos value .
+ */
+#defineIPTOS_DSCP_OFFSET   2
+
+/*
  * Definitions for DiffServ Codepoints as per RFC2474 and RFC5865.
  */
 #defineIPTOS_DSCP_CS0  0x00

Modified: stable/11/sys/netinet/ip6.h
==
--- stable/11/sys/netinet/ip6.h Fri Apr 26 16:38:23 2019(r346754)
+++ stable/11/sys/netinet/ip6.h Fri Apr 26 17:01:56 2019(r346755)
@@ -102,6 +102,7 @@ struct ip6_hdr {
 #define IPV6_FLOWLABEL_MASK0x0f00  /* flow label (20 bits) */
 #endif /* LITTLE_ENDIAN */
 #endif
+#define IPV6_FLOWLABEL_LEN 20
 #if 1
 /* ECN bits proposed by Sally Floyd */
 #define IP6TOS_CE  0x01/* congestion experienced */

Modified: stable/11/sys/netinet/ip_carp.c
==
--- stable/11/sys/netinet/ip_carp.c Fri Apr 26 16:38:23 2019
(r346754)
+++ stable/11/sys/netinet/ip_carp.c Fri Apr 26 17:01:56 2019
(r346755)
@@ -190,6 +190,10 @@ static int proto_reg[] = {-1, -1};
 static VNET_DEFINE(int, carp_allow) = 1;
 #defineV_carp_allowVNET(carp_allow)
 
+/* Set DSCP in outgoing CARP packets. */
+static VNET_DEFINE(int, carp_dscp) = 56;
+#defineV_carp_dscp VNET(carp_dscp)
+
 /* Preempt slower nodes. */
 static VNET_DEFINE(int, carp_preempt) = 0;
 #defineV_carp_preempt  VNET(carp_preempt)
@@ -210,11 +214,15 @@ static VNET_DEFINE(int, carp_senderr_adj) = CARP_MAXSK
 static VNET_DEFINE(int, carp_ifdown_adj) = CARP_MAXSKEW;
 #defineV_carp_ifdown_adj   VNET(carp_ifdown_adj)
 
+static int carp_dscp_sysctl(SYSCTL_HANDLER_ARGS);
 static int carp_demote_adj_sysctl(SYSCTL_HANDLER_ARGS);
 
 SYSCTL_NODE(_net_inet, IPPRO

svn commit: r346754 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 16:38:23 2019
New Revision: 346754
URL: https://svnweb.freebsd.org/changeset/base/346754

Log:
  Merge __VGLGetXY() back into VGLGetXY().  They were split to simplify
  the organization of fixes for the mouse cursor, but after optimizations
  VGLGetXY() automatically avoids the mouse cursor.

Modified:
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cFri Apr 26 16:26:01 2019(r346753)
+++ head/lib/libvgl/simple.cFri Apr 26 16:38:23 2019(r346754)
@@ -133,12 +133,19 @@ set_planar:
   }
 }
 
-static u_long
-__VGLGetXY(VGLBitmap *object, int x, int y)
+u_long
+VGLGetXY(VGLBitmap *object, int x, int y)
 {
-  int offset;
   u_long color;
+  int offset;
 
+  VGLCheckSwitch();
+  if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
+return 0;
+  if (object == VGLDisplay)
+object = 
+  else if (object->Type != MEMBUF)
+return 0;  /* invalid */
   offset = (y * object->VXsize + x) * object->PixelBytes;
   switch (object->PixelBytes) {
   case 1:
@@ -155,19 +162,6 @@ __VGLGetXY(VGLBitmap *object, int x, int y)
 return le32toh(color);
   }
   return 0;/* invalid */
-}
-
-u_long
-VGLGetXY(VGLBitmap *object, int x, int y)
-{
-  VGLCheckSwitch();
-  if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
-return 0;
-  if (object == VGLDisplay)
-object = 
-  else if (object->Type != MEMBUF)
-return 0;  /* invalid */
-  return __VGLGetXY(object, x, y);
 }
 
  /*
___
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: r346753 - stable/11/sbin/geom/class/part

2019-04-26 Thread Alexander Motin
Author: mav
Date: Fri Apr 26 16:26:01 2019
New Revision: 346753
URL: https://svnweb.freebsd.org/changeset/base/346753

Log:
  MFC r317515: Fix withered handling of r280687, broken by r286719.

Modified:
  stable/11/sbin/geom/class/part/geom_part.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/geom/class/part/geom_part.c
==
--- stable/11/sbin/geom/class/part/geom_part.c  Fri Apr 26 16:14:23 2019
(r346752)
+++ stable/11/sbin/geom/class/part/geom_part.c  Fri Apr 26 16:26:01 2019
(r346753)
@@ -75,6 +75,7 @@ volatile sig_atomic_t undo_restore;
 
 static struct gclass *find_class(struct gmesh *, const char *);
 static struct ggeom * find_geom(struct gclass *, const char *);
+static int geom_is_withered(struct ggeom *);
 static const char *find_geomcfg(struct ggeom *, const char *);
 static const char *find_provcfg(struct gprovider *, const char *);
 static struct gprovider *find_provider(struct ggeom *, off_t);
@@ -217,7 +218,7 @@ find_geom(struct gclass *classp, const char *name)
LIST_FOREACH(gp, >lg_geom, lg_geom) {
if (strcmp(gp->lg_name, name) != 0)
continue;
-   if (find_geomcfg(gp, "wither") == NULL)
+   if (!geom_is_withered(gp))
return (gp);
else
wgp = gp;
@@ -225,6 +226,18 @@ find_geom(struct gclass *classp, const char *name)
return (wgp);
 }
 
+static int
+geom_is_withered(struct ggeom *gp)
+{
+   struct gconfig *gc;
+
+   LIST_FOREACH(gc, >lg_config, lg_config) {
+   if (!strcmp(gc->lg_name, "wither"))
+   return (1);
+   }
+   return (0);
+}
+
 static const char *
 find_geomcfg(struct ggeom *gp, const char *cfg)
 {
@@ -616,7 +629,7 @@ gpart_show_geom(struct ggeom *gp, const char *element,
off_t length, secsz;
int idx, wblocks, wname, wmax;
 
-   if (find_geomcfg(gp, "wither"))
+   if (geom_is_withered(gp))
return;
scheme = find_geomcfg(gp, "scheme");
if (scheme == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346588 - head/lib/libc/powerpc64/string

2019-04-26 Thread Justin Hibbits
On Tue, 23 Apr 2019 10:24:42 +
Alexey Dokuchaev  wrote:

> On Tue, Apr 23, 2019 at 02:53:53AM +, Justin Hibbits wrote:
> > New Revision: 346588
> > URL: https://svnweb.freebsd.org/changeset/base/346588
> > 
> > Log:
> >   powerpc64: Rewrite strcmp in asm to take advantage of word size
> > ...
> >   Some performance gain rates between the current and the optimized
> >   solution:
> > 
> >   String size (bytes)   Gain rate
> > <=8 0.59%
> > <=161.92%
> > 32  3.02%
> > 64  5.60%
> > 128 10.16%
> > 256 18.05%
> > 512 30.18%
> > 102442.82%  
> 
> Nice!  This should help to speed up buildworld quite a bit.  Would it
> be feasible to patch ppc32 in a similar fashion?  Thanks,
> 
> ./danfe

This actually uses 'cmpb' which is only available on PowerISA 2.05+, so
I'll need to pull it out for now, and re-enable it once we have
ifuncs.  As it stands, this commit broke the G5 and POWER4/POWER5.

- Justin
___
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: r346752 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 16:14:23 2019
New Revision: 346752
URL: https://svnweb.freebsd.org/changeset/base/346752

Log:
  In VGLClear(), check for the overlap of the mouse cursor in the whole
  display, not just in the unpanned top left corner.  This currently
  makes no difference since the kernel erroneously doesn't allow moving
  the cursor completely outside of the unpanned corner.

Modified:
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cFri Apr 26 15:43:14 2019(r346751)
+++ head/lib/libvgl/simple.cFri Apr 26 16:14:23 2019(r346752)
@@ -476,7 +476,7 @@ VGLClear(VGLBitmap *object, u_long color)
   VGLCheckSwitch();
   if (object == VGLDisplay) {
 VGLMouseFreeze();
-mouseoverlap = VGLMouseOverlap(0, 0, object->Xsize, object->Ysize);
+mouseoverlap = VGLMouseOverlap(0, 0, object->VXsize, object->VYsize);
 if (mouseoverlap)
   VGLMousePointerHide();
 VGLClear(, color);
___
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: r346751 - head/lib/libc/gen

2019-04-26 Thread Ian Lepore
Author: ian
Date: Fri Apr 26 15:43:14 2019
New Revision: 346751
URL: https://svnweb.freebsd.org/changeset/base/346751

Log:
  Add a manpage for elf_aux_info(3)
  
  Differential Revision:https://reviews.freebsd.org/D20063

Added:
  head/lib/libc/gen/auxv.3   (contents, props changed)
Modified:
  head/lib/libc/gen/Makefile.inc

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Fri Apr 26 15:00:59 2019
(r346750)
+++ head/lib/libc/gen/Makefile.inc  Fri Apr 26 15:43:14 2019
(r346751)
@@ -193,6 +193,7 @@ SYM_MAPS+=${LIBC_SRCTOP}/gen/Symbol.map
 
 MAN+=  alarm.3 \
arc4random.3 \
+   auxv.3 \
basename.3 \
cap_rights_get.3 \
cap_sandboxed.3 \
@@ -321,6 +322,7 @@ MAN+=   alarm.3 \
 
 MLINKS+=arc4random.3 arc4random_buf.3 \
arc4random.3 arc4random_uniform.3
+MLINKS+=auxv.3 elf_aux_info.3
 MLINKS+=ctermid.3 ctermid_r.3
 MLINKS+=devname.3 devname_r.3
 MLINKS+=devname.3 fdevname.3

Added: head/lib/libc/gen/auxv.3
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/gen/auxv.3Fri Apr 26 15:43:14 2019(r346751)
@@ -0,0 +1,86 @@
+.\"
+.\" Copyright (c) 2019 Ian Lepore 
+.\"
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 25, 2019
+.Dt ELF_AUX_INFO 3
+.Os
+.Sh NAME
+.Nm elf_aux_info
+.Nd extract data from the elf auxiliary vector of the current process
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/auxv.h
+.Ft int
+.Fn elf_aux_info "int aux" "void *buf" "int buflen"
+.Sh DESCRIPTION
+The
+.Fn elf_aux_info
+function retrieves the auxiliary info vector requested in
+.Va aux .
+The information is stored into the provided buffer if it will fit.
+The following values, defined in
+.In sys/elf_common.h
+can be requested:
+.Bl -tag -width AT_OSRELDATE
+.It AT_CANARY
+The canary value for SSP.
+.It AT_HWCAP
+CPU / hardware feature flags.
+.It AT_HWCAP2
+CPU / hardware feature flags.
+.It AT_NCPUS
+Number of CPUs.
+.It AT_OSRELDATE
+Kernel OSRELDATE.
+.It AT_PAGESIZES
+Vector of page sizes.
+.It AT_PAGESZ
+Page size in bytes.
+.It AT_TIMEKEEP
+Pointer to VDSO timehands (for library internal use).
+.El
+.Sh RETURN VALUES
+Returns zero on success, or an error number on failure.
+.Sh ERRORS
+.Bl -tag -width Er
+.It Bq Er EINVAL
+An unknown item was requested.
+.It Bq Er EINVAL
+The provided buffer was not the right size for the requested item.
+.It Bq Er ENOENT
+The requested item is not available.
+.El
+.Sh HISTORY
+The
+.Fn elf_aux_info
+function appeared in
+.Fx 12.0 .
+.Sh BUGS
+Only a small subset of available auxiliary info vector items are
+accessible with this function.
+Some items require a "right-sized" buffer while others just require a
+"big enough" buffer.
___
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: r346750 - head/sys/kern

2019-04-26 Thread Alan Somers
Author: asomers
Date: Fri Apr 26 15:00:59 2019
New Revision: 346750
URL: https://svnweb.freebsd.org/changeset/base/346750

Log:
  [skip ci] fix typo in comment from r59840
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Fri Apr 26 14:44:50 2019(r346749)
+++ head/sys/kern/vfs_bio.c Fri Apr 26 15:00:59 2019(r346750)
@@ -4424,7 +4424,7 @@ bufwait(struct buf *bp)
  * read error occurred, or if the op was a write.  B_CACHE is never
  * set if the buffer is invalid or otherwise uncacheable.
  *
- * biodone does not mess with B_INVAL, allowing the I/O routine or the
+ * bufdone does not mess with B_INVAL, allowing the I/O routine or the
  * initiator to leave B_INVAL set to brelse the buffer out of existence
  * in the biodone routine.
  */
___
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: r346748 - head/tools/boot

2019-04-26 Thread Rebecca Cran
Author: bcran
Date: Fri Apr 26 14:44:46 2019
New Revision: 346748
URL: https://svnweb.freebsd.org/changeset/base/346748

Log:
  Fix tools/boot/ci-qemu-test.sh and make some improvements
  
  Update ci-qemu-test.sh
  
  o Update the path to the OVMF file, which is now in 
/usr/local/share/uefi-edk2-qemu.
  o Use the more modern q35, pc-q35-3.0 (Q35 + ICH9, 2009) QEMU machine
instead of the default, obsolete pc, pc-i440fx-3.0 (i440FX + PIIX, 1996).
For example this adds ACPI support.
  o Specify the system firmware using the newer pflash drive syntax instead
of bios.
  o Remove extra, unneeded devices by passing -nodefaults.
  o Change text to talk about 'firmware' instead of 'bios', since UEFI
isn't a BIOS.
  
  Reviewed by:  imp, emaste
  Differential Revision:https://reviews.freebsd.org/D20074

Modified:
  head/tools/boot/ci-qemu-test.sh

Modified: head/tools/boot/ci-qemu-test.sh
==
--- head/tools/boot/ci-qemu-test.sh Fri Apr 26 14:44:20 2019
(r346747)
+++ head/tools/boot/ci-qemu-test.sh Fri Apr 26 14:44:46 2019
(r346748)
@@ -81,10 +81,10 @@ if [ -z "${SRCTOP}" ]; then
die "Cannot locate top of source tree"
 fi
 
-# Locate the uefi bios file used by qemu.
-: ${OVMF:=/usr/local/share/UEFI-firmware/QEMU_UEFI_CODE_x86_64.fd}
+# Locate the uefi firmware file used by qemu.
+: ${OVMF:=/usr/local/share/uefi-edk2-qemu/QEMU_UEFI_CODE-x86_64.fd}
 if [ ! -r "${OVMF}" ]; then
-   die "Cannot read UEFI bios file ${OVMF}"
+   die "Cannot read UEFI firmware file ${OVMF}"
 fi
 
 # Create a temp dir to hold the boot image.
@@ -97,7 +97,8 @@ trap tempdir_cleanup EXIT SIGINT SIGHUP SIGTERM SIGQUI
 # And, boot in QEMU.
 : ${BOOTLOG:=${TMPDIR:-/tmp}/ci-qemu-test-boot.log}
 timeout 300 \
-qemu-system-x86_64 -m 256M -bios ${OVMF} \
+qemu-system-x86_64 -M q35 -m 256M -nodefaults \
+   -drive if=pflash,format=raw,readonly,file=${OVMF} \
 -serial stdio -vga none -nographic -monitor none \
 -snapshot -hda fat:${ROOTDIR} 2>&1 | tee ${BOOTLOG}
 
___
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: r346749 - head/libexec/rc

2019-04-26 Thread Lev A. Serebryakov
Author: lev (ports committer)
Date: Fri Apr 26 14:44:50 2019
New Revision: 346749
URL: https://svnweb.freebsd.org/changeset/base/346749

Log:
   Make mdmfs verbose if diskless boot is verbose.
  
  Approved by:  ian@
  Differential Revision:D17104

Modified:
  head/libexec/rc/rc.initdiskless

Modified: head/libexec/rc/rc.initdiskless
==
--- head/libexec/rc/rc.initdiskless Fri Apr 26 14:44:46 2019
(r346748)
+++ head/libexec/rc/rc.initdiskless Fri Apr 26 14:44:50 2019
(r346749)
@@ -208,7 +208,11 @@ handle_remount() { # $1 = mount point
 # The 'auto' parameter will attempt to use tmpfs(5), falls back to md(4).
 # $1 is size in 512-byte sectors, $2 is the mount point.
 mount_md() {
-/sbin/mdmfs -s $1 auto $2
+if [ ${o_verbose} -gt 0 ] ; then
+/sbin/mdmfs -XL -s $1 auto $2
+else
+/sbin/mdmfs -s $1 auto $2
+fi
 }
 
 # Create the memory filesystem if it has not already been created
___
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: r346747 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 14:44:20 2019
New Revision: 346747
URL: https://svnweb.freebsd.org/changeset/base/346747

Log:
  Remove save/restore of the crtc and gdc registers when showing and
  hiding the mouse cursor.  The showing and hiding is often done
  asynchronously in a not very safe signal handler, but the state of
  these registers and much more is protected from the signal handler
  in a better way by deferring mouse signals while the state is in use.

Modified:
  head/lib/libvgl/mouse.c

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Fri Apr 26 14:15:58 2019(r346746)
+++ head/lib/libvgl/mouse.c Fri Apr 26 14:44:20 2019(r346747)
@@ -108,18 +108,11 @@ VGLMousePointerShow()
   byte buf[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE*4];
   VGLBitmap buffer =
 VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, buf);
-  byte crtcidx, crtcval, gdcidx, gdcval;
   int pos;
 
   if (!VGLMouseVisible) {
 INTOFF();
 VGLMouseVisible = 1;
-if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
-  crtcidx = inb(0x3c4);
-  crtcval = inb(0x3c5);
-  gdcidx = inb(0x3ce);
-  gdcval = inb(0x3cf);
-}
 buffer.PixelBytes = VGLDisplay->PixelBytes;
 __VGLBitmapCopy(, VGLMouseXpos, VGLMouseYpos, 
 , 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
@@ -130,12 +123,6 @@ VGLMousePointerShow()
   VGLDisplay->PixelBytes);
 __VGLBitmapCopy(, 0, 0, VGLDisplay, 
  VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
-if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
-  outb(0x3c4, crtcidx);
-  outb(0x3c5, crtcval);
-  outb(0x3ce, gdcidx);
-  outb(0x3cf, gdcval);
-}
 INTON();
   }
 }
@@ -143,25 +130,11 @@ VGLMousePointerShow()
 void
 VGLMousePointerHide()
 {
-  byte crtcidx, crtcval, gdcidx, gdcval;
-
   if (VGLMouseVisible) {
 INTOFF();
 VGLMouseVisible = 0;
-if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
-  crtcidx = inb(0x3c4);
-  crtcval = inb(0x3c5);
-  gdcidx = inb(0x3ce);
-  gdcval = inb(0x3cf);
-}
 __VGLBitmapCopy(, VGLMouseXpos, VGLMouseYpos, VGLDisplay, 
 VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, 
MOUSE_IMG_SIZE);
-if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
-  outb(0x3c4, crtcidx);
-  outb(0x3c5, crtcval);
-  outb(0x3ce, gdcidx);
-  outb(0x3cf, gdcval);
-}
 INTON();
   }
 }
___
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: r346746 - stable/12/sbin/pfctl

2019-04-26 Thread Kristof Provost
Author: kp
Date: Fri Apr 26 14:15:58 2019
New Revision: 346746
URL: https://svnweb.freebsd.org/changeset/base/346746

Log:
  MFC r346370:
  
  pfctl: Fix ifgroup check
  
  We cannot just assume that any name which ends with a letter is a group
  That's not been true since we allowed renaming of network interfaces. It's 
also
  not true for things like epair0a.
  
  Try to retrieve the group members for the name to check, since we'll get 
ENOENT
  if the group doesn't exist.

Modified:
  stable/12/sbin/pfctl/pfctl_optimize.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/pfctl/pfctl_optimize.c
==
--- stable/12/sbin/pfctl/pfctl_optimize.c   Fri Apr 26 13:49:06 2019
(r346745)
+++ stable/12/sbin/pfctl/pfctl_optimize.c   Fri Apr 26 14:15:58 2019
(r346746)
@@ -1500,14 +1500,24 @@ superblock_inclusive(struct superblock *block, struct 
 int
 interface_group(const char *ifname)
 {
+   int s;
+   struct ifgroupreq   ifgr;
+
if (ifname == NULL || !ifname[0])
return (0);
 
-   /* Real interfaces must end in a number, interface groups do not */
-   if (isdigit(ifname[strlen(ifname) - 1]))
-   return (0);
-   else
-   return (1);
+   s = get_query_socket();
+
+   memset(, 0, sizeof(ifgr));
+   strlcpy(ifgr.ifgr_name, ifname, IFNAMSIZ);
+   if (ioctl(s, SIOCGIFGMEMB, (caddr_t)) == -1) {
+   if (errno == ENOENT)
+   return (0);
+   else
+   err(1, "SIOCGIFGMEMB");
+   }
+
+   return (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: r346745 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 13:49:06 2019
New Revision: 346745
URL: https://svnweb.freebsd.org/changeset/base/346745

Log:
  Fix the only known remaining (libvgl) bug for 24-bit modes, and enable
  support for 24-bit modes.
  
  The non-segmented case has worked for a long time, but the segmented
  case could never have worked since 24-bit accesses may cross a window
  boundary but the window was not changed in the middle of the specialized
  24-bit accesses for writing a single pixel.

Modified:
  head/lib/libvgl/main.c
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Fri Apr 26 13:22:54 2019(r346744)
+++ head/lib/libvgl/main.c  Fri Apr 26 13:49:06 2019(r346745)
@@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "vgl.h"
 
-/* XXX Direct Color 24bits modes unsupported */
-
 #define min(x, y)  (((x) < (y)) ? (x) : (y))
 #define max(x, y)  (((x) > (y)) ? (x) : (y))
 
@@ -223,11 +221,9 @@ VGLInit(int mode)
 case 2:
   VGLDisplay->Type = VIDBUF16;
   break;
-#if notyet
 case 3:
   VGLDisplay->Type = VIDBUF24;
   break;
-#endif
 case 4:
   VGLDisplay->Type = VIDBUF32;
   break;

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cFri Apr 26 13:22:54 2019(r346744)
+++ head/lib/libvgl/simple.cFri Apr 26 13:49:06 2019(r346745)
@@ -51,7 +51,7 @@ static byte VGLSavePaletteBlue[256];
 void
 VGLSetXY(VGLBitmap *object, int x, int y, u_long color)
 {
-  int offset, undermouse;
+  int offset, soffset, undermouse;
 
   VGLCheckSwitch();
   if (x>=0 && xVXsize && y>=0 && yVYsize) {
@@ -67,7 +67,6 @@ VGLSetXY(VGLBitmap *object, int x, int y, u_long color
   switch (object->Type) {
   case VIDBUF8S:
   case VIDBUF16S:
-  case VIDBUF24S:
   case VIDBUF32S:
 offset = VGLSetSegment(offset);
 /* FALLTHROUGH */
@@ -89,6 +88,25 @@ VGLSetXY(VGLBitmap *object, int x, int y, u_long color
   break;
 case 4:
   memcpy(>Bitmap[offset], , 4);
+  break;
+}
+break;
+  case VIDBUF24S:
+soffset = VGLSetSegment(offset);
+color = htole32(color);
+switch (VGLAdpInfo.va_window_size - soffset) {
+case 1:
+  memcpy(>Bitmap[soffset], , 1);
+  soffset = VGLSetSegment(offset + 1);
+  memcpy(>Bitmap[soffset], (byte *) + 1, 2);
+  break;
+case 2:
+  memcpy(>Bitmap[soffset], , 2);
+  soffset = VGLSetSegment(offset + 2);
+  memcpy(>Bitmap[soffset], (byte *) + 2, 1);
+  break;
+default:
+  memcpy(>Bitmap[soffset], , 3);
   break;
 }
 break;
___
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: r346744 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 13:22:54 2019
New Revision: 346744
URL: https://svnweb.freebsd.org/changeset/base/346744

Log:
  Restore the line width in VGLEnd().  The line width may be changed by
  VGLSetVScreenSize(), but is not restored by mode switches to at least
  standard text mode, so must be restored explicitly.  Standard text mode
  displayed blanks when the line width was doubled.

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Fri Apr 26 13:04:10 2019(r346743)
+++ head/lib/libvgl/main.c  Fri Apr 26 13:22:54 2019(r346744)
@@ -64,6 +64,7 @@ static unsigned int VGLCurWindow;
 static int VGLInitDone = 0;
 static video_info_t VGLOldModeInfo;
 static vid_info_t VGLOldVInfo;
+static int VGLOldVXsize;
 
 void
 VGLEnd()
@@ -85,6 +86,8 @@ struct vt_mode smode;
 munmap(VGLMem, VGLAdpInfo.va_window_size);
   }
 
+  ioctl(0, FBIO_SETLINEWIDTH, );
+
   if (VGLOldMode >= M_VESA_BASE)
 ioctl(0, _IO('V', VGLOldMode - M_VESA_BASE), 0);
   else
@@ -322,6 +325,7 @@ VGLInit(int mode)
   depth = VGLModeInfo.vi_depth;
   if (depth == 15)
 depth = 16;
+  VGLOldVXsize =
   VGLDisplay->VXsize = VGLAdpInfo.va_line_width
   *8/(depth/VGLModeInfo.vi_planes);
   VGLDisplay->VYsize = 
VGLBufSize/VGLModeInfo.vi_planes/VGLAdpInfo.va_line_width;
___
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: r346743 - head/lib/libvgl

2019-04-26 Thread Bruce Evans
Author: bde
Date: Fri Apr 26 13:04:10 2019
New Revision: 346743
URL: https://svnweb.freebsd.org/changeset/base/346743

Log:
  Fix an off-by-1 error for copying overlapping bitmaps in r346416.  For
  nonzero height, the first line in the original order was not copied, and
  for zero height, garbage lines before the first were copied until a crash
  occurred.

Modified:
  head/lib/libvgl/bitmap.c

Modified: head/lib/libvgl/bitmap.c
==
--- head/lib/libvgl/bitmap.cFri Apr 26 13:00:25 2019(r346742)
+++ head/lib/libvgl/bitmap.cFri Apr 26 13:04:10 2019(r346743)
@@ -207,7 +207,7 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
   yextra = 0;
   ystep = 1;
   if (src->Bitmap == dst->Bitmap && srcy < dsty) {
-yend = srcy;
+yend = srcy - 1;
 yextra = hight - 1;
 ystep = -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: r346742 - stable/11/sys/netpfil/pf

2019-04-26 Thread Kristof Provost
Author: kp
Date: Fri Apr 26 13:00:25 2019
New Revision: 346742
URL: https://svnweb.freebsd.org/changeset/base/346742

Log:
  MFC r346349:
  
  pf: No need to M_NOWAIT in DIOCRSETTFLAGS
  
  Now that we don't hold a lock during DIOCRSETTFLAGS memory allocation we can
  use M_WAITOK.
  
  Pointed out by:   glebius@

Modified:
  stable/11/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf_ioctl.c
==
--- stable/11/sys/netpfil/pf/pf_ioctl.c Fri Apr 26 13:00:22 2019
(r346741)
+++ stable/11/sys/netpfil/pf/pf_ioctl.c Fri Apr 26 13:00:25 2019
(r346742)
@@ -2693,11 +2693,7 @@ DIOCCHANGEADDR_error:
 
totlen = io->pfrio_size * sizeof(struct pfr_table);
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   M_TEMP, M_NOWAIT);
-   if (pfrts == NULL) {
-   error = ENOMEM;
-   break;
-   }
+   M_TEMP, M_WAITOK);
error = copyin(io->pfrio_buffer, pfrts, totlen);
if (error) {
free(pfrts, M_TEMP);
___
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: r346741 - stable/12/sys/netpfil/pf

2019-04-26 Thread Kristof Provost
Author: kp
Date: Fri Apr 26 13:00:22 2019
New Revision: 346741
URL: https://svnweb.freebsd.org/changeset/base/346741

Log:
  MFC r346349:
  
  pf: No need to M_NOWAIT in DIOCRSETTFLAGS
  
  Now that we don't hold a lock during DIOCRSETTFLAGS memory allocation we can
  use M_WAITOK.
  
  Pointed out by:   glebius@

Modified:
  stable/12/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/pf/pf_ioctl.c
==
--- stable/12/sys/netpfil/pf/pf_ioctl.c Fri Apr 26 12:59:23 2019
(r346740)
+++ stable/12/sys/netpfil/pf/pf_ioctl.c Fri Apr 26 13:00:22 2019
(r346741)
@@ -3110,11 +3110,7 @@ DIOCCHANGEADDR_error:
 
totlen = io->pfrio_size * sizeof(struct pfr_table);
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   M_TEMP, M_NOWAIT);
-   if (pfrts == NULL) {
-   error = ENOMEM;
-   break;
-   }
+   M_TEMP, M_WAITOK);
error = copyin(io->pfrio_buffer, pfrts, totlen);
if (error) {
free(pfrts, M_TEMP);
___
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: r346740 - stable/12/tests/sys/netpfil/pf

2019-04-26 Thread Kristof Provost
Author: kp
Date: Fri Apr 26 12:59:23 2019
New Revision: 346740
URL: https://svnweb.freebsd.org/changeset/base/346740

Log:
  MFC r346347:
  
  pf tests: Fail the test if we can't set the rules
  
  The test should fail if pf rules can't be set. This is helpful both
  while writing tests and to verify that pfctl works as expected.

Modified:
  stable/12/tests/sys/netpfil/pf/utils.subr
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/netpfil/pf/utils.subr
==
--- stable/12/tests/sys/netpfil/pf/utils.subr   Fri Apr 26 12:55:52 2019
(r346739)
+++ stable/12/tests/sys/netpfil/pf/utils.subr   Fri Apr 26 12:59:23 2019
(r346740)
@@ -40,6 +40,10 @@ pft_set_rules()
printf "$1\n"
shift
done | jexec ${jname} pfctl -f -
+   if [ $? -ne 0 ];
+   then
+   atf_fail "Failed to set PF rules in ${jname}"
+   fi
 }
 
 pft_cleanup()
___
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: r346739 - in head/sys: compat/freebsd32 kern

2019-04-26 Thread Ed Maste
Author: emaste
Date: Fri Apr 26 12:55:52 2019
New Revision: 346739
URL: https://svnweb.freebsd.org/changeset/base/346739

Log:
  make sysent after r346273 (readlinkat arg correction)
  
  PR:   197915
  Reminded by:  dchagin

Modified:
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/kern/systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Apr 26 11:28:59 
2019(r346738)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Apr 26 12:55:52 
2019(r346739)
@@ -10460,7 +10460,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
/* readlinkat */
case 500:
if (ndx == 0 || ndx == 1)
-   p = "int";
+   p = "ssize_t";
break;
/* renameat */
case 501:

Modified: head/sys/kern/systrace_args.c
==
--- head/sys/kern/systrace_args.c   Fri Apr 26 11:28:59 2019
(r346738)
+++ head/sys/kern/systrace_args.c   Fri Apr 26 12:55:52 2019
(r346739)
@@ -10421,7 +10421,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
/* readlinkat */
case 500:
if (ndx == 0 || ndx == 1)
-   p = "int";
+   p = "ssize_t";
break;
/* renameat */
case 501:
___
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: r346737 - in stable/12: lib/libsecureboot lib/libsecureboot/h share/mk stand stand/common sys/conf sys/security/mac_veriexec_parser tools/build/options

2019-04-26 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 11:12:51 2019
New Revision: 346737
URL: https://svnweb.freebsd.org/changeset/base/346737

Log:
  MFC r345830: Create kernel module to parse Veriexec manifest based on envs
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Added:
  stable/12/lib/libsecureboot/pass_manifest.c
 - copied unchanged from r345830, head/lib/libsecureboot/pass_manifest.c
  stable/12/sys/security/mac_veriexec_parser/
 - copied from r345830, head/sys/security/mac_veriexec_parser/
  stable/12/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST
 - copied unchanged from r345830, 
head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST
Modified:
  stable/12/lib/libsecureboot/Makefile.libsa.inc
  stable/12/lib/libsecureboot/h/verify_file.h
  stable/12/lib/libsecureboot/libsecureboot-priv.h
  stable/12/lib/libsecureboot/verify_file.c
  stable/12/share/mk/src.opts.mk
  stable/12/stand/common/boot.c
  stable/12/stand/common/module.c
  stable/12/stand/loader.mk
  stable/12/sys/conf/files

Modified: stable/12/lib/libsecureboot/Makefile.libsa.inc
==
--- stable/12/lib/libsecureboot/Makefile.libsa.inc  Fri Apr 26 09:06:29 
2019(r346736)
+++ stable/12/lib/libsecureboot/Makefile.libsa.inc  Fri Apr 26 11:12:51 
2019(r346737)
@@ -29,6 +29,11 @@ CFLAGS+= \
-I${SRCTOP}/stand/efi/include/${MACHINE}
 .endif
 
+.if ${MK_LOADER_VERIEXEC_PASS_MANIFEST} == "yes"
+SRCS+= \
+   pass_manifest.c
+.endif
+
 # this is the list of paths (relative to a file
 # that we need to verify) used to find a signed manifest.
 # the signature extensions in VE_SIGNATURE_EXT_LIST

Modified: stable/12/lib/libsecureboot/h/verify_file.h
==
--- stable/12/lib/libsecureboot/h/verify_file.h Fri Apr 26 09:06:29 2019
(r346736)
+++ stable/12/lib/libsecureboot/h/verify_file.h Fri Apr 26 11:12:51 2019
(r346737)
@@ -32,6 +32,7 @@
 #define VE_WANT 1/* we want this verified */
 #define VE_MUST 2/* this must be verified */
 
+#define VE_NOT_CHECKED -42
 #define VE_VERIFIED 1/* all good */
 #define VE_UNVERIFIED_OK 0   /* not verified but that's ok */
 #define VE_NOT_VERIFYING 2  /* we are not verifying */
@@ -42,6 +43,8 @@ voidve_debug_set(int);
 int ve_status_get(int);
 voidve_efi_init(void);
 int load_manifest(const char *, const char *, const char *, struct stat *);
+int pass_manifest(const char *, const char *);
+int pass_manifest_export_envs(void);
 int verify_file(int, const char *, off_t, int);
 voidverify_pcr_export(void);
 

Modified: stable/12/lib/libsecureboot/libsecureboot-priv.h
==
--- stable/12/lib/libsecureboot/libsecureboot-priv.hFri Apr 26 09:06:29 
2019(r346736)
+++ stable/12/lib/libsecureboot/libsecureboot-priv.hFri Apr 26 11:12:51 
2019(r346737)
@@ -31,6 +31,8 @@
 /* public api */
 #include "libsecureboot.h"
 
+struct stat;
+
 typedef struct {
unsigned char   *data;
size_t  hash_size;
@@ -49,6 +51,9 @@ int verify_rsa_digest(br_rsa_public_key *pkey,
 const unsigned char *hash_oid,
 unsigned char *mdata, size_t mlen,
 unsigned char *sdata, size_t slen);
+
+int is_verified(struct stat *stp);
+void add_verify_status(struct stat *stp, int status);
 
 int openpgp_self_tests(void);
 

Copied: stable/12/lib/libsecureboot/pass_manifest.c (from r345830, 
head/lib/libsecureboot/pass_manifest.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/lib/libsecureboot/pass_manifest.c Fri Apr 26 11:12:51 2019
(r346737, copy of r345830, head/lib/libsecureboot/pass_manifest.c)
@@ -0,0 +1,152 @@
+/*-
+ * Copyright (c) 2019 Stormshield.
+ * Copyright (c) 2019 Semihalf.
+ *
+ * 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 

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

2019-04-26 Thread Konstantin Belousov
On Fri, Apr 26, 2019 at 08:04:29PM +1000, Bruce Evans wrote:
> On Fri, 26 Apr 2019, Mark Johnston wrote:
> 
> > On Fri, Apr 26, 2019 at 10:38:36AM +0300, Konstantin Belousov wrote:
> >> On Fri, Apr 26, 2019 at 02:04:56AM -0400, Mark Johnston wrote:
> >>> On Thu, Apr 25, 2019 at 11:22:22AM +0300, Konstantin Belousov wrote:
>  On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:
> > Intel does not reorder reads against the condition "if" here. I know for
> > sure that ARM does, but therestill might be some other architectures 
> > that
> > also suffers such behavior - I just don't have any means to verify.
> > I remember the discussion for rS302292 where we agreed that this kind of
> > patches should be the least impacting in perfomrance as possible. Adding
> > unconditional memory barrier causes significant performance drop on 
> > Intel,
> > where in fact, the issue was never seen.
> >
>  Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
>  barrier.  If you need read/read fence on some architectures, I am sure
>  that you need compiler barrier on all.
> >>>
> >>> To add a bit, one reason to prefer atomic(9) to explicit fences is
> >>> precisely because it issues fences only when required by a given
> >>> CPU architecture.  There is no "unconditional memory barrier" added by
> >>> the diff even without the #ifdef.
> >> Well, atomic_thread_fence_acq() is the explicit fence.  And on x86 it
> >> does add unconditional compiler memory barrier.
> >
> > I only mean that with atomic_thread_fence_acq() on x86, the CPU does not
> > see any fences.
> >
> > Based on the original commit it seems that a compiler barrier is
> > required on all platforms, at a minimum.
> 
> buf_ring.h has some volatile variables which might give sufficient barriers.
> But no one knows what volatile does, so reasoning about it is even harder
> than reasoning about ordering from atomic ops.  I think the volatiles give
> program order for the volatile variables only (plus ordering of other 
> variables
> from dependencies on the volatile variables), while the compiler barrier
> gives program order for all variables.

No, volatile does not give any ordering. For gcc-like compilers,
documentation implies that the volatile accesses are guarenteed to
occur, i.e. they cannot be optimized out. We use volatiles to implement
relaxed atomics in atomic(9) API.

For Java, volatile reads have acquire semantic, and volatile writes are
releases.
___
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: r346593 - head/sys/sys

2019-04-26 Thread Bruce Evans

On Fri, 26 Apr 2019, Mark Johnston wrote:


On Fri, Apr 26, 2019 at 10:38:36AM +0300, Konstantin Belousov wrote:

On Fri, Apr 26, 2019 at 02:04:56AM -0400, Mark Johnston wrote:

On Thu, Apr 25, 2019 at 11:22:22AM +0300, Konstantin Belousov wrote:

On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:

Intel does not reorder reads against the condition "if" here. I know for
sure that ARM does, but therestill might be some other architectures that
also suffers such behavior - I just don't have any means to verify.
I remember the discussion for rS302292 where we agreed that this kind of
patches should be the least impacting in perfomrance as possible. Adding
unconditional memory barrier causes significant performance drop on Intel,
where in fact, the issue was never seen.


Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
barrier.  If you need read/read fence on some architectures, I am sure
that you need compiler barrier on all.


To add a bit, one reason to prefer atomic(9) to explicit fences is
precisely because it issues fences only when required by a given
CPU architecture.  There is no "unconditional memory barrier" added by
the diff even without the #ifdef.

Well, atomic_thread_fence_acq() is the explicit fence.  And on x86 it
does add unconditional compiler memory barrier.


I only mean that with atomic_thread_fence_acq() on x86, the CPU does not
see any fences.

Based on the original commit it seems that a compiler barrier is
required on all platforms, at a minimum.


buf_ring.h has some volatile variables which might give sufficient barriers.
But no one knows what volatile does, so reasoning about it is even harder
than reasoning about ordering from atomic ops.  I think the volatiles give
program order for the volatile variables only (plus ordering of other variables
from dependencies on the volatile variables), while the compiler barrier
gives program order for all variables.

Bruce
___
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: r346593 - head/sys/sys

2019-04-26 Thread Mark Johnston
On Fri, Apr 26, 2019 at 10:38:36AM +0300, Konstantin Belousov wrote:
> On Fri, Apr 26, 2019 at 02:04:56AM -0400, Mark Johnston wrote:
> > On Thu, Apr 25, 2019 at 11:22:22AM +0300, Konstantin Belousov wrote:
> > > On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:
> > > > Intel does not reorder reads against the condition "if" here. I know for
> > > > sure that ARM does, but therestill might be some other architectures 
> > > > that
> > > > also suffers such behavior - I just don't have any means to verify.
> > > > I remember the discussion for rS302292 where we agreed that this kind of
> > > > patches should be the least impacting in perfomrance as possible. Adding
> > > > unconditional memory barrier causes significant performance drop on 
> > > > Intel,
> > > > where in fact, the issue was never seen.
> > > > 
> > > Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
> > > barrier.  If you need read/read fence on some architectures, I am sure
> > > that you need compiler barrier on all.
> > 
> > To add a bit, one reason to prefer atomic(9) to explicit fences is
> > precisely because it issues fences only when required by a given
> > CPU architecture.  There is no "unconditional memory barrier" added by
> > the diff even without the #ifdef.
> Well, atomic_thread_fence_acq() is the explicit fence.  And on x86 it
> does add unconditional compiler memory barrier.

I only mean that with atomic_thread_fence_acq() on x86, the CPU does not
see any fences.

Based on the original commit it seems that a compiler barrier is
required on all platforms, at a minimum.
___
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: r346593 - head/sys/sys

2019-04-26 Thread Konstantin Belousov
On Fri, Apr 26, 2019 at 02:04:56AM -0400, Mark Johnston wrote:
> On Thu, Apr 25, 2019 at 11:22:22AM +0300, Konstantin Belousov wrote:
> > On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:
> > > Intel does not reorder reads against the condition "if" here. I know for
> > > sure that ARM does, but therestill might be some other architectures that
> > > also suffers such behavior - I just don't have any means to verify.
> > > I remember the discussion for rS302292 where we agreed that this kind of
> > > patches should be the least impacting in perfomrance as possible. Adding
> > > unconditional memory barrier causes significant performance drop on Intel,
> > > where in fact, the issue was never seen.
> > > 
> > Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
> > barrier.  If you need read/read fence on some architectures, I am sure
> > that you need compiler barrier on all.
> 
> To add a bit, one reason to prefer atomic(9) to explicit fences is
> precisely because it issues fences only when required by a given
> CPU architecture.  There is no "unconditional memory barrier" added by
> the diff even without the #ifdef.
Well, atomic_thread_fence_acq() is the explicit fence.  And on x86 it
does add unconditional compiler memory barrier.
___
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: r346593 - head/sys/sys

2019-04-26 Thread Mark Johnston
On Thu, Apr 25, 2019 at 11:22:22AM +0300, Konstantin Belousov wrote:
> On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:
> > Intel does not reorder reads against the condition "if" here. I know for
> > sure that ARM does, but therestill might be some other architectures that
> > also suffers such behavior - I just don't have any means to verify.
> > I remember the discussion for rS302292 where we agreed that this kind of
> > patches should be the least impacting in perfomrance as possible. Adding
> > unconditional memory barrier causes significant performance drop on Intel,
> > where in fact, the issue was never seen.
> > 
> Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
> barrier.  If you need read/read fence on some architectures, I am sure
> that you need compiler barrier on all.

To add a bit, one reason to prefer atomic(9) to explicit fences is
precisely because it issues fences only when required by a given
CPU architecture.  There is no "unconditional memory barrier" added by
the diff even without the #ifdef.
___
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"