svn commit: r332162 - stable/11/tools/build/options

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Sat Apr  7 02:56:59 2018
New Revision: 332162
URL: https://svnweb.freebsd.org/changeset/base/332162

Log:
  MFC r330116, r330118, r330251, r330254
  
  r330116:
  Some missing LOADER_EFI build option descriptions
  
  r330118:
  Add missing punctuation to *_LOADER_EFI descriptions...
  
  r330251:
  Remove LOADER_EFI description files
  
  LOADER_EFI functionality got folded into EFI as of r330248.
  
  r330254:
  Add descriptions for recently added loader options

Added:
  stable/11/tools/build/options/WITHOUT_LOADER_OFW
 - copied unchanged from r330254, 
head/tools/build/options/WITHOUT_LOADER_OFW
  stable/11/tools/build/options/WITHOUT_LOADER_UBOOT
 - copied unchanged from r330254, 
head/tools/build/options/WITHOUT_LOADER_UBOOT
  stable/11/tools/build/options/WITH_LOADER_OFW
 - copied unchanged from r330254, head/tools/build/options/WITH_LOADER_OFW
  stable/11/tools/build/options/WITH_LOADER_UBOOT
 - copied unchanged from r330254, head/tools/build/options/WITH_LOADER_UBOOT
Modified:
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/tools/build/options/WITHOUT_LOADER_OFW (from r330254, 
head/tools/build/options/WITHOUT_LOADER_OFW)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/tools/build/options/WITHOUT_LOADER_OFWSat Apr  7 02:56:59 
2018(r332162, copy of r330254, 
head/tools/build/options/WITHOUT_LOADER_OFW)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Disable building of openfirmware bootloader components.

Copied: stable/11/tools/build/options/WITHOUT_LOADER_UBOOT (from r330254, 
head/tools/build/options/WITHOUT_LOADER_UBOOT)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/tools/build/options/WITHOUT_LOADER_UBOOT  Sat Apr  7 02:56:59 
2018(r332162, copy of r330254, 
head/tools/build/options/WITHOUT_LOADER_UBOOT)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Disable building of ubldr.

Copied: stable/11/tools/build/options/WITH_LOADER_OFW (from r330254, 
head/tools/build/options/WITH_LOADER_OFW)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/tools/build/options/WITH_LOADER_OFW   Sat Apr  7 02:56:59 
2018(r332162, copy of r330254, head/tools/build/options/WITH_LOADER_OFW)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build openfirmware bootloader components.

Copied: stable/11/tools/build/options/WITH_LOADER_UBOOT (from r330254, 
head/tools/build/options/WITH_LOADER_UBOOT)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/tools/build/options/WITH_LOADER_UBOOT Sat Apr  7 02:56:59 
2018(r332162, copy of r330254, 
head/tools/build/options/WITH_LOADER_UBOOT)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build ubldr.
___
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: r332163 - stable/11/share/man/man5

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Sat Apr  7 03:02:07 2018
New Revision: 332163
URL: https://svnweb.freebsd.org/changeset/base/332163

Log:
  Regenerate src.conf(5) after r332162
  
  This is a direct commit to stable/11

Modified:
  stable/11/share/man/man5/src.conf.5

Modified: stable/11/share/man/man5/src.conf.5
==
--- stable/11/share/man/man5/src.conf.5 Sat Apr  7 02:56:59 2018
(r332162)
+++ stable/11/share/man/man5/src.conf.5 Sat Apr  7 03:02:07 2018
(r332163)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd March 23, 2018
+.Dd April 6, 2018
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -431,18 +431,12 @@ Set to not build CUSE-related programs and libraries.
 .It Va WITHOUT_CXGBETOOL
 Set to not build
 .Xr cxgbetool 8
-.It Va WITHOUT_MLX5TOOL
-Set to not build
-.Xr mlx5tool 8
 .Pp
 This is a default setting on
 arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32 and powerpc/powerpc.
 .It Va WITH_CXGBETOOL
 Set to build
 .Xr cxgbetool 8
-.It Va WITH_MLX5TOOL
-Set to build
-.Xr mlx5tool 8
 .Pp
 This is a default setting on
 amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc64 and 
sparc64/sparc64.
@@ -608,7 +602,7 @@ and
 .Xr efivar 8 .
 .Pp
 This is a default setting on
-mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, 
powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
+mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, 
powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
 .It Va WITH_EFI
 Set to build
 .Xr efivar 3
@@ -616,7 +610,7 @@ and
 .Xr efivar 8 .
 .Pp
 This is a default setting on
-amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and 
pc98/i386.
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386.
 .It Va WITH_EISA
 Set to build EISA kernel modules.
 .It Va WITHOUT_ELFCOPY_AS_OBJCOPY
@@ -1003,6 +997,29 @@ Enable firewire support in /boot/loader and /boot/zfsl
 This option is a nop on all other platforms.
 .It Va WITHOUT_LOADER_GELI
 Disable inclusion of GELI crypto support in the boot chain binaries.
+.Pp
+This is a default setting on
+arm/arm, arm/armeb, arm/armv6, arm64/aarch64, mips/mipsel, mips/mips, 
mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 
and sparc64/sparc64.
+.It Va WITHOUT_LOADER_OFW
+Disable building of openfirmware bootloader components.
+.Pp
+This is a default setting on
+amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, 
mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32 and pc98/i386.
+.It Va WITH_LOADER_OFW
+Set to build openfirmware bootloader components.
+.Pp
+This is a default setting on
+powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
+.It Va WITHOUT_LOADER_UBOOT
+Disable building of ubldr.
+.Pp
+This is a default setting on
+amd64/amd64, arm64/aarch64, i386/i386, pc98/i386 and sparc64/sparc64.
+.It Va WITH_LOADER_UBOOT
+Set to build ubldr.
+.Pp
+This is a default setting on
+arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITHOUT_LOCALES
 Set to not build localization files; see
 .Xr locale 1 .
@@ -1138,6 +1155,18 @@ This must be set in the environment, make command line
 .Pa /etc/src-env.conf ,
 not
 .Pa /etc/src.conf .
+.It Va WITHOUT_MLX5TOOL
+Set to not build
+.Xr mlx5tool 8
+.Pp
+This is a default setting on
+arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, 
mips/mips64, mips/mipsn32 and powerpc/powerpc.
+.It Va WITH_MLX5TOOL
+Set to build
+.Xr mlx5tool 8
+.Pp
+This is a default setting on
+amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc64 and 
sparc64/sparc64.
 .It Va WITH_NAND
 Set to build the NAND Flash components.
 .It Va WITHOUT_NDIS
___
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: r332161 - stable/11/sys/dev/sbni

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Sat Apr  7 00:23:49 2018
New Revision: 332161
URL: https://svnweb.freebsd.org/changeset/base/332161

Log:
  MFC r331651-r331653
  
  r331651:
  Copy flags over ifr_union directly rather than via casts through
  ifr_data.
  
  No functional change in practice.  If the sbni driver supported
  64-bit big-endian system, this would be an ABI changes, but it is
  i386-only.  The old version leaked a word of stack on 64-bit systems.
  
  This eliminates the only assignment to ifr_data.
  
  r331652:
  Revert r331651 to recommit with proper commit metadata.
  
  r331653:
  Copy flags over ifr_union directly rather than via casts through
  ifr_data.
  
  No functional change in practice.  If the sbni driver supported
  64-bit big-endian system, this would be an ABI changes, but it is
  i386-only.  The old version leaked a word of stack on 64-bit systems.
  
  This eliminates the only assignment to ifr_data.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14874

Modified:
  stable/11/sys/dev/sbni/if_sbni.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/sbni/if_sbni.c
==
--- stable/11/sys/dev/sbni/if_sbni.cSat Apr  7 00:04:28 2018
(r332160)
+++ stable/11/sys/dev/sbni/if_sbni.cSat Apr  7 00:23:49 2018
(r332161)
@@ -1144,7 +1144,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t 
flags.fixed_rxl = (sc->delta_rxl == 0);
flags.fixed_rate = 1;
SBNI_UNLOCK(sc);
-   ifr->ifr_data = *(caddr_t*) 
+   bcopy(, >ifr_ifru, sizeof(flags));
break;
 
case SIOCGINSTATS:
@@ -1163,7 +1163,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t 
error = priv_check(td, PRIV_DRIVER);
if (error)
break;
-   flags = *(struct sbni_flags*)>ifr_data;
+   bcopy(>ifr_ifru, , sizeof(flags));
SBNI_LOCK(sc);
if (flags.fixed_rxl) {
sc->delta_rxl = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332160 - in stable/10/sys: net ofed/drivers/infiniband/ulp/ipoib

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Sat Apr  7 00:04:28 2018
New Revision: 332160
URL: https://svnweb.freebsd.org/changeset/base/332160

Log:
  MFC r331648:
  
  Improve copy-and-pasted versions of SIOCGIFADDR.
  
  The original implementation used a reference to ifr_data and a cast to
  do the equivalent of accessing ifr_addr. This was copied multiple
  times since 1996.
  
  Approved by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14873

Modified:
  stable/10/sys/net/if_arcsubr.c
  stable/10/sys/net/if_ethersubr.c
  stable/10/sys/net/if_fddisubr.c
  stable/10/sys/net/if_fwsubr.c
  stable/10/sys/net/if_iso88025subr.c
  stable/10/sys/net/if_vlan.c
  stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_arcsubr.c
==
--- stable/10/sys/net/if_arcsubr.c  Fri Apr  6 23:31:47 2018
(r332159)
+++ stable/10/sys/net/if_arcsubr.c  Sat Apr  7 00:04:28 2018
(r332160)
@@ -715,12 +715,7 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t d
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) >ifr_data;
-   *(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp);
-   }
+   ifr->ifr_addr.sa_data[0] = ARC_LLADDR(ifp);
break;
 
case SIOCADDMULTI:

Modified: stable/10/sys/net/if_ethersubr.c
==
--- stable/10/sys/net/if_ethersubr.cFri Apr  6 23:31:47 2018
(r332159)
+++ stable/10/sys/net/if_ethersubr.cSat Apr  7 00:04:28 2018
(r332160)
@@ -1109,13 +1109,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy(IF_LLADDR(ifp),
- (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
-   }
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   ETHER_ADDR_LEN);
break;
 
case SIOCSIFMTU:

Modified: stable/10/sys/net/if_fddisubr.c
==
--- stable/10/sys/net/if_fddisubr.c Fri Apr  6 23:31:47 2018
(r332159)
+++ stable/10/sys/net/if_fddisubr.c Sat Apr  7 00:04:28 2018
(r332160)
@@ -669,14 +669,9 @@ fddi_ioctl (ifp, command, data)
break;
}
break;
-   case SIOCGIFADDR: {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy(IF_LLADDR(ifp),
- (caddr_t) sa->sa_data, FDDI_ADDR_LEN);
-
-   }
+   case SIOCGIFADDR:
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   FDDI_ADDR_LEN);
break;
case SIOCSIFMTU:
/*

Modified: stable/10/sys/net/if_fwsubr.c
==
--- stable/10/sys/net/if_fwsubr.c   Fri Apr  6 23:31:47 2018
(r332159)
+++ stable/10/sys/net/if_fwsubr.c   Sat Apr  7 00:04:28 2018
(r332160)
@@ -656,13 +656,8 @@ firewire_ioctl(struct ifnet *ifp, u_long command, cadd
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy((ifp)->fc_hwaddr,
-   (caddr_t) sa->sa_data, sizeof(struct fw_hwaddr));
-   }
+   bcopy((ifp)->fc_hwaddr, >ifr_addr.sa_data[0],
+   sizeof(struct fw_hwaddr));
break;
 
case SIOCSIFMTU:

Modified: stable/10/sys/net/if_iso88025subr.c
==
--- stable/10/sys/net/if_iso88025subr.c Fri Apr  6 23:31:47 2018
(r332159)
+++ stable/10/sys/net/if_iso88025subr.c Sat Apr  7 00:04:28 2018
(r332160)
@@ -200,13 +200,9 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, cadd
 }
 break;
 
-case SIOCGIFADDR: {
-struct sockaddr *sa;
-
-sa = (struct sockaddr *) & ifr->ifr_data;
-bcopy(IF_LLADDR(ifp),
-  (caddr_t) sa->sa_data, ISO88025_ADDR_LEN);
-}
+case SIOCGIFADDR:
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   ISO88025_ADDR_LEN);
 break;
 
 case SIOCSIFMTU:

Modified: 

svn commit: r332159 - in stable/11/sys: net ofed/drivers/infiniband/ulp/ipoib

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 23:31:47 2018
New Revision: 332159
URL: https://svnweb.freebsd.org/changeset/base/332159

Log:
  MFC r331648:
  
  Improve copy-and-pasted versions of SIOCGIFADDR.
  
  The original implementation used a reference to ifr_data and a cast to
  do the equivalent of accessing ifr_addr. This was copied multiple
  times since 1996.
  
  Approved by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14873

Modified:
  stable/11/sys/net/if_arcsubr.c
  stable/11/sys/net/if_ethersubr.c
  stable/11/sys/net/if_fddisubr.c
  stable/11/sys/net/if_fwsubr.c
  stable/11/sys/net/if_iso88025subr.c
  stable/11/sys/net/if_vlan.c
  stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/net/if_arcsubr.c
==
--- stable/11/sys/net/if_arcsubr.c  Fri Apr  6 23:25:54 2018
(r332158)
+++ stable/11/sys/net/if_arcsubr.c  Fri Apr  6 23:31:47 2018
(r332159)
@@ -679,12 +679,7 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t d
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) >ifr_data;
-   *(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp);
-   }
+   ifr->ifr_addr.sa_data[0] = ARC_LLADDR(ifp);
break;
 
case SIOCADDMULTI:

Modified: stable/11/sys/net/if_ethersubr.c
==
--- stable/11/sys/net/if_ethersubr.cFri Apr  6 23:25:54 2018
(r332158)
+++ stable/11/sys/net/if_ethersubr.cFri Apr  6 23:31:47 2018
(r332159)
@@ -1084,13 +1084,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy(IF_LLADDR(ifp),
- (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
-   }
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   ETHER_ADDR_LEN);
break;
 
case SIOCSIFMTU:

Modified: stable/11/sys/net/if_fddisubr.c
==
--- stable/11/sys/net/if_fddisubr.c Fri Apr  6 23:25:54 2018
(r332158)
+++ stable/11/sys/net/if_fddisubr.c Fri Apr  6 23:31:47 2018
(r332159)
@@ -556,14 +556,9 @@ fddi_ioctl (ifp, command, data)
break;
}
break;
-   case SIOCGIFADDR: {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy(IF_LLADDR(ifp),
- (caddr_t) sa->sa_data, FDDI_ADDR_LEN);
-
-   }
+   case SIOCGIFADDR:
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   FDDI_ADDR_LEN);
break;
case SIOCSIFMTU:
/*

Modified: stable/11/sys/net/if_fwsubr.c
==
--- stable/11/sys/net/if_fwsubr.c   Fri Apr  6 23:25:54 2018
(r332158)
+++ stable/11/sys/net/if_fwsubr.c   Fri Apr  6 23:31:47 2018
(r332159)
@@ -660,13 +660,8 @@ firewire_ioctl(struct ifnet *ifp, u_long command, cadd
break;
 
case SIOCGIFADDR:
-   {
-   struct sockaddr *sa;
-
-   sa = (struct sockaddr *) & ifr->ifr_data;
-   bcopy((ifp)->fc_hwaddr,
-   (caddr_t) sa->sa_data, sizeof(struct fw_hwaddr));
-   }
+   bcopy((ifp)->fc_hwaddr, >ifr_addr.sa_data[0],
+   sizeof(struct fw_hwaddr));
break;
 
case SIOCSIFMTU:

Modified: stable/11/sys/net/if_iso88025subr.c
==
--- stable/11/sys/net/if_iso88025subr.c Fri Apr  6 23:25:54 2018
(r332158)
+++ stable/11/sys/net/if_iso88025subr.c Fri Apr  6 23:31:47 2018
(r332159)
@@ -171,13 +171,9 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, cadd
 }
 break;
 
-case SIOCGIFADDR: {
-struct sockaddr *sa;
-
-sa = (struct sockaddr *) & ifr->ifr_data;
-bcopy(IF_LLADDR(ifp),
-  (caddr_t) sa->sa_data, ISO88025_ADDR_LEN);
-}
+case SIOCGIFADDR:
+   bcopy(IF_LLADDR(ifp), >ifr_addr.sa_data[0],
+   ISO88025_ADDR_LEN);
 break;
 
 case SIOCSIFMTU:

Modified: 

svn commit: r332158 - head/sys/net

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 23:25:54 2018
New Revision: 332158
URL: https://svnweb.freebsd.org/changeset/base/332158

Log:
  Remove the thread argument from ifr_buffer_*() accessors.
  
  They are always used in a context where curthread is the correct thread.
  This makes them more similar to the ifr_data_get_ptr() accessor.

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Fri Apr  6 22:03:43 2018(r332157)
+++ head/sys/net/if.c   Fri Apr  6 23:25:54 2018(r332158)
@@ -2403,13 +2403,13 @@ ifunit(const char *name)
 }
 
 static void *
-ifr_buffer_get_buffer(struct thread *td, void *data)
+ifr_buffer_get_buffer(void *data)
 {
union ifreq_union *ifrup;
 
ifrup = data;
 #ifdef COMPAT_FREEBSD32
-   if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
+   if (SV_CURPROC_FLAG(SV_ILP32))
return ((void *)(uintptr_t)
ifrup->ifr32.ifr_ifru.ifru_buffer.buffer);
 #endif
@@ -2417,13 +2417,13 @@ ifr_buffer_get_buffer(struct thread *td, void *data)
 }
 
 static void
-ifr_buffer_set_buffer_null(struct thread *td, void *data)
+ifr_buffer_set_buffer_null(void *data)
 {
union ifreq_union *ifrup;
 
ifrup = data;
 #ifdef COMPAT_FREEBSD32
-   if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
+   if (SV_CURPROC_FLAG(SV_ILP32))
ifrup->ifr32.ifr_ifru.ifru_buffer.buffer = 0;
else
 #endif
@@ -2431,26 +2431,26 @@ ifr_buffer_set_buffer_null(struct thread *td, void *da
 }
 
 static size_t
-ifr_buffer_get_length(struct thread *td, void *data)
+ifr_buffer_get_length(void *data)
 {
union ifreq_union *ifrup;
 
ifrup = data;
 #ifdef COMPAT_FREEBSD32
-   if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
+   if (SV_CURPROC_FLAG(SV_ILP32))
return (ifrup->ifr32.ifr_ifru.ifru_buffer.length);
 #endif
return (ifrup->ifr.ifr_ifru.ifru_buffer.length);
 }
 
 static void
-ifr_buffer_set_length(struct thread *td, void *data, size_t len)
+ifr_buffer_set_length(void *data, size_t len)
 {
union ifreq_union *ifrup;
 
ifrup = data;
 #ifdef COMPAT_FREEBSD32
-   if (SV_PROC_FLAG(td->td_proc, SV_ILP32))
+   if (SV_CURPROC_FLAG(SV_ILP32))
ifrup->ifr32.ifr_ifru.ifru_buffer.length = len;
else
 #endif
@@ -2531,12 +2531,12 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data,
else {
/* space for terminating nul */
descrlen = strlen(ifp->if_description) + 1;
-   if (ifr_buffer_get_length(td, ifr) < descrlen)
-   ifr_buffer_set_buffer_null(td, ifr);
+   if (ifr_buffer_get_length(ifr) < descrlen)
+   ifr_buffer_set_buffer_null(ifr);
else
error = copyout(ifp->if_description,
-   ifr_buffer_get_buffer(td, ifr), descrlen);
-   ifr_buffer_set_length(td, ifr, descrlen);
+   ifr_buffer_get_buffer(ifr), descrlen);
+   ifr_buffer_set_length(ifr, descrlen);
}
sx_sunlock(_sx);
break;
@@ -2552,15 +2552,15 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data,
 * length parameter is supposed to count the
 * terminating nul in.
 */
-   if (ifr_buffer_get_length(td, ifr) > ifdescr_maxlen)
+   if (ifr_buffer_get_length(ifr) > ifdescr_maxlen)
return (ENAMETOOLONG);
-   else if (ifr_buffer_get_length(td, ifr) == 0)
+   else if (ifr_buffer_get_length(ifr) == 0)
descrbuf = NULL;
else {
-   descrbuf = malloc(ifr_buffer_get_length(td, ifr),
+   descrbuf = malloc(ifr_buffer_get_length(ifr),
M_IFDESCR, M_WAITOK | M_ZERO);
-   error = copyin(ifr_buffer_get_buffer(td, ifr), descrbuf,
-   ifr_buffer_get_length(td, ifr) - 1);
+   error = copyin(ifr_buffer_get_buffer(ifr), descrbuf,
+   ifr_buffer_get_length(ifr) - 1);
if (error) {
free(descrbuf, M_IFDESCR);
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"


Re: svn commit: r332133 - head/sys/conf

2018-04-06 Thread John Baldwin
On Friday, April 06, 2018 07:11:22 PM Brooks Davis wrote:
> Author: brooks
> Date: Fri Apr  6 19:11:22 2018
> New Revision: 332133
> URL: https://svnweb.freebsd.org/changeset/base/332133
> 
> Log:
>   Add an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
>   platforms without COMPAT_LINUX32.

I wonder if it wouldn't be cleaner to just move COMPAT_LINUX32 itself to
sys/conf/options?

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


svn commit: r332157 - in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel

2018-04-06 Thread John Baldwin
Author: jhb
Date: Fri Apr  6 22:03:43 2018
New Revision: 332157
URL: https://svnweb.freebsd.org/changeset/base/332157

Log:
  Add a way to temporarily suspend and resume virtual CPUs.
  
  This is used as part of implementing run control in bhyve's debug
  server.  The hypervisor now maintains a set of "debugged" CPUs.
  Attempting to run a debugged CPU will fail to execute any guest
  instructions and will instead report a VM_EXITCODE_DEBUG exit to
  the userland hypervisor.  Virtual CPUs are placed into the debugged
  state via vm_suspend_cpu() (implemented via a new VM_SUSPEND_CPU ioctl).
  Virtual CPUs can be resumed via vm_resume_cpu() (VM_RESUME_CPU ioctl).
  
  The debug server suspends virtual CPUs when it wishes them to stop
  executing in the guest (for example, when a debugger attaches to the
  server).  The debug server can choose to resume only a subset of CPUs
  (for example, when single stepping) or it can choose to resume all
  CPUs.  The debug server must explicitly mark a CPU as resumed via
  vm_resume_cpu() before the virtual CPU will successfully execute any
  guest instructions.
  
  Reviewed by:  avg, grehan
  Tested on:Intel (jhb), AMD (avg)
  Differential Revision:https://reviews.freebsd.org/D14466

Modified:
  head/lib/libvmmapi/vmmapi.c
  head/lib/libvmmapi/vmmapi.h
  head/sys/amd64/include/vmm.h
  head/sys/amd64/include/vmm_dev.h
  head/sys/amd64/vmm/amd/svm.c
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_dev.c

Modified: head/lib/libvmmapi/vmmapi.c
==
--- head/lib/libvmmapi/vmmapi.c Fri Apr  6 21:50:09 2018(r332156)
+++ head/lib/libvmmapi/vmmapi.c Fri Apr  6 22:03:43 2018(r332157)
@@ -1374,6 +1374,13 @@ vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus)
 }
 
 int
+vm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus)
+{
+
+   return (vm_get_cpus(ctx, VM_DEBUG_CPUS, cpus));
+}
+
+int
 vm_activate_cpu(struct vmctx *ctx, int vcpu)
 {
struct vm_activate_cpu ac;
@@ -1386,6 +1393,30 @@ vm_activate_cpu(struct vmctx *ctx, int vcpu)
 }
 
 int
+vm_suspend_cpu(struct vmctx *ctx, int vcpu)
+{
+   struct vm_activate_cpu ac;
+   int error;
+
+   bzero(, sizeof(struct vm_activate_cpu));
+   ac.vcpuid = vcpu;
+   error = ioctl(ctx->fd, VM_SUSPEND_CPU, );
+   return (error);
+}
+
+int
+vm_resume_cpu(struct vmctx *ctx, int vcpu)
+{
+   struct vm_activate_cpu ac;
+   int error;
+
+   bzero(, sizeof(struct vm_activate_cpu));
+   ac.vcpuid = vcpu;
+   error = ioctl(ctx->fd, VM_RESUME_CPU, );
+   return (error);
+}
+
+int
 vm_get_intinfo(struct vmctx *ctx, int vcpu, uint64_t *info1, uint64_t *info2)
 {
struct vm_intinfo vmii;
@@ -1501,7 +1532,8 @@ vm_get_ioctls(size_t *len)
VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE,
VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA,
VM_GLA2GPA_NOFAULT,
-   VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SET_INTINFO, VM_GET_INTINFO,
+   VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU,
+   VM_SET_INTINFO, VM_GET_INTINFO,
VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME,
VM_RESTART_INSTRUCTION };
 

Modified: head/lib/libvmmapi/vmmapi.h
==
--- head/lib/libvmmapi/vmmapi.h Fri Apr  6 21:50:09 2018(r332156)
+++ head/lib/libvmmapi/vmmapi.h Fri Apr  6 22:03:43 2018(r332157)
@@ -216,7 +216,10 @@ intvcpu_reset(struct vmctx *ctx, int vcpu);
 
 intvm_active_cpus(struct vmctx *ctx, cpuset_t *cpus);
 intvm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus);
+intvm_debug_cpus(struct vmctx *ctx, cpuset_t *cpus);
 intvm_activate_cpu(struct vmctx *ctx, int vcpu);
+intvm_suspend_cpu(struct vmctx *ctx, int vcpu);
+intvm_resume_cpu(struct vmctx *ctx, int vcpu);
 
 /*
  * FreeBSD specific APIs

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hFri Apr  6 21:50:09 2018
(r332156)
+++ head/sys/amd64/include/vmm.hFri Apr  6 22:03:43 2018
(r332157)
@@ -231,8 +231,11 @@ int vm_get_x2apic_state(struct vm *vm, int vcpu, enum 
 int vm_set_x2apic_state(struct vm *vm, int vcpu, enum x2apic_state state);
 int vm_apicid2vcpuid(struct vm *vm, int apicid);
 int vm_activate_cpu(struct vm *vm, int vcpu);
+int vm_suspend_cpu(struct vm *vm, int vcpu);
+int vm_resume_cpu(struct vm *vm, int vcpu);
 struct vm_exit *vm_exitinfo(struct vm *vm, int vcpuid);
 void vm_exit_suspended(struct vm *vm, int vcpuid, uint64_t rip);
+void vm_exit_debug(struct vm *vm, int vcpuid, uint64_t rip);
 void vm_exit_rendezvous(struct vm *vm, int vcpuid, uint64_t rip);
 void vm_exit_astpending(struct vm *vm, int vcpuid, uint64_t rip);
 void vm_exit_reqidle(struct vm *vm, int vcpuid, 

svn commit: r332156 - in stable/11: stand/efi/boot1 stand/efi/include stand/efi/libefi stand/i386/libfirewire sys/dev/firewire

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 21:50:09 2018
New Revision: 332156
URL: https://svnweb.freebsd.org/changeset/base/332156

Log:
  MFC r330970, r331067, r331767, r331852, r331858
  
  r330970:
  libefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE
  
  Drop UEFI_BOOT_VAR_GUID and use EFI_GLOBAL_VARIABLE.
  
  r331067:
  Only print boot order / boot current if we can get the variables from
  the loader. Some UEFI implementations don't return all of them.
  
  Sponsored by: Netflix
  
  r331767:
  efinet: Do not return only if ReceiveFilter fails
  
  If the network interface or the uefi implementation do not support the
  ReceiveFilter interface do not return only and just print a message.
  U-Boot doesn't support is and likely never will. Also even if this fails
  it doesn't mean that network in EFI isn't supported.
  
  r331852:
  fwohcireg.h is 99% the same between the boot loader and the
  kernel. Delete it and fix up the 1% difference because there's no need
  for them to be different.
  
  r331858:
  The Uninorth ID was really for Uninorth 2.

Deleted:
  stable/11/stand/i386/libfirewire/fwohcireg.h
Modified:
  stable/11/stand/efi/boot1/boot1.c
  stable/11/stand/efi/include/efi.h
  stable/11/stand/efi/libefi/efienv.c
  stable/11/stand/efi/libefi/efinet.c
  stable/11/stand/i386/libfirewire/firewire.c
  stable/11/stand/i386/libfirewire/fwohci.c
  stable/11/stand/i386/libfirewire/fwohci.h
  stable/11/sys/dev/firewire/fwohci_pci.c
  stable/11/sys/dev/firewire/fwohcireg.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/boot1/boot1.c
==
--- stable/11/stand/efi/boot1/boot1.c   Fri Apr  6 21:40:23 2018
(r332155)
+++ stable/11/stand/efi/boot1/boot1.c   Fri Apr  6 21:50:09 2018
(r332156)
@@ -467,16 +467,18 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
 
boot_current = 0;
sz = sizeof(boot_current);
-   efi_global_getenv("BootCurrent", _current, );
-   printf("   BootCurrent: %04x\n", boot_current);
+   if (efi_global_getenv("BootCurrent", _current, ) == 
EFI_SUCCESS) {
+   printf("   BootCurrent: %04x\n", boot_current);
 
-   sz = sizeof(boot_order);
-   efi_global_getenv("BootOrder", _order, );
-   printf("   BootOrder:");
-   for (i = 0; i < sz / sizeof(boot_order[0]); i++)
-   printf(" %04x%s", boot_order[i],
-   boot_order[i] == boot_current ? "[*]" : "");
-   printf("\n");
+   sz = sizeof(boot_order);
+   if (efi_global_getenv("BootOrder", _order, ) == 
EFI_SUCCESS) {
+   printf("   BootOrder:");
+   for (i = 0; i < sz / sizeof(boot_order[0]); i++)
+   printf(" %04x%s", boot_order[i],
+   boot_order[i] == boot_current ? "[*]" : "");
+   printf("\n");
+   }
+   }
 
 #ifdef TEST_FAILURE
/*

Modified: stable/11/stand/efi/include/efi.h
==
--- stable/11/stand/efi/include/efi.h   Fri Apr  6 21:40:23 2018
(r332155)
+++ stable/11/stand/efi/include/efi.h   Fri Apr  6 21:50:09 2018
(r332156)
@@ -59,7 +59,5 @@ Revision History
  */
 #define FREEBSD_BOOT_VAR_GUID \
{ 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 
0xAE, 0x99} }
-#define UEFI_BOOT_VAR_GUID \
-   { 0x8be4df61, 0x93ca, 0x11d2, {0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 
0x2b, 0x8c} }
 
 #endif

Modified: stable/11/stand/efi/libefi/efienv.c
==
--- stable/11/stand/efi/libefi/efienv.c Fri Apr  6 21:40:23 2018
(r332155)
+++ stable/11/stand/efi/libefi/efienv.c Fri Apr  6 21:50:09 2018
(r332156)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID;
-static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID;
+static EFI_GUID GlobalBootVarGUID = EFI_GLOBAL_VARIABLE;
 
 EFI_STATUS
 efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *len)

Modified: stable/11/stand/efi/libefi/efinet.c
==
--- stable/11/stand/efi/libefi/efinet.c Fri Apr  6 21:40:23 2018
(r332155)
+++ stable/11/stand/efi/libefi/efinet.c Fri Apr  6 21:50:09 2018
(r332156)
@@ -225,11 +225,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint)
EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST;
 
status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL);
-   if (status != EFI_SUCCESS) {
+   if (status != EFI_SUCCESS)
printf("net%d: cannot set rx. filters (status=%lu)\n",
nif->nif_unit, EFI_ERROR_CODE(status));
-   return;
-   }
 
 #ifdef EFINET_DEBUG
dump_mode(net->Mode);


svn commit: r332155 - stable/11/stand/common

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 21:40:23 2018
New Revision: 332155
URL: https://svnweb.freebsd.org/changeset/base/332155

Log:
  MFC r331331: Apply r228478 (CTASSERT => _Static_assert()) to bootstrap.h

Modified:
  stable/11/stand/common/bootstrap.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/bootstrap.h
==
--- stable/11/stand/common/bootstrap.h  Fri Apr  6 21:37:25 2018
(r332154)
+++ stable/11/stand/common/bootstrap.h  Fri Apr  6 21:40:23 2018
(r332155)
@@ -330,10 +330,8 @@ void   dev_cleanup(void);
 
 time_t time(time_t *tloc);
 
-#ifndef CTASSERT/* Allow lint to override */
-#define CTASSERT(x) _CTASSERT(x, __LINE__)
-#define _CTASSERT(x, y) __CTASSERT(x, y)
-#define __CTASSERT(x, y)typedef char __assert ## y[(x) ? 1 : -1]
+#ifndef CTASSERT
+#defineCTASSERT(x) _Static_assert(x, "compile-time assertion 
failed")
 #endif
 
 #endif /* !_BOOTSTRAP_H_ */
___
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: r332154 - in stable/11/stand: common efi/boot1 efi/include efi/libefi efi/loader efi/loader/arch/arm ficl/aarch64 ficl/amd64 ficl/arm ficl/i386 ficl/mips ficl/mips64 ficl/powerpc ficl/r...

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 21:37:25 2018
New Revision: 332154
URL: https://svnweb.freebsd.org/changeset/base/332154

Log:
  MFC r330806-r330815, r330837, r330864, r330883
  
  pc98 changes associated with the named commits are also included in this
  commit, despite not having been made with the original commits due to its
  removal in head.
  
  r330806:
  Minor cosmetic changes.
  
  Make sure { on the same line as struct for all struct *devdesc.  Move
  some type definitions to next to the dv_type define, since that's what
  sets the d_type.
  
  r330807:
  We can't use d_opendata for blkio storage.
  
  open_disk uses d_opendata for it's own purpse. We can't store blkio
  there. Fortunately, blkio is stored elsewhere and we never actually
  retrieve blkio from d_opendata. Eliminate it as a source of confusion.
  Eliminate all stores of d_opendata in efi since this layer doesn't own
  that field.
  
  r330808:
  Make struct libi386_devdesc match the struct devdesc better
  
  Move data to top and call it d_opendata.
  
  r330809:
  Use the actual struct devdesc at the start of all *_devdesc structs
  
  The current system is fragile and requires very careful layout of all
  *_devdesc structures. It also makes it hard to change the base
  devdesc. Take a page from CAM and put the 'header' in all the derived
  classes and adjust the code to match.
  
  For OFW, move the iHandle h_handle out of a slot conflicting with
  d_opendata. Due to quirks in the alignment rules, this worked.
  However changing the code to use d_opendata storage now that it's a
  pointer is hard, so just have a separate field for it.
  
  All other cleanups were to make the *_devdesc structures match where
  they'd taken some liberties that were none-the-less compatible enough
  to work.
  
  r330810:
  Remove d_type from devdesc. It's not needed as we can fetch it from
  d_dev->dv_type when we need it.
  
  r330811:
  GC unused routines.
  
  Sponsored by: Netflix
  
  r330812:
  Use the one-line-per-file pattern here, and sort the file names.
  
  Sponsored by: Netflix
  
  r330813:
  Move the env convenience routines out of boot1.c.
  
  These routines are more generally useful. Even though boot1 is on its
  way out, it's better to make these common during the transition than
  copy them.
  
  r330814:
  Star BootCurrent entry when booting.
  
  Sponsored by: Netflix
  
  r330815:
  Print the load and device path as well as BootCurrent and BootOrder
  
  Sponsored by: Netflix
  
  r330837:
  biosdisk.c should not set d_opendata.
  
  Same as 330807, d_opendata is owned by open_disk and we should not
  set it.
  
  Mstand/i386/libi386/biosdisk.c
  
  r330864:
  Prefer uintXX_t to u_intXX_t
  
  A foolish consistency is the hobgoblin of little minds, adored by
  little statesmen and philosophers and divines. With consistency a
  great soul has simply nothing to do. -- Ralph Waldo Emerson
  
  r330883:
  Fix typo that misteriously passes compilation.

Added:
  stable/11/stand/efi/libefi/efienv.c
 - copied unchanged from r330815, head/stand/efi/libefi/efienv.c
Modified:
  stable/11/stand/common/bootstrap.h
  stable/11/stand/common/disk.c
  stable/11/stand/common/disk.h
  stable/11/stand/common/isapnp.c
  stable/11/stand/common/load_elf.c
  stable/11/stand/common/load_elf_obj.c
  stable/11/stand/common/metadata.c
  stable/11/stand/common/misc.c
  stable/11/stand/common/pnp.c
  stable/11/stand/efi/boot1/boot1.c
  stable/11/stand/efi/boot1/ufs_module.c
  stable/11/stand/efi/include/efilib.h
  stable/11/stand/efi/libefi/Makefile
  stable/11/stand/efi/libefi/devicename.c
  stable/11/stand/efi/libefi/efipart.c
  stable/11/stand/efi/libefi/efizfs.c
  stable/11/stand/efi/libefi/env.c
  stable/11/stand/efi/loader/arch/arm/exec.c
  stable/11/stand/efi/loader/main.c
  stable/11/stand/ficl/aarch64/sysdep.c
  stable/11/stand/ficl/amd64/sysdep.c
  stable/11/stand/ficl/arm/sysdep.c
  stable/11/stand/ficl/i386/sysdep.c
  stable/11/stand/ficl/mips/sysdep.c
  stable/11/stand/ficl/mips64/sysdep.c
  stable/11/stand/ficl/powerpc/sysdep.c
  stable/11/stand/ficl/riscv/sysdep.c
  stable/11/stand/ficl/sparc64/sysdep.c
  stable/11/stand/i386/btx/lib/btxv86.h
  stable/11/stand/i386/libi386/biosacpi.c
  stable/11/stand/i386/libi386/bioscd.c
  stable/11/stand/i386/libi386/biosdisk.c
  stable/11/stand/i386/libi386/biospnp.c
  stable/11/stand/i386/libi386/bootinfo32.c
  stable/11/stand/i386/libi386/bootinfo64.c
  stable/11/stand/i386/libi386/devicename.c
  stable/11/stand/i386/libi386/elf64_freebsd.c
  stable/11/stand/i386/libi386/libi386.h
  stable/11/stand/i386/libi386/multiboot.c
  stable/11/stand/i386/libi386/pxe.c
  stable/11/stand/i386/loader/chain.c
  stable/11/stand/i386/loader/main.c
  stable/11/stand/libsa/arp.c
  stable/11/stand/libsa/bootp.c
  stable/11/stand/libsa/bootparam.c
  stable/11/stand/libsa/dosfs.h
  stable/11/stand/libsa/ext2fs.c
  stable/11/stand/libsa/net.h
  stable/11/stand/libsa/rpc.c
  stable/11/stand/libsa/stand.h
  

Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/

2018-04-06 Thread Dimitry Andric
On 6 Apr 2018, at 21:00, Oliver Pinter  wrote:
> 
> On 4/6/18, John Baldwin  wrote:
>> On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote:
>>> On 31 March 2018 at 14:41, Mark Linimon  wrote:
>>> This is the most important point of this discussion: we do need to
>>> ensure there's good communication and coordination between teams where
>>> dependencies like this exist. I'll take the blame here: Dimitry asked
>>> me about merging the Clang update to stable/11 and I agreed that it
>>> was reasonable to merge sooner rather than later to have as much lead
>>> time as possible before the 11.2 process starts. I also assumed that
>>> outstanding Clang 6 issues in ports were farther along in being
>>> addressed.
>>> 
>>> The key lesson from this discussion is that for significant commits
>>> and merges like this one we should make sure to always have sufficient
>>> advance notice.
>> 
>> Is this driven by -mretpoline?
> 
> Don't think so since it requires LLD as linker.

You can use lld on 11, but it isn't the default.


> The LLVM 5 which was already
> part of the 11-stable has the retpoline option. See r331219.

Indeed, r331219 contains backports (from upstream) for llvm, clang *and*
lld.  If you want to make use of -mretpoline, you should also pass
-fuse-ld=lld on the command line.


> From other side, I like to see a newer compiler sets in the recent
> releases, because
> there are lot of performance improvements and other fixes.

That is certainly the case, the flip side is that there are always some
new bugs, regressions and newly added warnings.  Having the default C++
dialect bumped is really an anomaly, this won't happen every upstream
release. :)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r332153 - stable/11/share/mk

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 20:56:06 2018
New Revision: 332153
URL: https://svnweb.freebsd.org/changeset/base/332153

Log:
  stable/11: Mark EFI as a broken option on pc98
  
  This is a direct commit to stable/11, due to pc98 removal in head.

Modified:
  stable/11/share/mk/src.opts.mk

Modified: stable/11/share/mk/src.opts.mk
==
--- stable/11/share/mk/src.opts.mk  Fri Apr  6 20:27:55 2018
(r332152)
+++ stable/11/share/mk/src.opts.mk  Fri Apr  6 20:56:06 2018
(r332153)
@@ -278,8 +278,9 @@ BROKEN_OPTIONS+=LLDB
 .if ${__T} != "armv6"
 BROKEN_OPTIONS+=LIBSOFT
 .endif
-# EFI doesn't exist on mips, powerpc, sparc or riscv.
-.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*}
+# EFI doesn't exist on mips, pc98, powerpc, sparc or riscv.
+.if ${__T:Mmips*} || ${__TT:Mpc98*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || \
+${__T:Mriscv*}
 BROKEN_OPTIONS+=EFI
 .endif
 # GELI isn't supported on !x86
___
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: r332152 - in stable/11/stand: ofw/common ofw/libofw powerpc/ofw

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 20:27:55 2018
New Revision: 332152
URL: https://svnweb.freebsd.org/changeset/base/332152

Log:
  MFC r330365, r330371: OFW changes
  
  r330365:
  Move "common" Open Firmware parts of the loader used only on PowerPC to
  the powerpc/ subdirectory. These have never used by SPARC and we have
  no other (and almost certainly will have no other) Open Firmware platforms.
  This makes the directory structure simpler and lets us avoid some
  cargo-cult MI patterns on code that is, and always was,
  architecture-specific.
  
  r330371:
  Where we can, pass the kernel an FDT facsimile of the OF device tree rather
  than a pointer to Open Firmware by default. This eliminates a number of
  potentially unsafe calls to firmware from the kernel and provides better
  performance.
  
  This feature is meant to be expanded until it is on by default
  unconditionally and, ideally, we can then garbage-collect the
  nightmare pile of hacks required to call into Open Firmware from a live
  kernel.

Added:
  stable/11/stand/powerpc/ofw/elf_freebsd.c
 - copied unchanged from r330365, head/stand/powerpc/ofw/elf_freebsd.c
  stable/11/stand/powerpc/ofw/main.c
 - copied, changed from r330365, head/stand/powerpc/ofw/main.c
  stable/11/stand/powerpc/ofw/ppc64_elf_freebsd.c
 - copied unchanged from r330365, head/stand/powerpc/ofw/ppc64_elf_freebsd.c
Deleted:
  stable/11/stand/ofw/common/
  stable/11/stand/ofw/libofw/elf_freebsd.c
  stable/11/stand/ofw/libofw/ppc64_elf_freebsd.c
Modified:
  stable/11/stand/ofw/libofw/Makefile
  stable/11/stand/ofw/libofw/libofw.h
  stable/11/stand/powerpc/ofw/Makefile
  stable/11/stand/powerpc/ofw/conf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/ofw/libofw/Makefile
==
--- stable/11/stand/ofw/libofw/Makefile Fri Apr  6 20:26:56 2018
(r332151)
+++ stable/11/stand/ofw/libofw/Makefile Fri Apr  6 20:27:55 2018
(r332152)
@@ -4,7 +4,7 @@
 
 LIB=   ofw
 
-SRCS=  devicename.c elf_freebsd.c ofw_console.c ofw_copy.c ofw_disk.c \
+SRCS=  devicename.c ofw_console.c ofw_copy.c ofw_disk.c \
ofw_memory.c ofw_module.c ofw_net.c ofw_reboot.c \
ofw_time.c openfirm.c
 .PATH: ${ZFSSRC}
@@ -12,10 +12,6 @@ SRCS+=  devicename_stubs.c
 
 # Pick up the bootstrap header for some interface items
 CFLAGS+=   -I${LDRSRC}
-
-.if ${MACHINE_CPUARCH} == "powerpc"
-SRCS+= ppc64_elf_freebsd.c
-.endif
 
 .ifdef(BOOT_DISK_DEBUG)
 # Make the disk code more talkative

Modified: stable/11/stand/ofw/libofw/libofw.h
==
--- stable/11/stand/ofw/libofw/libofw.h Fri Apr  6 20:26:56 2018
(r332151)
+++ stable/11/stand/ofw/libofw/libofw.h Fri Apr  6 20:27:55 2018
(r332152)
@@ -62,17 +62,9 @@ void ofw_memmap(int);
 struct preloaded_file;
 struct file_format;
 
-intofw_elf_loadfile(char *, vm_offset_t, struct preloaded_file **);
-intofw_elf_exec(struct preloaded_file *);
-
 /* MD code implementing MI interfaces */
 vm_offset_t md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
 vm_offset_t md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
-
-extern struct file_format  ofw_elf;
-#ifdef __powerpc__
-extern struct file_format  ofw_elf64;
-#endif
 
 extern voidreboot(void);
 

Modified: stable/11/stand/powerpc/ofw/Makefile
==
--- stable/11/stand/powerpc/ofw/MakefileFri Apr  6 20:26:56 2018
(r332151)
+++ stable/11/stand/powerpc/ofw/MakefileFri Apr  6 20:27:55 2018
(r332152)
@@ -17,7 +17,7 @@ NEWVERSWHAT=  "Open Firmware loader" ${MACHINE_ARCH}
 INSTALLFLAGS=  -b
 
 # Architecture-specific loader code
-SRCS=  conf.c vers.c start.c
+SRCS=  conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c
 SRCS+= ucmpdi2.c
 
 .include   "${BOOTSRC}/fdt.mk"
@@ -37,10 +37,6 @@ RELOC?=  0x1C0
 CFLAGS+=   -DRELOC=${RELOC}
 
 LDFLAGS=   -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
-
-# Pull in common loader code
-.PATH: ${BOOTSRC}/ofw/common
-.include   "${BOOTSRC}/ofw/common/Makefile.inc"
 
 # Open Firmware standalone support library
 LIBOFW=${BOOTOBJ}/ofw/libofw/libofw.a

Modified: stable/11/stand/powerpc/ofw/conf.c
==
--- stable/11/stand/powerpc/ofw/conf.c  Fri Apr  6 20:26:56 2018
(r332151)
+++ stable/11/stand/powerpc/ofw/conf.c  Fri Apr  6 20:27:55 2018
(r332152)
@@ -97,6 +97,9 @@ struct netif_driver *netif_drivers[] = {
  * rather than reading the file go first.
  */
 
+struct file_format ofw_elf;
+struct file_format ofw_elf64;
+
 struct file_format *file_formats[] = {
 _elf,
 _elf64,

Copied: stable/11/stand/powerpc/ofw/elf_freebsd.c 

svn commit: r332151 - head/sys/net

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 20:26:56 2018
New Revision: 332151
URL: https://svnweb.freebsd.org/changeset/base/332151

Log:
  ifconf(): correct handling of sockaddrs smaller than struct sockaddr.
  
  Portable programs that use SIOCGIFCONF (e.g. traceroute) assume
  that each pseudo ifreq is of length MAX(sizeof(struct ifreq),
  sizeof(ifr_name) + ifr_addr.sa_len).  For short sockaddrs we copied
  too much from the source sockaddr resulting in a heap leak.
  
  I believe only one such sockaddr exists (struct sockaddr_sco which
  is 8 bytes) and it is unclear if such sockaddrs end up on interfaces
  in practice.  If it did, the result would be an 8 byte heap leak on
  current architectures.
  
  admbugs:  869
  Reviewed by:  kib
  Obtained from:CheriBSD
  MFC after:3 days
  Security: kernel heap leak
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14981

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Fri Apr  6 20:24:50 2018(r332150)
+++ head/sys/net/if.c   Fri Apr  6 20:26:56 2018(r332151)
@@ -3191,7 +3191,13 @@ again:
continue;
addrs++;
if (sa->sa_len <= sizeof(*sa)) {
-   ifr.ifr_addr = *sa;
+   if (sa->sa_len < sizeof(*sa)) {
+   memset(_ifru.ifru_addr, 0,
+   sizeof(ifr.ifr_ifru.ifru_addr));
+   memcpy(_ifru.ifru_addr, sa,
+   sa->sa_len);
+   } else
+   ifr.ifr_ifru.ifru_addr = *sa;
sbuf_bcat(sb, , sizeof(ifr));
max_len += sizeof(ifr);
} 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: r332150 - in stable/11/stand: . common mips/beri/loader powerpc/kboot powerpc/ofw sparc64/loader uboot/common uboot/lib

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 20:24:50 2018
New Revision: 332150
URL: https://svnweb.freebsd.org/changeset/base/332150

Log:
  MFC r329190, r329315, r330131: metadata load file unification
  
  r329190: Unify metadata load files for arm, mips, powerpc, sparc64
  
  Summary:
  All metadata.c files are very similar, with only trivial changes. Unify them
  into a single common file, with minor special-casing where needed.
  
  r329315: stand: Fix ubldr after r329190
  
  metadata load files were consolidated in r329190, and these relocation fixup
  bits were inadvertently dropped in the process. Re-add them to fix boot with
  ubldr.
  
  r330131: Fix module loading on arm after the metadata.c unification in
  r329190. Arm modules need an additional address fixup not needed by other
  platforms.

Added:
  stable/11/stand/common/metadata.c
 - copied, changed from r329190, head/stand/common/metadata.c
Deleted:
  stable/11/stand/mips/beri/loader/metadata.c
  stable/11/stand/powerpc/kboot/metadata.c
  stable/11/stand/powerpc/ofw/metadata.c
  stable/11/stand/sparc64/loader/metadata.c
  stable/11/stand/uboot/common/metadata.c
Modified:
  stable/11/stand/loader.mk
  stable/11/stand/mips/beri/loader/Makefile
  stable/11/stand/mips/beri/loader/exec.c
  stable/11/stand/mips/beri/loader/loader.h
  stable/11/stand/powerpc/kboot/Makefile
  stable/11/stand/powerpc/kboot/main.c
  stable/11/stand/powerpc/ofw/Makefile
  stable/11/stand/sparc64/loader/Makefile
  stable/11/stand/uboot.mk
  stable/11/stand/uboot/lib/elf_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Copied and modified: stable/11/stand/common/metadata.c (from r329190, 
head/stand/common/metadata.c)
==
--- head/stand/common/metadata.cTue Feb 13 03:44:50 2018
(r329190, copy source)
+++ stable/11/stand/common/metadata.c   Fri Apr  6 20:24:50 2018
(r332150)
@@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef __arm__
+#include 
+#endif
 #include 
 
 #include "bootstrap.h"
@@ -262,6 +265,7 @@ md_copymodules(vm_offset_t addr, int kern64)
 struct preloaded_file  *fp;
 struct file_metadata   *md;
 uint64_t   scratch64;
+uint32_t   scratch32;
 intc;
 
 c = addr != 0;
@@ -278,7 +282,11 @@ md_copymodules(vm_offset_t addr, int kern64)
scratch64 = fp->f_size;
MOD_SIZE(addr, scratch64, c);
} else {
-   MOD_ADDR(addr, fp->f_addr, c);
+   scratch32 = fp->f_addr;
+#ifdef __arm__
+   scratch32 -= __elfN(relocation_offset);
+#endif
+   MOD_ADDR(addr, scratch32, c);
MOD_SIZE(addr, fp->f_size, c);
}
for (md = fp->f_metadata; md != NULL; md = md->md_next) {
@@ -315,7 +323,23 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs
 uint64_t   scratch64;
 char   *rootdevname;
 inthowto;
+#ifdef __arm__
+vm_offset_tvaddr;
+inti;
 
+   /*
+* These metadata addreses must be converted for kernel after
+* relocation.
+*/
+uint32_t   mdt[] = {
+   MODINFOMD_SSYM, MODINFOMD_ESYM, MODINFOMD_KERNEND,
+   MODINFOMD_ENVP,
+#if defined(LOADER_FDT_SUPPORT)
+   MODINFOMD_DTBP
+#endif
+};
+#endif
+
 align = kern64 ? 8 : 4;
 howto = md_getboothowto(args);
 
@@ -409,6 +433,23 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_offs
 } else {
bcopy(, md->md_data, sizeof kernend);
 }
+
+#ifdef __arm__
+/* Convert addresses to the final VA */
+*modulep -= __elfN(relocation_offset);
+
+/* Do relocation fixup on metadata of each module. */
+for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
+for (i = 0; i < nitems(mdt); i++) {
+md = file_findmetadata(xp, mdt[i]);
+if (md) {
+bcopy(md->md_data, , sizeof vaddr);
+vaddr -= __elfN(relocation_offset);
+bcopy(, md->md_data, sizeof vaddr);
+}
+}
+}
+#endif
 
 (void)md_copymodules(addr, kern64);
 #if defined(LOADER_FDT_SUPPORT)

Modified: stable/11/stand/loader.mk
==
--- stable/11/stand/loader.mk   Fri Apr  6 19:59:27 2018(r332149)
+++ stable/11/stand/loader.mk   Fri Apr  6 20:24:50 2018(r332150)
@@ -22,12 +22,16 @@ SRCS+=  load_elf32.c reloc_elf32.c
 .elif ${MACHINE_CPUARCH} == "powerpc"
 SRCS+= load_elf32.c reloc_elf32.c
 SRCS+= load_elf64.c reloc_elf64.c
+SRCS+= metadata.c
 .elif ${MACHINE_CPUARCH} == "sparc64"
 SRCS+= load_elf64.c reloc_elf64.c
+SRCS+= metadata.c
 .elif ${MACHINE_ARCH:Mmips64*} != ""
 SRCS+= 

svn commit: r332149 - in stable/11/stand/mips/beri: boot2 common loader

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:59:27 2018
New Revision: 332149
URL: https://svnweb.freebsd.org/changeset/base/332149

Log:
  MFC r330788: beri loader: Replace getc/putc with beri_ prefixed versions
  
  This matches a convention that we use, at least in ubldr, to prefix
  getc/putc with a loader-specific prefix to avoid collisions. This was
  encountered while trying to build the beri loader with MK_LOADER_LUA=yes.

Modified:
  stable/11/stand/mips/beri/boot2/boot2.c
  stable/11/stand/mips/beri/common/altera_jtag_uart.c
  stable/11/stand/mips/beri/common/cons.h
  stable/11/stand/mips/beri/loader/beri_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/mips/beri/boot2/boot2.c
==
--- stable/11/stand/mips/beri/boot2/boot2.c Fri Apr  6 19:54:10 2018
(r332148)
+++ stable/11/stand/mips/beri/boot2/boot2.c Fri Apr  6 19:59:27 2018
(r332149)
@@ -627,7 +627,7 @@ static int
 xputc(int c)
 {
 if (ioctrl & IO_KEYBOARD)
-   putc(c);
+   beri_putc(c);
 #if 0
 if (ioctrl & IO_SERIAL)
sio_putc(c);
@@ -642,7 +642,7 @@ xgetc(int fn)
return 0;
 for (;;) {
if (ioctrl & IO_KEYBOARD && keyhit(0))
-   return fn ? 1 : getc();
+   return fn ? 1 : beri_getc();
 #if 0
if (ioctrl & IO_SERIAL && sio_ischar())
return fn ? 1 : sio_getc();

Modified: stable/11/stand/mips/beri/common/altera_jtag_uart.c
==
--- stable/11/stand/mips/beri/common/altera_jtag_uart.c Fri Apr  6 19:54:10 
2018(r332148)
+++ stable/11/stand/mips/beri/common/altera_jtag_uart.c Fri Apr  6 19:59:27 
2018(r332149)
@@ -159,7 +159,7 @@ keyhit(int seconds)
 }
 
 int
-getc(void)
+beri_getc(void)
 {
 
while (!(uart_readable()));
@@ -168,7 +168,7 @@ getc(void)
 }
 
 void
-putc(int ch)
+beri_putc(int ch)
 {
 
uart_data_write(ch);

Modified: stable/11/stand/mips/beri/common/cons.h
==
--- stable/11/stand/mips/beri/common/cons.h Fri Apr  6 19:54:10 2018
(r332148)
+++ stable/11/stand/mips/beri/common/cons.h Fri Apr  6 19:59:27 2018
(r332149)
@@ -33,8 +33,8 @@
 #ifndef _CONS_H_
 #define_CONS_H_
 
-intgetc(void);
+intberi_getc(void);
 intkeyhit(int);
-void   putc(int);
+void   beri_putc(int);
 
 #endif

Modified: stable/11/stand/mips/beri/loader/beri_console.c
==
--- stable/11/stand/mips/beri/loader/beri_console.c Fri Apr  6 19:54:10 
2018(r332148)
+++ stable/11/stand/mips/beri/loader/beri_console.c Fri Apr  6 19:59:27 
2018(r332149)
@@ -72,14 +72,14 @@ static void
 c_out(int c)
 {
 
-   putc(c);
+   beri_putc(c);
 }
 
 static int
 c_in(void)
 {
 
-   return (getc());
+   return (beri_getc());
 }
 
 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: r332148 - in stable/11/stand: efi i386 powerpc sparc64 uboot

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:54:10 2018
New Revision: 332148
URL: https://svnweb.freebsd.org/changeset/base/332148

Log:
  MFC r330249-r330250
  
  r330249:
  stand: Makefile SUBDIR cleanup
  
  Use SUBDIR.${MK_*} where appropriate. r330248 eliminated most of the
  offenders, sweep the rest under the rug.
  
  Differential Revision:https://reviews.freebsd.org/D14545
  
  r330250:
  stand: Fix build after r330249
  
  One does not simply convert to SUBDIR.yes in stand without making everything
  else in the affected files SUBDIR.yes -- there are better ways to do this.

Modified:
  stable/11/stand/efi/Makefile
  stable/11/stand/i386/Makefile
  stable/11/stand/powerpc/Makefile
  stable/11/stand/sparc64/Makefile
  stable/11/stand/uboot/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/Makefile
==
--- stable/11/stand/efi/MakefileFri Apr  6 19:52:00 2018
(r332147)
+++ stable/11/stand/efi/MakefileFri Apr  6 19:54:10 2018
(r332148)
@@ -8,11 +8,8 @@ NO_OBJ=t
 # than 4.5 supports it.
 .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
 
-.if ${MK_FDT} != "no"
-SUBDIR+=   fdt
-.endif
-
-SUBDIR+=   libefi loader boot1
+SUBDIR.${MK_FDT}+= fdt
+SUBDIR.yes+=   libefi loader boot1
 
 .endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
 

Modified: stable/11/stand/i386/Makefile
==
--- stable/11/stand/i386/Makefile   Fri Apr  6 19:52:00 2018
(r332147)
+++ stable/11/stand/i386/Makefile   Fri Apr  6 19:54:10 2018
(r332148)
@@ -4,24 +4,20 @@ NO_OBJ=t
 
 .include 
 
-SUBDIR=mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
+SUBDIR.yes=mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot \
libi386
 
-.if ${MK_LOADER_FIREWIRE} == "yes"
-SUBDIR+=   libfirewire
-.endif
+SUBDIR.${MK_LOADER_FIREWIRE}+= libfirewire
 
-SUBDIR+=   loader
+SUBDIR.yes+=   loader
 
 # special boot programs, 'self-extracting boot2+loader'
-SUBDIR+=   pxeldr
+SUBDIR.yes+=   pxeldr
 
 .if ${MACHINE_CPUARCH} == "i386"
-SUBDIR+=   kgzldr
+SUBDIR.yes+=   kgzldr
 .endif
 
-.if ${MK_ZFS} != "no"
-SUBDIR+=   zfsboot gptzfsboot zfsloader
-.endif
+SUBDIR.${MK_ZFS}+= zfsboot gptzfsboot zfsloader
 
 .include 

Modified: stable/11/stand/powerpc/Makefile
==
--- stable/11/stand/powerpc/MakefileFri Apr  6 19:52:00 2018
(r332147)
+++ stable/11/stand/powerpc/MakefileFri Apr  6 19:54:10 2018
(r332148)
@@ -4,9 +4,7 @@ NO_OBJ=t
 
 .include 
 
-SUBDIR=boot1.chrp ofw uboot
-.if ${MK_FDT} == "yes"
-SUBDIR+=   kboot
-.endif
+SUBDIR.yes=boot1.chrp ofw uboot
+SUBDIR.${MK_FDT}+= kboot
 
 .include 

Modified: stable/11/stand/sparc64/Makefile
==
--- stable/11/stand/sparc64/MakefileFri Apr  6 19:52:00 2018
(r332147)
+++ stable/11/stand/sparc64/MakefileFri Apr  6 19:54:10 2018
(r332148)
@@ -4,9 +4,7 @@ NO_OBJ=t
 
 .include 
 
-SUBDIR=boot1 loader
-.if ${MK_ZFS} != "no"
-SUBDIR+=zfsboot zfsloader
-.endif
+SUBDIR.yes=boot1 loader
+SUBDIR.${MK_ZFS}+=zfsboot zfsloader
 
 .include 

Modified: stable/11/stand/uboot/Makefile
==
--- stable/11/stand/uboot/Makefile  Fri Apr  6 19:52:00 2018
(r332147)
+++ stable/11/stand/uboot/Makefile  Fri Apr  6 19:54:10 2018
(r332148)
@@ -2,10 +2,8 @@
 
 .include 
 
-SUBDIR=lib
+SUBDIR.yes=lib
 
-.if ${MK_FDT} != "no"
-SUBDIR+=fdt
-.endif
+SUBDIR.${MK_FDT}+=fdt
 
 .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: r332147 - stable/11/stand

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:52:00 2018
New Revision: 332147
URL: https://svnweb.freebsd.org/changeset/base/332147

Log:
  Revert lua bits that snuck in with r332144
  
  These will get re-MFC'd differently when we import lualoader from head. This
  is a direct commit to stable/11

Modified:
  stable/11/stand/Makefile

Modified: stable/11/stand/Makefile
==
--- stable/11/stand/MakefileFri Apr  6 19:49:57 2018(r332146)
+++ stable/11/stand/MakefileFri Apr  6 19:52:00 2018(r332147)
@@ -6,15 +6,13 @@
 # others we don't. LIB32LIST is a list of libraries, which if
 # included, need to be built 32-bit as well.
 .if ${MACHINE_ARCH} == "amd64"
-LIB32LIST=libsa ficl liblua zfs
+LIB32LIST=libsa ficl zfs
 .endif
 
 S.yes+=libsa
 
 S.${MK_FORTH}+=ficl
 S.${MK_FORTH}+=forth
-S.${MK_LOADER_LUA}+=   liblua
-S.${MK_LOADER_LUA}+=   lua
 S.${MK_FDT}+=  fdt
 S.${MK_LOADER_OFW}+=   ofw
 S.${MK_ZFS}+=  zfs
___
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: r332146 - head/share/mk

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:49:57 2018
New Revision: 332146
URL: https://svnweb.freebsd.org/changeset/base/332146

Log:
  Re-sort LOADER options
  
  These have become unsorted from everything else. This is desync'd from
  stable/11 due to some hand-merging that was done there, so the MFC of this
  will look slightly different.
  
  MFC after:3 days

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Fri Apr  6 19:47:44 2018(r332145)
+++ head/share/mk/src.opts.mk   Fri Apr  6 19:49:57 2018(r332146)
@@ -129,14 +129,14 @@ __DEFAULT_YES_OPTIONS = \
 LIBPTHREAD \
 LIBTHR \
 LLVM_COV \
+LOADER_GELI \
+LOADER_OFW \
+LOADER_UBOOT \
 LOCALES \
 LOCATE \
 LPR \
 LS_COLORS \
 LZMA_SUPPORT \
-LOADER_GELI \
-LOADER_OFW \
-LOADER_UBOOT \
 MAIL \
 MAILWRAPPER \
 MAKE \
___
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: r332145 - head/sys/cam/scsi

2018-04-06 Thread Alexander Motin
Author: mav
Date: Fri Apr  6 19:47:44 2018
New Revision: 332145
URL: https://svnweb.freebsd.org/changeset/base/332145

Log:
  Do not fail devices just for errors in descriptor format.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

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

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Fri Apr  6 19:47:07 2018(r332144)
+++ head/sys/cam/scsi/scsi_cd.c Fri Apr  6 19:47:44 2018(r332145)
@@ -1119,7 +1119,8 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
 * supported" (0x25) error.
 */
if ((have_sense) && (asc != 0x25)
-&& (error_code == SSD_CURRENT_ERROR)) {
+&& (error_code == SSD_CURRENT_ERROR
+ || error_code == SSD_DESC_CURRENT_ERROR)) {
const char *sense_key_desc;
const char *asc_desc;
 

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Fri Apr  6 19:47:07 2018(r332144)
+++ head/sys/cam/scsi/scsi_da.c Fri Apr  6 19:47:44 2018(r332145)
@@ -4649,7 +4649,8 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
(((csio->ccb_h.status & CAM_STATUS_MASK) ==
CAM_REQ_INVALID) ||
 ((have_sense) &&
- (error_code == SSD_CURRENT_ERROR) &&
+ (error_code == SSD_CURRENT_ERROR ||
+  error_code == SSD_DESC_CURRENT_ERROR) &&
  (sense_key == SSD_KEY_ILLEGAL_REQUEST 
{
cam_periph_lock(periph);
softc->flags &= ~DA_FLAG_CAN_RC16;
@@ -4674,7 +4675,8 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
 */
if ((have_sense)
 && (asc != 0x25) && (asc != 0x44)
-&& (error_code == SSD_CURRENT_ERROR)) {
+&& (error_code == SSD_CURRENT_ERROR
+ || error_code == SSD_DESC_CURRENT_ERROR)) {
const char *sense_key_desc;
const char *asc_desc;
 
___
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: r332144 - in stable/11: share/mk stand stand/efi

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:47:07 2018
New Revision: 332144
URL: https://svnweb.freebsd.org/changeset/base/332144

Log:
  MFC r330077, r330248
  
  r330077:
  Move EFI up to common makefile. There's no need for all these .if's
  based on architecture.
  
  Sponsored by: Netflix
  
  r330248:
  Create LOADER_UBOOT, and LOADER_OFW. Move these options out of
  Makefile.${MACHINE_ARCH} and remove the now-empty files. Generate the
  *32 directories on the necessary architectures (well, currently only
  amd64) on the fly. Remove LOADER_EFI variable and co-locate it with
  EFI.

Deleted:
  stable/11/stand/Makefile.arm
  stable/11/stand/Makefile.arm64
  stable/11/stand/Makefile.i386
  stable/11/stand/Makefile.mips
  stable/11/stand/Makefile.powerpc
  stable/11/stand/Makefile.sparc64
Modified:
  stable/11/share/mk/src.opts.mk
  stable/11/stand/Makefile
  stable/11/stand/Makefile.amd64
  stable/11/stand/efi/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/mk/src.opts.mk
==
--- stable/11/share/mk/src.opts.mk  Fri Apr  6 19:37:15 2018
(r332143)
+++ stable/11/share/mk/src.opts.mk  Fri Apr  6 19:47:07 2018
(r332144)
@@ -131,6 +131,8 @@ __DEFAULT_YES_OPTIONS = \
 LPR \
 LS_COLORS \
 LZMA_SUPPORT \
+LOADER_OFW \
+LOADER_UBOOT \
 MAIL \
 MAILWRAPPER \
 MAKE \
@@ -276,9 +278,23 @@ BROKEN_OPTIONS+=LLDB
 .if ${__T} != "armv6"
 BROKEN_OPTIONS+=LIBSOFT
 .endif
+# EFI doesn't exist on mips, powerpc, sparc or riscv.
 .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*}
 BROKEN_OPTIONS+=EFI
 .endif
+# GELI isn't supported on !x86
+.if ${__T} != "i386" && ${__T} != "amd64"
+BROKEN_OPTIONS+=LOADER_GELI
+.endif
+# OFW is only for powerpc and sparc64, exclude others
+.if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == ""
+BROKEN_OPTIONS+=LOADER_OFW
+.endif
+# UBOOT is only for arm, mips and powerpc, exclude others
+.if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == ""
+BROKEN_OPTIONS+=LOADER_UBOOT
+.endif
+
 .if ${__T:Mmips64*}
 # profiling won't work on MIPS64 because there is only assembly for o32
 BROKEN_OPTIONS+=PROFILE

Modified: stable/11/stand/Makefile
==
--- stable/11/stand/MakefileFri Apr  6 19:37:15 2018(r332143)
+++ stable/11/stand/MakefileFri Apr  6 19:47:07 2018(r332144)
@@ -2,20 +2,43 @@
 
 .include 
 
-SUBDIR+=   libsa
-.if ${MK_FORTH} != "no"
-# Build the add-in FORTH interpreter.
-SUBDIR+=   ficl
-SUBDIR+=   forth
+# For amd64 we have to build 32 and 64 bit versions of things. For
+# others we don't. LIB32LIST is a list of libraries, which if
+# included, need to be built 32-bit as well.
+.if ${MACHINE_ARCH} == "amd64"
+LIB32LIST=libsa ficl liblua zfs
 .endif
 
-SUBDIR+=   defaults
-SUBDIR+=   man
+S.yes+=libsa
 
+S.${MK_FORTH}+=ficl
+S.${MK_FORTH}+=forth
+S.${MK_LOADER_LUA}+=   liblua
+S.${MK_LOADER_LUA}+=   lua
+S.${MK_FDT}+=  fdt
+S.${MK_LOADER_OFW}+=   ofw
+S.${MK_ZFS}+=  zfs
+S.yes+=defaults
+S.yes+=man
+
+S.${MK_LOADER_GELI}+=  geli
+
 .include 
 
+S.${MK_EFI}+=  efi
+S.${MK_LOADER_UBOOT}+= uboot
+
 .if exists(${.CURDIR}/${MACHINE}/.)
-SUBDIR+=   ${MACHINE}
+S.yes+= ${MACHINE}
 .endif
+
+# Build the actual subdir list from S.yes, adding in the 32-bit
+# variant if necessary.
+.for _x in ${S.yes}
+SUBDIR+=${_x}
+.if defined(LIB32LIST) && ${LIB32LIST:M${_x}}
+SUBDIR+=${_x}32
+.endif
+.endfor
 
 .include 

Modified: stable/11/stand/Makefile.amd64
==
--- stable/11/stand/Makefile.amd64  Fri Apr  6 19:37:15 2018
(r332143)
+++ stable/11/stand/Makefile.amd64  Fri Apr  6 19:47:07 2018
(r332144)
@@ -1,18 +1,4 @@
 # $FreeBSD$
 
-SUBDIR+=   libsa32
-.if ${MK_ZFS} != "no"
-SUBDIR+=   zfs zfs32
-.endif
-.if ${MK_FORTH} != "no"
-SUBDIR+=   ficl32
-.endif
-
-SUBDIR+=   efi
-SUBDIR+=   userboot
-
-.if ${MK_LOADER_GELI} == "yes"
-SUBDIR+=   geli
-.endif
-
-SUBDIR+=   i386
+S.yes+=userboot
+S.yes+=i386

Modified: stable/11/stand/efi/Makefile
==
--- stable/11/stand/efi/MakefileFri Apr  6 19:37:15 2018
(r332143)
+++ stable/11/stand/efi/MakefileFri Apr  6 19:47:07 2018
(r332144)
@@ -8,17 +8,11 @@ NO_OBJ=t
 # than 4.5 supports it.
 .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
 
-.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm"
 .if ${MK_FDT} != "no"
 SUBDIR+=   

svn commit: r332143 - head/tests/sys/netpfil/pf/ioctl

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 19:37:15 2018
New Revision: 332143
URL: https://svnweb.freebsd.org/changeset/base/332143

Log:
  pf tests: Basic ioctl validation
  
  Basic validation tests for DIOCRADDADDRS, DIOCRDELADDRS, DIOCRSETADDRS,
  DIOCRGETADDRS, DIOCRGETASTATS, DIOCRCLRASTATS, DIOCRTSTADDRS,
  DIOCRINADEFINE, DIOCXBEGIN and DIOCXROLLBACK.
  
  MFC after:1 week

Modified:
  head/tests/sys/netpfil/pf/ioctl/validation.c

Modified: head/tests/sys/netpfil/pf/ioctl/validation.c
==
--- head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:36:35 
2018(r332142)
+++ head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:37:15 
2018(r332143)
@@ -264,6 +264,232 @@ ATF_TC_BODY(settflags, tc)
COMMON_CLEANUP();
 }
 
+ATF_TC_WITHOUT_HEAD(addaddrs);
+ATF_TC_BODY(addaddrs, tc)
+{
+   struct pfioc_table io;
+   struct pfr_addr addr;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(addr));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(addr);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRADDADDRS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 28;
+   if (ioctl(dev, DIOCRADDADDRS, ) == 0)
+   atf_tc_fail("Reuqest with size 1 << 28 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(deladdrs);
+ATF_TC_BODY(deladdrs, tc)
+{
+   struct pfioc_table io;
+   struct pfr_addr addr;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(addr));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(addr);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRDELADDRS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 28;
+   if (ioctl(dev, DIOCRDELADDRS, ) == 0)
+   atf_tc_fail("Reuqest with size 1 << 28 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(setaddrs);
+ATF_TC_BODY(setaddrs, tc)
+{
+   struct pfioc_table io;
+   struct pfr_addr addr;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(addr));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(addr);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRSETADDRS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 28;
+   if (ioctl(dev, DIOCRSETADDRS, ) == 0)
+   atf_tc_fail("Reuqest with size 1 << 28 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(getaddrs);
+ATF_TC_BODY(getaddrs, tc)
+{
+   struct pfioc_table io;
+   struct pfr_addr addr;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(addr));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(addr);
+
+   common_init_tbl(_table);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRGETADDRS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRGETADDRS, ) == 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(getastats);
+ATF_TC_BODY(getastats, tc)
+{
+   struct pfioc_table io;
+   struct pfr_astats astats;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(astats));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(astats);
+
+   common_init_tbl(_table);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRGETASTATS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRGETASTATS, ) == 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(clrastats);
+ATF_TC_BODY(clrastats, tc)
+{
+   struct pfioc_table io;
+   struct pfr_addr addr;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(addr));
+   bzero(, sizeof(io));
+   io.pfrio_flags = 0;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(addr);
+
+   common_init_tbl(_table);
+
+   /* Negative size. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRCLRASTATS, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRCLRASTATS, ) == 0)
+   

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

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 19:36:35 2018
New Revision: 332142
URL: https://svnweb.freebsd.org/changeset/base/332142

Log:
  pf: Improve ioctl validation
  
  Ensure that multiplications for memory allocations cannot overflow, and
  that we'll not try to allocate M_WAITOK for potentially overly large
  allocations.
  
  MFC after:1 week

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

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 19:34:21 2018
(r332141)
+++ head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 19:36:35 2018
(r332142)
@@ -2740,9 +2740,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
+   error = EINVAL;
+   break;
+   }
totlen = io->pfrio_size * sizeof(struct pfr_addr);
pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr),
-   M_TEMP, M_WAITOK);
+   M_TEMP, M_NOWAIT);
if (! pfras) {
error = ENOMEM;
break;
@@ -2772,9 +2777,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
+   error = EINVAL;
+   break;
+   }
totlen = io->pfrio_size * sizeof(struct pfr_addr);
pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr),
-   M_TEMP, M_WAITOK);
+   M_TEMP, M_NOWAIT);
if (! pfras) {
error = ENOMEM;
break;
@@ -2804,10 +2814,18 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 || io->pfrio_size2 < 0) {
+   error = EINVAL;
+   break;
+   }
count = max(io->pfrio_size, io->pfrio_size2);
+   if (WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) {
+   error = EINVAL;
+   break;
+   }
totlen = count * sizeof(struct pfr_addr);
pfras = mallocarray(count, sizeof(struct pfr_addr), M_TEMP,
-   M_WAITOK);
+   M_NOWAIT);
if (! pfras) {
error = ENOMEM;
break;
@@ -2838,9 +2856,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
+   error = EINVAL;
+   break;
+   }
totlen = io->pfrio_size * sizeof(struct pfr_addr);
pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr),
-   M_TEMP, M_WAITOK);
+   M_TEMP, M_NOWAIT);
if (! pfras) {
error = ENOMEM;
break;
@@ -2864,9 +2887,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_astats))) {
+   error = EINVAL;
+   break;
+   }
totlen = io->pfrio_size * sizeof(struct pfr_astats);
pfrastats = mallocarray(io->pfrio_size,
-   sizeof(struct pfr_astats), M_TEMP, M_WAITOK);
+   sizeof(struct pfr_astats), M_TEMP, M_NOWAIT);
if (! pfrastats) {
error = ENOMEM;
break;
@@ -2890,9 +2918,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+   if (io->pfrio_size < 0 ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) {
+   error = EINVAL;
+   break;
+   }
totlen = io->pfrio_size * sizeof(struct pfr_addr);
pfras = mallocarray(io->pfrio_size, sizeof(struct pfr_addr),
-   M_TEMP, M_WAITOK);
+   M_TEMP, M_NOWAIT);
if (! pfras) {
error = ENOMEM;
break;
@@ -2922,9 +2955,14 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+ 

svn commit: r332141 - stable/11/stand/libsa

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:34:21 2018
New Revision: 332141
URL: https://svnweb.freebsd.org/changeset/base/332141

Log:
  MFC r330056: libsa: replace remaining _write callbacks by null_write
  
  There are some _write callbacks left only returning EROFS, replace them
  by null_write. return EROFS from null_write().

Modified:
  stable/11/stand/libsa/cd9660.c
  stable/11/stand/libsa/nullfs.c
  stable/11/stand/libsa/tftp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/cd9660.c
==
--- stable/11/stand/libsa/cd9660.c  Fri Apr  6 19:24:04 2018
(r332140)
+++ stable/11/stand/libsa/cd9660.c  Fri Apr  6 19:34:21 2018
(r332141)
@@ -66,8 +66,6 @@ static intcd9660_open(const char *path, struct open_f
 static int cd9660_close(struct open_file *f);
 static int cd9660_read(struct open_file *f, void *buf, size_t size,
size_t *resid);
-static int cd9660_write(struct open_file *f, const void *buf, size_t size,
-   size_t *resid);
 static off_t   cd9660_seek(struct open_file *f, off_t offset, int where);
 static int cd9660_stat(struct open_file *f, struct stat *sb);
 static int cd9660_readdir(struct open_file *f, struct dirent *d);
@@ -86,7 +84,7 @@ struct fs_ops cd9660_fsops = {
cd9660_open,
cd9660_close,
cd9660_read,
-   cd9660_write,
+   null_write,
cd9660_seek,
cd9660_stat,
cd9660_readdir
@@ -554,13 +552,6 @@ again:
 
fp->f_off += isonum_711(ep->length);
return (0);
-}
-
-static int
-cd9660_write(struct open_file *f __unused, const void *buf __unused,
-size_t size __unused, size_t *resid __unused)
-{
-   return EROFS;
 }
 
 static off_t

Modified: stable/11/stand/libsa/nullfs.c
==
--- stable/11/stand/libsa/nullfs.c  Fri Apr  6 19:24:04 2018
(r332140)
+++ stable/11/stand/libsa/nullfs.c  Fri Apr  6 19:34:21 2018
(r332141)
@@ -85,7 +85,7 @@ int   null_read (struct open_file *f, void *buf, size_t 
 
 intnull_write (struct open_file *f, const void *buf, size_t size, size_t 
*resid)
 {
-   return EIO;
+   return EROFS;
 }
 
 off_t  null_seek (struct open_file *f, off_t offset, int where)

Modified: stable/11/stand/libsa/tftp.c
==
--- stable/11/stand/libsa/tftp.cFri Apr  6 19:24:04 2018
(r332140)
+++ stable/11/stand/libsa/tftp.cFri Apr  6 19:34:21 2018
(r332141)
@@ -69,8 +69,6 @@ static inttftp_open(const char *path, struct open_fil
 static int tftp_close(struct open_file *f);
 static int tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len);
 static int tftp_read(struct open_file *f, void *buf, size_t size, size_t 
*resid);
-static int tftp_write(struct open_file *f, const void *buf, size_t size,
-   size_t *resid);
 static off_t   tftp_seek(struct open_file *f, off_t offset, int where);
 static int tftp_set_blksize(struct tftp_handle *h, const char *str);
 static int tftp_stat(struct open_file *f, struct stat *sb);
@@ -80,7 +78,7 @@ struct fs_ops tftp_fsops = {
tftp_open,
tftp_close,
tftp_read,
-   tftp_write,
+   null_write,
tftp_seek,
tftp_stat,
null_readdir
@@ -572,13 +570,6 @@ tftp_close(struct open_file *f)
}
is_open = 0;
return (0);
-}
-
-static int
-tftp_write(struct open_file *f __unused, const void *start __unused,
-size_t size __unused, size_t *resid __unused /* out */)
-{
-   return (EROFS);
 }
 
 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"


Re: svn commit: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/

2018-04-06 Thread Oliver Pinter
On 4/6/18, John Baldwin  wrote:
> On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote:
>> On 31 March 2018 at 14:41, Mark Linimon  wrote:
>> This is the most important point of this discussion: we do need to
>> ensure there's good communication and coordination between teams where
>> dependencies like this exist. I'll take the blame here: Dimitry asked
>> me about merging the Clang update to stable/11 and I agreed that it
>> was reasonable to merge sooner rather than later to have as much lead
>> time as possible before the 11.2 process starts. I also assumed that
>> outstanding Clang 6 issues in ports were farther along in being
>> addressed.
>>
>> The key lesson from this discussion is that for significant commits
>> and merges like this one we should make sure to always have sufficient
>> advance notice.
>
> Is this driven by -mretpoline?

Don't think so since it requires LLD as linker. The LLVM 5 which was already
part of the 11-stable has the retpoline option. See r331219.

>From other side, I like to see a newer compiler sets in the recent
releases, because
there are lot of performance improvements and other fixes.

> That is, would we not be as aggressive
> with pushing for clang 6 in 11.2 if it weren't for that?  I kind of feel
> like we probably wouldn't and would have left it at 5 and let clang 6 be
> a FreeBSD 12 thing.  Was -mretpoline backported to clang 5 (I thought
> there was some talk of providing patches for clang 5)?
>
> --
> John Baldwin
> ___
> svn-src-stable...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11
> To unsubscribe, send any mail to
> "svn-src-stable-11-unsubscr...@freebsd.org"
>
___
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: r332140 - stable/11/stand/libsa

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:24:04 2018
New Revision: 332140
URL: https://svnweb.freebsd.org/changeset/base/332140

Log:
  MFC r330026: libsa: Move MAXWAIT from net.h to net.c
  
  It's not a setting that has any effect or use outside of the net.c context.

Modified:
  stable/11/stand/libsa/net.c
  stable/11/stand/libsa/net.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/net.c
==
--- stable/11/stand/libsa/net.c Fri Apr  6 19:22:22 2018(r332139)
+++ stable/11/stand/libsa/net.c Fri Apr  6 19:24:04 2018(r332140)
@@ -58,6 +58,20 @@ __FBSDID("$FreeBSD$");
 #include "net.h"
 
 /*
+ * Maximum wait time for sending and receiving before we give up and timeout.
+ * If set to 0, operations will eventually timeout completely, but send/recv
+ * timeouts must progress exponentially from MINTMO to MAXTMO before final
+ * timeout is hit.
+ */
+#ifndef MAXWAIT
+#define MAXWAIT 0  /* seconds */
+#endif
+
+#if MAXWAIT < 0
+#error MAXWAIT must not be a negative number
+#endif
+
+/*
  * Send a packet and wait for a reply, with exponential backoff.
  *
  * The send routine must return the actual number of bytes written,

Modified: stable/11/stand/libsa/net.h
==
--- stable/11/stand/libsa/net.h Fri Apr  6 19:22:22 2018(r332139)
+++ stable/11/stand/libsa/net.h Fri Apr  6 19:24:04 2018(r332140)
@@ -61,20 +61,6 @@ enum net_proto {
 #define MAXTMO 120 /* seconds */
 #define MINTMO 2   /* seconds */
 
-/*
- * Maximum wait time for sending and receiving before we give up and timeout.
- * If set to 0, operations will eventually timeout completely, but send/recv
- * timeouts must progress exponentially from MINTMO to MAXTMO before final
- * timeout is hit.
- */
-#ifndef MAXWAIT
-#define MAXWAIT 0  /* seconds */
-#endif
-
-#if MAXWAIT < 0
-#error MAXWAIT must not be a negative number
-#endif
-
 #define FNAME_SIZE 128
 #defineIFNAME_SIZE 16
 #define RECV_SIZE 1536 /* XXX delete this */
___
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: r332139 - head/tests/sys/netpfil/pf/ioctl

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 19:22:22 2018
New Revision: 332139
URL: https://svnweb.freebsd.org/changeset/base/332139

Log:
  pf tests: Try to provoke a memory leak
  
  There was a memory leak in the DIOCRADDTABLES ioctl() code which could
  be triggered by trying to add tables with the same name.
  Try to provoke this memory leak. It was fixed in r331225.
  
  MFC after:1 week

Modified:
  head/tests/sys/netpfil/pf/ioctl/validation.c

Modified: head/tests/sys/netpfil/pf/ioctl/validation.c
==
--- head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:21:36 
2018(r332138)
+++ head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:22:22 
2018(r332139)
@@ -66,6 +66,7 @@ ATF_TC_BODY(addtables, tc)
 {
struct pfioc_table io;
struct pfr_table tbl;
+   struct pfr_table tbls[4];
int flags;
 
COMMON_HEAD();
@@ -92,6 +93,14 @@ ATF_TC_BODY(addtables, tc)
io.pfrio_buffer = NULL;
if (ioctl(dev, DIOCRADDTABLES, ) == 0)
atf_tc_fail("Request with NULL buffer succeeded");
+
+   /* This can provoke a memory leak, see r331225. */
+   io.pfrio_size = 4;
+   for (int i = 0; i < io.pfrio_size; i++)
+   common_init_tbl([i]);
+
+   io.pfrio_buffer = 
+   ioctl(dev, DIOCRADDTABLES, );
 
COMMON_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: r332138 - in stable/11/stand: libsa userboot/userboot zfs

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:21:36 2018
New Revision: 332138
URL: https://svnweb.freebsd.org/changeset/base/332138

Log:
  MFC r329879, r329892
  
  r329879:
  libsa: Const-ify buffer argument of write(2) analog
  
  r329892:
  libsa: Change write(2)-alike prototype to match definition
  
  Broken in r329879.
  
  Apparently old GCC detects this, but modern GCC didn't.  Mea culpa.

Modified:
  stable/11/stand/libsa/cd9660.c
  stable/11/stand/libsa/nfs.c
  stable/11/stand/libsa/nullfs.c
  stable/11/stand/libsa/stand.h
  stable/11/stand/libsa/tftp.c
  stable/11/stand/libsa/ufs.c
  stable/11/stand/libsa/write.c
  stable/11/stand/userboot/userboot/host.c
  stable/11/stand/zfs/zfs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/libsa/cd9660.c
==
--- stable/11/stand/libsa/cd9660.c  Fri Apr  6 19:21:29 2018
(r332137)
+++ stable/11/stand/libsa/cd9660.c  Fri Apr  6 19:21:36 2018
(r332138)
@@ -66,7 +66,7 @@ static intcd9660_open(const char *path, struct open_f
 static int cd9660_close(struct open_file *f);
 static int cd9660_read(struct open_file *f, void *buf, size_t size,
size_t *resid);
-static int cd9660_write(struct open_file *f, void *buf, size_t size,
+static int cd9660_write(struct open_file *f, const void *buf, size_t size,
size_t *resid);
 static off_t   cd9660_seek(struct open_file *f, off_t offset, int where);
 static int cd9660_stat(struct open_file *f, struct stat *sb);
@@ -557,7 +557,8 @@ again:
 }
 
 static int
-cd9660_write(struct open_file *f __unused, void *start __unused, size_t size 
__unused, size_t *resid __unused)
+cd9660_write(struct open_file *f __unused, const void *buf __unused,
+size_t size __unused, size_t *resid __unused)
 {
return EROFS;
 }

Modified: stable/11/stand/libsa/nfs.c
==
--- stable/11/stand/libsa/nfs.c Fri Apr  6 19:21:29 2018(r332137)
+++ stable/11/stand/libsa/nfs.c Fri Apr  6 19:21:36 2018(r332138)
@@ -126,7 +126,6 @@ struct nfs_iodesc {
 intnfs_open(const char *path, struct open_file *f);
 static int nfs_close(struct open_file *f);
 static int nfs_read(struct open_file *f, void *buf, size_t size, size_t 
*resid);
-static int nfs_write(struct open_file *f, void *buf, size_t size, size_t 
*resid);
 static off_t   nfs_seek(struct open_file *f, off_t offset, int where);
 static int nfs_stat(struct open_file *f, struct stat *sb);
 static int nfs_readdir(struct open_file *f, struct dirent *d);
@@ -138,7 +137,7 @@ struct fs_ops nfs_fsops = {
nfs_open,
nfs_close,
nfs_read,
-   nfs_write,
+   null_write,
nfs_seek,
nfs_stat,
nfs_readdir
@@ -713,15 +712,6 @@ ret:
*resid = size;
 
return (0);
-}
-
-/*
- * Not implemented.
- */
-int
-nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
-{
-   return (EROFS);
 }
 
 off_t

Modified: stable/11/stand/libsa/nullfs.c
==
--- stable/11/stand/libsa/nullfs.c  Fri Apr  6 19:21:29 2018
(r332137)
+++ stable/11/stand/libsa/nullfs.c  Fri Apr  6 19:21:36 2018
(r332138)
@@ -83,7 +83,7 @@ int   null_read (struct open_file *f, void *buf, size_t 
return EIO;
 }
 
-intnull_write (struct open_file *f, void *buf, size_t size, size_t *resid)
+intnull_write (struct open_file *f, const void *buf, size_t size, size_t 
*resid)
 {
return EIO;
 }

Modified: stable/11/stand/libsa/stand.h
==
--- stable/11/stand/libsa/stand.h   Fri Apr  6 19:21:29 2018
(r332137)
+++ stable/11/stand/libsa/stand.h   Fri Apr  6 19:21:36 2018
(r332138)
@@ -105,7 +105,7 @@ struct fs_ops {
 int(*fo_close)(struct open_file *f);
 int(*fo_read)(struct open_file *f, void *buf,
   size_t size, size_t *resid);
-int(*fo_write)(struct open_file *f, void *buf,
+int(*fo_write)(struct open_file *f, const void *buf,
size_t size, size_t *resid);
 off_t  (*fo_seek)(struct open_file *f, off_t offset, int where);
 int(*fo_stat)(struct open_file *f, struct stat *sb);
@@ -289,7 +289,7 @@ extern int  open(const char *, int);
 extern int close(int);
 extern voidcloseall(void);
 extern ssize_t read(int, void *, size_t);
-extern ssize_t write(int, void *, size_t);
+extern ssize_t write(int, const void *, size_t);
 extern struct  dirent *readdirfd(int);
 
 extern voidsrandom(u_long seed);
@@ -383,7 +383,7 @@ extern void nullsys(void);
 extern int null_open(const char *path, struct 

svn commit: r332137 - head/tests/sys/netpfil/pf/ioctl

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 19:21:29 2018
New Revision: 332137
URL: https://svnweb.freebsd.org/changeset/base/332137

Log:
  pf tests: Basic ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
  
  Validate the DIOCIGETIFACES and DIOCXCOMMIT ioctls with invalid values.
  
  MFC after:1 week

Modified:
  head/tests/sys/netpfil/pf/ioctl/validation.c

Modified: head/tests/sys/netpfil/pf/ioctl/validation.c
==
--- head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:20:45 
2018(r332136)
+++ head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 19:21:29 
2018(r332137)
@@ -255,6 +255,63 @@ ATF_TC_BODY(settflags, tc)
COMMON_CLEANUP();
 }
 
+ATF_TC_WITHOUT_HEAD(igetifaces);
+ATF_TC_BODY(igetifaces, tc)
+{
+   struct pfioc_iface io;
+   struct pfi_kif kif;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(io));
+   io.pfiio_flags = 0;
+   io.pfiio_buffer = 
+   io.pfiio_esize = sizeof(kif);
+
+   /* Negative size */
+   io.pfiio_size = -1;
+   if (ioctl(dev, DIOCIGETIFACES, ) == 0)
+   atf_tc_fail("request with size -1 succeeded");
+
+   /* Overflow size */
+   io.pfiio_size = 1 << 31;
+   if (ioctl(dev, DIOCIGETIFACES, ) == 0)
+   atf_tc_fail("request with size 1 << 31 succeeded");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(commit);
+ATF_TC_BODY(commit, tc)
+{
+   struct pfioc_trans io;
+   struct pfioc_trans_e ioe;
+
+   COMMON_HEAD();
+
+   bzero(, sizeof(io));
+   io.esize = sizeof(ioe);
+   io.array = 
+
+   /* Negative size */
+   io.size = -1;
+   if (ioctl(dev, DIOCXCOMMIT, ) == 0)
+   atf_tc_fail("request with size -1 succeeded");
+
+   /* Overflow size */
+   io.size = 1 << 30;
+   if (ioctl(dev, DIOCXCOMMIT, ) == 0)
+   atf_tc_fail("request with size 1 << 30 succeeded");
+
+   /* NULL buffer */
+   io.size = 1;
+   io.array = NULL;
+   if (ioctl(dev, DIOCXCOMMIT, ) == 0)
+   atf_tc_fail("request with size -1 succeeded");
+
+   COMMON_CLEANUP();
+}
+
 ATF_TP_ADD_TCS(tp)
 {
ATF_TP_ADD_TC(tp, addtables);
@@ -263,6 +320,8 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, gettstats);
ATF_TP_ADD_TC(tp, clrtstats);
ATF_TP_ADD_TC(tp, settflags);
+   ATF_TP_ADD_TC(tp, igetifaces);
+   ATF_TP_ADD_TC(tp, commit);
 
return (atf_no_error());
 }
___
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: r332136 - head/sys/netpfil/pf

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 19:20:45 2018
New Revision: 332136
URL: https://svnweb.freebsd.org/changeset/base/332136

Log:
  pf: Improve ioctl validation for DIOCIGETIFACES and DIOCXCOMMIT
  
  These ioctls can process a number of items at a time, which puts us at
  risk of overflow in mallocarray() and of impossibly large allocations
  even if we don't overflow.
  
  There's no obvious limit to the request size for these, so we limit the
  requests to something which won't overflow. Change the memory allocation
  to M_NOWAIT so excessive requests will fail rather than stall forever.
  
  MFC after:1 week

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

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 19:17:59 2018
(r332135)
+++ head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 19:20:45 2018
(r332136)
@@ -3143,10 +3143,17 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
+
+   if (io->size < 0 ||
+   WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) {
+   error = EINVAL;
+   break;
+   }
+
totlen = sizeof(struct pfioc_trans_e) * io->size;
ioes = mallocarray(io->size, sizeof(struct pfioc_trans_e),
-   M_TEMP, M_WAITOK);
-   if (! ioes) {
+   M_TEMP, M_NOWAIT);
+   if (ioes == NULL) {
error = ENOMEM;
break;
}
@@ -3349,13 +3356,20 @@ DIOCCHANGEADDR_error:
break;
}
 
+   if (io->pfiio_size < 0 ||
+   WOULD_OVERFLOW(io->pfiio_size, sizeof(struct pfi_kif))) {
+   error = EINVAL;
+   break;
+   }
+
bufsiz = io->pfiio_size * sizeof(struct pfi_kif);
ifstore = mallocarray(io->pfiio_size, sizeof(struct pfi_kif),
-   M_TEMP, M_WAITOK);
-   if (! ifstore) {
+   M_TEMP, M_NOWAIT);
+   if (ifstore == NULL) {
error = ENOMEM;
break;
}
+
PF_RULES_RLOCK();
pfi_get_ifaces(io->pfiio_name, ifstore, >pfiio_size);
PF_RULES_RUNLOCK();
___
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: r332135 - in stable/11: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/s...

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:17:59 2018
New Revision: 332135
URL: https://svnweb.freebsd.org/changeset/base/332135

Log:
  MFC r329859,r329860: Float protection in stand
  
  r329859: Do not include float interfaces when using libsa.
  
  We don't support float in the boot loaders, so don't include
  interfaces for float or double in systems headers. In addition, take
  the unusual step of spiking double and float to prevent any more
  accidental seepage.
  
  r329860: Floaty McFloatface is funnier...

Modified:
  stable/11/contrib/compiler-rt/lib/builtins/int_types.h
  stable/11/include/time.h
  stable/11/stand/defs.mk
  stable/11/sys/arm/include/_types.h
  stable/11/sys/arm64/include/_types.h
  stable/11/sys/mips/include/_types.h
  stable/11/sys/powerpc/include/_types.h
  stable/11/sys/powerpc/include/pcb.h
  stable/11/sys/riscv/include/_types.h
  stable/11/sys/sparc64/include/_types.h
  stable/11/sys/sys/_types.h
  stable/11/sys/x86/include/_types.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/compiler-rt/lib/builtins/int_types.h
==
--- stable/11/contrib/compiler-rt/lib/builtins/int_types.h  Fri Apr  6 
19:11:58 2018(r332134)
+++ stable/11/contrib/compiler-rt/lib/builtins/int_types.h  Fri Apr  6 
19:17:59 2018(r332135)
@@ -114,6 +114,7 @@ static __inline tu_int make_tu(du_int h, du_int l) {
 
 #endif /* CRT_HAS_128BIT */
 
+#ifndef _STANDALONE
 typedef union
 {
 su_int u;
@@ -125,6 +126,7 @@ typedef union
 udwords u;
 double  f;
 } double_bits;
+#endif
 
 typedef struct
 {
@@ -137,6 +139,7 @@ typedef struct
 #endif /* _YUGA_LITTLE_ENDIAN */
 } uqwords;
 
+#ifndef _STANDALONE
 typedef union
 {
 uqwords u;
@@ -159,6 +162,7 @@ typedef struct { long double real, imaginary; } Lcompl
 
 #define COMPLEX_REAL(x) (x).real
 #define COMPLEX_IMAGINARY(x) (x).imaginary
+#endif
 #endif
 #endif /* INT_TYPES_H */
 

Modified: stable/11/include/time.h
==
--- stable/11/include/time.hFri Apr  6 19:11:58 2018(r332134)
+++ stable/11/include/time.hFri Apr  6 19:17:59 2018(r332135)
@@ -144,7 +144,9 @@ __BEGIN_DECLS
 char *asctime(const struct tm *);
 clock_t clock(void);
 char *ctime(const time_t *);
+#ifndef _STANDALONE
 double difftime(time_t, time_t);
+#endif
 /* XXX missing: getdate() */
 struct tm *gmtime(const time_t *);
 struct tm *localtime(const time_t *);

Modified: stable/11/stand/defs.mk
==
--- stable/11/stand/defs.mk Fri Apr  6 19:11:58 2018(r332134)
+++ stable/11/stand/defs.mk Fri Apr  6 19:17:59 2018(r332135)
@@ -49,6 +49,9 @@ CFLAGS+=  -I${BOOTOBJ}/libsa
 .endif
 CFLAGS+=   -I${SASRC} -D_STANDALONE
 CFLAGS+=   -I${SYSDIR}
+# Spike the floating point interfaces
+CFLAGS+=   -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface
+
 
 # GELI Support, with backward compat hooks (mostly)
 .if defined(HAVE_GELI)

Modified: stable/11/sys/arm/include/_types.h
==
--- stable/11/sys/arm/include/_types.h  Fri Apr  6 19:11:58 2018
(r332134)
+++ stable/11/sys/arm/include/_types.h  Fri Apr  6 19:17:59 2018
(r332135)
@@ -68,8 +68,10 @@ typedef  unsigned long long  __uint64_t;
  */
 typedef__uint32_t  __clock_t;  /* clock()... */
 typedef__int32_t   __critical_t;
+#ifndef _STANDALONE
 typedefdouble  __double_t;
 typedeffloat   __float_t;
+#endif
 typedef__int32_t   __intfptr_t;
 typedef__int64_t   __intmax_t;
 typedef__int32_t   __intptr_t;

Modified: stable/11/sys/arm64/include/_types.h
==
--- stable/11/sys/arm64/include/_types.hFri Apr  6 19:11:58 2018
(r332134)
+++ stable/11/sys/arm64/include/_types.hFri Apr  6 19:17:59 2018
(r332135)
@@ -56,8 +56,10 @@ typedef  unsigned long   __uint64_t;
  */
 typedef__int32_t   __clock_t;  /* clock()... */
 typedef__int64_t   __critical_t;
+#ifndef _STANDALONE
 typedefdouble  __double_t;
 typedeffloat   __float_t;
+#endif
 typedef__int64_t   __intfptr_t;
 typedef__int64_t   __intmax_t;
 typedef__int64_t   __intptr_t;

Modified: stable/11/sys/mips/include/_types.h
==
--- stable/11/sys/mips/include/_types.h Fri Apr  6 19:11:58 2018
(r332134)
+++ stable/11/sys/mips/include/_types.h Fri Apr  6 19:17:59 2018
(r332135)
@@ -73,8 +73,10 @@ typedef  unsigned long long  __uint64_t;
  * Standard type 

svn commit: r332134 - stable/11/stand/sparc64/loader

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:11:58 2018
New Revision: 332134
URL: https://svnweb.freebsd.org/changeset/base/332134

Log:
  MFC r329758: Fix compilation with LOADER_DEBUG defined after r329725.

Modified:
  stable/11/stand/sparc64/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/sparc64/loader/main.c
==
--- stable/11/stand/sparc64/loader/main.c   Fri Apr  6 19:11:22 2018
(r332133)
+++ stable/11/stand/sparc64/loader/main.c   Fri Apr  6 19:11:58 2018
(r332134)
@@ -938,7 +938,7 @@ static const char *const page_sizes[] = {
 
 static void
 pmap_print_tte_sun4u(tte_t tag, tte_t tte)
-
+{
 
printf("%s %s ",
page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK],
___
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: r332133 - head/sys/conf

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 19:11:22 2018
New Revision: 332133
URL: https://svnweb.freebsd.org/changeset/base/332133

Log:
  Add an unused _COMPAT_LINUX32 option to ensure opt_compat.h exists on
  platforms without COMPAT_LINUX32.
  
  Reported by:  kib

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Fri Apr  6 19:10:11 2018(r332132)
+++ head/sys/conf/options   Fri Apr  6 19:11:22 2018(r332133)
@@ -92,6 +92,7 @@ COMPAT_FREEBSD11  opt_global.h
 COMPAT_CLOUDABI32  opt_dontuse.h
 COMPAT_CLOUDABI64  opt_dontuse.h
 COMPAT_LINUXKPIopt_dontuse.h
+_COMPAT_LINUX32opt_compat.h# XXX: make sure opt_compat.h exists
 COMPILING_LINT opt_global.h
 CY_PCI_FASTINTR
 DEADLKRES  opt_watchdog.h
___
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: r332132 - stable/11/stand/common

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:10:11 2018
New Revision: 332132
URL: https://svnweb.freebsd.org/changeset/base/332132

Log:
  MFC r329745: load_elf.c: Use consistent indentation
  
  As noted in D14267 load_elf.c has a variety of indentation styles.  Move
  to standard 8 column hard tab indents, 4 space second level indents.
  Also includes some whitespace cleanups found by clang-format.

Modified:
  stable/11/stand/common/load_elf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/load_elf.c
==
--- stable/11/stand/common/load_elf.c   Fri Apr  6 19:01:08 2018
(r332131)
+++ stable/11/stand/common/load_elf.c   Fri Apr  6 19:10:11 2018
(r332132)
@@ -52,29 +52,31 @@ __FBSDID("$FreeBSD$");
 #endif
 
 typedef struct elf_file {
-Elf_Phdr   *ph;
-Elf_Ehdr   *ehdr;
-Elf_Sym*symtab;
-Elf_Hashelt*hashtab;
-Elf_Hasheltnbuckets;
-Elf_Hasheltnchains;
-Elf_Hashelt*buckets;
-Elf_Hashelt*chains;
-Elf_Rel*rel;
-size_t relsz;
-Elf_Rela   *rela;
-size_t relasz;
-char   *strtab;
-size_t strsz;
-intfd;
-caddr_tfirstpage;
-size_t firstlen;
-intkernel;
-u_int64_t  off;
+   Elf_Phdr*ph;
+   Elf_Ehdr*ehdr;
+   Elf_Sym *symtab;
+   Elf_Hashelt *hashtab;
+   Elf_Hashelt nbuckets;
+   Elf_Hashelt nchains;
+   Elf_Hashelt *buckets;
+   Elf_Hashelt *chains;
+   Elf_Rel *rel;
+   size_t  relsz;
+   Elf_Rela*rela;
+   size_t  relasz;
+   char*strtab;
+   size_t  strsz;
+   int fd;
+   caddr_t firstpage;
+   size_t  firstlen;
+   int kernel;
+   u_int64_t   off;
 } *elf_file_t;
 
-static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, 
u_int64_t loadaddr);
-static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, 
const char* name, Elf_Sym* sym);
+static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef,
+u_int64_t loadaddr);
+static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef,
+const char* name, Elf_Sym* sym);
 static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
 Elf_Addr p, void *val, size_t len);
 static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef,
@@ -198,11 +200,11 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef)
 {
ssize_t  bytes_read;
Elf_Ehdr*ehdr;
-   int  err;
+   int  err;
 
/*
-   * Open the image, read and validate the ELF header 
-   */
+* Open the image, read and validate the ELF header
+*/
if (filename == NULL)   /* can't handle nameless */
return (EFTYPE);
if ((ef->fd = open(filename, O_RDONLY)) == -1)
@@ -237,7 +239,8 @@ __elfN(load_elf_header)(char *filename, elf_file_t ef)
if (err)
goto error;
 
-   if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) 
{ /* Machine ? */
+   if (ehdr->e_version != EV_CURRENT || ehdr->e_machine != ELF_TARG_MACH) {
+   /* Machine ? */
err = EFTYPE;
goto error;
}
@@ -271,136 +274,144 @@ int
 __elfN(loadfile_raw)(char *filename, u_int64_t dest,
 struct preloaded_file **result, int multiboot)
 {
-struct preloaded_file  *fp, *kfp;
-struct elf_fileef;
-Elf_Ehdr   *ehdr;
-interr;
+   struct preloaded_file   *fp, *kfp;
+   struct elf_file ef;
+   Elf_Ehdr*ehdr;
+   int err;
 
-fp = NULL;
-bzero(, sizeof(struct elf_file));
-ef.fd = -1;
+   fp = NULL;
+   bzero(, sizeof(struct elf_file));
+   ef.fd = -1;
 
-err = __elfN(load_elf_header)(filename, );
-if (err != 0)
-   return (err);
+   err = __elfN(load_elf_header)(filename, );
+   if (err != 0)
+   return (err);
 
-ehdr = ef.ehdr;
+   ehdr = ef.ehdr;
 
-/*
- * Check to see what sort of module we are.
- */
-kfp = file_findfile(NULL, __elfN(kerneltype));
+   /*
+* Check to see what sort of module we are.
+*/
+   kfp = file_findfile(NULL, __elfN(kerneltype));
 #ifdef __powerpc__
-/*
- * Kernels can be ET_DYN, so just assume the first loaded object is the
- * kernel. This assumption will be checked later.
- */
-if (kfp == NULL)
-ef.kernel = 1;
-#endif
-if (ef.kernel || ehdr->e_type == ET_EXEC) {
-   /* Looks like a kernel */
-   if (kfp != NULL) {
-   printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: 

svn commit: r332131 - in stable/11: share/mk stand stand/fdt stand/ficl stand/geli stand/libsa stand/mips/uboot stand/uboot/fdt stand/uboot/lib stand/zfs

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 19:01:08 2018
New Revision: 332131
URL: https://svnweb.freebsd.org/changeset/base/332131

Log:
  MFC r329345: Eliminate bsd.stand.mk and -fPIC 32-bit intel builds
  
  OK. We don't really need a bsd.stand.mk, and it was causing a -fPIC
  for the toolchain to be added (bogusly) when building on amd64. Pull
  all relevant defs back into defs.mk and delete bsd.stand.mk.
  
  This saves about 15-20k on i386 loader and zfsloader which when
  combined with Lua give us a lot more stack space in those constrained
  environments.

Deleted:
  stable/11/share/mk/bsd.stand.mk
Modified:
  stable/11/stand/defs.mk
  stable/11/stand/fdt/Makefile
  stable/11/stand/ficl/Makefile
  stable/11/stand/geli/Makefile
  stable/11/stand/libsa/Makefile
  stable/11/stand/mips/uboot/Makefile
  stable/11/stand/uboot/fdt/Makefile
  stable/11/stand/uboot/lib/Makefile
  stable/11/stand/zfs/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/defs.mk
==
--- stable/11/stand/defs.mk Fri Apr  6 18:55:02 2018(r332130)
+++ stable/11/stand/defs.mk Fri Apr  6 19:01:08 2018(r332131)
@@ -99,8 +99,10 @@ SSP_CFLAGS=
 # currently has no /boot/loader, but may soon.
 CFLAGS+=   -ffreestanding ${CFLAGS_NO_SIMD}
 .if ${MACHINE_CPUARCH} == "aarch64"
-CFLAGS+=   -mgeneral-regs-only
-.elif ${MACHINE_CPUARCH} != "riscv"
+CFLAGS+=   -mgeneral-regs-only -fPIC
+.elif ${MACHINE_CPUARCH} == "riscv"
+CFLAGS+=   -march=rv64imac -mabi=lp64
+.else
 CFLAGS+=   -msoft-float
 .endif
 
@@ -108,8 +110,10 @@ CFLAGS+=   -msoft-float
 CFLAGS+=   -march=i386
 CFLAGS.gcc+=   -mpreferred-stack-boundary=2
 .endif
+.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0
+CFLAGS+=   -fPIC -mno-red-zone
+.endif
 
-
 .if ${MACHINE_CPUARCH} == "arm"
 # Do not generate movt/movw, because the relocation fixup for them does not
 # translate to the -Bsymbolic -pie format required by self_reloc() in 
loader(8).
@@ -120,6 +124,7 @@ CFLAGS.clang+=  -mllvm -arm-use-movt=0
 CFLAGS.clang+= -mno-movt
 .endif
 CFLAGS.clang+=  -mfpu=none
+CFLAGS+=   -fPIC
 .endif
 
 # The boot loader build uses dd status=none, where possible, for reproducible
@@ -128,6 +133,10 @@ CFLAGS.clang+=  -mfpu=none
 # when this test succeeds rather than require dd to be a bootstrap tool.
 DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true
 DD=dd ${DD_NOSTATUS}
+
+.if ${MACHINE_CPUARCH} == "mips"
+CFLAGS+=   -G0 -fno-pic -mno-abicalls
+.endif
 
 .if ${MK_LOADER_FORCE_LE} != "no"
 .if ${MACHINE_ARCH} == "powerpc64"

Modified: stable/11/stand/fdt/Makefile
==
--- stable/11/stand/fdt/MakefileFri Apr  6 18:55:02 2018
(r332130)
+++ stable/11/stand/fdt/MakefileFri Apr  6 19:01:08 2018
(r332131)
@@ -17,5 +17,4 @@ CFLAGS+=  -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC}
 
 CFLAGS+=   -Wformat -Wall
 
-.include 
 .include 

Modified: stable/11/stand/ficl/Makefile
==
--- stable/11/stand/ficl/Makefile   Fri Apr  6 18:55:02 2018
(r332130)
+++ stable/11/stand/ficl/Makefile   Fri Apr  6 19:01:08 2018
(r332131)
@@ -12,7 +12,6 @@ BASE_SRCS=dict.c ficl.c fileaccess.c float.c loader.c
 SRCS=  ${BASE_SRCS} sysdep.c softcore.c
 CLEANFILES+=   softcore.c testmain testmain.o
 
-.include 
 .ifmake testmain
 CFLAGS=-DTESTMAIN -D_TESTMAIN
 CFLAGS+=   -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}

Modified: stable/11/stand/geli/Makefile
==
--- stable/11/stand/geli/Makefile   Fri Apr  6 18:55:02 2018
(r332130)
+++ stable/11/stand/geli/Makefile   Fri Apr  6 19:01:08 2018
(r332131)
@@ -34,5 +34,4 @@ SRCS+=geliboot_crypto.c g_eli_hmac.c 
g_eli_key.c g_e
 .PATH: ${SYSDIR}/opencrypto
 SRCS+= xform_aes_xts.c
 
-.include 
 .include 

Modified: stable/11/stand/libsa/Makefile
==
--- stable/11/stand/libsa/Makefile  Fri Apr  6 18:55:02 2018
(r332130)
+++ stable/11/stand/libsa/Makefile  Fri Apr  6 19:01:08 2018
(r332131)
@@ -147,5 +147,4 @@ CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2
 .PATH: ${SYSDIR}/libkern
 SRCS+=  explicit_bzero.c
 
-.include 
 .include 

Modified: stable/11/stand/mips/uboot/Makefile
==
--- stable/11/stand/mips/uboot/Makefile Fri Apr  6 18:55:02 2018
(r332130)
+++ stable/11/stand/mips/uboot/Makefile Fri Apr  6 19:01:08 2018
(r332131)
@@ -53,5 +53,4 @@ ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACH
 
 CLEANFILES+=   ldscript.abs ldscript.pie ubldr 

svn commit: r332130 - in stable/11/stand/i386: boot2 loader

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:55:02 2018
New Revision: 332130
URL: https://svnweb.freebsd.org/changeset/base/332130

Log:
  MFC r329726, r329737, r329740
  
  r329726:
  Honor settings for including / excluding cd9660, ufs, ext2fs and msdos.
  
  The Makefile gives the impression that ext2fs and msdos were excluded
  (they weren't) and that you could exclude cd9660 and ufs support (you
  couldn't). Allow those to be excluded.
  
  We need to look, in the future, at trimming the number of supported
  filesystems, and this will make that easier.
  
  r329737:
  Purely whitespace changes bringing this file closer to style(9).
  
  Curiously, changing whitespace seems to cause the md5 of the .o files to 
differ
  these days hence the following testing strategy:
  
  Tested by:objdump -d | md5 (both in-tree clang and lang/gcc6)
  
  r329740:
  Further style(9) changes.
  
  Tested by:objdump -d | md5 (both in-tree clang and lang/gcc6)

Modified:
  stable/11/stand/i386/boot2/boot2.c
  stable/11/stand/i386/loader/Makefile
  stable/11/stand/i386/loader/conf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/i386/boot2/boot2.c
==
--- stable/11/stand/i386/boot2/boot2.c  Fri Apr  6 18:48:10 2018
(r332129)
+++ stable/11/stand/i386/boot2/boot2.c  Fri Apr  6 18:55:02 2018
(r332130)
@@ -72,33 +72,33 @@ extern uint32_t _end;
 
 static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */
 static const unsigned char flags[NOPT] = {
-RBX_DUAL,
-RBX_SERIAL,
-RBX_ASKNAME,
-RBX_CDROM,
-RBX_CONFIG,
-RBX_KDB,
-RBX_GDB,
-RBX_MUTE,
-RBX_NOINTR,
-RBX_PAUSE,
-RBX_QUIET,
-RBX_DFLTROOT,
-RBX_SINGLE,
-RBX_VERBOSE
+   RBX_DUAL,
+   RBX_SERIAL,
+   RBX_ASKNAME,
+   RBX_CDROM,
+   RBX_CONFIG,
+   RBX_KDB,
+   RBX_GDB,
+   RBX_MUTE,
+   RBX_NOINTR,
+   RBX_PAUSE,
+   RBX_QUIET,
+   RBX_DFLTROOT,
+   RBX_SINGLE,
+   RBX_VERBOSE
 };
 
 static const char *const dev_nm[NDEV] = {"ad", "da", "fd"};
 static const unsigned char dev_maj[NDEV] = {30, 4, 2};
 
 static struct dsk {
-unsigned drive;
-unsigned type;
-unsigned unit;
-uint8_t slice;
-uint8_t part;
-unsigned start;
-int init;
+   unsigned drive;
+   unsigned type;
+   unsigned unit;
+   uint8_t slice;
+   uint8_t part;
+   unsigned start;
+   int init;
 } dsk;
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
@@ -126,18 +126,22 @@ static void memcpy(void *, const void *, int);
 static void
 memcpy(void *dst, const void *src, int len)
 {
-const char *s = src;
-char *d = dst;
+   const char *s;
+   char *d;
 
-while (len--)
-*d++ = *s++;
+   s = src;
+   d = dst;
+
+   while (len--)
+   *d++ = *s++;
 }
 
 static inline int
 strcmp(const char *s1, const char *s2)
 {
-for (; *s1 == *s2 && *s1; s1++, s2++);
-return (unsigned char)*s1 - (unsigned char)*s2;
+
+   for (; *s1 == *s2 && *s1; s1++, s2++);
+   return ((unsigned char)*s1 - (unsigned char)*s2);
 }
 
 #defineUFS_SMALL_CGBASE
@@ -146,501 +150,513 @@ strcmp(const char *s1, const char *s2)
 static int
 xfsread(ufs_ino_t inode, void *buf, size_t nbyte)
 {
-if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
-   printf("Invalid %s\n", "format");
-   return -1;
-}
-return 0;
+
+   if ((size_t)fsread(inode, buf, nbyte) != nbyte) {
+   printf("Invalid %s\n", "format");
+   return (-1);
+   }
+   return (0);
 }
 
 static inline void
 getstr(void)
 {
-char *s;
-int c;
+   char *s;
+   int c;
 
-s = cmd;
-for (;;) {
-   switch (c = xgetc(0)) {
-   case 0:
-   break;
-   case '\177':
-   case '\b':
-   if (s > cmd) {
-   s--;
-   printf("\b \b");
-   }
-   break;
-   case '\n':
-   case '\r':
-   *s = 0;
-   return;
-   default:
-   if (s - cmd < sizeof(cmd) - 1)
-   *s++ = c;
-   putchar(c);
+   s = cmd;
+   for (;;) {
+   switch (c = xgetc(0)) {
+   case 0:
+   break;
+   case '\177':
+   case '\b':
+   if (s > cmd) {
+   s--;
+   printf("\b \b");
+   }
+   break;
+   case '\n':
+   case '\r':
+   *s = 0;
+   return;
+   default:
+   if (s - cmd < sizeof(cmd) - 1)
+   *s++ = c;
+   putchar(c);
+   }
}
-}
 }
 
 static inline void
 putc(int c)
 {
-v86.addr = 0x10;
-v86.eax = 

svn commit: r332129 - stable/11

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:48:10 2018
New Revision: 332129
URL: https://svnweb.freebsd.org/changeset/base/332129

Log:
  Record-only MFC of r329269 and r329418
  
  r329269 was a style(9) cleanup that had a functional side-effect. r329418
  reverted it while benno regrouped to fight the forces of evil.

Modified:
Directory Properties:
  stable/11/   (props changed)
___
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: r332128 - in stable/11/stand: . common efi/libefi efi/loader i386/loader sparc64/loader userboot/userboot

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:40:24 2018
New Revision: 332128
URL: https://svnweb.freebsd.org/changeset/base/332128

Log:
  MFC r329725, r329831
  
  r329725:
  Consolidate three copies of ZFS commands into a central location.
  
  There's no reason to have multiple copies of lszfs and
  reloadbe. Consolidate them into one location. Also ldi_get_size is the
  same everywhere (except sparc64). Make it the same everywhere as the
  common definition is more general and will work on spar64.
  
  r329831:
  Fix userboot w/ ZFS after r329725
  
  r329725 cleaned up ZFS commands duplicated in multiple places, but userboot
  was not setting HAVE_ZFS when MK_ZFS != "no". This resulted in a failure to
  boot (as seen in PR 226118) in bhyve, with the following message:
  
  /boot/userboot.so: Undefined symbol "ldi_get_size"

Added:
  stable/11/stand/common/zfs_cmd.c
 - copied unchanged from r329725, head/stand/common/zfs_cmd.c
Modified:
  stable/11/stand/efi/libefi/efizfs.c
  stable/11/stand/efi/loader/Makefile
  stable/11/stand/efi/loader/main.c
  stable/11/stand/i386/loader/main.c
  stable/11/stand/loader.mk
  stable/11/stand/sparc64/loader/Makefile
  stable/11/stand/sparc64/loader/main.c
  stable/11/stand/userboot/userboot/Makefile
  stable/11/stand/userboot/userboot/main.c
Directory Properties:
  stable/11/   (props changed)

Copied: stable/11/stand/common/zfs_cmd.c (from r329725, 
head/stand/common/zfs_cmd.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/stand/common/zfs_cmd.cFri Apr  6 18:40:24 2018
(r332128, copy of r329725, head/stand/common/zfs_cmd.c)
@@ -0,0 +1,108 @@
+/*-
+ * Copyright (c) 2018 Warner Losh 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY 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$");
+
+/*
+ * MD bootstrap main() and assorted miscellaneous
+ * commands.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "bootstrap.h"
+
+#ifdef LOADER_ZFS_SUPPORT
+#include "../zfs/libzfs.h"
+#endif
+
+COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset",
+   command_lszfs);
+
+static int
+command_lszfs(int argc, char *argv[])
+{
+   int err;
+
+   if (argc != 2) {
+   command_errmsg = "a single dataset must be supplied";
+   return (CMD_ERROR);
+   }
+
+   err = zfs_list(argv[1]);
+   if (err != 0) {
+   command_errmsg = strerror(err);
+   return (CMD_ERROR);
+   }
+   return (CMD_OK);
+}
+
+COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments",
+   command_reloadbe);
+
+static int
+command_reloadbe(int argc, char *argv[])
+{
+   int err;
+   char *root;
+
+   if (argc > 2) {
+   command_errmsg = "wrong number of arguments";
+   return (CMD_ERROR);
+   }
+
+   if (argc == 2) {
+   err = zfs_bootenv(argv[1]);
+   } else {
+   root = getenv("zfs_be_root");
+   if (root == NULL) {
+   /* There does not appear to be a ZFS pool here, exit 
without error */
+   return (CMD_OK);
+   }
+   err = zfs_bootenv(root);
+   }
+
+   if (err != 0) {
+   command_errmsg = strerror(err);
+   return (CMD_ERROR);
+   }
+
+   return (CMD_OK);
+}
+
+uint64_t
+ldi_get_size(void *priv)
+{
+   int fd = (uintptr_t) priv;
+   uint64_t size;
+
+   ioctl(fd, DIOCGMEDIASIZE, );
+   return (size);
+}

Modified: stable/11/stand/efi/libefi/efizfs.c

svn commit: r332127 - in stable/11/stand/efi: include libefi loader

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:38:25 2018
New Revision: 332127
URL: https://svnweb.freebsd.org/changeset/base/332127

Log:
  MFC r329268, r329517
  
  r329268:
  efi: Only scan the BLKIO MEDIA once
  
  Scan only the BLOCK IO MEDIA once instead of each time for each type of
  device (fd, cd and hdd).
  Leave the mechanism to free and reprobe all devices if one day we want
  to implement a "dev rescan" thing.
  
  r329517:
  efi: Do not pad the efi devpath structure
  
  This solve problem when booting with efi on armv7

Modified:
  stable/11/stand/efi/include/efidevp.h
  stable/11/stand/efi/include/efilib.h
  stable/11/stand/efi/libefi/efipart.c
  stable/11/stand/efi/loader/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/efi/include/efidevp.h
==
--- stable/11/stand/efi/include/efidevp.h   Fri Apr  6 18:25:03 2018
(r332126)
+++ stable/11/stand/efi/include/efidevp.h   Fri Apr  6 18:38:25 2018
(r332127)
@@ -31,6 +31,8 @@ Revision History
 // Device Path structures - Section C
 //
 
+#pragma pack(1)
+
 typedef struct _EFI_DEVICE_PATH {
 UINT8   Type;
 UINT8   SubType;
@@ -450,5 +452,7 @@ typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL {
EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText;
EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText;
 } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
+
+#pragma pack()
 
 #endif

Modified: stable/11/stand/efi/include/efilib.h
==
--- stable/11/stand/efi/include/efilib.hFri Apr  6 18:25:03 2018
(r332126)
+++ stable/11/stand/efi/include/efilib.hFri Apr  6 18:38:25 2018
(r332127)
@@ -106,4 +106,7 @@ int wcscmp(CHAR16 *, CHAR16 *);
 void cpy8to16(const char *, CHAR16 *, size_t);
 void cpy16to8(const CHAR16 *, char *, size_t);
 
+/* efipart.c */
+intefipart_inithandles(void);
+
 #endif /* _LOADER_EFILIB_H */

Modified: stable/11/stand/efi/libefi/efipart.c
==
--- stable/11/stand/efi/libefi/efipart.cFri Apr  6 18:25:03 2018
(r332126)
+++ stable/11/stand/efi/libefi/efipart.cFri Apr  6 18:38:25 2018
(r332127)
@@ -148,7 +148,7 @@ efiblk_pdinfo_count(pdinfo_list_t *pdi)
return (i);
 }
 
-static int
+int
 efipart_inithandles(void)
 {
UINTN sz;
@@ -176,6 +176,10 @@ efipart_inithandles(void)
 
efipart_handles = hin;
efipart_nhandles = sz;
+#ifdef EFIPART_DEBUG
+   printf("%s: Got %d BLOCK IO MEDIA handle(s)\n", __func__,
+   efipart_nhandles);
+#endif
return (0);
 }
 
@@ -319,11 +323,7 @@ efipart_updatefd(void)
 static int
 efipart_initfd(void)
 {
-   int rv;
 
-   rv = efipart_inithandles();
-   if (rv != 0)
-   return (rv);
STAILQ_INIT();
 
efipart_updatefd();
@@ -439,11 +439,7 @@ efipart_updatecd(void)
 static int
 efipart_initcd(void)
 {
-   int rv;
 
-   rv = efipart_inithandles();
-   if (rv != 0)
-   return (rv);
STAILQ_INIT();
 
efipart_updatecd();
@@ -685,11 +681,7 @@ efipart_updatehd(void)
 static int
 efipart_inithd(void)
 {
-   int rv;
 
-   rv = efipart_inithandles();
-   if (rv != 0)
-   return (rv);
STAILQ_INIT();
 
efipart_updatehd();

Modified: stable/11/stand/efi/loader/main.c
==
--- stable/11/stand/efi/loader/main.c   Fri Apr  6 18:25:03 2018
(r332126)
+++ stable/11/stand/efi/loader/main.c   Fri Apr  6 18:38:25 2018
(r332127)
@@ -456,11 +456,15 @@ main(int argc, CHAR16 *argv[])
}
 
/*
-* March through the device switch probing for things.
+* Scan the BLOCK IO MEDIA handles then
+* march through the device switch probing for things.
 */
-   for (i = 0; devsw[i] != NULL; i++)
-   if (devsw[i]->dv_init != NULL)
-   (devsw[i]->dv_init)();
+   if ((i = efipart_inithandles()) == 0) {
+   for (i = 0; devsw[i] != NULL; i++)
+   if (devsw[i]->dv_init != NULL)
+   (devsw[i]->dv_init)();
+   } else
+   printf("efipart_inithandles failed %d, expect failures", i);
 
printf("Command line arguments:");
for (i = 0; i < argc; i++)
___
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: r332090 - head/stand/i386

2018-04-06 Thread Warner Losh
On Fri, Apr 6, 2018 at 11:54 AM, John Baldwin  wrote:

> On Friday, April 06, 2018 02:57:58 AM Ed Maste wrote:
> > Author: emaste
> > Date: Fri Apr  6 02:57:58 2018
> > New Revision: 332090
> > URL: https://svnweb.freebsd.org/changeset/base/332090
> >
> > Log:
> >   stand: pass --no-rosegment for i386 bits when linking with lld
> >
> >   btxld does not correctly handle input with other than 2 PT_LOAD
> >   segments.  Passing --no-rosegment lets lld produce output eqivalent to
> >   ld.bfd: 2 PT_LOAD segments and no PT_GNU_RELRO.
> >
> >   PR: 225775
> >   MFC after:  3 weeks
> >   Sponsored by:   The FreeBSD Foundation
> >   Differential Revision:  https://reviews.freebsd.org/D14956
> >
> > Modified:
> >   head/stand/i386/Makefile.inc
> >
> > Modified: head/stand/i386/Makefile.inc
> > 
> ==
> > --- head/stand/i386/Makefile.inc  Fri Apr  6 02:47:43 2018
> (r332089)
> > +++ head/stand/i386/Makefile.inc  Fri Apr  6 02:57:58 2018
> (r332090)
> > @@ -2,8 +2,13 @@
> >  #
> >  # $FreeBSD$
> >
> > +.sinclude 
> > +
> >  LOADER_ADDRESS?=0x20
> >  LDFLAGS+=-nostdlib
> > +.if defined(LINKER_TYPE) && ${LINKER_TYPE} == "lld"
> > +LDFLAGS+=-Wl,--no-rosegment
> > +.endif
>
> Maybe we should support LDFLAGS.${LINKER_TYPE} as we do for CFLAGS, etc.?
>

I concur. It doesn't take too many of these for that to pay off big time,
especially if we have to do anything globally...

Warner
___
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: r331838 - in stable/11: . contrib/compiler-rt/include/sanitizer contrib/compiler-rt/include/xray contrib/compiler-rt/lib/BlocksRuntime contrib/compiler-rt/lib/asan contrib/compiler-rt/

2018-04-06 Thread John Baldwin
On Monday, April 02, 2018 12:27:47 PM Ed Maste wrote:
> On 31 March 2018 at 14:41, Mark Linimon  wrote:
> This is the most important point of this discussion: we do need to
> ensure there's good communication and coordination between teams where
> dependencies like this exist. I'll take the blame here: Dimitry asked
> me about merging the Clang update to stable/11 and I agreed that it
> was reasonable to merge sooner rather than later to have as much lead
> time as possible before the 11.2 process starts. I also assumed that
> outstanding Clang 6 issues in ports were farther along in being
> addressed.
> 
> The key lesson from this discussion is that for significant commits
> and merges like this one we should make sure to always have sufficient
> advance notice.

Is this driven by -mretpoline?  That is, would we not be as aggressive
with pushing for clang 6 in 11.2 if it weren't for that?  I kind of feel
like we probably wouldn't and would have left it at 5 and let clang 6 be
a FreeBSD 12 thing.  Was -mretpoline backported to clang 5 (I thought
there was some talk of providing patches for clang 5)?

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


Re: svn commit: r332090 - head/stand/i386

2018-04-06 Thread John Baldwin
On Friday, April 06, 2018 02:57:58 AM Ed Maste wrote:
> Author: emaste
> Date: Fri Apr  6 02:57:58 2018
> New Revision: 332090
> URL: https://svnweb.freebsd.org/changeset/base/332090
> 
> Log:
>   stand: pass --no-rosegment for i386 bits when linking with lld
>   
>   btxld does not correctly handle input with other than 2 PT_LOAD
>   segments.  Passing --no-rosegment lets lld produce output eqivalent to
>   ld.bfd: 2 PT_LOAD segments and no PT_GNU_RELRO.
>   
>   PR: 225775
>   MFC after:  3 weeks
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D14956
> 
> Modified:
>   head/stand/i386/Makefile.inc
> 
> Modified: head/stand/i386/Makefile.inc
> ==
> --- head/stand/i386/Makefile.inc  Fri Apr  6 02:47:43 2018
> (r332089)
> +++ head/stand/i386/Makefile.inc  Fri Apr  6 02:57:58 2018
> (r332090)
> @@ -2,8 +2,13 @@
>  #
>  # $FreeBSD$
>  
> +.sinclude 
> +
>  LOADER_ADDRESS?=0x20
>  LDFLAGS+=-nostdlib
> +.if defined(LINKER_TYPE) && ${LINKER_TYPE} == "lld"
> +LDFLAGS+=-Wl,--no-rosegment
> +.endif

Maybe we should support LDFLAGS.${LINKER_TYPE} as we do for CFLAGS, etc.?

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


Re: svn commit: r327954 - in head/sys: amd64/conf conf dev/acpica vm x86/acpica

2018-04-06 Thread John Baldwin
On Sunday, April 01, 2018 01:35:45 PM Ian Lepore wrote:
> On Sun, 2018-01-14 at 03:36 +, Jeff Roberson wrote:
> > Author: jeff
> > Date: Sun Jan 14 03:36:03 2018
> > New Revision: 327954
> > URL: https://svnweb.freebsd.org/changeset/base/327954
> > 
> > Log:
> >   Move VM_NUMA_ALLOC and DEVICE_NUMA under the single global config
> > option NUMA.
> >   
> >   Sponsored by: Netflix, Dell/EMC Isilon
> >   Discussed with:   jhb
> 
> It turns out this breaks building powerpc lint kernels. It shakes out
> like this... makeLINT.mk copies sys/conf/NOTES into the generated LINT
> config (I guess on the theory that things documented in NOTES are
> supported by all arches). So option NUMA is present on powerpc, but the
> powerpc vmparam.h doesn't define VM_LEVEL_0_ORDER so the build fails.
> (Mips also doesn't define that, but it has no lint kernel build at all
> right now.)
> 
> It could be fixed in vm_domainset.c with:
> 
> -#ifdef NUMA
> +#if defined(NUMA) && defined(VM_LEVEL_0_ORDER)
> 
> but there may be some better way to fix it, I don't know that much
> about this stuff.

Maybe add 'nooption NUMA' to sys/powerpc/conf/NOTES?  (It has several
nooption and nodevice lines already)  If it affects more than powerpc
then I wouldn't do that, but if it's only powerpc then I think patching
powerpc/conf/NOTES is most consistent with how this has been handled to
date.

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


svn commit: r332126 - in stable/11/usr.sbin: . efibootmgr

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:25:03 2018
New Revision: 332126
URL: https://svnweb.freebsd.org/changeset/base/332126

Log:
  MFC efibootmgr: r326725-r326728, r326771, r326800-r326804, r326806, r327163
   r327572-r327573, r327610-r327611, r327877, r331069
  
  r326725:
  Import Netflix's efibootmgr to help manage UEFI boot variables
  
  efibootmgr manages the UEFI Boot variables that implement the UEFI
  Boot Manager protocol defined in the UEFI standards. It is modeled
  after the Linux program of the same name with a mostly compatible set
  of command line options. Since there's a fair amount of OS specifioc
  code due to differeing names and methods of doing things, the
  compatibility isn't 100%.
  
  Basic functionality is implemented, though the more advanced next boot
  functionality that's been defined elsewhere is unimplemented.
  
  Submitted by: Matt Williams (with unix / efi path xlate by me)
  Sponsored by: Netflix
  
  r326726:
  Forgotten in 326725
  
  Release Notes: Yes
  
  r326727:
  Remove vestiges of -d and -p commands.
  Fix two core dumps when optional data isn't specified.
  
  Sponsored by: Netflix
  
  r326728:
  Indent multiple device path entries correctly.
  
  Sponsored by: Netflix
  
  r326771:
  Unbreak gcc build by using (void) for functions that take no args.
  
  Sponsored by: Netflix
  
  r326800:
  Check return value for set_bootvar and give a good error message.
  
  CID: 1383601
  Sponsored by: Netflix
  
  r326801:
  Don't leak new_data.
  
  CID: 1383605
  Sponsored by: Netflix
  
  r326802:
  Fix resource leak. Free converted description after printing it.
  Also minor style sort of local vars.
  
  CID: 1383606
  Sponsored by: Netflix
  
  r326803:
  Free load_opt_buf after we're done with it.
  
  CID: 1383607
  Sponsored by: Netflix
  
  r326804:
  Add sanity testing against maximum sane lengths for device paths for
  loader and kernel.
  
  CID: 1383608
  Sponsored by: Netflix
  
  r326806:
  Actually insert the free(d) call missed in r326802.
  
  Noticed by: rpokala@
  
  r327163:
  Remove write-only opt and useless optlen variables.
  
  This squashes the warning gebnerated by GCC 6.x. Since
  variables that are now removed had come documentation
  value, put relevant bits in comment, so they can be
  resurrected from there when actually needed.
  
  r327572:
  Ensure that we have a description string. When unspecified, default to "".
  
  Sponsored by: Netflix
  
  r327573:
  Free options before setting them. This will prevent us from leaking
  memory when we have multiple copies of the same option from being
  specified.
  
  Sponsored by: Netflix
  
  r327610:
  Fix usage strings. -d and -p were removed before this was committed to
  FreeBSD, but the strings weren't updated.
  
  Sponsored by: Netflix
  
  r327611:
  There's no need / benefit from deleting the variable before we set it.
  
  Sponsored by: Netflix
  
  r327877:
  Fix error in determining the next available boot slot.
  
  Sponsored by: Netflix
  
  r331069:
  Make not getting BootOrder a warning, not a fatal error when printing.
  
  Sponsored by: Netflix
  
  Relnotes: yes

Added:
  stable/11/usr.sbin/efibootmgr/
 - copied from r326728, head/usr.sbin/efibootmgr/
Modified:
  stable/11/usr.sbin/Makefile
  stable/11/usr.sbin/efibootmgr/efibootmgr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/Makefile
==
--- stable/11/usr.sbin/Makefile Fri Apr  6 18:23:42 2018(r332125)
+++ stable/11/usr.sbin/Makefile Fri Apr  6 18:25:03 2018(r332126)
@@ -126,7 +126,7 @@ SUBDIR.${MK_CTM}+=  ctm
 SUBDIR.${MK_CXGBETOOL}+=   cxgbetool
 SUBDIR.${MK_MLX5TOOL}+=mlx5tool
 SUBDIR.${MK_DIALOG}+=  bsdconfig
-SUBDIR.${MK_EFI}+= efivar efidp
+SUBDIR.${MK_EFI}+= efivar efidp efibootmgr
 SUBDIR.${MK_FLOPPY}+=  fdcontrol
 SUBDIR.${MK_FLOPPY}+=  fdformat
 SUBDIR.${MK_FLOPPY}+=  fdread

Modified: stable/11/usr.sbin/efibootmgr/efibootmgr.c
==
--- head/usr.sbin/efibootmgr/efibootmgr.c   Sat Dec  9 07:44:00 2017
(r326728)
+++ stable/11/usr.sbin/efibootmgr/efibootmgr.c  Fri Apr  6 18:25:03 2018
(r332126)
@@ -164,18 +164,17 @@ static int
 set_bootvar(const char *name, uint8_t *data, size_t size)
 {
 
-   efi_del_variable(EFI_GLOBAL_GUID, name);
return efi_set_variable(EFI_GLOBAL_GUID, name, data, size,
COMMON_ATTRS);
 }
 
 
 #define USAGE \
-   "   [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] 
[--help] \n \
-  [-c -d device -p partition -l loader [-L label] [--dry-run]]"
+   "   [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] 
[--help] \n\
+  [-c -l loader [-k kernel ] [-L label] [--dry-run]]"
 
 #define CREATE_USAGE \
-   "   efibootmgr -c -d device -p partition -loader loader [-L label ] 

svn commit: r332125 - in stable/11/share: examples/etc mk

2018-04-06 Thread Jung-uk Kim
Author: jkim
Date: Fri Apr  6 18:23:42 2018
New Revision: 332125
URL: https://svnweb.freebsd.org/changeset/base/332125

Log:
  MFC:  r314875, r331963
  
  Catch up with Clang 6.0.

Modified:
  stable/11/share/examples/etc/make.conf
  stable/11/share/mk/bsd.cpu.mk
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/examples/etc/make.conf
==
--- stable/11/share/examples/etc/make.conf  Fri Apr  6 18:16:14 2018
(r332124)
+++ stable/11/share/examples/etc/make.conf  Fri Apr  6 18:23:42 2018
(r332125)
@@ -44,8 +44,9 @@
 #  if omitted), ultrasparc3
 # Additionally the following CPU types are recognized by clang:
 #   Intel x86 architecture (for both amd64 and i386):
-#   (AMD CPUs) bdver4, bdver3, bdver2, bdver1, btver2, btver1
-#   (Intel CPUs)   skylake, knl, broadwell, haswell, ivybridge,
+#   (AMD CPUs) znver1, bdver4, bdver3, bdver2, bdver1, btver2, btver1
+#   (Intel CPUs)   cannonlake, knm, skylake-avx512, knl, goldmont,
+#  skylake, broadwell, haswell, ivybridge,
 #  sandybridge, westmere, nehalem, silvermont, bonnell
 #
 # (?= allows to buildworld for a different CPUTYPE.)

Modified: stable/11/share/mk/bsd.cpu.mk
==
--- stable/11/share/mk/bsd.cpu.mk   Fri Apr  6 18:16:14 2018
(r332124)
+++ stable/11/share/mk/bsd.cpu.mk   Fri Apr  6 18:23:42 2018
(r332125)
@@ -173,7 +173,9 @@ _CPUCFLAGS = -mcpu=${CPUTYPE}
 
 ## i386
 . if ${MACHINE_CPUARCH} == "i386"
-.  if ${CPUTYPE} == "bdver4"
+.  if ${CPUTYPE} == "znver1"
+MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
+.  elif ${CPUTYPE} == "bdver4"
 MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
 .  elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
 ${CPUTYPE} == "bdver1"
@@ -200,14 +202,16 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586
 MACHINE_CPU = mmx k6 k5 i586
 .  elif ${CPUTYPE} == "k5"
 MACHINE_CPU = k5 i586
-.  elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl"
+.  elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \
+${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl"
 MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
-.  elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell"
+.  elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \
+${CPUTYPE} == "haswell"
 MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
 .  elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
 MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
-.  elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \
-${CPUTYPE} == "silvermont"
+.  elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \
+${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont"
 MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
 .  elif ${CPUTYPE} == "penryn"
 MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586
@@ -242,7 +246,9 @@ MACHINE_CPU = mmx
 MACHINE_CPU += i486
 ## amd64
 . elif ${MACHINE_CPUARCH} == "amd64"
-.  if ${CPUTYPE} == "bdver4"
+.  if ${CPUTYPE} == "znver1"
+MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3
+.  elif ${CPUTYPE} == "bdver4"
 MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3
 .  elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
 ${CPUTYPE} == "bdver1"
@@ -259,14 +265,16 @@ MACHINE_CPU = k8 3dnow sse3
 .  elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
 ${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8"
 MACHINE_CPU = k8 3dnow
-.  elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl"
+.  elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \
+${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl"
 MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3
-.  elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell"
+.  elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \
+${CPUTYPE} == "haswell"
 MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3
 .  elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
 MACHINE_CPU = avx sse42 sse41 ssse3 sse3
-.  elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \
-${CPUTYPE} == "silvermont"
+.  elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \
+${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont"
 MACHINE_CPU = sse42 sse41 ssse3 sse3
 .  elif ${CPUTYPE} == "penryn"
 MACHINE_CPU = sse41 ssse3 sse3
___
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: r332123 - in stable/11: lib/libefivar usr.sbin/efidp usr.sbin/efivar

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 18:10:38 2018
New Revision: 332123
URL: https://svnweb.freebsd.org/changeset/base/332123

Log:
  MFC efivar changes: r321429, r323056-r323057, r323066, r323259-r323260,
  r323519, r325684, r326050-r326051, r326231, r326287, r326457-r326459,
  r326472, r326658, r326805, r327574-r327575, r330279
  
  r321429:
  fix typo
  
  r323056:
  Fix printing File() nodes in device paths.
  
  Device paths encoded into the FILEPATH_DEVICE_PATH are UCS2 not
  ASCII/UTF8. Convert to utf8 and print that when printing File
  paths. Also, since File may be at the end of a long device path,
  output File() around the path so it doesn't just show up as random
  nodes that might accidentally match real node paths names and cause
  errors.
  
  r323057:
  Fix parsing File() nodes in device paths.
  
  o Add File to the mUefiDevicePathLibDevPathFromTextTable table so we
don't include 'File()' in the supposed path name. This happens because
of a possible misfeature in the EDK2 code where any path that's not
recognized is treated as a File() node.
  o Convert utf8 input into ucs2 output rather than just copying the
utf8 and hoping for the best (no good comes from that).
  o Remove bogus comment about needing to add 1. The dummy array already
is length 1, so that's included in sizeof the struct, so there's no
need to add it.
  
  Sponsored by: Netflix
  
  r323066:
  Add UCS2->UTF8 option.
  
  Many UEFI variables are UCS2 strings (some NUL terminated, others
  not). Add --utf8 (-u) to convert UCS2 strings to UTF8 before printing.
  
  Sponsored by: Netflix
  
  r323259:
  Implement efidp_size
  
  efidp_size will return the size, in bytes, of a EFI device path
  structure. This is a convenience wrapper in the same style as the
  other linux routines. It's implemented by GetDevicePathSize from EDK2
  we already needed for other things.
  
  Sponsored by: Netflix
  
  r323260:
  Create efi utility printing routines
  
  Split out asciidump, utf8dump, bindump, and hexdump into a separate
  file efiutil.c. Implement new efi_print_load_option for printing out
  the EFI_LOADER_OPTION data structure used to specify different options
  to the UEFI boot manager.
  
  Sponsored by: Netflix
  
  r323519:
  Minor fixes to edge cases in efi_get_next_variable_name
  
  Fix allocating more memory for the names (unlikely to be needed, but
  still best to get right) to ask for the length the kernel told use we
  needed, not the old length of the variable. Mind the proper NUL that
  we add in the space we allocate. Free the old name string before we
  allcoate a new one to limit what we leak to the last one (free passed
  in name for the last one in the list), and detect the last one by rv
  != 0 and errno == ENOENT, rather then just the former to avoid false
  positives if errno happens to be ENOENT on entry.
  
  Sponsored by: Netflix
  
  r325684:
  Simplify the efivar interface a little.
  
  We started out having Linux compatible libefivar interfaces. This was
  in anticipation of porting the GPL'd efibootmgr to FreeBSD via a
  port. However, since we need that functionality in the base, that port
  isn't going to happened. It also appears that efivar is a private
  library that's not used much outside a command line util and
  efibootmgr. Reduce compatibility with the Linux version a little by
  removing the mode parameter to efi_set_variable (which was unused on
  FreeBSD, and not set to something useful in the code we'd
  written). Also remove some efi error routines that were never
  implemented and existed only to placate early GPL efibootmgr porting
  experiments.
  
  Suggested by: Matt Williams
  Sponsored by: Netflix
  
  r326050:
  Document what the command line arguments actually do. List some of the
  size limitations.
  
  Sponsored by: Netflix
  
  r326051:
  This program is more useful if it skips leading whitespace when
  parsing a textual UEFI Device Path, since otherwise it things the
  passed in path is a filename. While here, reduce the repetition of
  8192.
  
  Sponsored by: Netflix
  
  r326231:
  Add efidp_format_device_path_node to format a single node in a device
  path, much like efidp_format_device_path will format the entire path.
  
  Sponsored by: Netflix
  
  r326287:
  efivar: add missing getopt 'u' option
  
  r326457:
  Read multiple lines when parsing the data. Allow multiple device paths
  to be read when formatting device paths. Set the upper limit to 64k
  (most of these paths are < 64 bytes).
  
  Sponsored by: Netflix
  
  r326458:
  Create a function to translate UEFI paths to unix paths
  
  efivar_device_path_to_unix_path translates from UEFI to Unix
  efivar_unix_path_to_device_path translates from Unix to UEFI
  
  At present, only HD() device types are supported (both GPT and
  MBR). CdRom and floppy devices aren't supported. ZFS isn't supported
  because there's no way in the UEFI standard to specify a ZFS datastore.
  Network devices 

New study: the best & worst states at managing debt

2018-04-06 Thread Neha Chhabdiya
Hi there,

Debt is a major issue many Americans face today and we wanted to find out where 
people are faring the worst. I wanted to share this new analysis from Credible 
because you’ve touched on debt in the past.

Here are a few highlights of the best and worst states at managing debt:

On average, people in Michigan have the least debt relative to the 
income they make
Hawaii has the highest average debt-to-income ratio of all states
On average, borrowers are paying nearly $1,500 on monthly credit card 
bills, student loan debt, and housing costs

I think it would be really interesting to see how your audience would respond 
to that.

Will you let me know what you think of this piece? :)

I can even send you a quick line of code to embed a map on your site if you’re 
interested.

Thanks,
Neha



Neha Chhabdiya
Community Manager

p: 866-540-6005
e: n...@credible.com
w: credible.comDon't want emails from us anymore? Reply to this email with the 
word "UNSUBSCRIBE" in the subject line.
Credible Labs Inc., 101 Green Street Level 2, San Francisco California, 94111, 
United States

___
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: r332122 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 arm/arm arm64/arm64 cam/scsi compat/freebsd32 compat/ia32 compat/linux conf dev/aac dev/aacraid dev/acpica dev/at...

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 17:35:35 2018
New Revision: 332122
URL: https://svnweb.freebsd.org/changeset/base/332122

Log:
  Move most of the contents of opt_compat.h to opt_global.h.
  
  opt_compat.h is mentioned in nearly 180 files. In-progress network
  driver compabibility improvements may add over 100 more so this is
  closer to "just about everywhere" than "only some files" per the
  guidance in sys/conf/options.
  
  Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of
  sys/compat/linux/*.c.  A fake _COMPAT_LINUX option ensure opt_compat.h
  is created on all architectures.
  
  Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the
  set of compiled files.
  
  Reviewed by:  kib, cem, jhb, jtl
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14941

Modified:
  head/sys/amd64/amd64/db_trace.c
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/amd64/genassym.c
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/amd64/ptrace_machdep.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/amd64/ia32/ia32_misc.c
  head/sys/amd64/ia32/ia32_reg.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/amd64/ia32/ia32_sigtramp.S
  head/sys/amd64/ia32/ia32_syscall.c
  head/sys/amd64/linux/linux_dummy.c
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/arm/arm/machdep.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/cam/scsi/scsi_enc.c
  head/sys/cam/scsi/scsi_pass.c
  head/sys/compat/freebsd32/freebsd32_ioctl.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/ia32/ia32_genassym.c
  head/sys/compat/ia32/ia32_sysvec.c
  head/sys/compat/linux/linux_util.c
  head/sys/conf/options
  head/sys/conf/options.amd64
  head/sys/conf/options.arm64
  head/sys/conf/options.mips
  head/sys/conf/options.powerpc
  head/sys/dev/aac/aac.c
  head/sys/dev/aacraid/aacraid.c
  head/sys/dev/acpica/acpi_hpet.c
  head/sys/dev/atkbdc/atkbd.c
  head/sys/dev/cy/cy.c
  head/sys/dev/drm2/drmP.h
  head/sys/dev/drm2/drm_ioc32.c
  head/sys/dev/drm2/i915/i915_ioc32.c
  head/sys/dev/drm2/radeon/radeon_ioc32.c
  head/sys/dev/filemon/filemon.c
  head/sys/dev/filemon/filemon_wrapper.c
  head/sys/dev/kbdmux/kbdmux.c
  head/sys/dev/md/md.c
  head/sys/dev/mfi/mfi.c
  head/sys/dev/mpr/mpr_user.c
  head/sys/dev/mps/mps_user.c
  head/sys/dev/mrsas/mrsas_linux.c
  head/sys/dev/null/null.c
  head/sys/dev/pci/pci_user.c
  head/sys/dev/rp/rp.c
  head/sys/dev/sio/sio.c
  head/sys/dev/syscons/scvidctl.c
  head/sys/dev/syscons/syscons.c
  head/sys/dev/uart/uart_kbd_sun.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/vkbd/vkbd.c
  head/sys/dev/vt/vt_core.c
  head/sys/fs/cuse/cuse.c
  head/sys/fs/devfs/devfs_devs.c
  head/sys/fs/procfs/procfs_dbregs.c
  head/sys/fs/procfs/procfs_fpregs.c
  head/sys/fs/procfs/procfs_ioctl.c
  head/sys/fs/procfs/procfs_map.c
  head/sys/fs/procfs/procfs_regs.c
  head/sys/geom/geom_dev.c
  head/sys/i386/i386/genassym.c
  head/sys/i386/i386/locore.s
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/sigtramp.s
  head/sys/i386/linux/linux_dummy.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/init_sysent.c
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_event.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_jail.c
  head/sys/kern/kern_mib.c
  head/sys/kern/kern_module.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_prot.c
  head/sys/kern/kern_resource.c
  head/sys/kern/kern_sendfile.c
  head/sys/kern/kern_sharedpage.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/kern_tc.c
  head/sys/kern/kern_thr.c
  head/sys/kern/kern_umtx.c
  head/sys/kern/kern_xxx.c
  head/sys/kern/makesyscalls.sh
  head/sys/kern/subr_dummy_vdso_tc.c
  head/sys/kern/sys_generic.c
  head/sys/kern/sys_getrandom.c
  head/sys/kern/sys_pipe.c
  head/sys/kern/sys_process.c
  head/sys/kern/sysv_ipc.c
  head/sys/kern/sysv_msg.c
  head/sys/kern/sysv_sem.c
  head/sys/kern/sysv_shm.c
  head/sys/kern/tty.c
  head/sys/kern/tty_compat.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_sem.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/vfs_aio.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_syscalls.c
  head/sys/mips/include/reg.h
  head/sys/mips/include/sigframe.h
  head/sys/mips/include/tls.h
  head/sys/mips/include/ucontext.h
  head/sys/mips/mips/freebsd32_machdep.c
  head/sys/mips/mips/pm_machdep.c
  head/sys/mips/mips/swtch.S
  head/sys/mips/mips/trap.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/modules/aac/Makefile
  head/sys/modules/aacraid/Makefile
  head/sys/modules/cam/Makefile
  head/sys/modules/cryptodev/Makefile
  head/sys/modules/cuse/Makefile
  head/sys/modules/drm2/drm2/Makefile
  

svn commit: r332121 - head

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 17:23:47 2018
New Revision: 332121
URL: https://svnweb.freebsd.org/changeset/base/332121

Log:
  Support -DNO_CLEAN builds across r332119.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Apr  6 17:20:37 2018(r332120)
+++ head/Makefile.inc1  Fri Apr  6 17:23:47 2018(r332121)
@@ -807,7 +807,8 @@ _cleanobj_fast_depend_hack: .PHONY
 # 20170624  r320278  fstat fstatat fstatfs getdirentries getfsstat statfs
 # 20180404  r332048  sigreturn
 # 20180405  r332080  shmat
-.for f in fstat fstatat fstatfs getdirentries getfsstat shmat sigreturn statfs
+# 20180406  r332119  setlogin
+.for f in fstat fstatat fstatfs getdirentries getfsstat setlogin shmat 
sigreturn statfs
 .if exists(${OBJTOP}/lib/libc/.depend.${f}.o)
@if egrep -qw '${f}\.[sS]' \
${OBJTOP}/lib/libc/.depend.${f}.o; then \
___
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: r332120 - head/sys/netinet

2018-04-06 Thread Jonathan T. Looney
Author: jtl
Date: Fri Apr  6 17:20:37 2018
New Revision: 332120
URL: https://svnweb.freebsd.org/changeset/base/332120

Log:
  If a user closes the socket before we call tcp_usr_abort(), then
  tcp_drop() may unlock the INP.  Currently, tcp_usr_abort() does not
  check for this case, which results in a panic while trying to unlock
  the already-unlocked INP (not to mention, a use-after-free violation).
  
  Make tcp_usr_abort() check the return value of tcp_drop(). In the case
  where tcp_drop() returns NULL, tcp_usr_abort() can skip further steps
  to abort the connection and simply unlock the INP_INFO lock prior to
  returning.
  
  Reviewed by:  glebius
  MFC after:2 weeks
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Fri Apr  6 17:17:34 2018
(r332119)
+++ head/sys/netinet/tcp_usrreq.c   Fri Apr  6 17:20:37 2018
(r332120)
@@ -1095,7 +1095,9 @@ tcp_usr_abort(struct socket *so)
!(inp->inp_flags & INP_DROPPED)) {
tp = intotcpcb(inp);
TCPDEBUG1();
-   tcp_drop(tp, ECONNABORTED);
+   tp = tcp_drop(tp, ECONNABORTED);
+   if (tp == NULL)
+   goto dropped;
TCPDEBUG2(PRU_ABORT);
TCP_PROBE2(debug__user, tp, PRU_ABORT);
}
@@ -1106,6 +1108,7 @@ tcp_usr_abort(struct socket *so)
inp->inp_flags |= INP_SOCKREF;
}
INP_WUNLOCK(inp);
+dropped:
INP_INFO_RUNLOCK(_tcbinfo);
 }
 
___
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: r332119 - in head/lib/libc: amd64/sys gen i386/sys powerpc/sys powerpc64/sys sparc64/sys

2018-04-06 Thread Brooks Davis
Author: brooks
Date: Fri Apr  6 17:17:34 2018
New Revision: 332119
URL: https://svnweb.freebsd.org/changeset/base/332119

Log:
  Remove caching from getlogin(2).
  
  This caching has existed since the CSRG import, but serves no obvious
  purpose. Sure, setlogin() is called rarely, but calls to getlogin()
  should also be infrequent. The required invalidation was not
  implemented on aarch64, arm, mips, amd riscv so updates would never
  occur if getlogin() was called before setlogin().
  
  Reported by:  Ali Mashtizadeh 
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14965

Deleted:
  head/lib/libc/amd64/sys/setlogin.S
  head/lib/libc/i386/sys/setlogin.S
  head/lib/libc/powerpc/sys/setlogin.S
  head/lib/libc/powerpc64/sys/setlogin.S
  head/lib/libc/sparc64/sys/setlogin.S
Modified:
  head/lib/libc/amd64/sys/Makefile.inc
  head/lib/libc/gen/getlogin.c
  head/lib/libc/i386/sys/Makefile.inc
  head/lib/libc/powerpc/sys/Makefile.inc
  head/lib/libc/powerpc64/sys/Makefile.inc
  head/lib/libc/sparc64/sys/Makefile.inc

Modified: head/lib/libc/amd64/sys/Makefile.inc
==
--- head/lib/libc/amd64/sys/Makefile.incFri Apr  6 17:16:50 2018
(r332118)
+++ head/lib/libc/amd64/sys/Makefile.incFri Apr  6 17:17:34 2018
(r332119)
@@ -9,7 +9,7 @@ SRCS+=  \
amd64_set_gsbase.c
 
 MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \
-   sbrk.S setlogin.S
+   sbrk.S
 
 # Don't generate default code for these syscalls:
 NOASM+=vfork.o

Modified: head/lib/libc/gen/getlogin.c
==
--- head/lib/libc/gen/getlogin.cFri Apr  6 17:16:50 2018
(r332118)
+++ head/lib/libc/gen/getlogin.cFri Apr  6 17:17:34 2018
(r332119)
@@ -47,62 +47,33 @@ __FBSDID("$FreeBSD$");
 
 #include "libc_private.h"
 
-#defineTHREAD_LOCK()   if (__isthreaded) 
_pthread_mutex_lock(_mutex)
-#defineTHREAD_UNLOCK() if (__isthreaded) 
_pthread_mutex_unlock(_mutex)
-
 extern int _getlogin(char *, int);
 
-int_logname_valid __hidden; /* known to setlogin() */
-static pthread_mutex_t logname_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-static char *
-getlogin_basic(int *status)
-{
-   static char logname[MAXLOGNAME];
-
-   if (_logname_valid == 0) {
-   if (_getlogin(logname, sizeof(logname)) < 0) {
-   *status = errno;
-   return (NULL);
-   }
-   _logname_valid = 1;
-   }
-   *status = 0;
-   return (*logname ? logname : NULL);
-}
-
 char *
 getlogin(void)
 {
-   char*result;
-   int status;
+   static char logname[MAXLOGNAME];
 
-   THREAD_LOCK();
-   result = getlogin_basic();
-   THREAD_UNLOCK();
-   return (result);
+   if (_getlogin(logname, sizeof(logname)) < 0)
+   return (NULL);
+   return (logname[0] != '\0' ? logname : NULL);
 }
 
 int
 getlogin_r(char *logname, int namelen)
 {
-   char*result;
+   char tmpname[MAXLOGNAME];
int len;
-   int status;
 
if (namelen < 1)
return (ERANGE);
logname[0] = '\0';
 
-   THREAD_LOCK();
-   result = getlogin_basic();
-   if (status == 0 && result != NULL) {
-   len = strlen(result) + 1;
-   if (len > namelen)
-   status = ERANGE;
-   else
-   strncpy(logname, result, len);
-   }
-   THREAD_UNLOCK();
-   return (status);
+   if (_getlogin(tmpname, sizeof(tmpname)) < 0)
+   return (errno);
+   len = strlen(tmpname) + 1;
+   if (len > namelen)
+   return (ERANGE);
+   strlcpy(logname, tmpname, len);
+   return (0);
 }

Modified: head/lib/libc/i386/sys/Makefile.inc
==
--- head/lib/libc/i386/sys/Makefile.inc Fri Apr  6 17:16:50 2018
(r332118)
+++ head/lib/libc/i386/sys/Makefile.inc Fri Apr  6 17:17:34 2018
(r332119)
@@ -8,7 +8,7 @@ SRCS+=  i386_get_fsbase.c i386_get_gsbase.c i386_get_io
i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
 
 MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \
-   sbrk.S setlogin.S syscall.S
+   sbrk.S syscall.S
 
 NOASM+=vfork.o
 

Modified: head/lib/libc/powerpc/sys/Makefile.inc
==
--- head/lib/libc/powerpc/sys/Makefile.inc  Fri Apr  6 17:16:50 2018
(r332118)
+++ head/lib/libc/powerpc/sys/Makefile.inc  Fri Apr  6 17:17:34 2018
(r332119)
@@ -1,3 +1,3 @@
 # $FreeBSD$
 
-MDASM+=brk.S cerror.S exect.S sbrk.S setlogin.S
+MDASM+=brk.S cerror.S exect.S 

svn commit: r332118 - head/usr.sbin/syslogd

2018-04-06 Thread Ed Schouten
Author: ed
Date: Fri Apr  6 17:16:50 2018
New Revision: 332118
URL: https://svnweb.freebsd.org/changeset/base/332118

Log:
  Push RFC 5424 message format from logmsg() into fprintlog().
  
  Now that all of parsemsg() parses both RFC 3164 and 5424 messages and
  hands them to logmsg(), alter the latter to properly forward all RFC
  5424 message attributes to fprintlog(). While there, make some minor
  cleanups to this code:
  
  - Instead of extending the existing code that compares hostnames and
message bodies for deduplication, print all of the relevant message
fields into a single string that we can compare ('saved').
  
  - No longer let the behaviour of fprintflog() depend on whether
'msg == NULL' to print repetition messages, Simply decompose this
function into fprintlog_first() and fprintlog_successive(). This
makes the interpretation of function arguments less magical and also
allows us to get consistent behaviour across RFC 3164 and 5424 when
adding support for the RFC 5424 output format.
  
  - As RFC 5424 syslog messages have a dedicated application name field,
alter the repetition messages to be printed on behalf of syslogd on
the current system. Change these messages to use the local hostname,
so that it's obvious which syslogd instance detected the repetition.
Remove f_prevhost, as it has now become unnecessary.
  
  - Remove a useless strdup(). Deconsting the message string is safe in
this specific case.

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Fri Apr  6 17:06:22 2018
(r332117)
+++ head/usr.sbin/syslogd/syslogd.c Fri Apr  6 17:16:50 2018
(r332118)
@@ -252,7 +252,6 @@ struct filed {
 #definefu_pipe_pid f_un.f_pipe.f_pid
charf_prevline[MAXSVLINE];  /* last message logged */
struct logtime f_lasttime;  /* time of last occurrence */
-   charf_prevhost[MAXHOSTNAMELEN]; /* host from which recd. */
int f_prevpri;  /* pri of f_prevline */
size_t  f_prevlen;  /* length of f_prevline */
int f_prevcount;/* repetition cnt of prevline */
@@ -385,7 +384,9 @@ static void die(int) __dead2;
 static voiddodie(int);
 static voiddofsync(void);
 static voiddomark(int);
-static voidfprintlog(struct filed *, int, const char *);
+static voidfprintlog_first(struct filed *, const char *, const char *,
+const char *, const char *, const char *, const char *, int);
+static voidfprintlog_successive(struct filed *, int);
 static voidinit(int);
 static voidlogerror(const char *);
 static voidlogmsg(int, const struct logtime *, const char *, const char *,
@@ -1411,19 +1412,19 @@ skip_message(const char *name, const char *spec, int c
  * STRUCTURED-DATA fields are thus discarded for the time being.
  */
 static void
-logmsg(int pri, const struct logtime *timestamp, const char *from,
-const char *app_name, const char *procid, const char *msgid __unused,
-const char *structured_data __unused, const char *msg, int flags)
+logmsg(int pri, const struct logtime *timestamp, const char *hostname,
+const char *app_name, const char *procid, const char *msgid,
+const char *structured_data, const char *msg, int flags)
 {
struct timeval tv;
struct logtime timestamp_now;
struct filed *f;
-   size_t msglen;
+   size_t savedlen;
int fac, prilev;
-   char buf[MAXLINE+1];
+   char saved[MAXSVLINE];
 
dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n",
-   pri, flags, from, msg);
+   pri, flags, hostname, msg);
 
(void)gettimeofday(, NULL);
now = tv.tv_sec;
@@ -1445,18 +1446,6 @@ logmsg(int pri, const struct logtime *timestamp, const
 
prilev = LOG_PRI(pri);
 
-   /* Prepend the application name to the message if provided. */
-   if (app_name != NULL) {
-   if (procid != NULL)
-   msglen = snprintf(buf, sizeof(buf), "%s[%s]: %s",
-   app_name, procid, msg);
-   else
-   msglen = snprintf(buf, sizeof(buf), "%s: %s",
-   app_name, msg);
-   msg = buf;
-   } else
-   msglen = strlen(msg);
-
/* log the message to the particular outputs */
if (!Initialized) {
f = 
@@ -1468,12 +1457,27 @@ logmsg(int pri, const struct logtime *timestamp, const
 
if (f->f_file >= 0) {
f->f_lasttime = *timestamp;
-   fprintlog(f, flags, msg);
+   fprintlog_first(f, hostname, app_name, procid, msgid,
+   structured_data, msg, flags);
 

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

2018-04-06 Thread Jonathan T. Looney
Author: jtl
Date: Fri Apr  6 17:06:22 2018
New Revision: 332117
URL: https://svnweb.freebsd.org/changeset/base/332117

Log:
  Pat the watchdog less while producing a coredump.  Prior to this change,
  we patted the watchdog approximately once per 4KB page of memory.  After
  this change, we pat the watchdog approximately once per 128MB of memory.
  On a sample machine, this translated to patting the watchdog approximately
  every 5.4 seconds, which "seems reasonable". We can choose a different
  value in the future, if warranted.
  
  This has extensive field experience. It is a performance improvement, and
  has not caused any known problems.
  
  Reviewed by:  imp, kib
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D14988

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

Modified: head/sys/amd64/amd64/minidump_machdep.c
==
--- head/sys/amd64/amd64/minidump_machdep.c Fri Apr  6 17:04:21 2018
(r332116)
+++ head/sys/amd64/amd64/minidump_machdep.c Fri Apr  6 17:06:22 2018
(r332117)
@@ -62,7 +62,7 @@ static struct kerneldumpheader kdh;
 /* Handle chunked writes. */
 static size_t fragsz;
 static void *dump_va;
-static size_t counter, progress, dumpsize;
+static size_t counter, progress, dumpsize, wdog_next;
 
 CTASSERT(sizeof(*vm_page_dump) == 8);
 static int dump_retry_count = 5;
@@ -134,6 +134,9 @@ report_progress(size_t progress, size_t dumpsize)
}
 }
 
+/* Pat the watchdog approximately every 128MB of the dump. */
+#defineWDOG_DUMP_INTERVAL  (128 * 1024 * 1024)
+
 static int
 blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
 {
@@ -173,9 +176,14 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t
report_progress(progress, dumpsize);
counter &= (1<<24) - 1;
}
+   if (progress <= wdog_next) {
+   wdog_kern_pat(WD_LASTVAL);
+   if (wdog_next > WDOG_DUMP_INTERVAL)
+   wdog_next -= WDOG_DUMP_INTERVAL;
+   else
+   wdog_next = 0;
+   }
 
-   wdog_kern_pat(WD_LASTVAL);
-
if (ptr) {
error = dump_append(di, ptr, 0, len);
if (error)
@@ -313,7 +321,7 @@ minidumpsys(struct dumperinfo *di)
}
dumpsize += PAGE_SIZE;
 
-   progress = dumpsize;
+   wdog_next = progress = dumpsize;
 
/* Initialize mdhdr */
bzero(, sizeof(mdhdr));
___
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: r332116 - in stable/11: etc/mtree stand/defaults

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 17:04:21 2018
New Revision: 332116
URL: https://svnweb.freebsd.org/changeset/base/332116

Log:
  MFC r331212,r331213: Move /boot/overlays to /boot/dtb/overlays
  
  r331212: Move /boot/overlays to /boot/dtb/overlays
  
  The former is fairly vague; these are FDT overlays to be applied to the
  running system, so /boot/dtb is a sensible location to put it without
  cluttering up /boot/dtb even further if desired.
  
  r331213: Amend missed reference to /boot/overlays

Modified:
  stable/11/etc/mtree/BSD.root.dist
  stable/11/stand/defaults/loader.conf
  stable/11/stand/defaults/loader.conf.5
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/mtree/BSD.root.dist
==
--- stable/11/etc/mtree/BSD.root.dist   Fri Apr  6 16:59:58 2018
(r332115)
+++ stable/11/etc/mtree/BSD.root.dist   Fri Apr  6 17:04:21 2018
(r332116)
@@ -11,14 +11,14 @@
 defaults
 ..
 dtb
+overlays  tags=package=runtime
+..
 ..
 firmware
 ..
 kernel
 ..
 modules
-..
-overlays  tags=package=runtime
 ..
 zfs
 ..

Modified: stable/11/stand/defaults/loader.conf
==
--- stable/11/stand/defaults/loader.confFri Apr  6 16:59:58 2018
(r332115)
+++ stable/11/stand/defaults/loader.confFri Apr  6 17:04:21 2018
(r332116)
@@ -80,7 +80,7 @@ bootenv_autolist="YES"# Auto populate the 
list of ZF
 #comconsole_speed="9600"   # Set the current serial console speed
 #console="vidconsole"  # A comma separated list of console(s)
 #currdev="disk1s1a"# Set the current device
-module_path="/boot/modules;/boot/dtb;/boot/overlays"   # Set the module search 
path
+module_path="/boot/modules;/boot/dtb;/boot/dtb/overlays"   # Set the 
module search path
 #prompt="\\${interpret}"   # Set the command prompt
 #root_disk_unit="0"# Force the root disk unit number
 #rootdev="disk1s1a"# Set the root filesystem

Modified: stable/11/stand/defaults/loader.conf.5
==
--- stable/11/stand/defaults/loader.conf.5  Fri Apr  6 16:59:58 2018
(r332115)
+++ stable/11/stand/defaults/loader.conf.5  Fri Apr  6 17:04:21 2018
(r332116)
@@ -284,7 +284,7 @@ that have no default value:
 .Bl -tag -width bootfile -offset indent
 .It Va fdt_overlays
 Specifies a comma-delimited list of FDT overlays to apply.
-.Pa /boot/overlays
+.Pa /boot/dtb/overlays
 is created by default for overlays to be placed in.
 .It Va kernels_autodetect
 If set to
___
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: r332115 - in stable/11/stand: . arm/loader defaults forth mips/uboot

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 16:59:58 2018
New Revision: 332115
URL: https://svnweb.freebsd.org/changeset/base/332115

Log:
  MFC r330005-r330007, r330021, r330029, r330622, r331207: Solo loader.conf(5)
  
  r330005:
  Go back to one loader.conf
  
  We really only need one loader.conf. The other loader.conf was created
  because the current one took forever to parse in FORTH. That will be
  fixed in the next commit.
  
  r330006:
  Take a meat cleaver to defaults/loader.conf
  
  Remove almost all of the _load=XXX options (kept only those relevant
  to splash screens, since there were other settings).
  Remove the excessively cutesy comment blocks.
  Remove excessive comments and replace with similar content
  Remove gratuitous blank lines (while leaving some)
  
  We have too many modules to list them all here. There's no purpose in
  doing so and it's a giant hassle to maintain. In addition the extra
  ~500 lines slow this down on small platforms. It slowed it down
  so much small platforms forked, which caused other issues...
  This is a compromise between those two extremes.
  
  r330007:
  loader.conf is loader agnostic, so remove 4th references.
  
  r330021:
  These two directories build man pages, so it's incorrect to tag them
  NO_OBJ. Also, make sure the loader.conf.5 man gets built and installed.
  
  r330029:
  Fix a typo: "now" -> "no".
  
  r330622:
  loader.conf(5): Document some other settings
  
  These tend to have less coverage in other places and they don't have
  defaults as of yet, so mention them here:
  - fdt_overlays
  - kernels_autodetect (lualoader only)
  
  r331207:
  loader.conf: remove obsolete non-x86 beastie menu statement
  
  As of r330005 the same loader.conf defaults are used on all platforms.

Added:
  stable/11/stand/defaults/
 - copied from r330007, head/stand/defaults/
Deleted:
  stable/11/stand/arm/loader/loader.conf
  stable/11/stand/forth/loader.conf
  stable/11/stand/forth/loader.conf.5
  stable/11/stand/mips/uboot/loader.conf
Modified:
  stable/11/stand/Makefile
  stable/11/stand/defaults/Makefile
  stable/11/stand/defaults/loader.conf
  stable/11/stand/defaults/loader.conf.5
  stable/11/stand/forth/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/Makefile
==
--- stable/11/stand/MakefileFri Apr  6 16:48:11 2018(r332114)
+++ stable/11/stand/MakefileFri Apr  6 16:59:58 2018(r332115)
@@ -9,6 +9,7 @@ SUBDIR+=ficl
 SUBDIR+=   forth
 .endif
 
+SUBDIR+=   defaults
 SUBDIR+=   man
 
 .include 

Modified: stable/11/stand/defaults/Makefile
==
--- head/stand/defaults/MakefileMon Feb 26 03:16:57 2018
(r330007)
+++ stable/11/stand/defaults/Makefile   Fri Apr  6 16:59:58 2018
(r332115)
@@ -1,11 +1,9 @@
 # $FreeBSD$
 
-NO_OBJ=t
-
 .include 
 
 FILES+=loader.conf
-FILES+= loader.conf.5
+MAN+=  loader.conf.5
 
 FILESDIR_loader.conf=  /boot/defaults
 

Modified: stable/11/stand/defaults/loader.conf
==
--- head/stand/defaults/loader.conf Mon Feb 26 03:16:57 2018
(r330007)
+++ stable/11/stand/defaults/loader.confFri Apr  6 16:59:58 2018
(r332115)
@@ -69,7 +69,7 @@ acpi_video_load="NO"  # Load the ACPI video extension 
 #loader_delay="3"  # Delay in seconds before loading anything.
# Default is unset and disabled (no delay).
 #autoboot_delay="10"   # Delay in seconds before autobooting,
-   # -1 for now user interrupts, NO to disable
+   # -1 for no user interrupts, NO to disable
 #password=""   # Prevent changes to boot options
 #bootlock_password=""  # Prevent booting (see check-password.4th(8))
 #geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root

Modified: stable/11/stand/defaults/loader.conf.5
==
--- head/stand/defaults/loader.conf.5   Mon Feb 26 03:16:57 2018
(r330007)
+++ stable/11/stand/defaults/loader.conf.5  Fri Apr  6 16:59:58 2018
(r332115)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd January 6, 2016
+.Dd March 19, 2018
 .Dt LOADER.CONF 5
 .Os
 .Sh NAME
@@ -249,7 +249,6 @@ be displayed.
 If set to
 .Dq YES ,
 the beastie boot menu will be skipped.
-The beastie boot menu is always skipped if running non-x86 hardware.
 .It Va loader_logo Pq Dq Li orbbw
 Selects a desired logo in the beastie boot menu.
 Possible values are:
@@ -277,6 +276,23 @@ See the entropy entries in
 .Pq Dq /boot/entropy
 The name of the very early
 boot-time entropy cache file.
+.El
+.Sh OTHER SETTINGS
+Other settings 

svn commit: r332114 - head/sys/netinet

2018-04-06 Thread Jonathan T. Looney
Author: jtl
Date: Fri Apr  6 16:48:11 2018
New Revision: 332114
URL: https://svnweb.freebsd.org/changeset/base/332114

Log:
  Check that in_pcbfree() is only called once for each PCB.  If that
  assumption is violated, "bad things" could follow.
  
  I believe such an assert would have detected some of the problems jch@
  was chasing in PR 203175 (see r307551).  We also use it in our internal
  TCP development efforts.  And, in case a bug does slip through to
  released code, this change silently ignores subsequent calls to
  in_pcbfree().
  
  Reviewed by:  rrs
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D14990

Modified:
  head/sys/netinet/in_pcb.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Fri Apr  6 16:48:07 2018(r332113)
+++ head/sys/netinet/in_pcb.c   Fri Apr  6 16:48:11 2018(r332114)
@@ -1288,6 +1288,13 @@ in_pcbfree(struct inpcb *inp)
 
KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
 
+   KASSERT((inp->inp_flags2 & INP_FREED) == 0,
+   ("%s: called twice for pcb %p", __func__, inp));
+   if (inp->inp_flags2 & INP_FREED) {
+   INP_WUNLOCK(inp);
+   return;
+   }
+
 #ifdef INVARIANTS
if (pcbinfo == _tcbinfo) {
INP_INFO_LOCK_ASSERT(pcbinfo);
___
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: r332113 - in stable/11/sys/modules: i2c/iicbus i2c/isl spi/at45d spi/mx25l spi/spibus

2018-04-06 Thread Ian Lepore
Author: ian
Date: Fri Apr  6 16:48:07 2018
New Revision: 332113
URL: https://svnweb.freebsd.org/changeset/base/332113

Log:
  MFC r331868:
  
  Add opt_platform.h for several modules that have #ifdef FDT in the source.
  
  Submitted by: Andre Albsmeier 
  
  PR:   227322 227323

Modified:
  stable/11/sys/modules/i2c/iicbus/Makefile
  stable/11/sys/modules/i2c/isl/Makefile
  stable/11/sys/modules/spi/at45d/Makefile
  stable/11/sys/modules/spi/mx25l/Makefile
  stable/11/sys/modules/spi/spibus/Makefile

Modified: stable/11/sys/modules/i2c/iicbus/Makefile
==
--- stable/11/sys/modules/i2c/iicbus/Makefile   Fri Apr  6 16:45:00 2018
(r332112)
+++ stable/11/sys/modules/i2c/iicbus/Makefile   Fri Apr  6 16:48:07 2018
(r332113)
@@ -13,6 +13,7 @@ SRCS= \
iicbus_if.h \
iiconf.c \
iiconf.h \
+   opt_platform.h \
 
 .if !empty(OPT_FDT)
 SRCS+= ofw_iicbus.c ofw_bus_if.h

Modified: stable/11/sys/modules/i2c/isl/Makefile
==
--- stable/11/sys/modules/i2c/isl/Makefile  Fri Apr  6 16:45:00 2018
(r332112)
+++ stable/11/sys/modules/i2c/isl/Makefile  Fri Apr  6 16:48:07 2018
(r332113)
@@ -2,6 +2,6 @@
 
 .PATH: ${SRCTOP}/sys/dev/isl
 KMOD   = isl
-SRCS   = isl.c device_if.h bus_if.h iicbus_if.h
+SRCS   = isl.c device_if.h bus_if.h iicbus_if.h opt_platform.h
 
 .include 

Modified: stable/11/sys/modules/spi/at45d/Makefile
==
--- stable/11/sys/modules/spi/at45d/MakefileFri Apr  6 16:45:00 2018
(r332112)
+++ stable/11/sys/modules/spi/at45d/MakefileFri Apr  6 16:48:07 2018
(r332113)
@@ -9,6 +9,7 @@ SRCS=   at45d.c
 SRCS+= \
bus_if.h \
device_if.h \
+   opt_platform.h \
spibus_if.h \
 
 .if !empty(OPT_FDT)

Modified: stable/11/sys/modules/spi/mx25l/Makefile
==
--- stable/11/sys/modules/spi/mx25l/MakefileFri Apr  6 16:45:00 2018
(r332112)
+++ stable/11/sys/modules/spi/mx25l/MakefileFri Apr  6 16:48:07 2018
(r332113)
@@ -9,6 +9,7 @@ SRCS=   mx25l.c
 SRCS+= \
bus_if.h \
device_if.h \
+   opt_platform.h \
spibus_if.h \
 
 .if !empty(OPT_FDT)

Modified: stable/11/sys/modules/spi/spibus/Makefile
==
--- stable/11/sys/modules/spi/spibus/Makefile   Fri Apr  6 16:45:00 2018
(r332112)
+++ stable/11/sys/modules/spi/spibus/Makefile   Fri Apr  6 16:48:07 2018
(r332113)
@@ -13,6 +13,7 @@ SRCS+=ofw_spibus.c ofw_bus_if.h
 SRCS+= \
bus_if.h \
device_if.h \
+   opt_platform.h \
spibus_if.c \
spibus_if.h \
 
___
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: r332112 - stable/11/usr.bin/dtc

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 16:45:00 2018
New Revision: 332112
URL: https://svnweb.freebsd.org/changeset/base/332112

Log:
  MFC r320160: dtc: Update to upstream 917526
  
  - Add missing "typename" in divmod's  "using" of
binary_operator_base::result.

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

Modified: stable/11/usr.bin/dtc/input_buffer.cc
==
--- stable/11/usr.bin/dtc/input_buffer.cc   Fri Apr  6 16:26:46 2018
(r332111)
+++ stable/11/usr.bin/dtc/input_buffer.cc   Fri Apr  6 16:45:00 2018
(r332112)
@@ -698,7 +698,7 @@ template
 struct divmod : public binary_operator<5, T>
 {
using binary_operator<5, T>::binary_operator;
-   using binary_operator_base::result;
+   using typename binary_operator_base::result;
result operator()() override
{
result r = (*binary_operator_base::rhs)();
___
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: r332111 - head/usr.sbin/syslogd

2018-04-06 Thread Ed Schouten
Author: ed
Date: Fri Apr  6 16:26:46 2018
New Revision: 332111
URL: https://svnweb.freebsd.org/changeset/base/332111

Log:
  Remove some places where error messages are prefixed with "syslogd".
  
  Due to using RFC 5424, the application name is stored in a dedicated
  field. It can simply be passed as an argument to logmsg() now.

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Fri Apr  6 16:24:03 2018
(r332110)
+++ head/usr.sbin/syslogd/syslogd.c Fri Apr  6 16:26:46 2018
(r332111)
@@ -1991,7 +1991,7 @@ domark(int signo __unused)
  * Print syslogd errors some place.
  */
 static void
-logerror(const char *type)
+logerror(const char *msg)
 {
char buf[512];
static int recursed = 0;
@@ -2000,15 +2000,15 @@ logerror(const char *type)
if (recursed)
return;
recursed++;
-   if (errno)
-   (void)snprintf(buf,
-   sizeof buf, "syslogd: %s: %s", type, strerror(errno));
-   else
-   (void)snprintf(buf, sizeof buf, "syslogd: %s", type);
+   if (errno != 0) {
+   (void)snprintf(buf, sizeof(buf), "%s: %s", msg,
+   strerror(errno));
+   msg = buf;
+   }
errno = 0;
dprintf("%s\n", buf);
-   logmsg(LOG_SYSLOG|LOG_ERR, NULL, LocalHostName, NULL, NULL, NULL,
-   NULL, buf, 0);
+   logmsg(LOG_SYSLOG|LOG_ERR, NULL, LocalHostName, "syslogd", NULL, NULL,
+   NULL, msg, 0);
recursed--;
 }
 
@@ -2355,18 +2355,18 @@ init(int signo)
}
}
 
-   logmsg(LOG_SYSLOG|LOG_INFO, NULL, LocalHostName, NULL, NULL, NULL,
-   NULL, "syslogd: restart", 0);
+   logmsg(LOG_SYSLOG | LOG_INFO, NULL, LocalHostName, "syslogd", NULL,
+   NULL, NULL, "restart", 0);
dprintf("syslogd: restarted\n");
/*
 * Log a change in hostname, but only on a restart.
 */
if (signo != 0 && strcmp(oldLocalHostName, LocalHostName) != 0) {
(void)snprintf(hostMsg, sizeof(hostMsg),
-   "syslogd: hostname changed, \"%s\" to \"%s\"",
+   "hostname changed, \"%s\" to \"%s\"",
oldLocalHostName, LocalHostName);
-   logmsg(LOG_SYSLOG|LOG_INFO, NULL, LocalHostName, NULL, NULL,
-   NULL, NULL, hostMsg, 0);
+   logmsg(LOG_SYSLOG | LOG_INFO, NULL, LocalHostName, "syslogd",
+   NULL, NULL, NULL, hostMsg, 0);
dprintf("%s\n", hostMsg);
}
/*
@@ -2375,9 +2375,9 @@ init(int signo)
 */
if (signo == 0 && !use_bootfile) {
(void)snprintf(bootfileMsg, sizeof(bootfileMsg),
-   "syslogd: kernel boot file is %s", bootfile);
-   logmsg(LOG_KERN|LOG_INFO, NULL, LocalHostName, NULL, NULL,
-   NULL, NULL, bootfileMsg, 0);
+   "kernel boot file is %s", bootfile);
+   logmsg(LOG_KERN | LOG_INFO, NULL, LocalHostName, "syslogd",
+   NULL, NULL, NULL, bootfileMsg, 0);
dprintf("%s\n", bootfileMsg);
}
 }
___
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: r332110 - head/usr.sbin/syslogd

2018-04-06 Thread Ed Schouten
Author: ed
Date: Fri Apr  6 16:24:03 2018
New Revision: 332110
URL: https://svnweb.freebsd.org/changeset/base/332110

Log:
  Properly respect the passed in hostname for RFC 5424 messages.
  
  Only override the hostname in case none is provided or when remote
  hostnames should be ignored.

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Fri Apr  6 16:22:14 2018
(r332109)
+++ head/usr.sbin/syslogd/syslogd.c Fri Apr  6 16:24:03 2018
(r332110)
@@ -1028,6 +1028,8 @@ parsemsg_rfc5424(const char *from, int pri, char *msg)
msg[-1] = '\0'; \
}
PARSE_STRING("HOSTNAME", hostname);
+   if (hostname == NULL || !RemoteHostname)
+   hostname = from;
PARSE_STRING("APP-NAME", app_name);
PARSE_STRING("PROCID", procid);
PARSE_STRING("MSGID", msgid);
@@ -1079,7 +1081,7 @@ parsemsg_rfc5424(const char *from, int pri, char *msg)
 #undef IF_NOT_NILVALUE
 
parsemsg_remove_unsafe_characters(msg, line, sizeof(line));
-   logmsg(pri, timestamp, from, app_name, procid, msgid,
+   logmsg(pri, timestamp, hostname, app_name, procid, msgid,
structured_data, line, 0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r332109 - in head/sys: amd64/amd64 x86/x86

2018-04-06 Thread Roger Pau Monné
Author: royger
Date: Fri Apr  6 16:22:14 2018
New Revision: 332109
URL: https://svnweb.freebsd.org/changeset/base/332109

Log:
  x86: fix trampoline memory allocation after r332073
  
  Add the missing breaks in the for loops, in order to exit the loop
  when a suitable entry is found.
  
  Also switch amd64 native_start_all_aps to use PHYS_TO_DMAP in order to
  find the virtual address of the boot_trampoline and the initial page
  tables.
  
  Reported and tested by:   pho
  Sponsored by: Citrix Systems R

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 15:57:20 2018
(r332108)
+++ head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 16:22:14 2018
(r332109)
@@ -128,6 +128,7 @@ mp_bootaddress(vm_paddr_t *physmap, unsigned int *phys
sizeof(*physmap) * (*physmap_idx - i + 2));
*physmap_idx -= 2;
}
+   break;
}
 
if (!allocated) {
@@ -336,7 +337,6 @@ init_secondary(void)
 int
 native_start_all_aps(void)
 {
-   vm_offset_t va = boot_address + KERNBASE;
u_int64_t *pt4, *pt3, *pt2;
u_int32_t mpbioswarmvec;
int apic_id, cpu, i;
@@ -344,13 +344,11 @@ native_start_all_aps(void)
 
mtx_init(_boot_mtx, "ap boot", NULL, MTX_SPIN);
 
-   /* install the AP 1st level boot code */
-   pmap_kenter(va, boot_address);
-   pmap_invalidate_page(kernel_pmap, va);
-   bcopy(mptramp_start, (void *)va, bootMP_size);
+   /* copy the AP 1st level boot code */
+   bcopy(mptramp_start, (void *)PHYS_TO_DMAP(boot_address), bootMP_size);
 
/* Locate the page tables, they'll be below the trampoline */
-   pt4 = (u_int64_t *)(uintptr_t)(mptramp_pagetables + KERNBASE);
+   pt4 = (uint64_t *)PHYS_TO_DMAP(mptramp_pagetables);
pt3 = pt4 + (PAGE_SIZE) / sizeof(u_int64_t);
pt2 = pt3 + (PAGE_SIZE) / sizeof(u_int64_t);
 

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Apr  6 15:57:20 2018(r332108)
+++ head/sys/x86/x86/mp_x86.c   Fri Apr  6 16:22:14 2018(r332109)
@@ -947,6 +947,7 @@ alloc_ap_trampoline(vm_paddr_t *physmap, unsigned int 
sizeof(*physmap) * (*physmap_idx - i + 2));
*physmap_idx -= 2;
}
+   break;
}
 
if (!allocated) {
___
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: r332092 - in head/sys: amd64/amd64 sys x86/x86

2018-04-06 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: royger
> Date: Fri Apr  6 11:20:06 2018
> New Revision: 332092
> URL: https://svnweb.freebsd.org/changeset/base/332092
> 
> Log:
>   remove GiB/MiB macros from param.h
>   
>   And instead define them in the files where they are used.

It would of been better to "revert" your prior change and
make a seperate new commit.  It is rarely desireable to combine
a revert of a change with anything.


>   Requested by: bde
> 
> Modified:
>   head/sys/amd64/amd64/mp_machdep.c
>   head/sys/sys/param.h
>   head/sys/x86/x86/mp_x86.c
> 
> Modified: head/sys/amd64/amd64/mp_machdep.c
...

-- 
Rod Grimes rgri...@freebsd.org
___
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: r332108 - head/tests/sys/netpfil/pf/ioctl

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 15:57:20 2018
New Revision: 332108
URL: https://svnweb.freebsd.org/changeset/base/332108

Log:
  pf tests: Basic ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, 
DIOCRCLRTSTATS and DIOCRSETTFLAGS
  
  Validate the DIOCRGETTABLES, DIOCRGETTSTATS, DIOCRCLRTSTATS and
  DIOCRSETTFLAGS ioctls with invalid values. These may succeed (because
  the kernel uses the minimally required size, not the specified size),
  but should not trigger kernel panics.
  
  MFC after:1 week

Modified:
  head/tests/sys/netpfil/pf/ioctl/validation.c

Modified: head/tests/sys/netpfil/pf/ioctl/validation.c
==
--- head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 15:54:30 
2018(r332107)
+++ head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 15:57:20 
2018(r332108)
@@ -51,6 +51,16 @@ static int dev;
 #define COMMON_CLEANUP() \
close(dev);
 
+void
+common_init_tbl(struct pfr_table *tbl)
+{
+   bzero(tbl, sizeof(struct pfr_table));
+   strcpy(tbl->pfrt_anchor, "anchor");
+   strcpy(tbl->pfrt_name, "name");
+   tbl->pfrt_flags = 0;
+   tbl->pfrt_fback = 0;
+}
+
 ATF_TC_WITHOUT_HEAD(addtables);
 ATF_TC_BODY(addtables, tc)
 {
@@ -121,10 +131,138 @@ ATF_TC_BODY(deltables, tc)
COMMON_CLEANUP();
 }
 
+ATF_TC_WITHOUT_HEAD(gettables);
+ATF_TC_BODY(gettables, tc)
+{
+   struct pfioc_table io;
+   struct pfr_table tbl;
+   int flags;
+
+   COMMON_HEAD();
+
+   flags = 0;
+
+   bzero(, sizeof(io));
+   io.pfrio_flags = flags;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(tbl);
+
+   /* Negative size. This will succeed, because the kernel will not copy
+* tables than it has. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRGETTABLES, ) != 0)
+   atf_tc_fail("Request with size -1 failed");
+
+   /* Overly large size. See above. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRGETTABLES, ) != 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(gettstats);
+ATF_TC_BODY(gettstats, tc)
+{
+   struct pfioc_table io;
+   struct pfr_tstats stats;
+   int flags;
+
+   COMMON_HEAD();
+
+   flags = 0;
+
+   bzero(, sizeof(io));
+   io.pfrio_flags = flags;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(stats);
+
+   /* Negative size. This will succeed, because the kernel will not copy
+* tables than it has. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRGETTSTATS, ) != 0)
+   atf_tc_fail("Request with size -1 failed");
+
+   /* Overly large size. See above. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRGETTSTATS, ) != 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(clrtstats);
+ATF_TC_BODY(clrtstats, tc)
+{
+   struct pfioc_table io;
+   struct pfr_table tbl;
+   int flags;
+
+   COMMON_HEAD();
+
+   flags = 0;
+
+   common_init_tbl();
+
+   bzero(, sizeof(io));
+   io.pfrio_flags = flags;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(tbl);
+
+   /* Negative size. This will succeed, because the kernel will not copy
+* tables than it has. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRCLRTSTATS, ) != 0)
+   atf_tc_fail("Request with size -1 failed ");
+
+   /* Overly large size. See above. */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRCLRTSTATS, ) != 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
+ATF_TC_WITHOUT_HEAD(settflags);
+ATF_TC_BODY(settflags, tc)
+{
+   struct pfioc_table io;
+   struct pfr_table tbl;
+   int flags;
+
+   COMMON_HEAD();
+
+   flags = 0;
+
+   common_init_tbl();
+
+   bzero(, sizeof(io));
+   io.pfrio_flags = flags;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(tbl);
+
+   /* Negative size. This will succeed, because the kernel will not copy
+* tables than it has. */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRSETTFLAGS, ) != 0)
+   atf_tc_fail("Request with size -1 failed");
+
+   /* Overly large size. See above. */
+   io.pfrio_size = 1 << 28;
+   if (ioctl(dev, DIOCRSETTFLAGS, ) != 0)
+   atf_tc_fail("Request with size 1 << 24 failed");
+
+   COMMON_CLEANUP();
+}
+
 ATF_TP_ADD_TCS(tp)
 {
ATF_TP_ADD_TC(tp, addtables);
ATF_TP_ADD_TC(tp, deltables);
+   ATF_TP_ADD_TC(tp, gettables);
+   ATF_TP_ADD_TC(tp, gettstats);
+   ATF_TP_ADD_TC(tp, clrtstats);
+   ATF_TP_ADD_TC(tp, settflags);
 
return (atf_no_error());
 }
___
svn-src-all@freebsd.org mailing list

svn commit: r332107 - in head/sys: net netpfil/pf

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 15:54:30 2018
New Revision: 332107
URL: https://svnweb.freebsd.org/changeset/base/332107

Log:
  pf: Improve ioctl validation for DIOCRGETTABLES, DIOCRGETTSTATS, 
DIOCRCLRTSTATS and DIOCRSETTFLAGS
  
  These ioctls can process a number of items at a time, which puts us at
  risk of overflow in mallocarray() and of impossibly large allocations
  even if we don't overflow.
  
  Limit the allocation to required size (or the user allocation, if that's
  smaller). That does mean we need to do the allocation with the rules
  lock held (so the number doesn't change while we're doing this), so it
  can't M_WAITOK.
  
  MFC after:1 week

Modified:
  head/sys/net/pfvar.h
  head/sys/netpfil/pf/pf_ioctl.c
  head/sys/netpfil/pf/pf_table.c

Modified: head/sys/net/pfvar.h
==
--- head/sys/net/pfvar.hFri Apr  6 15:19:48 2018(r332106)
+++ head/sys/net/pfvar.hFri Apr  6 15:54:30 2018(r332107)
@@ -1638,6 +1638,7 @@ void  pfr_detach_table(struct pfr_ktable *);
 intpfr_clr_tables(struct pfr_table *, int *, int);
 intpfr_add_tables(struct pfr_table *, int, int *, int);
 intpfr_del_tables(struct pfr_table *, int, int *, int);
+intpfr_table_count(struct pfr_table *, int);
 intpfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int);
 intpfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int);
 intpfr_clr_tstats(struct pfr_table *, int, int *, int);

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 15:19:48 2018
(r332106)
+++ head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 15:54:30 2018
(r332107)
@@ -2588,20 +2588,25 @@ DIOCCHANGEADDR_error:
case DIOCRGETTABLES: {
struct pfioc_table *io = (struct pfioc_table *)addr;
struct pfr_table *pfrts;
-   size_t totlen;
+   size_t totlen, n;
 
if (io->pfrio_esize != sizeof(struct pfr_table)) {
error = ENODEV;
break;
}
+   PF_RULES_RLOCK();
+   n = pfr_table_count(>pfrio_table, io->pfrio_flags);
+   io->pfrio_size = min(io->pfrio_size, n);
+
totlen = io->pfrio_size * sizeof(struct pfr_table);
+
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   M_TEMP, M_WAITOK);
-   if (! pfrts) {
+   M_TEMP, M_NOWAIT);
+   if (pfrts == NULL) {
error = ENOMEM;
+   PF_RULES_RUNLOCK();
break;
}
-   PF_RULES_RLOCK();
error = pfr_get_tables(>pfrio_table, pfrts,
>pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL);
PF_RULES_RUNLOCK();
@@ -2614,20 +2619,24 @@ DIOCCHANGEADDR_error:
case DIOCRGETTSTATS: {
struct pfioc_table *io = (struct pfioc_table *)addr;
struct pfr_tstats *pfrtstats;
-   size_t totlen;
+   size_t totlen, n;
 
if (io->pfrio_esize != sizeof(struct pfr_tstats)) {
error = ENODEV;
break;
}
+   PF_RULES_WLOCK();
+   n = pfr_table_count(>pfrio_table, io->pfrio_flags);
+   io->pfrio_size = min(io->pfrio_size, n);
+
totlen = io->pfrio_size * sizeof(struct pfr_tstats);
pfrtstats = mallocarray(io->pfrio_size,
-   sizeof(struct pfr_tstats), M_TEMP, M_WAITOK);
-   if (! pfrtstats) {
+   sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT);
+   if (pfrtstats == NULL) {
error = ENOMEM;
+   PF_RULES_WUNLOCK();
break;
}
-   PF_RULES_WLOCK();
error = pfr_get_tstats(>pfrio_table, pfrtstats,
>pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL);
PF_RULES_WUNLOCK();
@@ -2640,25 +2649,31 @@ DIOCCHANGEADDR_error:
case DIOCRCLRTSTATS: {
struct pfioc_table *io = (struct pfioc_table *)addr;
struct pfr_table *pfrts;
-   size_t totlen;
+   size_t totlen, n;
 
if (io->pfrio_esize != sizeof(struct pfr_table)) {
error = ENODEV;
break;
}
+
+   PF_RULES_WLOCK();
+   n = pfr_table_count(>pfrio_table, io->pfrio_flags);
+   io->pfrio_size = min(io->pfrio_size, n);
+
totlen = io->pfrio_size * sizeof(struct pfr_table);
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   

svn commit: r332106 - head/stand/lua

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 15:19:48 2018
New Revision: 332106
URL: https://svnweb.freebsd.org/changeset/base/332106

Log:
  lualoader: Fix menu skipping with loader.conf(5) vars
  
  Earlier efforts to stop loading the menu broke the ability to skip the menu
  with, e.g., beastie_disable in loader.conf(5) as it was decided before
  configuration was read.
  
  Defer bringing in the menu module until we've loaded configuration so that
  we can make a more informed decision on whether the menu should be skipped
  or not.

Modified:
  head/stand/lua/loader.lua

Modified: head/stand/lua/loader.lua
==
--- head/stand/lua/loader.lua   Fri Apr  6 15:17:09 2018(r332105)
+++ head/stand/lua/loader.lua   Fri Apr  6 15:19:48 2018(r332106)
@@ -37,15 +37,17 @@ require("cli")
 local color = require("color")
 local core = require("core")
 local config = require("config")
-local menu
-if not core.isMenuSkipped() then
-   menu = require("menu")
-end
 local password = require("password")
+-- The menu module will be brought in after config has loaded if we actually
+-- need it.
+local menu
 
 try_include("local")
 
 config.load()
+if not core.isMenuSkipped() then
+   menu = require("menu")
+end
 if core.isUEFIBoot() then
loader.perform("efi-autoresizecons")
 end
___
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: r332105 - head/sys/arm/allwinner

2018-04-06 Thread Kyle Evans
Author: kevans
Date: Fri Apr  6 15:17:09 2018
New Revision: 332105
URL: https://svnweb.freebsd.org/changeset/base/332105

Log:
  aw_sid(4): Use prctl read for all reads when it's required
  
  It was later found that some operation on the OrangePi one will cause
  direct accesses to the eeprom to return wrong data again, so reading it all
  once via prctl at attach time is no longer sufficient.

Modified:
  head/sys/arm/allwinner/aw_sid.c

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Fri Apr  6 15:15:21 2018
(r332104)
+++ head/sys/arm/allwinner/aw_sid.c Fri Apr  6 15:17:09 2018
(r332105)
@@ -61,8 +61,11 @@ __FBSDID("$FreeBSD$");
 #defineSID_RDKEY   0x60
 
 #defineSID_SRAM0x200
-#defineSID_THERMAL_CALIB0  (SID_SRAM + 0x34)
-#defineSID_THERMAL_CALIB1  (SID_SRAM + 0x38)
+/* Offsets into efuse space, for convenience */
+#defineSID_THERMAL_CALIB0_OFF  (0x34)
+#defineSID_THERMAL_CALIB1_OFF  (0x38)
+#defineSID_THERMAL_CALIB0  (SID_SRAM + SID_THERMAL_CALIB0_OFF)
+#defineSID_THERMAL_CALIB1  (SID_SRAM + SID_THERMAL_CALIB1_OFF)
 
 #defineROOT_KEY_SIZE   4
 
@@ -116,6 +119,7 @@ static struct ofw_compat_data compat_data[] = {
 };
 
 struct aw_sid_softc {
+   device_tsid_dev;
struct resource *res;
struct aw_sid_conf  *sid_conf;
struct mtx  prctl_mtx;
@@ -135,6 +139,8 @@ enum sid_keys {
 #defineRD4(sc, reg)bus_read_4((sc)->res, (reg))
 #defineWR4(sc, reg, val)   bus_write_4((sc)->res, (reg), (val))
 
+#definePRCTL_RD4(sc, reg, val) aw_sid_prctl_read((sc)->sid_dev, (reg), 
(val))
+
 static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS);
 static int aw_sid_prctl_read(device_t dev, bus_size_t offset, uint32_t *val);
 
@@ -183,10 +189,9 @@ static int
 aw_sid_attach(device_t dev)
 {
struct aw_sid_softc *sc;
-   bus_size_t i;
-   uint32_t val;
 
sc = device_get_softc(dev);
+   sc->sid_dev = dev;
 
if (bus_alloc_resources(dev, aw_sid_spec, >res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");
@@ -197,19 +202,6 @@ aw_sid_attach(device_t dev)
sc->sid_conf = (struct aw_sid_conf *)ofw_bus_search_compatible(dev, 
compat_data)->ocd_data;
aw_sid_sc = sc;
 
-   /*
-* This set of reads is solely for working around a silicon bug on some
-* SoC that require a prctl read in order for direct register access to
-* return a non-garbled value. Hence, the values we read are simply
-* ignored.
-*/
-   if (sc->sid_conf->requires_prctl_read)
-   for (i = 0; i < sc->sid_conf->efuse_size; i += 4)
-   if (aw_sid_prctl_read(dev, i, ) != 0) {
-   device_printf(dev, "failed prctl read\n");
-   goto fail;
-   }
-
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "rootkey",
@@ -217,11 +209,6 @@ aw_sid_attach(device_t dev)
dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
 
return (0);
-
-fail:
-   bus_release_resources(dev, aw_sid_spec, >res);
-   mtx_destroy(>prctl_mtx);
-   return (ENXIO);
 }
 
 int
@@ -235,8 +222,13 @@ aw_sid_read_tscalib(uint32_t *calib0, uint32_t *calib1
if (!sc->sid_conf->has_thermal)
return (ENXIO);
 
-   *calib0 = RD4(sc, SID_THERMAL_CALIB0);
-   *calib1 = RD4(sc, SID_THERMAL_CALIB1);
+   if (sc->sid_conf->requires_prctl_read) {
+   PRCTL_RD4(sc, SID_THERMAL_CALIB0_OFF, calib0);
+   PRCTL_RD4(sc, SID_THERMAL_CALIB1_OFF, calib1);
+   } else {
+   *calib0 = RD4(sc, SID_THERMAL_CALIB0);
+   *calib1 = RD4(sc, SID_THERMAL_CALIB1);
+   }
 
return (0);
 }
@@ -254,7 +246,10 @@ aw_sid_get_rootkey(u_char *out)
return (ENXIO);
root_key_off = aw_sid_sc->sid_conf->rootkey_offset;
for (i = 0; i < ROOT_KEY_SIZE ; i++) {
-   tmp = RD4(aw_sid_sc, root_key_off + (i * 4));
+   if (sc->sid_conf->requires_prctl_read)
+   PRCTL_RD4(sc, (i * 4), );
+   else
+   tmp = RD4(aw_sid_sc, root_key_off + (i * 4));
be32enc([i * 4], tmp);
}
 
___
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: r332104 - head/sys/dev/ipmi

2018-04-06 Thread Jonathan T. Looney
Author: jtl
Date: Fri Apr  6 15:15:21 2018
New Revision: 332104
URL: https://svnweb.freebsd.org/changeset/base/332104

Log:
  In cases where an application issues certain IPMI commands at a high
  enough rate, the IPMI code can print large numbers of messages to the
  console, such as:
ipmi0: KCS: Failed to read completion code
ipmi0: KCS error: ff
ipmi0: KCS: Failed to read completion code
ipmi0: KCS error: ff
  
  These seem to be innocuous from a system standpoint, and the user-
  space code can deal with the failures. Therefore, suppress printing
  these messages to the console unless bootverbose is enabled.
  
  Obtained from:Netflix, Inc.

Modified:
  head/sys/dev/ipmi/ipmi_kcs.c

Modified: head/sys/dev/ipmi/ipmi_kcs.c
==
--- head/sys/dev/ipmi/ipmi_kcs.cFri Apr  6 15:09:30 2018
(r332103)
+++ head/sys/dev/ipmi/ipmi_kcs.cFri Apr  6 15:15:21 2018
(r332104)
@@ -150,7 +150,7 @@ kcs_error(struct ipmi_softc *sc)
 
/* Read error status */
data = INB(sc, KCS_DATA);
-   if (data != 0)
+   if (data != 0 && (data != 0xff || bootverbose))
device_printf(sc->ipmi_dev, "KCS error: %02x\n",
data);
 
@@ -416,8 +416,10 @@ kcs_polled_request(struct ipmi_softc *sc, struct ipmi_
 
/* Next we read the completion code. */
if (kcs_read_byte(sc, >ir_compcode) != 1) {
-   device_printf(sc->ipmi_dev,
-   "KCS: Failed to read completion code\n");
+   if (bootverbose) {
+   device_printf(sc->ipmi_dev,
+   "KCS: Failed to read completion code\n");
+   }
goto fail;
}
 #ifdef KCS_DEBUG
___
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: r332103 - stable/11/sys/compat/linuxkpi/common/src

2018-04-06 Thread Mark Johnston
Author: markj
Date: Fri Apr  6 15:09:30 2018
New Revision: 332103
URL: https://svnweb.freebsd.org/changeset/base/332103

Log:
  MFC r331934:
  Wrap long lines.

Modified:
  stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Fri Apr  6 
15:03:48 2018(r332102)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_schedule.c   Fri Apr  6 
15:09:30 2018(r332103)
@@ -267,7 +267,8 @@ linux_wait_event_common(wait_queue_head_t *wqh, wait_q
PHOLD(task->task_thread->td_proc);
sleepq_lock(task);
if (atomic_read(>state) != TASK_WAKING) {
-   ret = linux_add_to_sleepqueue(task, task, "wevent", timeout, 
state);
+   ret = linux_add_to_sleepqueue(task, task, "wevent", timeout,
+   state);
} else {
sleepq_release(task);
ret = 0;
@@ -300,7 +301,8 @@ linux_schedule_timeout(int timeout)
sleepq_lock(task);
state = atomic_read(>state);
if (state != TASK_WAKING) {
-   ret = linux_add_to_sleepqueue(task, task, "sched", timeout, 
state);
+   ret = linux_add_to_sleepqueue(task, task, "sched", timeout,
+   state);
} else {
sleepq_release(task);
ret = 0;
@@ -368,7 +370,8 @@ linux_wait_on_bit_timeout(unsigned long *word, int bit
break;
}
set_task_state(task, state);
-   ret = linux_add_to_sleepqueue(wchan, task, "wbit", timeout, 
state);
+   ret = linux_add_to_sleepqueue(wchan, task, "wbit", timeout,
+   state);
if (ret != 0)
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: r332102 - in head: etc/mtree tests/sys/netpfil/pf tests/sys/netpfil/pf/ioctl

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 15:03:48 2018
New Revision: 332102
URL: https://svnweb.freebsd.org/changeset/base/332102

Log:
  pf tests: Basic ioctl validation tests
  
  Validate the DIOCRADDTABLES and DIOCRDELTABLES ioctls with invalid size
  values. All of these requests should fail.
  
  MFC after:1 week

Added:
  head/tests/sys/netpfil/pf/ioctl/
  head/tests/sys/netpfil/pf/ioctl/Makefile   (contents, props changed)
  head/tests/sys/netpfil/pf/ioctl/validation.c   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/tests/sys/netpfil/pf/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Fri Apr  6 15:01:45 2018
(r332101)
+++ head/etc/mtree/BSD.tests.dist   Fri Apr  6 15:03:48 2018
(r332102)
@@ -742,6 +742,8 @@
 ..
 netpfil
 pf
+ioctl
+..
 ..
 ..
 opencrypto

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- head/tests/sys/netpfil/pf/Makefile  Fri Apr  6 15:01:45 2018
(r332101)
+++ head/tests/sys/netpfil/pf/Makefile  Fri Apr  6 15:03:48 2018
(r332102)
@@ -3,6 +3,7 @@
 PACKAGE=   tests
 
 TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf
+TESTS_SUBDIRS+=ioctl
 
 ATF_TESTS_SH+= pass_block \
forward \

Added: head/tests/sys/netpfil/pf/ioctl/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/ioctl/MakefileFri Apr  6 15:03:48 2018
(r332102)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=   ${TESTSBASE}/sys/netpfil/pf/ioctl
+
+ATF_TESTS_C += \
+   validation
+
+.include 

Added: head/tests/sys/netpfil/pf/ioctl/validation.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/ioctl/validation.cFri Apr  6 15:03:48 
2018(r332102)
@@ -0,0 +1,130 @@
+/*-
+ * Copyright (c) 2018  Kristof Provost 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+static int dev;
+
+#define COMMON_HEAD() \
+   if (modfind("pf") == -1) \
+   atf_tc_skip("pf not loaded"); \
+   dev = open("/dev/pf", O_RDWR); \
+   if (dev == -1) \
+   atf_tc_skip("Failed to open /dev/pf");
+
+#define COMMON_CLEANUP() \
+   close(dev);
+
+ATF_TC_WITHOUT_HEAD(addtables);
+ATF_TC_BODY(addtables, tc)
+{
+   struct pfioc_table io;
+   struct pfr_table tbl;
+   int flags;
+
+   COMMON_HEAD();
+
+   flags = 0;
+
+   bzero(, sizeof(io));
+   io.pfrio_flags = flags;
+   io.pfrio_buffer = 
+   io.pfrio_esize = sizeof(tbl);
+
+   /* Negative size */
+   io.pfrio_size = -1;
+   if (ioctl(dev, DIOCRADDTABLES, ) == 0)
+   atf_tc_fail("Request with size -1 succeeded");
+
+   /* Overly large size */
+   io.pfrio_size = 1 << 24;
+   if (ioctl(dev, DIOCRADDTABLES, ) == 0)
+   atf_tc_fail("Request with size 1 << 24 succeeded");
+
+   /* NULL buffer */
+   io.pfrio_size = 1;
+   io.pfrio_buffer = NULL;
+   if (ioctl(dev, DIOCRADDTABLES, ) == 0)
+   atf_tc_fail("Request with NULL buffer succeeded");
+
+   COMMON_CLEANUP();
+}
+

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

2018-04-06 Thread Kristof Provost
Author: kp
Date: Fri Apr  6 15:01:45 2018
New Revision: 332101
URL: https://svnweb.freebsd.org/changeset/base/332101

Log:
  pf: Improve ioctl validation for DIOCRADDTABLES and DIOCRDELTABLES
  
  The DIOCRADDTABLES and DIOCRDELTABLES ioctls can process a number of
  tables at a time, and as such try to allocate  *
  sizeof(struct pfr_table). This multiplication can overflow. Thanks to
  mallocarray() this is not exploitable, but an overflow does panic the
  system.
  
  Arbitrarily limit this to 65535 tables. pfctl only ever processes one
  table at a time, so it presents no issues there.
  
  MFC after:1 week

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

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 13:00:45 2018
(r332100)
+++ head/sys/netpfil/pf/pf_ioctl.c  Fri Apr  6 15:01:45 2018
(r332101)
@@ -89,6 +89,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#define PF_TABLES_MAX_REQUEST   65535 /* Maximum tables per request. */
+
 static struct pf_pool  *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t,
u_int8_t, u_int8_t, u_int8_t);
 
@@ -2530,13 +2532,15 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
-   totlen = io->pfrio_size * sizeof(struct pfr_table);
-   pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   M_TEMP, M_WAITOK);
-   if (! pfrts) {
+
+   if (io->pfrio_size < 0 || io->pfrio_size > 
PF_TABLES_MAX_REQUEST) {
error = ENOMEM;
break;
}
+
+   totlen = io->pfrio_size * sizeof(struct pfr_table);
+   pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
+   M_TEMP, M_WAITOK);
error = copyin(io->pfrio_buffer, pfrts, totlen);
if (error) {
free(pfrts, M_TEMP);
@@ -2559,13 +2563,15 @@ DIOCCHANGEADDR_error:
error = ENODEV;
break;
}
-   totlen = io->pfrio_size * sizeof(struct pfr_table);
-   pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
-   M_TEMP, M_WAITOK);
-   if (! pfrts) {
+
+   if (io->pfrio_size < 0 || io->pfrio_size > 
PF_TABLES_MAX_REQUEST) {
error = ENOMEM;
break;
}
+
+   totlen = io->pfrio_size * sizeof(struct pfr_table);
+   pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
+   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"


Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86

2018-04-06 Thread Conrad Meyer
I like something like this for clarity.  But I don't see any reason
for these function-like macros instead of the more general definition
of an SI prefix constant multiple.  A multiple works with numeric
literals and variables alike.  Something like:

#define GiB ((size_t)1 << 30)
my_foo = 15 * GiB;

(There's nothing byte-specific about SI prefixes, but "Gi" alone is a
worse name.  Arguably, size_t is wrong for quantities of bytes on
32-bit platforms with 64-bit off_t.)

The compiler will still reduce constant expressions.  Perhaps even
better, conversion away is straightforward units math, and the
compiler can still do the clever thing with right shifts:

my_gb = howmany(my_foo, GiB); //or
my_gb = my_foo / GiB;

Unfortunately, I expect a lot of code to already have defines or
variables with conflicting names, so I'm not sure adding these names
to primary headers is viable as-is.

Best,
Conrad

On Fri, Apr 6, 2018 at 4:20 AM, Roger Pau Monné  wrote:
> Author: royger
> Date: Fri Apr  6 11:20:06 2018
> New Revision: 332092
> URL: https://svnweb.freebsd.org/changeset/base/332092
>
> Log:
>   remove GiB/MiB macros from param.h
>
>   And instead define them in the files where they are used.
>
>   Requested by: bde
>
> Modified:
>   head/sys/amd64/amd64/mp_machdep.c
>   head/sys/sys/param.h
>   head/sys/x86/x86/mp_x86.c
>
> Modified: head/sys/amd64/amd64/mp_machdep.c
> ==
> --- head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 09:25:08 2018
> (r332091)
> +++ head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 11:20:06 2018
> (r332092)
> @@ -83,6 +83,8 @@ __FBSDID("$FreeBSD$");
>  #define BIOS_RESET (0x0f)
>  #define BIOS_WARM  (0x0a)
>
> +#define GiB(v) (v ## ULL << 30)
> +
>  extern struct pcpu __pcpu[];
>
>  /* Temporary variables for init_secondary()  */
>
> Modified: head/sys/sys/param.h
> ==
> --- head/sys/sys/param.hFri Apr  6 09:25:08 2018(r332091)
> +++ head/sys/sys/param.hFri Apr  6 11:20:06 2018(r332092)
> @@ -362,8 +362,4 @@ __END_DECLS
>   */
>  #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])
>
> -/* Unit conversion macros. */
> -#define GiB(v) (v ## ULL << 30)
> -#define MiB(v) (v ## ULL << 20)
> -
>  #endif /* _SYS_PARAM_H_ */
>
> Modified: head/sys/x86/x86/mp_x86.c
> ==
> --- head/sys/x86/x86/mp_x86.c   Fri Apr  6 09:25:08 2018(r332091)
> +++ head/sys/x86/x86/mp_x86.c   Fri Apr  6 11:20:06 2018(r332092)
> @@ -160,6 +160,8 @@ struct cache_info {
>
>  unsigned int boot_address;
>
> +#define MiB(v) (v ## ULL << 20)
> +
>  void
>  mem_range_AP_init(void)
>  {
>
___
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: r332100 - in head: . lib/libc/gen sys/sys

2018-04-06 Thread Ed Schouten
Author: ed
Date: Fri Apr  6 13:00:45 2018
New Revision: 332100
URL: https://svnweb.freebsd.org/changeset/base/332100

Log:
  Let syslog(3) use RFC 5424.
  
  With r332099 changing syslogd(8) to parse RFC 5424 formatted syslog
  messages, go ahead and also change the syslog(3) libc function to
  generate them. Compared to RFC 3164, RFC 5424 has various advantages,
  such as sub-second precision for log entry timestamps.
  
  As this change could have adverse effects when not updating syslogd(8)
  or using a different system logging daemon, add a notice to UPDATING and
  increase __FreeBSD_version.
  
  Differential Revision:https://reviews.freebsd.org/D14926

Modified:
  head/UPDATING
  head/lib/libc/gen/syslog.3
  head/lib/libc/gen/syslog.c
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Fri Apr  6 12:57:01 2018(r332099)
+++ head/UPDATING   Fri Apr  6 13:00:45 2018(r332100)
@@ -51,6 +51,45 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
 
 ** SPECIAL WARNING: **
 
+20180406:
+   In addition to supporting RFC 3164 formatted messages, the
+   syslogd(8) service is now capable of parsing RFC 5424 formatted
+   log messages. The main benefit of using RFC 5424 is that clients
+   may now send log messages with timestamps containing year numbers,
+   microseconds and time zone offsets.
+
+   Similarly, the syslog(3) C library function has been altered to
+   send RFC 5424 formatted messages to the local system logging
+   daemon. On systems using syslogd(8), this change should have no
+   negative impact, as long as syslogd(8) and the C library are
+   updated at the same time. On systems using a different system
+   logging daemon, it may be necessary to make configuration
+   adjustments, depending on the software used.
+
+   When using syslog-ng, add the 'syslog-protocol' flag to local
+   input sources to enable parsing of RFC 5424 formatted messages:
+
+   source src {
+   unix-dgram("/var/run/log" flags(syslog-protocol));
+   }
+
+   When using rsyslog, disable the 'SysSock.UseSpecialParser' option
+   of the 'imuxsock' module to let messages be processed by the
+   regular RFC 3164/5424 parsing pipeline:
+
+   module(load="imuxsock" SysSock.UseSpecialParser="off")
+
+   Do note that these changes only affect communication between local
+   applications and syslogd(8). The format that syslogd(8) uses to
+   store messages on disk or forward messages to other systems
+   remains unchanged. syslogd(8) still uses RFC 3164 for these
+   purposes. Options to customize this behaviour will be added in the
+   future. Utilities that process log files stored in /var/log are
+   thus expected to continue to function as before.
+
+   __FreeBSD_version has been incremented to 1200061 to denote this
+   change.
+
 20180328:
Support for token ring networks has been removed. If you
have "device token" in your kernel config you should remove

Modified: head/lib/libc/gen/syslog.3
==
--- head/lib/libc/gen/syslog.3  Fri Apr  6 12:57:01 2018(r332099)
+++ head/lib/libc/gen/syslog.3  Fri Apr  6 13:00:45 2018(r332100)
@@ -28,7 +28,7 @@
 .\" @(#)syslog.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 5, 2017
+.Dd April 6, 2018
 .Dt SYSLOG 3
 .Os
 .Sh NAME
@@ -156,6 +156,9 @@ Write the message to standard error output as well to 
 .It Dv LOG_PID
 Log the process id with each message: useful for identifying
 instantiations of daemons.
+On
+.Fx ,
+this option is enabled by default.
 .El
 .Pp
 The

Modified: head/lib/libc/gen/syslog.c
==
--- head/lib/libc/gen/syslog.c  Fri Apr  6 12:57:01 2018(r332099)
+++ head/lib/libc/gen/syslog.c  Fri Apr  6 13:00:45 2018(r332100)
@@ -36,9 +36,10 @@ static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
-#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -134,11 +135,13 @@ syslog(int pri, const char *fmt, ...)
 static void
 vsyslog1(int pri, const char *fmt, va_list ap)
 {
-   int cnt;
+   struct timeval now;
+   struct tm tm;
char ch, *p;
-   time_t now;
-   int fd, saved_errno;
-   char *stdp, tbuf[2048], fmt_cpy[1024], timbuf[26], errstr[64];
+   long tz_offset;
+   int cnt, fd, saved_errno;
+   char hostname[MAXHOSTNAMELEN], *stdp, tbuf[2048], fmt_cpy[1024],
+   errstr[64], tz_sign;
FILE *fp, *fmt_fp;
 

svn commit: r332099 - head/usr.sbin/syslogd

2018-04-06 Thread Ed Schouten
Author: ed
Date: Fri Apr  6 12:57:01 2018
New Revision: 332099
URL: https://svnweb.freebsd.org/changeset/base/332099

Log:
  Add RFC 5424 syslog message parsing to syslogd.
  
  Syslogd currently uses the RFC 3164 format for its log messages.One
  limitation of RFC 3164 is that it cannot be used to log entries with
  sub-second precision timestamps. One of our users has expressed a desire
  for doing this for doing some basic performance measurements.
  
  This change attempts to make a first cut at switching to RFC 5424 based
  logging. The first step is to alter syslogd's input path to properly
  parse such messages. It alters the logmsg() prototype to match the
  fields of RFC 5424. The parsemsg() function is extended to parse both
  RFC 3164 and 5424 messages and call into logmsg() accordingly.
  
  Additional changes include:
  
  - Introducing proper parsing of timestamps, so that they can be printed
in any desired output format. This means we need to infer the year and
timezone for RFC 3164 timestamps.
  - Removing ISKERNEL. This can now be realised by simply providing an
APP-NAME (== "kernel").
  - Extending RFC 3164 parsing to trim off the TAG prefix and using that
to derive APP-NAME and PROCID.
  - Increase MAXLINE. RFC 5424 mentions we should support 2k messages.
  
  Differential Revision:https://reviews.freebsd.org/D14926

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

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Fri Apr  6 12:39:47 2018
(r332098)
+++ head/usr.sbin/syslogd/syslogd.c Fri Apr  6 12:57:01 2018
(r332099)
@@ -28,6 +28,33 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2018 Prodrive Technologies, https://prodrive-technologies.com/
+ * Author: Ed Schouten 
+ *
+ * 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.
+ */
 
 #ifndef lint
 static const char copyright[] =
@@ -71,8 +98,7 @@ __FBSDID("$FreeBSD$");
  */
 
 /* Maximum number of characters in time of last occurrence */
-#defineMAXDATELEN  16
-#defineMAXLINE 1024/* maximum line length */
+#defineMAXLINE 2048/* maximum line length */
 #defineMAXSVLINE   MAXLINE /* maximum saved line length */
 #defineDEFUPRI (LOG_USER|LOG_NOTICE)
 #defineDEFSPRI (LOG_KERN|LOG_CRIT)
@@ -97,8 +123,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #endif
-#include 
 
+#include 
 #include 
 #include 
 #include 
@@ -107,6 +133,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,8 +201,17 @@ static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INI
 #defineIGN_CONS0x001   /* don't print on console */
 #defineSYNC_FILE   0x002   /* do fsync on file after printing */
 #defineMARK0x008   /* this message is a mark */
-#defineISKERNEL0x010   /* kernel generated message */
 
+/* Timestamps of log entries. */
+struct logtime {
+   struct tm   tm;
+   suseconds_t usec;
+};
+
+/* Traditional syslog timestamp format. */
+#defineRFC3164_DATELEN 15
+#defineRFC3164_DATEFMT "%b %e %H:%M:%S"
+
 /*
  * This structure represents the files that will have log
  * copies printed.
@@ -215,10 +251,10 @@ struct filed {
 #definefu_pipe_pname   f_un.f_pipe.f_pname
 #definefu_pipe_pid f_un.f_pipe.f_pid
charf_prevline[MAXSVLINE];  /* last 

svn commit: r332098 - stable/10/sys/i386/i386

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 12:39:47 2018
New Revision: 332098
URL: https://svnweb.freebsd.org/changeset/base/332098

Log:
  MFC r331761: align i386 cpu_reset() with amd64 version

Modified:
  stable/10/sys/i386/i386/vm_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/i386/i386/vm_machdep.c
==
--- stable/10/sys/i386/i386/vm_machdep.cFri Apr  6 12:39:33 2018
(r332097)
+++ stable/10/sys/i386/i386/vm_machdep.cFri Apr  6 12:39:47 2018
(r332098)
@@ -649,7 +649,8 @@ cpu_reset_proxy()
 
cpu_reset_proxy_active = 1;
while (cpu_reset_proxy_active == 1)
-   ;   /* Wait for other cpu to see that we've started */
+   ia32_pause(); /* Wait for other cpu to see that we've started */
+
CPU_SETOF(cpu_reset_proxyid, );
stop_cpus(tcrp);
printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid);
@@ -689,19 +690,21 @@ cpu_reset()
printf("cpu_reset: Restarting BSP\n");
 
/* Restart CPU #0. */
-   /* XXX: restart_cpus(1 << 0); */
CPU_SETOF(0, _cpus);
wmb();
 
cnt = 0;
-   while (cpu_reset_proxy_active == 0 && cnt < 1000)
+   while (cpu_reset_proxy_active == 0 && cnt < 1000) {
+   ia32_pause();
cnt++;  /* Wait for BSP to announce restart */
+   }
if (cpu_reset_proxy_active == 0)
printf("cpu_reset: Failed to restart BSP\n");
enable_intr();
cpu_reset_proxy_active = 2;
 
-   while (1);
+   while (1)
+   ia32_pause();
/* NOTREACHED */
}
 
___
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: r332097 - stable/11/sys/i386/i386

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 12:39:33 2018
New Revision: 332097
URL: https://svnweb.freebsd.org/changeset/base/332097

Log:
  MFC r331761: align i386 cpu_reset() with amd64 version

Modified:
  stable/11/sys/i386/i386/vm_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/i386/i386/vm_machdep.c
==
--- stable/11/sys/i386/i386/vm_machdep.cFri Apr  6 12:23:59 2018
(r332096)
+++ stable/11/sys/i386/i386/vm_machdep.cFri Apr  6 12:39:33 2018
(r332097)
@@ -594,7 +594,8 @@ cpu_reset_proxy()
 
cpu_reset_proxy_active = 1;
while (cpu_reset_proxy_active == 1)
-   ;   /* Wait for other cpu to see that we've started */
+   ia32_pause(); /* Wait for other cpu to see that we've started */
+
CPU_SETOF(cpu_reset_proxyid, );
stop_cpus(tcrp);
printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid);
@@ -634,19 +635,21 @@ cpu_reset()
printf("cpu_reset: Restarting BSP\n");
 
/* Restart CPU #0. */
-   /* XXX: restart_cpus(1 << 0); */
CPU_SETOF(0, _cpus);
wmb();
 
cnt = 0;
-   while (cpu_reset_proxy_active == 0 && cnt < 1000)
+   while (cpu_reset_proxy_active == 0 && cnt < 1000) {
+   ia32_pause();
cnt++;  /* Wait for BSP to announce restart */
+   }
if (cpu_reset_proxy_active == 0)
printf("cpu_reset: Failed to restart BSP\n");
enable_intr();
cpu_reset_proxy_active = 2;
 
-   while (1);
+   while (1)
+   ia32_pause();
/* NOTREACHED */
}
 
___
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: r332096 - stable/10/sys/geom

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 12:23:59 2018
New Revision: 332096
URL: https://svnweb.freebsd.org/changeset/base/332096

Log:
  MFC r330977: g_access: deal with races created by geoms that drop the 
topology lock
  
  PR:   225960

Modified:
  stable/10/sys/geom/geom.h
  stable/10/sys/geom/geom_subr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/geom.h
==
--- stable/10/sys/geom/geom.h   Fri Apr  6 12:13:32 2018(r332095)
+++ stable/10/sys/geom/geom.h   Fri Apr  6 12:23:59 2018(r332096)
@@ -147,8 +147,10 @@ struct g_geom {
void*spare1;
void*softc;
unsignedflags;
-#defineG_GEOM_WITHER   1
-#defineG_GEOM_VOLATILE_BIO 2
+#defineG_GEOM_WITHER   0x01
+#defineG_GEOM_VOLATILE_BIO 0x02
+#defineG_GEOM_IN_ACCESS0x04
+#defineG_GEOM_ACCESS_WAIT  0x08
 };
 
 /*

Modified: stable/10/sys/geom/geom_subr.c
==
--- stable/10/sys/geom/geom_subr.c  Fri Apr  6 12:13:32 2018
(r332095)
+++ stable/10/sys/geom/geom_subr.c  Fri Apr  6 12:23:59 2018
(r332096)
@@ -859,7 +859,11 @@ int
 g_access(struct g_consumer *cp, int dcr, int dcw, int dce)
 {
struct g_provider *pp;
-   int pr,pw,pe;
+   struct g_geom *gp;
+   int pw, pe;
+#ifdef INVARIANTS
+   int sr, sw, se;
+#endif
int error;
 
g_topology_assert();
@@ -867,6 +871,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
pp = cp->provider;
KASSERT(pp != NULL, ("access but not attached"));
G_VALID_PROVIDER(pp);
+   gp = pp->geom;
 
g_trace(G_T_ACCESS, "g_access(%p(%s), %d, %d, %d)",
cp, pp->name, dcr, dcw, dce);
@@ -875,7 +880,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
KASSERT(cp->acw + dcw >= 0, ("access resulting in negative acw"));
KASSERT(cp->ace + dce >= 0, ("access resulting in negative ace"));
KASSERT(dcr != 0 || dcw != 0 || dce != 0, ("NOP access request"));
-   KASSERT(pp->geom->access != NULL, ("NULL geom->access"));
+   KASSERT(gp->access != NULL, ("NULL geom->access"));
 
/*
 * If our class cares about being spoiled, and we have been, we
@@ -887,10 +892,30 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
return (ENXIO);
 
/*
+* A number of GEOM classes either need to perform an I/O on the first
+* open or to acquire a different subsystem's lock.  To do that they
+* may have to drop the topology lock.
+* Other GEOM classes perform special actions when opening a lower rank
+* geom for the first time.  As a result, more than one thread may
+* end up performing the special actions.
+* So, we prevent concurrent "first" opens by marking the consumer with
+* special flag.
+*
+* Note that if the geom's access method never drops the topology lock,
+* then we will never see G_GEOM_IN_ACCESS here.
+*/
+   while ((gp->flags & G_GEOM_IN_ACCESS) != 0) {
+   g_trace(G_T_ACCESS,
+   "%s: race on geom %s via provider %s and consumer of %s",
+   __func__, gp->name, pp->name, cp->geom->name);
+   gp->flags |= G_GEOM_ACCESS_WAIT;
+   g_topology_sleep(gp, 0);
+   }
+
+   /*
 * Figure out what counts the provider would have had, if this
 * consumer had (r0w0e0) at this time.
 */
-   pr = pp->acr - cp->acr;
pw = pp->acw - cp->acw;
pe = pp->ace - cp->ace;
 
@@ -902,7 +927,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
pp, pp->name);
 
/* If foot-shooting is enabled, any open on rank#1 is OK */
-   if ((g_debugflags & 16) && pp->geom->rank == 1)
+   if ((g_debugflags & 16) && gp->rank == 1)
;
/* If we try exclusive but already write: fail */
else if (dce > 0 && pw > 0)
@@ -916,11 +941,27 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
 
/* Ok then... */
 
-   error = pp->geom->access(pp, dcr, dcw, dce);
+#ifdef INVARIANTS
+   sr = cp->acr;
+   sw = cp->acw;
+   se = cp->ace;
+#endif
+   gp->flags |= G_GEOM_IN_ACCESS;
+   error = gp->access(pp, dcr, dcw, dce);
KASSERT(dcr > 0 || dcw > 0 || dce > 0 || error == 0,
("Geom provider %s::%s dcr=%d dcw=%d dce=%d error=%d failed "
-   "closing ->access()", pp->geom->class->name, pp->name, dcr, dcw,
+   "closing ->access()", gp->class->name, pp->name, dcr, dcw,
dce, error));
+
+   g_topology_assert();
+   gp->flags &= ~G_GEOM_IN_ACCESS;
+   KASSERT(cp->acr == sr && cp->acw == sw && cp->ace 

Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86

2018-04-06 Thread Bruce Evans

On Fri, 6 Apr 2018, [UTF-8] Roger Pau Monn?? wrote:


Log:
 remove GiB/MiB macros from param.h

 And instead define them in the files where they are used.

 Requested by: bde


Thanks, but these files have a negative need for the macros.


Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 09:25:08 2018
(r332091)
+++ head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 11:20:06 2018
(r332092)
@@ -83,6 +83,8 @@ __FBSDID("$FreeBSD$");
#define BIOS_RESET  (0x0f)
#define BIOS_WARM   (0x0a)

+#define GiB(v) (v ## ULL << 30)
+


In this file, the macro is used only once.  It takes about 4 times as
much code to define and use the macro once as to write
(vm_paddr_t)4 << 30.  Much more than 4 times longer to read, since some
searching is needed to find the macro and some decoding is needed to
understand it.  More to see that the wrong type returned by the macro
is not a problem.  The value can be written more consisely as 4L << 30
after doing a similar type analysis.  1G is normally written as
1024 * 1024 * 1024 since this is a bit clearer than 1 << 30.  This depends
n a similar type analysis -- the multipliction and the shift don't overflow
32-bit ints.  But care must be taken with multiplication by another 4 or
even 2.


Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Apr  6 09:25:08 2018(r332091)
+++ head/sys/x86/x86/mp_x86.c   Fri Apr  6 11:20:06 2018(r332092)
@@ -160,6 +160,8 @@ struct cache_info {

unsigned int boot_address;

+#define MiB(v) (v ## ULL << 20)
+


In this file, the macro is used twice with v = 1.  Defining and using it
takes only about twice as much code and time to read as (vm_paddr_t)1 << 20.
Here it is more important to use vm_paddr_t since this code is shared by
amd64, i386 and i386-PAE so the size of vm_paddr_t is variable.  However,
since 1MB is far below INT_MAX, it doesn't take much type analysis to see
than the shorter 1 << 20 is safe.  2 copies of the clearer 1024 * 1024
is also shorter than the macro and 2 calls to it.

The macro name doesn't match the comment.  The comment still says 1MB.
The fix is not to break the comment.

Later in the file, basemem is converted from K to bytes by multiplying
by 1024.  Now 1024 is shorter and clearer than 1 << 10 or 0x400 or a
macro with many undocmented details.  The type analysis to show that
multiplying by 1024 doesn't overflow is slightly more complicated since
basemem is a variable.  It is only easy to see that this doesn't
overflow because basemem is an old real-mode value.  640K was large
enough for anyone, and basemem in bytes is less than that.  640K was
20 times INT_MAX, but is now 1/3276 of INT_MAX.

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"


svn commit: r332095 - stable/11/sys/geom

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 12:13:32 2018
New Revision: 332095
URL: https://svnweb.freebsd.org/changeset/base/332095

Log:
  MFC r330977: g_access: deal with races created by geoms that drop the 
topology lock
  
  PR:   225960

Modified:
  stable/11/sys/geom/geom.h
  stable/11/sys/geom/geom_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/geom.h
==
--- stable/11/sys/geom/geom.h   Fri Apr  6 11:48:12 2018(r332094)
+++ stable/11/sys/geom/geom.h   Fri Apr  6 12:13:32 2018(r332095)
@@ -148,8 +148,10 @@ struct g_geom {
void*spare1;
void*softc;
unsignedflags;
-#defineG_GEOM_WITHER   1
-#defineG_GEOM_VOLATILE_BIO 2
+#defineG_GEOM_WITHER   0x01
+#defineG_GEOM_VOLATILE_BIO 0x02
+#defineG_GEOM_IN_ACCESS0x04
+#defineG_GEOM_ACCESS_WAIT  0x08
 };
 
 /*

Modified: stable/11/sys/geom/geom_subr.c
==
--- stable/11/sys/geom/geom_subr.c  Fri Apr  6 11:48:12 2018
(r332094)
+++ stable/11/sys/geom/geom_subr.c  Fri Apr  6 12:13:32 2018
(r332095)
@@ -862,7 +862,11 @@ int
 g_access(struct g_consumer *cp, int dcr, int dcw, int dce)
 {
struct g_provider *pp;
-   int pr,pw,pe;
+   struct g_geom *gp;
+   int pw, pe;
+#ifdef INVARIANTS
+   int sr, sw, se;
+#endif
int error;
 
g_topology_assert();
@@ -870,6 +874,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
pp = cp->provider;
KASSERT(pp != NULL, ("access but not attached"));
G_VALID_PROVIDER(pp);
+   gp = pp->geom;
 
g_trace(G_T_ACCESS, "g_access(%p(%s), %d, %d, %d)",
cp, pp->name, dcr, dcw, dce);
@@ -878,7 +883,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
KASSERT(cp->acw + dcw >= 0, ("access resulting in negative acw"));
KASSERT(cp->ace + dce >= 0, ("access resulting in negative ace"));
KASSERT(dcr != 0 || dcw != 0 || dce != 0, ("NOP access request"));
-   KASSERT(pp->geom->access != NULL, ("NULL geom->access"));
+   KASSERT(gp->access != NULL, ("NULL geom->access"));
 
/*
 * If our class cares about being spoiled, and we have been, we
@@ -890,10 +895,30 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
return (ENXIO);
 
/*
+* A number of GEOM classes either need to perform an I/O on the first
+* open or to acquire a different subsystem's lock.  To do that they
+* may have to drop the topology lock.
+* Other GEOM classes perform special actions when opening a lower rank
+* geom for the first time.  As a result, more than one thread may
+* end up performing the special actions.
+* So, we prevent concurrent "first" opens by marking the consumer with
+* special flag.
+*
+* Note that if the geom's access method never drops the topology lock,
+* then we will never see G_GEOM_IN_ACCESS here.
+*/
+   while ((gp->flags & G_GEOM_IN_ACCESS) != 0) {
+   g_trace(G_T_ACCESS,
+   "%s: race on geom %s via provider %s and consumer of %s",
+   __func__, gp->name, pp->name, cp->geom->name);
+   gp->flags |= G_GEOM_ACCESS_WAIT;
+   g_topology_sleep(gp, 0);
+   }
+
+   /*
 * Figure out what counts the provider would have had, if this
 * consumer had (r0w0e0) at this time.
 */
-   pr = pp->acr - cp->acr;
pw = pp->acw - cp->acw;
pe = pp->ace - cp->ace;
 
@@ -905,7 +930,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
pp, pp->name);
 
/* If foot-shooting is enabled, any open on rank#1 is OK */
-   if ((g_debugflags & 16) && pp->geom->rank == 1)
+   if ((g_debugflags & 16) && gp->rank == 1)
;
/* If we try exclusive but already write: fail */
else if (dce > 0 && pw > 0)
@@ -922,11 +947,27 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int 
 
/* Ok then... */
 
-   error = pp->geom->access(pp, dcr, dcw, dce);
+#ifdef INVARIANTS
+   sr = cp->acr;
+   sw = cp->acw;
+   se = cp->ace;
+#endif
+   gp->flags |= G_GEOM_IN_ACCESS;
+   error = gp->access(pp, dcr, dcw, dce);
KASSERT(dcr > 0 || dcw > 0 || dce > 0 || error == 0,
("Geom provider %s::%s dcr=%d dcw=%d dce=%d error=%d failed "
-   "closing ->access()", pp->geom->class->name, pp->name, dcr, dcw,
+   "closing ->access()", gp->class->name, pp->name, dcr, dcw,
dce, error));
+
+   g_topology_assert();
+   gp->flags &= ~G_GEOM_IN_ACCESS;
+   KASSERT(cp->acr == sr && cp->acw == sw && cp->ace 

svn commit: r332094 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 11:48:12 2018
New Revision: 332094
URL: https://svnweb.freebsd.org/changeset/base/332094

Log:
  MFC r330295: ZFS: fix adding vdevs to very large pools
  
  PR:   226096

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Fri Apr  6 11:42:08 2018(r332093)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Fri Apr  6 11:48:12 2018(r332094)
@@ -911,6 +911,7 @@ zpool_read_label(int fd, nvlist_t **config)
 
free(label);
*config = NULL;
+   errno = ENOENT;
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: r332093 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common

2018-04-06 Thread Andriy Gapon
Author: avg
Date: Fri Apr  6 11:42:08 2018
New Revision: 332093
URL: https://svnweb.freebsd.org/changeset/base/332093

Log:
  MFC r330295: ZFS: fix adding vdevs to very large pools
  
  PR:   226096

Modified:
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Fri Apr  6 11:20:06 2018(r332092)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
Fri Apr  6 11:42:08 2018(r332093)
@@ -916,6 +916,7 @@ zpool_read_label(int fd, nvlist_t **config)
 
free(label);
*config = NULL;
+   errno = ENOENT;
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: r332092 - in head/sys: amd64/amd64 sys x86/x86

2018-04-06 Thread Roger Pau Monné
Author: royger
Date: Fri Apr  6 11:20:06 2018
New Revision: 332092
URL: https://svnweb.freebsd.org/changeset/base/332092

Log:
  remove GiB/MiB macros from param.h
  
  And instead define them in the files where they are used.
  
  Requested by: bde

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/sys/param.h
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 09:25:08 2018
(r332091)
+++ head/sys/amd64/amd64/mp_machdep.c   Fri Apr  6 11:20:06 2018
(r332092)
@@ -83,6 +83,8 @@ __FBSDID("$FreeBSD$");
 #define BIOS_RESET (0x0f)
 #define BIOS_WARM  (0x0a)
 
+#define GiB(v) (v ## ULL << 30)
+
 extern struct pcpu __pcpu[];
 
 /* Temporary variables for init_secondary()  */

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hFri Apr  6 09:25:08 2018(r332091)
+++ head/sys/sys/param.hFri Apr  6 11:20:06 2018(r332092)
@@ -362,8 +362,4 @@ __END_DECLS
  */
 #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])
 
-/* Unit conversion macros. */
-#define GiB(v) (v ## ULL << 30)
-#define MiB(v) (v ## ULL << 20)
-
 #endif /* _SYS_PARAM_H_ */

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Fri Apr  6 09:25:08 2018(r332091)
+++ head/sys/x86/x86/mp_x86.c   Fri Apr  6 11:20:06 2018(r332092)
@@ -160,6 +160,8 @@ struct cache_info {
 
 unsigned int boot_address;
 
+#define MiB(v) (v ## ULL << 20)
+
 void
 mem_range_AP_init(void)
 {
___
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: r332012 - in vendor/opencsd: . dist dist/decoder dist/decoder/build dist/decoder/build/linux dist/decoder/build/linux/rctdl_c_api_lib dist/decoder/build/linux/ref_trace_decode_lib dist

2018-04-06 Thread Ruslan Bukin
On Wed, Apr 04, 2018 at 09:11:29AM -0700, Rodney W. Grimes wrote:
> [ Charset UTF-8 unsupported, converting... ]
> > On Wed, Apr 04, 2018 at 08:02:04AM -0700, Rodney W. Grimes wrote:
> > > > Author: br
> > > > Date: Wed Apr  4 12:33:46 2018
> > > > New Revision: 332012
> > > > URL: https://svnweb.freebsd.org/changeset/base/332012
> > > > 
> > > > Log:
> > > >   Import OpenCSD -- an ARM CoreSight Trace Decode library.
> > > 
> > > Why does this need to be in base?
> > > Is there some reason it can not live as a port?
> > > 
> > 
> > Yes opencsd is a dependancy for pmctrace(1) -- new HWPMC tracing tool.
> 
> Why does pmctrace(1) need to be in base?
> I can see that there is kernel driver code to support this,
> is it to keep the userland pmctrace(1) closely coupled to
> the kernel hwpmc(4) code?
> 

pmctrace(1) is part of hwpmc, i.e. it is using its facilities, similar to 
pmcstat(1).

> I shall assert this code also has a broken license form,
> if you read LICENSE there is no copyright "above" to
> retain, or print for a binary release.  As a consumer of
> that LICENSE technically I have to display nothing.
> I am sure that is not the desired intent.
> 
> I believe this is still under review without formal policy
> from core.

You are right. I just asked maintainter to fix this.
Thanks

Ruslan
___
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: r332072 - head/sys/sys

2018-04-06 Thread Roger Pau Monné
On Fri, Apr 06, 2018 at 03:12:08AM +1000, Bruce Evans wrote:
> On Thu, 5 Apr 2018, Warner Losh wrote:
> 
> > On Thu, Apr 5, 2018 at 9:46 AM, Roger Pau Monné  wrote:
> > 
> > > On Thu, Apr 05, 2018 at 09:32:57AM -0600, Ian Lepore wrote:
> > > > On Thu, 2018-04-05 at 14:31 +, Roger Pau Monné wrote:
> > > > > Log:
> > > > >   introduce GiB and MiB macros
> > > > > ...
> > > > > +/* Unit conversion macros. */
> > > > > +#define GiB(v) (v ## ULL << 30)
> > > > > +#define MiB(v) (v ## ULL << 20)
> > > > > +
> > > > >  #endif /* _SYS_PARAM_H_ */
> > > > 
> > > > These names don't make it clear whether the conversion is bytes->GiB or
> > > > GiB->bytes.  The names seem way too generic for a public namespace in a
> > > > file as heavily included behind your back as param.h is.
> > > > 
> > > > Also, this completely reasonable usage won't work, likely with
> > > > confusing compile error messages:
> > > > 
> > > >   int bytes, gibytes;
> > > >   ...
> > > >   bytes = GiB(gibytes);
> > > 
> > > I find those helpful for their specific usage. I could introduce
> > > static inline functions like:
> > > 
> > > size_t gb_to_bytes(size_t)...
> > > 
> > > But I assume this is also going to cause further discussion.
> 
> Yes, it gives even more namespace pollution and type errors.  Macros
> at least don't expose their internals if they are not used.
> 
> size_t is actually already part of the undocumented namespace pollution
> in .
> 
> The type errors are restriction to just one type in another way.  Type-
> generic APIs that avoid such restrictions are much harder to implement
> using inline functions than macros.
> 
> > Yea, traditional macro names would be "gibtob" and "btogib" but I didn't
> > just reply to bikeshed a name:
> > 
> > But you don't need to specify a type, consider the current btodb macro:
> > #define btodb(bytes)/* calculates (bytes / DEV_BSIZE)
> > */ \
> >(sizeof (bytes) > sizeof(long) \
> > ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
> > : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
> > 
> > which shows how to do this in a macro, which is orthogonal to any name you
> > may choose. I can also bikeshed function vs macro :)
> 
> This macro is mostly my mistake in 1995-1996.  The long long abominations
> in it were supposed to be temporary (until C99 standardized something
> better).  It was originally MD for i386 only and then the sizes of almost
> all types are known and fixed so it is easier to hard-code minimal sizes
> that work.  The optimization of avoiding using 64-bit types was more needed
> in 1995-1996 since CPUs were slower and compilers did less strength reduction.
> 
> btodb() is much easier than dbtob() since it shifts right, so it can't
> overflow unless the cast of 'bytes' is wrong so that it truncations.
> dbtob() doesn't try hard to be optimal.  It just always upcasts to
> off_t.
> 
> jake later convinced me (in connection with his PAE and sparc64 work) that
> it should be the caller's responsibility to avoid overflow.  Any casts in
> the macro limits it to the types in it.  This is why the page to byte
> conversion macros don't have any casts in them.  PAE usually needs 64-bit
> results, but this would just be a pessimization for normal i386, and
> deciding the casts in the macro as above is complicated.
> 
> So correct GB() macros would look like ((v) << 30), where the caller must
> cast v to a large enough type.  E.g., for variable v which might be larger
> than 4, on 32-bit systems, the caller must write something like
> GB((uintmax_t)v).  But it is easier for writing to just multiply v by 1G.
> This is also easier for reading since it is unclear that GB() is even a
> conversion or which direction it goes in.  A longer descriptive name would
> be about as clear and long as an explicit multiplication.
> 
> I usually write 1G as ((type)1024 * 1024 * 1024) since the decimal and
> even hex values of 1G have too many digits to be clear, and
> multiplication is clearer than shifting and allows the type to be in
> the factor.
> 
> Disk block size conversions need to use macros since the DEV_BSIZE = 512
> was variable in theory (in practice this is now a fixed virtual size).
> Conversions to G don't need macros since the magic number in them is no
> more magic than the G in their name.

I personally find the following chunk:

if (addr < GiB(4))
...

Much more easier to read and parse than:

if (addr < (4 * 1024 * 1024 * 1024))
...

But I won't insist anymore.

I will revert this and introduce the macros locally where I need them.

Roger.
___
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: r332091 - stable/11/sys/vm

2018-04-06 Thread Konstantin Belousov
Author: kib
Date: Fri Apr  6 09:25:08 2018
New Revision: 332091
URL: https://svnweb.freebsd.org/changeset/base/332091

Log:
  MFC r331760:
  Make vm_map_max/min/pmap KBI stable.

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

Modified: stable/11/sys/vm/vm_map.c
==
--- stable/11/sys/vm/vm_map.c   Fri Apr  6 02:57:58 2018(r332090)
+++ stable/11/sys/vm/vm_map.c   Fri Apr  6 09:25:08 2018(r332091)
@@ -4257,6 +4257,27 @@ vm_map_lookup_done(vm_map_t map, vm_map_entry_t entry)
vm_map_unlock_read(map);
 }
 
+vm_offset_t
+vm_map_max_KBI(const struct vm_map *map)
+{
+
+   return (map->max_offset);
+}
+
+vm_offset_t
+vm_map_min_KBI(const struct vm_map *map)
+{
+
+   return (map->min_offset);
+}
+
+pmap_t
+vm_map_pmap_KBI(vm_map_t map)
+{
+
+   return (map->pmap);
+}
+
 #include "opt_ddb.h"
 #ifdef DDB
 #include 

Modified: stable/11/sys/vm/vm_map.h
==
--- stable/11/sys/vm/vm_map.h   Fri Apr  6 02:57:58 2018(r332090)
+++ stable/11/sys/vm/vm_map.h   Fri Apr  6 09:25:08 2018(r332091)
@@ -205,6 +205,11 @@ struct vm_map {
 #defineMAP_BUSY_WAKEUP 0x02
 
 #ifdef _KERNEL
+#ifdef KLD_MODULE
+#definevm_map_max(map) vm_map_max_KBI((map))
+#definevm_map_min(map) vm_map_min_KBI((map))
+#definevm_map_pmap(map)vm_map_pmap_KBI((map))
+#else
 static __inline vm_offset_t
 vm_map_max(const struct vm_map *map)
 {
@@ -228,6 +233,7 @@ vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags
 {
map->flags = (map->flags | set) & ~clear;
 }
+#endif /* KLD_MODULE */
 #endif /* _KERNEL */
 
 /*
@@ -288,6 +294,9 @@ void vm_map_wakeup(vm_map_t map);
 void vm_map_busy(vm_map_t map);
 void vm_map_unbusy(vm_map_t map);
 void vm_map_wait_busy(vm_map_t map);
+vm_offset_t vm_map_max_KBI(const struct vm_map *map);
+vm_offset_t vm_map_min_KBI(const struct vm_map *map);
+pmap_t vm_map_pmap_KBI(vm_map_t map);
 
 #definevm_map_lock(map)_vm_map_lock(map, LOCK_FILE, LOCK_LINE)
 #definevm_map_unlock(map)  _vm_map_unlock(map, LOCK_FILE, 
LOCK_LINE)
___
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"