svn commit: r353746 - head/sys/powerpc/aim

2019-10-18 Thread Justin Hibbits
Author: jhibbits
Date: Sat Oct 19 02:47:32 2019
New Revision: 353746
URL: https://svnweb.freebsd.org/changeset/base/353746

Log:
  powerpc/aim: Fix comment typo

Modified:
  head/sys/powerpc/aim/trap_subr64.S

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Sat Oct 19 01:07:35 2019
(r353745)
+++ head/sys/powerpc/aim/trap_subr64.S  Sat Oct 19 02:47:32 2019
(r353746)
@@ -452,7 +452,7 @@ CNAME(trapcode):
blrl/* Branch to generictrap */
 CNAME(trapcodeend):
 
-/* Same thing for traps setting HSRR0/HSS1 */
+/* Same thing for traps setting HSRR0/HSRR1 */
.globl  CNAME(hypertrapcode),CNAME(hypertrapcodeend)
.p2align 3
 CNAME(hypertrapcode):
___
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: r353745 - head/sys/powerpc/mpc85xx

2019-10-18 Thread Justin Hibbits
Author: jhibbits
Date: Sat Oct 19 01:07:35 2019
New Revision: 353745
URL: https://svnweb.freebsd.org/changeset/base/353745

Log:
  powerpc/mpc85xx: Replace global PCI config mutex with per-controller mutex
  
  PCI controllers need to enforce exclusive config register access on their
  own bus, not between all buses.

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Fri Oct 18 22:53:40 2019
(r353744)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Sat Oct 19 01:07:35 2019
(r353745)
@@ -126,6 +126,7 @@ __FBSDID("$FreeBSD$");
 struct fsl_pcib_softc {
struct ofw_pci_softc pci_sc;
device_tsc_dev;
+   struct mtx  sc_cfg_mtx;
 
int sc_iomem_target;
bus_addr_t  sc_iomem_start, sc_iomem_end;
@@ -200,10 +201,6 @@ static uint32_t fsl_pcib_read_config(device_t, u_int, 
 static void fsl_pcib_write_config(device_t, u_int, u_int, u_int, u_int,
 uint32_t, int);
 
-/* Configuration r/w mutex. */
-struct mtx pcicfg_mtx;
-static int mtx_initialized = 0;
-
 /*
  * Bus interface definitions.
  */
@@ -298,10 +295,7 @@ fsl_pcib_attach(device_t dev)
sc->sc_bsh = rman_get_bushandle(sc->sc_res);
sc->sc_busnr = 0;
 
-   if (!mtx_initialized) {
-   mtx_init(_mtx, "pcicfg", NULL, MTX_SPIN);
-   mtx_initialized = 1;
-   }
+   mtx_init(>sc_cfg_mtx, "pcicfg", NULL, MTX_SPIN);
 
cfgreg = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_VENDOR, 2);
if (cfgreg != 0x1057 && cfgreg != 0x1957)
@@ -413,7 +407,7 @@ fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus,
if (sc->sc_pcie)
addr |= (reg & 0xf00) << 16;
 
-   mtx_lock_spin(_mtx);
+   mtx_lock_spin(>sc_cfg_mtx);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr);
 
switch (bytes) {
@@ -433,7 +427,7 @@ fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus,
data = ~0;
break;
}
-   mtx_unlock_spin(_mtx);
+   mtx_unlock_spin(>sc_cfg_mtx);
return (data);
 }
 
@@ -451,7 +445,7 @@ fsl_pcib_cfgwrite(struct fsl_pcib_softc *sc, u_int bus
if (sc->sc_pcie)
addr |= (reg & 0xf00) << 16;
 
-   mtx_lock_spin(_mtx);
+   mtx_lock_spin(>sc_cfg_mtx);
bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_CFG_ADDR, addr);
 
switch (bytes) {
@@ -468,7 +462,7 @@ fsl_pcib_cfgwrite(struct fsl_pcib_softc *sc, u_int bus
REG_CFG_DATA, htole32(data));
break;
}
-   mtx_unlock_spin(_mtx);
+   mtx_unlock_spin(>sc_cfg_mtx);
 }
 
 #if 0
@@ -757,11 +751,12 @@ fsl_pcib_err_init(device_t dev)
 static int
 fsl_pcib_detach(device_t dev)
 {
+   struct fsl_pcib_softc *sc;
 
-   if (mtx_initialized) {
-   mtx_destroy(_mtx);
-   mtx_initialized = 0;
-   }
+   sc = device_get_softc(dev);
+
+   mtx_destroy(>sc_cfg_mtx);
+
return (bus_generic_detach(dev));
 }
 
___
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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Cy Schubert
In message <201910182216.x9img7wo032...@slippy.cwsent.com>, Cy Schubert 
writes:
> In message <20191018183718.5e6b3...@hermann.fritz.box>, "Hartmann, O." 
> writes:
> > --Sig_/icZw9PmU7w9Aj=UqDZhZj.c
> > Content-Type: text/plain; charset=US-ASCII
> > Content-Transfer-Encoding: quoted-printable
> >
> > On Fri, 18 Oct 2019 09:26:51 -0700
> > Cy Schubert  wrote:
> >
> > > On October 18, 2019 8:54:06 AM PDT, "Hartmann, O."
> > >  wrote:
> > > >On Fri, 18 Oct 2019 07:24:12 -0700
> > > >Cy Schubert  wrote:
> > > > =20
> > > >> In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann,
> > > >> O." writes: =20
> > > >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32
> > > >> > Content-Type: text/plain; charset=3DUS-ASCII
> > > >> > Content-Transfer-Encoding: quoted-printable
> > > >> >
> > > >> > On Fri, 18 Oct 2019 14:00:45 +0200
> > > >> > Gary Jennejohn  wrote:
> > > >> >   =20
> > > >> > > On Fri, 18 Oct 2019 12:21:04 +0200
> > > >> > > "Hartmann, O."  wrote:
> > > >> > >=3D20   =20
> > > >> > > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > > >> > > > Conrad Meyer  wrote:
> > > >> > > >  =3D20   =20
> > > >> > > > > Author: cem
> > > >> > > > > Date: Thu Oct 17 21:33:01 2019
> > > >> > > > > New Revision: 353700
> > > >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > > >> > > > >=3D20
> > > >> > > > > Log:
> > > >> > > > >   Implement NetGDB(4)
> > > >> > > > >  =3D20
> > > >> > > > >   NetGDB(4) is a component of a system using a panic-time
> > > >> > > > > network stack to remotely debug crashed FreeBSD kernels
> > > >> > > > > over the network, instead of traditional serial interfaces.
> > > >> > > > >  =3D20
> > > >> > > > >   There are three pieces in the complete NetGDB system.
> > > >> > > > >  =3D20
> > > >> > > > >   First, a dedicated proxy server must be running to accept
> > > >> > > > > connections from both NetGDB and gdb(1), and pass
> > > >> > > > > bidirectional traffic between the two protocols.
> > > >> > > > >  =3D20
> > > >> > > > >   Second, the NetGDB client is activated much like ordinary
> > > >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic.
> > > >> > > > > Like other debugnet(4) clients (netdump(4)), the network
> > > >> > > > > interface on the route to the proxy server must be online
> > > >> > > > > and support debugnet(4). =3D20
> > > >> > > > >   Finally, the remote (k)gdb(1) uses 'target remote
> > > >> > > > > :' (like any other TCP remote) to connect to
> > > >> > > > > the proxy server.=3D20
> > > >> > > > >   The NetGDB v1 protocol speaks the literal GDB remote
> > > >> > > > > serial protocol, and uses a 1:1 relationship between GDB
> > > >> > > > > packets and sequences of debugnet packets (fragmented by
> > > >> > > > > MTU).  There is no encryption utilized to keep debugging
> > > >> > > > > sessions private, so this is only appropriate for local
> > > >> > > > > segments or trusted networks. =3D20
> > > >> > > > >   Submitted by:John Reimer 
> > > >> > > > > (earlier version) Discussed some with: emaste, markj
> > > >> > > > >   Relnotes:sure
> > > >> > > > >   Differential Revision:
> > > >> > > > > https://reviews.freebsd.org/D21568
> > > >> > > > >=3D20
> > > >> > > > > Added:
> > > >> > > > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > > >> > > > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > > >> > > > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > > >> > > > > Modified:
> > > >> > > > >   head/share/man/man4/Makefile
> > > >> > > > >   head/share/man/man4/ddb.4
> > > >> > > > >   head/sys/amd64/conf/GENERIC
> > > >> > > > >   head/sys/conf/NOTES
> > > >> > > > >   head/sys/conf/files
> > > >> > > > >   head/sys/conf/options
> > > >> > > > >   head/sys/gdb/gdb.h
> > > >> > > > >   head/sys/gdb/gdb_int.h
> > > >> > > > >   head/sys/gdb/gdb_main.c
> > > >> > > > >   head/sys/gdb/gdb_packet.c
> > > >> > > > >   head/sys/i386/conf/GENERIC
> > > >> > > > >   head/sys/kern/subr_kdb.c
> > > >> > > > >   head/sys/net/debugnet.c
> > > >> > > > >   head/sys/net/debugnet.h
> > > >> > > > >   head/sys/net/debugnet_inet.c
> > > >> > > > >   head/sys/net/debugnet_int.h
> > > >> > > > >   head/sys/sys/kdb.h
> > > >> > > > >   head/sys/sys/param.h
> > > >> > > > >=3D20
> > > >> > > > > Modified: head/share/man/man4/Makefile
> > > >> > > > > =20
> > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > > >=20
> > > >> > > > >   =20
> > > >> > =20
> > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > > >=20
> > > >> > =20
> > > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> > =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > > >=20
> > > >> > =3D3D=3D3D=3D3D=3D3D=3D3D   =20
> > > >> > > > > --- head/share/man/man4/Makefile   Thu Oct 17 21:25:50
> > > >> > > > > 2019   (r353699) +++ 

Re: svn commit: r353742 - in head/sys: conf net

2019-10-18 Thread Cy Schubert
In message <201910182203.x9im3byd035...@repo.freebsd.org>, Conrad Meyer 
writes:
> Author: cem
> Date: Fri Oct 18 22:03:36 2019
> New Revision: 353742
> URL: https://svnweb.freebsd.org/changeset/base/353742
>
> Log:
>   Fix debugnet(4) link/build fallout on some configurations
>   
>   Introduced in r353685 (sys/conf/files), r353694 (debugnet.c db_printf).
>   
>   Submitted by:   kevans
>   Reported by:cy
>   X-MFC-With: r353685, r353694
>
> Modified:
>   head/sys/conf/files
>   head/sys/net/debugnet.c
>
> Modified: head/sys/conf/files
> =
> =
> --- head/sys/conf/files   Fri Oct 18 21:53:27 2019(r353741)
> +++ head/sys/conf/files   Fri Oct 18 22:03:36 2019(r353742)
> @@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.coptional libalias | net
> gr
>  netinet/libalias/alias_proxy.c   optional libalias inet | netgraph_nat i
> net
>  netinet/libalias/alias_util.coptional libalias inet | netgraph_nat i
> net
>  netinet/libalias/alias_sctp.coptional libalias inet | netgraph_nat i
> net
> -netinet/netdump/netdump_client.c optional inet netdump
> +netinet/netdump/netdump_client.c optional inet debugnet netdump
>  netinet6/dest6.c optional inet6
>  netinet6/frag6.c optional inet6
>  netinet6/icmp6.c optional inet6
>
> Modified: head/sys/net/debugnet.c
> =
> =
> --- head/sys/net/debugnet.c   Fri Oct 18 21:53:27 2019(r353741)
> +++ head/sys/net/debugnet.c   Fri Oct 18 22:03:36 2019(r353742)
> @@ -659,7 +659,7 @@ debugnet_connect(const struct debugnet_conn_params *dc
>   CURVNET_RESTORE();
>  
>   if (dest_rt == NULL) {
> - db_printf("%s: Could not get route for that server.\n",
> + printf("%s: Could not get route for that server.\n",
>   __func__);
>   error = ENOENT;
>   goto cleanup;
>


Thank you.


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

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


___
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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Cy Schubert
In message <20191018183718.5e6b3...@hermann.fritz.box>, "Hartmann, O." 
writes:
> --Sig_/icZw9PmU7w9Aj=UqDZhZj.c
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: quoted-printable
>
> On Fri, 18 Oct 2019 09:26:51 -0700
> Cy Schubert  wrote:
>
> > On October 18, 2019 8:54:06 AM PDT, "Hartmann, O."
> >  wrote:
> > >On Fri, 18 Oct 2019 07:24:12 -0700
> > >Cy Schubert  wrote:
> > > =20
> > >> In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann,
> > >> O." writes: =20
> > >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32
> > >> > Content-Type: text/plain; charset=3DUS-ASCII
> > >> > Content-Transfer-Encoding: quoted-printable
> > >> >
> > >> > On Fri, 18 Oct 2019 14:00:45 +0200
> > >> > Gary Jennejohn  wrote:
> > >> >   =20
> > >> > > On Fri, 18 Oct 2019 12:21:04 +0200
> > >> > > "Hartmann, O."  wrote:
> > >> > >=3D20   =20
> > >> > > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > >> > > > Conrad Meyer  wrote:
> > >> > > >  =3D20   =20
> > >> > > > > Author: cem
> > >> > > > > Date: Thu Oct 17 21:33:01 2019
> > >> > > > > New Revision: 353700
> > >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > >> > > > >=3D20
> > >> > > > > Log:
> > >> > > > >   Implement NetGDB(4)
> > >> > > > >  =3D20
> > >> > > > >   NetGDB(4) is a component of a system using a panic-time
> > >> > > > > network stack to remotely debug crashed FreeBSD kernels
> > >> > > > > over the network, instead of traditional serial interfaces.
> > >> > > > >  =3D20
> > >> > > > >   There are three pieces in the complete NetGDB system.
> > >> > > > >  =3D20
> > >> > > > >   First, a dedicated proxy server must be running to accept
> > >> > > > > connections from both NetGDB and gdb(1), and pass
> > >> > > > > bidirectional traffic between the two protocols.
> > >> > > > >  =3D20
> > >> > > > >   Second, the NetGDB client is activated much like ordinary
> > >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic.
> > >> > > > > Like other debugnet(4) clients (netdump(4)), the network
> > >> > > > > interface on the route to the proxy server must be online
> > >> > > > > and support debugnet(4). =3D20
> > >> > > > >   Finally, the remote (k)gdb(1) uses 'target remote
> > >> > > > > :' (like any other TCP remote) to connect to
> > >> > > > > the proxy server.=3D20
> > >> > > > >   The NetGDB v1 protocol speaks the literal GDB remote
> > >> > > > > serial protocol, and uses a 1:1 relationship between GDB
> > >> > > > > packets and sequences of debugnet packets (fragmented by
> > >> > > > > MTU).  There is no encryption utilized to keep debugging
> > >> > > > > sessions private, so this is only appropriate for local
> > >> > > > > segments or trusted networks. =3D20
> > >> > > > >   Submitted by:  John Reimer 
> > >> > > > > (earlier version) Discussed some with:   emaste, markj
> > >> > > > >   Relnotes:  sure
> > >> > > > >   Differential Revision:
> > >> > > > > https://reviews.freebsd.org/D21568
> > >> > > > >=3D20
> > >> > > > > Added:
> > >> > > > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > >> > > > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > >> > > > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > >> > > > > Modified:
> > >> > > > >   head/share/man/man4/Makefile
> > >> > > > >   head/share/man/man4/ddb.4
> > >> > > > >   head/sys/amd64/conf/GENERIC
> > >> > > > >   head/sys/conf/NOTES
> > >> > > > >   head/sys/conf/files
> > >> > > > >   head/sys/conf/options
> > >> > > > >   head/sys/gdb/gdb.h
> > >> > > > >   head/sys/gdb/gdb_int.h
> > >> > > > >   head/sys/gdb/gdb_main.c
> > >> > > > >   head/sys/gdb/gdb_packet.c
> > >> > > > >   head/sys/i386/conf/GENERIC
> > >> > > > >   head/sys/kern/subr_kdb.c
> > >> > > > >   head/sys/net/debugnet.c
> > >> > > > >   head/sys/net/debugnet.h
> > >> > > > >   head/sys/net/debugnet_inet.c
> > >> > > > >   head/sys/net/debugnet_int.h
> > >> > > > >   head/sys/sys/kdb.h
> > >> > > > >   head/sys/sys/param.h
> > >> > > > >=3D20
> > >> > > > > Modified: head/share/man/man4/Makefile
> > >> > > > > =20
> > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > >=20
> > >> > > > >   =20
> > >> > =20
> > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > >=20
> > >> > =20
> > >=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=
> =3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
> > >=20
> > >> > =3D3D=3D3D=3D3D=3D3D=3D3D   =20
> > >> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50
> > >> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile
> > >> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7
> > >> > > > > @@ MAN=3D3D aac.4 \ net80211.4 \
> > >> > > > >  netdump.4 \
> > >> > > > >  netfpga10g_nf10bmac.4 \
> > >> > > > > +netgdb.4 \
> > >> > > > >  netgraph.4 \
> > 

svn commit: r353743 - head

2019-10-18 Thread Jung-uk Kim
Author: jkim
Date: Fri Oct 18 22:08:04 2019
New Revision: 353743
URL: https://svnweb.freebsd.org/changeset/base/353743

Log:
  Do not remove /usr/share/mk/bsd.compat.mk.  It was reintroduced by r353659.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Fri Oct 18 22:03:36 2019(r353742)
+++ head/ObsoleteFiles.inc  Fri Oct 18 22:08:04 2019(r353743)
@@ -5614,8 +5614,6 @@ OLD_DIRS+=usr/share/man/man1aout
 OLD_DIRS+=usr/share/man/cat1aout
 OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout
 OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout
-# 20130110: bsd.compat.mk removed
-OLD_FILES+=usr/share/mk/bsd.compat.mk
 # 20130103: gnats-supfile removed
 OLD_FILES+=usr/share/examples/cvsup/gnats-supfile
 # 20121230: libdisk removed
___
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: r353742 - in head/sys: conf net

2019-10-18 Thread Conrad Meyer
Author: cem
Date: Fri Oct 18 22:03:36 2019
New Revision: 353742
URL: https://svnweb.freebsd.org/changeset/base/353742

Log:
  Fix debugnet(4) link/build fallout on some configurations
  
  Introduced in r353685 (sys/conf/files), r353694 (debugnet.c db_printf).
  
  Submitted by: kevans
  Reported by:  cy
  X-MFC-With:   r353685, r353694

Modified:
  head/sys/conf/files
  head/sys/net/debugnet.c

Modified: head/sys/conf/files
==
--- head/sys/conf/files Fri Oct 18 21:53:27 2019(r353741)
+++ head/sys/conf/files Fri Oct 18 22:03:36 2019(r353742)
@@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.c  optional libalias | 
netgr
 netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_util.c  optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_sctp.c  optional libalias inet | netgraph_nat inet
-netinet/netdump/netdump_client.c optional inet netdump
+netinet/netdump/netdump_client.c optional inet debugnet netdump
 netinet6/dest6.c   optional inet6
 netinet6/frag6.c   optional inet6
 netinet6/icmp6.c   optional inet6

Modified: head/sys/net/debugnet.c
==
--- head/sys/net/debugnet.c Fri Oct 18 21:53:27 2019(r353741)
+++ head/sys/net/debugnet.c Fri Oct 18 22:03:36 2019(r353742)
@@ -659,7 +659,7 @@ debugnet_connect(const struct debugnet_conn_params *dc
CURVNET_RESTORE();
 
if (dest_rt == NULL) {
-   db_printf("%s: Could not get route for that server.\n",
+   printf("%s: Could not get route for that server.\n",
__func__);
error = ENOENT;
goto 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: r353741 - in head/sys: dev/netmap dev/virtio/network net

2019-10-18 Thread Vincenzo Maffione
Author: vmaffione
Date: Fri Oct 18 21:53:27 2019
New Revision: 353741
URL: https://svnweb.freebsd.org/changeset/base/353741

Log:
  tap: add support for virtio-net offloads
  
  This patch is part of an effort to make bhyve networking (in particular TCP)
  faster. The key strategy to enhance TCP throughput is to let the whole packet
  datapath work with TSO/LRO packets (up to 64KB each), so that the per-packet
  overhead is amortized over a large number of bytes.
  This capability is supported in the guest by means of the vtnet(4) driver,
  which is able to handle TSO/LRO packets leveraging the virtio-net header
  (see struct virtio_net_hdr and struct virtio_net_hdr_mrg_rxbuf).
  A bhyve VM exchanges packets with the host through a network backend,
  which can be vale(4) or if_tap(4).
  While vale(4) supports TSO/LRO packets, if_tap(4) does not.
  This patch extends if_tap(4) with the ability to understand the virtio-net
  header, so that a tapX interface can process TSO/LRO packets.
  A couple of ioctl commands have been added to configure and probe the
  virtio-net header. Once the virtio-net header is set, the tapX interface
  acquires all the IFCAP capabilities necessary for TSO/LRO.
  
  Reviewed by:  kevans
  Differential Revision:https://reviews.freebsd.org/D21263

Modified:
  head/sys/dev/netmap/if_ptnet.c
  head/sys/dev/virtio/network/virtio_net.h
  head/sys/net/if_tap.h
  head/sys/net/if_tuntap.c

Modified: head/sys/dev/netmap/if_ptnet.c
==
--- head/sys/dev/netmap/if_ptnet.c  Fri Oct 18 21:32:45 2019
(r353740)
+++ head/sys/dev/netmap/if_ptnet.c  Fri Oct 18 21:53:27 2019
(r353741)
@@ -1335,150 +1335,6 @@ ptnet_rx_intr(void *opaque)
ptnet_rx_eof(pq, PTNET_RX_BUDGET, true);
 }
 
-/* The following offloadings-related functions are taken from the vtnet
- * driver, but the same functionality is required for the ptnet driver.
- * As a temporary solution, I copied this code from vtnet and I started
- * to generalize it (taking away driver-specific statistic accounting),
- * making as little modifications as possible.
- * In the future we need to share these functions between vtnet and ptnet.
- */
-static int
-ptnet_tx_offload_ctx(struct mbuf *m, int *etype, int *proto, int *start)
-{
-   struct ether_vlan_header *evh;
-   int offset;
-
-   evh = mtod(m, struct ether_vlan_header *);
-   if (evh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
-   /* BMV: We should handle nested VLAN tags too. */
-   *etype = ntohs(evh->evl_proto);
-   offset = sizeof(struct ether_vlan_header);
-   } else {
-   *etype = ntohs(evh->evl_encap_proto);
-   offset = sizeof(struct ether_header);
-   }
-
-   switch (*etype) {
-#if defined(INET)
-   case ETHERTYPE_IP: {
-   struct ip *ip, iphdr;
-   if (__predict_false(m->m_len < offset + sizeof(struct ip))) {
-   m_copydata(m, offset, sizeof(struct ip),
-   (caddr_t) );
-   ip = 
-   } else
-   ip = (struct ip *)(m->m_data + offset);
-   *proto = ip->ip_p;
-   *start = offset + (ip->ip_hl << 2);
-   break;
-   }
-#endif
-#if defined(INET6)
-   case ETHERTYPE_IPV6:
-   *proto = -1;
-   *start = ip6_lasthdr(m, offset, IPPROTO_IPV6, proto);
-   /* Assert the network stack sent us a valid packet. */
-   KASSERT(*start > offset,
-   ("%s: mbuf %p start %d offset %d proto %d", __func__, m,
-   *start, offset, *proto));
-   break;
-#endif
-   default:
-   /* Here we should increment the tx_csum_bad_ethtype counter. */
-   return (EINVAL);
-   }
-
-   return (0);
-}
-
-static int
-ptnet_tx_offload_tso(if_t ifp, struct mbuf *m, int eth_type,
-int offset, bool allow_ecn, struct virtio_net_hdr *hdr)
-{
-   static struct timeval lastecn;
-   static int curecn;
-   struct tcphdr *tcp, tcphdr;
-
-   if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) {
-   m_copydata(m, offset, sizeof(struct tcphdr), (caddr_t) );
-   tcp = 
-   } else
-   tcp = (struct tcphdr *)(m->m_data + offset);
-
-   hdr->hdr_len = offset + (tcp->th_off << 2);
-   hdr->gso_size = m->m_pkthdr.tso_segsz;
-   hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 :
-   VIRTIO_NET_HDR_GSO_TCPV6;
-
-   if (tcp->th_flags & TH_CWR) {
-   /*
-* Drop if VIRTIO_NET_F_HOST_ECN was not negotiated. In FreeBSD,
-* ECN support is not on a per-interface basis, but globally via
-* the net.inet.tcp.ecn.enable sysctl knob. The default is off.
-*/
- 

svn commit: r353740 - head/sys/dev/nvdimm

2019-10-18 Thread Conrad Meyer
Author: cem
Date: Fri Oct 18 21:32:45 2019
New Revision: 353740
URL: https://svnweb.freebsd.org/changeset/base/353740

Log:
  nvdimm(4): Persist unit numbers in cdev
  
  They're formatted into the device name like unit numbers, anyway; store the
  number in mda_unit => si_drv0 like dev2unit() expects.
  
  No functional change intended.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/dev/nvdimm/nvdimm_ns.c
  head/sys/dev/nvdimm/nvdimm_spa.c
  head/sys/dev/nvdimm/nvdimm_var.h

Modified: head/sys/dev/nvdimm/nvdimm_ns.c
==
--- head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 20:05:27 2019
(r353739)
+++ head/sys/dev/nvdimm/nvdimm_ns.c Fri Oct 18 21:32:45 2019
(r353740)
@@ -74,7 +74,7 @@ nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI
ns->dev.spa_efi_mem_flags = spa->dev.spa_efi_mem_flags;
ns->dev.spa_memattr = spa->dev.spa_memattr;
asprintf(, M_NVDIMM, "spa%dns%d", spa->spa_nfit_idx, i);
-   error = nvdimm_spa_dev_init(>dev, name);
+   error = nvdimm_spa_dev_init(>dev, name, i);
free(name, M_NVDIMM);
if (error != 0)
break;

Modified: head/sys/dev/nvdimm/nvdimm_spa.c
==
--- head/sys/dev/nvdimm/nvdimm_spa.cFri Oct 18 20:05:27 2019
(r353739)
+++ head/sys/dev/nvdimm/nvdimm_spa.cFri Oct 18 21:32:45 2019
(r353740)
@@ -462,13 +462,13 @@ nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYS
return (0);
 
asprintf(, M_NVDIMM, "spa%d", spa->spa_nfit_idx);
-   error = nvdimm_spa_dev_init(>dev, name);
+   error = nvdimm_spa_dev_init(>dev, name, spa->spa_nfit_idx);
free(name, M_NVDIMM);
return (error);
 }
 
 int
-nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name)
+nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int unit)
 {
struct make_dev_args mda;
struct sglist *spa_sg;
@@ -507,6 +507,7 @@ nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const 
mda.mda_gid = GID_OPERATOR;
mda.mda_mode = 0660;
mda.mda_si_drv1 = dev;
+   mda.mda_unit = unit;
asprintf(, M_NVDIMM, "nvdimm_%s", name);
error = make_dev_s(, >spa_dev, "%s", devname);
free(devname, M_NVDIMM);

Modified: head/sys/dev/nvdimm/nvdimm_var.h
==
--- head/sys/dev/nvdimm/nvdimm_var.hFri Oct 18 20:05:27 2019
(r353739)
+++ head/sys/dev/nvdimm/nvdimm_var.hFri Oct 18 21:32:45 2019
(r353740)
@@ -170,7 +170,7 @@ struct nvdimm_dev *nvdimm_find_by_handle(nfit_handle_t
 int nvdimm_spa_init(struct SPA_mapping *spa, ACPI_NFIT_SYSTEM_ADDRESS 
*nfitaddr,
 enum SPA_mapping_type spa_type);
 void nvdimm_spa_fini(struct SPA_mapping *spa);
-int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name);
+int nvdimm_spa_dev_init(struct nvdimm_spa_dev *dev, const char *name, int 
unit);
 void nvdimm_spa_dev_fini(struct nvdimm_spa_dev *dev);
 int nvdimm_create_namespaces(struct SPA_mapping *spa, ACPI_TABLE_NFIT *nfitbl);
 void nvdimm_destroy_namespaces(struct SPA_mapping *spa);
___
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: r353739 - in head/contrib/llvm/tools/clang/lib/Driver/ToolChains: . Arch

2019-10-18 Thread Dimitry Andric
Author: dim
Date: Fri Oct 18 20:05:27 2019
New Revision: 353739
URL: https://svnweb.freebsd.org/changeset/base/353739

Log:
  Pull in r374154 from upstream clang trunk (by Simon Atanasyan):
  
[mips] Set default float ABI to "soft" on FreeBSD
  
Initial patch by Kyle Evans.
  
Fix PR43596
  
  Requested by: kevans
  MFC after:1 month
  X-MFC-With:   r353358

Modified:
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
  head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp   Fri Oct 
18 20:02:46 2019(r353738)
+++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.cpp   Fri Oct 
18 20:05:27 2019(r353739)
@@ -149,7 +149,8 @@ StringRef mips::getGnuCompatibleMipsABIName(StringRef 
 
 // Select the MIPS float ABI as determined by -msoft-float, -mhard-float,
 // and -mfloat-abi=.
-mips::FloatABI mips::getMipsFloatABI(const Driver , const ArgList ) {
+mips::FloatABI mips::getMipsFloatABI(const Driver , const ArgList ,
+ const llvm::Triple ) {
   mips::FloatABI ABI = mips::FloatABI::Invalid;
   if (Arg *A =
   Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
@@ -172,10 +173,15 @@ mips::FloatABI mips::getMipsFloatABI(const Driver , 
 
   // If unspecified, choose the default based on the platform.
   if (ABI == mips::FloatABI::Invalid) {
-// Assume "hard", because it's a default value used by gcc.
-// When we start to recognize specific target MIPS processors,
-// we will be able to select the default more correctly.
-ABI = mips::FloatABI::Hard;
+if (Triple.isOSFreeBSD()) {
+  // For FreeBSD, assume "soft" on all flavors of MIPS.
+  ABI = mips::FloatABI::Soft;
+} else {
+  // Assume "hard", because it's a default value used by gcc.
+  // When we start to recognize specific target MIPS processors,
+  // we will be able to select the default more correctly.
+  ABI = mips::FloatABI::Hard;
+}
   }
 
   assert(ABI != mips::FloatABI::Invalid && "must select an ABI");
@@ -267,7 +273,7 @@ void mips::getMIPSTargetFeatures(const Driver , cons
   D.Diag(diag::warn_drv_unsupported_longcalls) << (ABICallsArg ? 0 : 1);
   }
 
-  mips::FloatABI FloatABI = mips::getMipsFloatABI(D, Args);
+  mips::FloatABI FloatABI = mips::getMipsFloatABI(D, Args, Triple);
   if (FloatABI == mips::FloatABI::Soft) {
 // FIXME: Note, this is a hack. We need to pass the selected float
 // mode to the MipsTargetInfoBase to define appropriate macros there.

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h
==
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h Fri Oct 
18 20:02:46 2019(r353738)
+++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/Mips.h Fri Oct 
18 20:05:27 2019(r353739)
@@ -38,7 +38,8 @@ void getMIPSTargetFeatures(const Driver , const llvm
const llvm::opt::ArgList ,
std::vector );
 StringRef getGnuCompatibleMipsABIName(StringRef ABI);
-mips::FloatABI getMipsFloatABI(const Driver , const llvm::opt::ArgList 
);
+mips::FloatABI getMipsFloatABI(const Driver , const llvm::opt::ArgList ,
+   const llvm::Triple );
 std::string getMipsABILibSuffix(const llvm::opt::ArgList ,
 const llvm::Triple );
 bool hasMipsAbiArg(const llvm::opt::ArgList , const char *Value);

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp   Fri Oct 
18 20:02:46 2019(r353738)
+++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp   Fri Oct 
18 20:05:27 2019(r353739)
@@ -1646,7 +1646,7 @@ void Clang::AddMIPSTargetArgs(const ArgList ,
   CmdArgs.push_back("-target-abi");
   CmdArgs.push_back(ABIName.data());
 
-  mips::FloatABI ABI = mips::getMipsFloatABI(D, Args);
+  mips::FloatABI ABI = mips::getMipsFloatABI(D, Args, Triple);
   if (ABI == mips::FloatABI::Soft) {
 // Floating point operations and argument passing are soft.
 CmdArgs.push_back("-msoft-float");

Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp
==
--- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Fri Oct 18 
20:02:46 2019(r353738)
+++ 

svn commit: r353738 - head/contrib/llvm/tools/lld/ELF

2019-10-18 Thread Dimitry Andric
Author: dim
Date: Fri Oct 18 20:02:46 2019
New Revision: 353738
URL: https://svnweb.freebsd.org/changeset/base/353738

Log:
  Pull in r372651 from upstream lld trunk (by Simon Atanasyan):
  
[mips] Support elf32btsmipn32_fbsd / elf32ltsmipn32_fbsd emulations
  
Patch by Kyle Evans.
  
  Requested by: kevans
  MFC after:1 month
  X-MFC-With:   r353358

Modified:
  head/contrib/llvm/tools/lld/ELF/Driver.cpp

Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp
==
--- head/contrib/llvm/tools/lld/ELF/Driver.cpp  Fri Oct 18 19:30:12 2019
(r353737)
+++ head/contrib/llvm/tools/lld/ELF/Driver.cpp  Fri Oct 18 20:02:46 2019
(r353738)
@@ -966,7 +966,8 @@ static void readConfigs(opt::InputArgList ) {
 StringRef s = arg->getValue();
 std::tie(config->ekind, config->emachine, config->osabi) =
 parseEmulation(s);
-config->mipsN32Abi = (s == "elf32btsmipn32" || s == "elf32ltsmipn32");
+config->mipsN32Abi =
+(s.startswith("elf32btsmipn32") || s.startswith("elf32ltsmipn32"));
 config->emulation = s;
   }
 
___
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: r353737 - head/tools/build/options

2019-10-18 Thread Dimitry Andric
Author: dim
Date: Fri Oct 18 19:30:12 2019
New Revision: 353737
URL: https://svnweb.freebsd.org/changeset/base/353737

Log:
  Provide a src.conf(5) description for the new WITHOUT_CAROOT option, and
  rename the WITH_LOADER_VERIEXEC_PASS_MANFIEST description to its correct
  name.  Also correct a bunch of spelling errors in that description.
  
  MFC after:3 days

Added:
  head/tools/build/options/WITHOUT_CAROOT   (contents, props changed)
  head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST
 - copied, changed from r353736, 
head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST
Deleted:
  head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST
Modified:
  head/tools/build/options/WITH_LOADER_VERIEXEC
  head/tools/build/options/WITH_VERIEXEC

Added: head/tools/build/options/WITHOUT_CAROOT
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITHOUT_CAROOT Fri Oct 18 19:30:12 2019
(r353737)
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set to not add the trusted certificates from the Mozilla NSS bundle to
+base.

Modified: head/tools/build/options/WITH_LOADER_VERIEXEC
==
--- head/tools/build/options/WITH_LOADER_VERIEXEC   Fri Oct 18 18:01:22 
2019(r353736)
+++ head/tools/build/options/WITH_LOADER_VERIEXEC   Fri Oct 18 19:30:12 
2019(r353737)
@@ -1,7 +1,7 @@
 .\" $FreeBSD$
 Enable building
 .Xr loader 8
-with support for verifcation similar to Verified Exec.
+with support for verification similar to Verified Exec.
 .Pp
-It depends on
-.Va WITH_BEARSSL
+Depends on
+.Va WITH_BEARSSL .

Copied and modified: 
head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST (from r353736, 
head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST)
==
--- head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST Fri Oct 18 
18:01:22 2019(r353736, copy source)
+++ head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST Fri Oct 18 
19:30:12 2019(r353737)
@@ -1,8 +1,8 @@
 .\" $FreeBSD$
 Enable building
 .Xr loader 8
-with support to pass a verified manifest to kernel.
-Kernel has to be build with a module to parse the manfiest.
+with support to pass a verified manifest to the kernel.
+The kernel has to be built with a module to parse the manifest.
 .Pp
-It depends on
-.Va WITH_LOADER_VERIEXEC
+Depends on
+.Va WITH_LOADER_VERIEXEC .

Modified: head/tools/build/options/WITH_VERIEXEC
==
--- head/tools/build/options/WITH_VERIEXEC  Fri Oct 18 18:01:22 2019
(r353736)
+++ head/tools/build/options/WITH_VERIEXEC  Fri Oct 18 19:30:12 2019
(r353737)
@@ -5,5 +5,5 @@ which loads the contents of verified manifests into th
 for use by
 .Xr mac_veriexec 4
 .Pp
-It depends on
-.Va WITH_BEARSSL
+Depends on
+.Va WITH_BEARSSL .
___
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: r353735 - in vendor-sys/acpica/dist: . generate/unix/acpinames source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher sourc...

2019-10-18 Thread Jung-uk Kim
Author: jkim
Date: Fri Oct 18 18:00:41 2019
New Revision: 353735
URL: https://svnweb.freebsd.org/changeset/base/353735

Log:
  Import ACPICA 20191018.

Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/generate/unix/acpinames/Makefile
  vendor-sys/acpica/dist/source/common/acgetline.c
  vendor-sys/acpica/dist/source/common/adisasm.c
  vendor-sys/acpica/dist/source/common/adwalk.c
  vendor-sys/acpica/dist/source/common/dmtables.c
  vendor-sys/acpica/dist/source/common/dmtbdump1.c
  vendor-sys/acpica/dist/source/common/dmtbdump2.c
  vendor-sys/acpica/dist/source/common/dmtbdump3.c
  vendor-sys/acpica/dist/source/compiler/aslanalyze.c
  vendor-sys/acpica/dist/source/compiler/aslbtypes.c
  vendor-sys/acpica/dist/source/compiler/aslkeywords.y
  vendor-sys/acpica/dist/source/compiler/aslload.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.h
  vendor-sys/acpica/dist/source/compiler/aslmethod.c
  vendor-sys/acpica/dist/source/compiler/aslnamesp.c
  vendor-sys/acpica/dist/source/compiler/aslprepkg.c
  vendor-sys/acpica/dist/source/compiler/aslresource.c
  vendor-sys/acpica/dist/source/compiler/aslrestype2.c
  vendor-sys/acpica/dist/source/compiler/aslrestype2s.c
  vendor-sys/acpica/dist/source/compiler/aslutils.c
  vendor-sys/acpica/dist/source/compiler/cvdisasm.c
  vendor-sys/acpica/dist/source/compiler/cvparser.c
  vendor-sys/acpica/dist/source/compiler/dtcompile.c
  vendor-sys/acpica/dist/source/compiler/dtcompiler.h
  vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l
  vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y
  vendor-sys/acpica/dist/source/compiler/dtfield.c
  vendor-sys/acpica/dist/source/compiler/dtio.c
  vendor-sys/acpica/dist/source/compiler/dttable2.c
  vendor-sys/acpica/dist/source/components/debugger/dbconvert.c
  vendor-sys/acpica/dist/source/components/debugger/dbdisply.c
  vendor-sys/acpica/dist/source/components/debugger/dbfileio.c
  vendor-sys/acpica/dist/source/components/debugger/dbinput.c
  vendor-sys/acpica/dist/source/components/debugger/dbmethod.c
  vendor-sys/acpica/dist/source/components/debugger/dbnames.c
  vendor-sys/acpica/dist/source/components/debugger/dbobject.c
  vendor-sys/acpica/dist/source/components/disassembler/dmdeferred.c
  vendor-sys/acpica/dist/source/components/disassembler/dmresrc.c
  vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c
  vendor-sys/acpica/dist/source/components/dispatcher/dscontrol.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsfield.c
  vendor-sys/acpica/dist/source/components/events/evgpeblk.c
  vendor-sys/acpica/dist/source/components/events/evgpeinit.c
  vendor-sys/acpica/dist/source/components/events/evmisc.c
  vendor-sys/acpica/dist/source/components/events/evregion.c
  vendor-sys/acpica/dist/source/components/events/evrgnini.c
  vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c
  vendor-sys/acpica/dist/source/components/namespace/nsconvert.c
  vendor-sys/acpica/dist/source/components/namespace/nsdump.c
  vendor-sys/acpica/dist/source/components/namespace/nsxfname.c
  vendor-sys/acpica/dist/source/components/parser/psobject.c
  vendor-sys/acpica/dist/source/components/resources/rscreate.c
  vendor-sys/acpica/dist/source/components/tables/tbdata.c
  vendor-sys/acpica/dist/source/components/tables/tbxfload.c
  vendor-sys/acpica/dist/source/components/utilities/utbuffer.c
  vendor-sys/acpica/dist/source/components/utilities/utids.c
  vendor-sys/acpica/dist/source/components/utilities/uttrack.c
  vendor-sys/acpica/dist/source/include/acdebug.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/acstruct.h
  vendor-sys/acpica/dist/source/include/acutils.h
  vendor-sys/acpica/dist/source/include/platform/acfreebsd.h
  vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aeinitfile.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aetests.c
  vendor-sys/acpica/dist/source/tools/acpihelp/ahdecode.c
  vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asremove.c
  vendor-sys/acpica/dist/tests/templates/Makefile

Modified: vendor-sys/acpica/dist/changes.txt
==
--- vendor-sys/acpica/dist/changes.txt  Fri Oct 18 17:36:42 2019
(r353734)
+++ vendor-sys/acpica/dist/changes.txt  Fri Oct 18 18:00:41 2019
(r353735)
@@ -1,4 +1,51 @@
 
+18 October 2019. Summary of changes for version 20191018:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Debugger: added a new command: ?Fields [address space ID]?. This command 
+dumps the contents

svn commit: r353736 - vendor-sys/acpica/20191018

2019-10-18 Thread Jung-uk Kim
Author: jkim
Date: Fri Oct 18 18:01:22 2019
New Revision: 353736
URL: https://svnweb.freebsd.org/changeset/base/353736

Log:
  Tag ACPICA 20191018.

Added:
  vendor-sys/acpica/20191018/
 - copied from r353735, vendor-sys/acpica/dist/
___
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: r353734 - head/sys/vm

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 17:36:42 2019
New Revision: 353734
URL: https://svnweb.freebsd.org/changeset/base/353734

Log:
  Further constrain the use of per-CPU caches for free pages.
  
  In low memory conditions a significant number of pages may end up stuck
  in the caches, and currently these caches cannot be reaped, leading to
  spurious memory allocation failures and OOM kills.  So:
  
  - Take into account the fact that we may cache up to two full buckets
of pages per CPU, not just one.
  - Increase the amount of RAM required per CPU to enable the caches.
  
  This is a temporary measure until the page cache management policy is
  improved.
  
  PR:   241048
  Reported and tested by:   Kevin Oberman 
  Reviewed by:  alc, kib
  Discussed with:   jeff
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22040

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Fri Oct 18 17:01:27 2019(r353733)
+++ head/sys/vm/vm_page.c   Fri Oct 18 17:36:42 2019(r353734)
@@ -222,10 +222,12 @@ vm_page_init_cache_zones(void *dummy __unused)
vmd = VM_DOMAIN(domain);
 
/*
-* Don't allow the page caches to take up more than .25% of
-* memory.
+* Don't allow the page caches to take up more than .1875% of
+* memory.  A UMA bucket contains at most 256 free pages, and we
+* have two buckets per CPU per free pool.
 */
-   if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL)
+   if (vmd->vmd_page_count / 600 < 2 * 256 * mp_ncpus *
+   VM_NFREEPOOL)
continue;
for (pool = 0; pool < VM_NFREEPOOL; pool++) {
pgcache = >vmd_pgcache[pool];
___
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: r353733 - head/sys/ufs/ffs

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 17:01:27 2019
New Revision: 353733
URL: https://svnweb.freebsd.org/changeset/base/353733

Log:
  Abbreviate softdep lock names.
  
  The softdep lock names were unusually long and tended to stick out in
  lock profiling reports.  Abbreviate them and make them consistent with
  our conventional style for lock names.
  
  Reviewed by:  mckusick
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D22042

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Fri Oct 18 15:20:24 2019
(r353732)
+++ head/sys/ufs/ffs/ffs_softdep.c  Fri Oct 18 17:01:27 2019
(r353733)
@@ -968,7 +968,7 @@ static  int softdep_count_dependencies(struct buf *bp, 
  * Global lock over all of soft updates.
  */
 static struct mtx lk;
-MTX_SYSINIT(softdep_lock, , "Global Softdep Lock", MTX_DEF);
+MTX_SYSINIT(softdep_lock, , "global softdep", MTX_DEF);
 
 #define ACQUIRE_GBLLOCK(lk)mtx_lock(lk)
 #define FREE_GBLLOCK(lk)   mtx_unlock(lk)
@@ -2491,7 +2491,7 @@ softdep_mount(devvp, mp, fs, cred)
ump = VFSTOUFS(mp);
ump->um_softdep = sdp;
MNT_IUNLOCK(mp);
-   rw_init(LOCK_PTR(ump), "Per-Filesystem Softdep Lock");
+   rw_init(LOCK_PTR(ump), "per-fs softdep");
sdp->sd_ump = ump;
LIST_INIT(>softdep_workitem_pending);
LIST_INIT(>softdep_journal_pending);
___
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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Hartmann, O.
On Fri, 18 Oct 2019 09:26:51 -0700
Cy Schubert  wrote:

> On October 18, 2019 8:54:06 AM PDT, "Hartmann, O."
>  wrote:
> >On Fri, 18 Oct 2019 07:24:12 -0700
> >Cy Schubert  wrote:
> >  
> >> In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann,
> >> O." writes:  
> >> > --Sig_/QDD9BZgeMM6.TJkOIciNb32
> >> > Content-Type: text/plain; charset=US-ASCII
> >> > Content-Transfer-Encoding: quoted-printable
> >> >
> >> > On Fri, 18 Oct 2019 14:00:45 +0200
> >> > Gary Jennejohn  wrote:
> >> >
> >> > > On Fri, 18 Oct 2019 12:21:04 +0200
> >> > > "Hartmann, O."  wrote:
> >> > >=20
> >> > > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> >> > > > Conrad Meyer  wrote:
> >> > > >  =20
> >> > > > > Author: cem
> >> > > > > Date: Thu Oct 17 21:33:01 2019
> >> > > > > New Revision: 353700
> >> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700
> >> > > > >=20
> >> > > > > Log:
> >> > > > >   Implement NetGDB(4)
> >> > > > >  =20
> >> > > > >   NetGDB(4) is a component of a system using a panic-time
> >> > > > > network stack to remotely debug crashed FreeBSD kernels
> >> > > > > over the network, instead of traditional serial interfaces.
> >> > > > >  =20
> >> > > > >   There are three pieces in the complete NetGDB system.
> >> > > > >  =20
> >> > > > >   First, a dedicated proxy server must be running to accept
> >> > > > > connections from both NetGDB and gdb(1), and pass
> >> > > > > bidirectional traffic between the two protocols.
> >> > > > >  =20
> >> > > > >   Second, the NetGDB client is activated much like ordinary
> >> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic.
> >> > > > > Like other debugnet(4) clients (netdump(4)), the network
> >> > > > > interface on the route to the proxy server must be online
> >> > > > > and support debugnet(4). =20
> >> > > > >   Finally, the remote (k)gdb(1) uses 'target remote
> >> > > > > :' (like any other TCP remote) to connect to
> >> > > > > the proxy server.=20
> >> > > > >   The NetGDB v1 protocol speaks the literal GDB remote
> >> > > > > serial protocol, and uses a 1:1 relationship between GDB
> >> > > > > packets and sequences of debugnet packets (fragmented by
> >> > > > > MTU).  There is no encryption utilized to keep debugging
> >> > > > > sessions private, so this is only appropriate for local
> >> > > > > segments or trusted networks. =20
> >> > > > >   Submitted by:John Reimer 
> >> > > > > (earlier version) Discussed some with: emaste, markj
> >> > > > >   Relnotes:sure
> >> > > > >   Differential Revision:
> >> > > > > https://reviews.freebsd.org/D21568
> >> > > > >=20
> >> > > > > Added:
> >> > > > >   head/share/man/man4/netgdb.4   (contents, props changed)
> >> > > > >   head/sys/gdb/netgdb.c   (contents, props changed)
> >> > > > >   head/sys/gdb/netgdb.h   (contents, props changed)
> >> > > > > Modified:
> >> > > > >   head/share/man/man4/Makefile
> >> > > > >   head/share/man/man4/ddb.4
> >> > > > >   head/sys/amd64/conf/GENERIC
> >> > > > >   head/sys/conf/NOTES
> >> > > > >   head/sys/conf/files
> >> > > > >   head/sys/conf/options
> >> > > > >   head/sys/gdb/gdb.h
> >> > > > >   head/sys/gdb/gdb_int.h
> >> > > > >   head/sys/gdb/gdb_main.c
> >> > > > >   head/sys/gdb/gdb_packet.c
> >> > > > >   head/sys/i386/conf/GENERIC
> >> > > > >   head/sys/kern/subr_kdb.c
> >> > > > >   head/sys/net/debugnet.c
> >> > > > >   head/sys/net/debugnet.h
> >> > > > >   head/sys/net/debugnet_inet.c
> >> > > > >   head/sys/net/debugnet_int.h
> >> > > > >   head/sys/sys/kdb.h
> >> > > > >   head/sys/sys/param.h
> >> > > > >=20
> >> > > > > Modified: head/share/man/man4/Makefile
> >> > > > >  
> >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > 
> >> > > > >
> >> >  
> >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > 
> >> >  
> >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > 
> >> > =3D=3D=3D=3D=3D
> >> > > > > --- head/share/man/man4/Makefile   Thu Oct 17 21:25:50
> >> > > > > 2019   (r353699) +++ head/share/man/man4/Makefile
> >> > > > > Thu Oct 17 21:33:01 2019   (r353700) @@ -307,6 +307,7
> >> > > > > @@ MAN=3D aac.4 \ net80211.4 \
> >> > > > >netdump.4 \
> >> > > > >netfpga10g_nf10bmac.4 \
> >> > > > > +  netgdb.4 \
> >> > > > >netgraph.4 \
> >> > > > >netintro.4 \
> >> > > > >netmap.4 \
> >> > > > >=20
> >> > > > [...]
> >> > > >=20
> >> > > >=20
> >> > > > Having "nooptions   NETGDB  # netgdb(4) client
> >> > > > support" defined in my kernel config file, buildkernel fails
> >> > > > with the error shown below.
> >> > > >=20
> >> > > > [...]
> >> > > > --- debugnet.o ---
> >> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit
> >> > > > declaration of function 'db_printf' is invalid in C99
> >> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s:
> >> > > > Could not get route for that server.\n", ^
> >> > > > 

Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Cy Schubert
On October 18, 2019 8:54:06 AM PDT, "Hartmann, O."  
wrote:
>On Fri, 18 Oct 2019 07:24:12 -0700
>Cy Schubert  wrote:
>
>> In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann,
>> O." writes:
>> > --Sig_/QDD9BZgeMM6.TJkOIciNb32
>> > Content-Type: text/plain; charset=US-ASCII
>> > Content-Transfer-Encoding: quoted-printable
>> >
>> > On Fri, 18 Oct 2019 14:00:45 +0200
>> > Gary Jennejohn  wrote:
>> >  
>> > > On Fri, 18 Oct 2019 12:21:04 +0200
>> > > "Hartmann, O."  wrote:
>> > >=20  
>> > > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
>> > > > Conrad Meyer  wrote:
>> > > >  =20  
>> > > > > Author: cem
>> > > > > Date: Thu Oct 17 21:33:01 2019
>> > > > > New Revision: 353700
>> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700
>> > > > >=20
>> > > > > Log:
>> > > > >   Implement NetGDB(4)
>> > > > >  =20
>> > > > >   NetGDB(4) is a component of a system using a panic-time
>> > > > > network stack to remotely debug crashed FreeBSD kernels over
>> > > > > the network, instead of traditional serial interfaces.
>> > > > >  =20
>> > > > >   There are three pieces in the complete NetGDB system.
>> > > > >  =20
>> > > > >   First, a dedicated proxy server must be running to accept
>> > > > > connections from both NetGDB and gdb(1), and pass
>> > > > > bidirectional traffic between the two protocols.
>> > > > >  =20
>> > > > >   Second, the NetGDB client is activated much like ordinary
>> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic.
>> > > > > Like other debugnet(4) clients (netdump(4)), the network
>> > > > > interface on the route to the proxy server must be online and
>> > > > > support debugnet(4). =20
>> > > > >   Finally, the remote (k)gdb(1) uses 'target remote
>> > > > > :' (like any other TCP remote) to connect to the
>> > > > > proxy server.=20
>> > > > >   The NetGDB v1 protocol speaks the literal GDB remote serial
>> > > > > protocol, and uses a 1:1 relationship between GDB packets and
>> > > > > sequences of debugnet packets (fragmented by MTU).  There is
>> > > > > no encryption utilized to keep debugging sessions private, so
>> > > > > this is only appropriate for local segments or trusted
>> > > > > networks. =20
>> > > > >   Submitted by:  John Reimer 
>> > > > > (earlier version) Discussed some with:   emaste, markj
>> > > > >   Relnotes:  sure
>> > > > >   Differential Revision:
>> > > > > https://reviews.freebsd.org/D21568
>> > > > >=20
>> > > > > Added:
>> > > > >   head/share/man/man4/netgdb.4   (contents, props changed)
>> > > > >   head/sys/gdb/netgdb.c   (contents, props changed)
>> > > > >   head/sys/gdb/netgdb.h   (contents, props changed)
>> > > > > Modified:
>> > > > >   head/share/man/man4/Makefile
>> > > > >   head/share/man/man4/ddb.4
>> > > > >   head/sys/amd64/conf/GENERIC
>> > > > >   head/sys/conf/NOTES
>> > > > >   head/sys/conf/files
>> > > > >   head/sys/conf/options
>> > > > >   head/sys/gdb/gdb.h
>> > > > >   head/sys/gdb/gdb_int.h
>> > > > >   head/sys/gdb/gdb_main.c
>> > > > >   head/sys/gdb/gdb_packet.c
>> > > > >   head/sys/i386/conf/GENERIC
>> > > > >   head/sys/kern/subr_kdb.c
>> > > > >   head/sys/net/debugnet.c
>> > > > >   head/sys/net/debugnet.h
>> > > > >   head/sys/net/debugnet_inet.c
>> > > > >   head/sys/net/debugnet_int.h
>> > > > >   head/sys/sys/kdb.h
>> > > > >   head/sys/sys/param.h
>> > > > >=20
>> > > > > Modified: head/share/man/man4/Makefile
>> > > > >
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>> > > > >  
>> >
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>> >
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
>> > =3D=3D=3D=3D=3D  
>> > > > > --- head/share/man/man4/Makefile Thu Oct 17 21:25:50
>> > > > > 2019 (r353699) +++ head/share/man/man4/Makefile
>> > > > > Thu Oct 17 21:33:01 2019 (r353700) @@ -307,6 +307,7 @@
>> > > > > MAN=3D aac.4 \ net80211.4 \
>> > > > >  netdump.4 \
>> > > > >  netfpga10g_nf10bmac.4 \
>> > > > > +netgdb.4 \
>> > > > >  netgraph.4 \
>> > > > >  netintro.4 \
>> > > > >  netmap.4 \
>> > > > >=20  
>> > > > [...]
>> > > >=20
>> > > >=20
>> > > > Having "nooptions   NETGDB  # netgdb(4) client
>> > > > support" defined in my kernel config file, buildkernel fails
>> > > > with the error shown below.
>> > > >=20
>> > > > [...]
>> > > > --- debugnet.o ---
>> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration
>> > > > of function 'db_printf' is invalid in C99
>> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could
>> > > > not get route for that server.\n", ^
>> > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean
>> > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: 'if_printf'
>> > > > declared here int if_printf(struct ifnet *, const char *,
>> > > > ...) __printflike(2, 3); ^ 1 error generated. =20  
>> > >=20
>> > > And I also had to add "nooptions NETDUMP" to get the kernel to
>> > > 

Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Hartmann, O.
On Fri, 18 Oct 2019 07:24:12 -0700
Cy Schubert  wrote:

> In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann,
> O." writes:
> > --Sig_/QDD9BZgeMM6.TJkOIciNb32
> > Content-Type: text/plain; charset=US-ASCII
> > Content-Transfer-Encoding: quoted-printable
> >
> > On Fri, 18 Oct 2019 14:00:45 +0200
> > Gary Jennejohn  wrote:
> >  
> > > On Fri, 18 Oct 2019 12:21:04 +0200
> > > "Hartmann, O."  wrote:
> > >=20  
> > > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > > > Conrad Meyer  wrote:
> > > >  =20  
> > > > > Author: cem
> > > > > Date: Thu Oct 17 21:33:01 2019
> > > > > New Revision: 353700
> > > > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > > > >=20
> > > > > Log:
> > > > >   Implement NetGDB(4)
> > > > >  =20
> > > > >   NetGDB(4) is a component of a system using a panic-time
> > > > > network stack to remotely debug crashed FreeBSD kernels over
> > > > > the network, instead of traditional serial interfaces.
> > > > >  =20
> > > > >   There are three pieces in the complete NetGDB system.
> > > > >  =20
> > > > >   First, a dedicated proxy server must be running to accept
> > > > > connections from both NetGDB and gdb(1), and pass
> > > > > bidirectional traffic between the two protocols.
> > > > >  =20
> > > > >   Second, the NetGDB client is activated much like ordinary
> > > > > 'gdb' and similarly to 'netdump' in ddb(4) after a panic.
> > > > > Like other debugnet(4) clients (netdump(4)), the network
> > > > > interface on the route to the proxy server must be online and
> > > > > support debugnet(4). =20
> > > > >   Finally, the remote (k)gdb(1) uses 'target remote
> > > > > :' (like any other TCP remote) to connect to the
> > > > > proxy server.=20
> > > > >   The NetGDB v1 protocol speaks the literal GDB remote serial
> > > > > protocol, and uses a 1:1 relationship between GDB packets and
> > > > > sequences of debugnet packets (fragmented by MTU).  There is
> > > > > no encryption utilized to keep debugging sessions private, so
> > > > > this is only appropriate for local segments or trusted
> > > > > networks. =20
> > > > >   Submitted by:   John Reimer 
> > > > > (earlier version) Discussed some with:emaste, markj
> > > > >   Relnotes:   sure
> > > > >   Differential Revision:
> > > > > https://reviews.freebsd.org/D21568
> > > > >=20
> > > > > Added:
> > > > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > > > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > > > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > > > > Modified:
> > > > >   head/share/man/man4/Makefile
> > > > >   head/share/man/man4/ddb.4
> > > > >   head/sys/amd64/conf/GENERIC
> > > > >   head/sys/conf/NOTES
> > > > >   head/sys/conf/files
> > > > >   head/sys/conf/options
> > > > >   head/sys/gdb/gdb.h
> > > > >   head/sys/gdb/gdb_int.h
> > > > >   head/sys/gdb/gdb_main.c
> > > > >   head/sys/gdb/gdb_packet.c
> > > > >   head/sys/i386/conf/GENERIC
> > > > >   head/sys/kern/subr_kdb.c
> > > > >   head/sys/net/debugnet.c
> > > > >   head/sys/net/debugnet.h
> > > > >   head/sys/net/debugnet_inet.c
> > > > >   head/sys/net/debugnet_int.h
> > > > >   head/sys/sys/kdb.h
> > > > >   head/sys/sys/param.h
> > > > >=20
> > > > > Modified: head/share/man/man4/Makefile
> > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > > > >  
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > =3D=3D=3D=3D=3D  
> > > > > --- head/share/man/man4/Makefile  Thu Oct 17 21:25:50
> > > > > 2019  (r353699) +++ head/share/man/man4/Makefile
> > > > > Thu Oct 17 21:33:01 2019  (r353700) @@ -307,6 +307,7 @@
> > > > > MAN=3D aac.4 \ net80211.4 \
> > > > >   netdump.4 \
> > > > >   netfpga10g_nf10bmac.4 \
> > > > > + netgdb.4 \
> > > > >   netgraph.4 \
> > > > >   netintro.4 \
> > > > >   netmap.4 \
> > > > >=20  
> > > > [...]
> > > >=20
> > > >=20
> > > > Having "nooptions   NETGDB  # netgdb(4) client
> > > > support" defined in my kernel config file, buildkernel fails
> > > > with the error shown below.
> > > >=20
> > > > [...]
> > > > --- debugnet.o ---
> > > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration
> > > > of function 'db_printf' is invalid in C99
> > > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could
> > > > not get route for that server.\n", ^
> > > > /usr/src/sys/net/debugnet.c:662:4: note: did you mean
> > > > 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note: 'if_printf'
> > > > declared here int if_printf(struct ifnet *, const char *,
> > > > ...) __printflike(2, 3); ^ 1 error generated. =20  
> > >=20
> > > And I also had to add "nooptions NETDUMP" to get the kernel to
> > > compile and link.
> > >=20  
> >
> > I already had "nooptions NETDUMP" defined.  
> 
> 
> This will fix it.
> 
> Index: sys/net/debugnet.c
> 

svn commit: r353732 - head/sys/net

2019-10-18 Thread Gleb Smirnoff
Author: glebius
Date: Fri Oct 18 15:20:24 2019
New Revision: 353732
URL: https://svnweb.freebsd.org/changeset/base/353732

Log:
  Make rt_getifa_fib() static.

Modified:
  head/sys/net/route.c
  head/sys/net/route.h

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cFri Oct 18 14:05:13 2019(r353731)
+++ head/sys/net/route.cFri Oct 18 15:20:24 2019(r353732)
@@ -135,6 +135,7 @@ VNET_DEFINE_STATIC(uma_zone_t, rtzone); /* 
Routing ta
 
 EVENTHANDLER_LIST_DEFINE(rt_addrmsg);
 
+static int rt_getifa_fib(struct rt_addrinfo *, u_int);
 static int rtrequest1_fib_change(struct rib_head *, struct rt_addrinfo *,
 struct rtentry **, u_int);
 static void rt_setmetrics(const struct rt_addrinfo *, struct rtentry *);

Modified: head/sys/net/route.h
==
--- head/sys/net/route.hFri Oct 18 14:05:13 2019(r353731)
+++ head/sys/net/route.hFri Oct 18 15:20:24 2019(r353732)
@@ -488,7 +488,6 @@ int  rtinit(struct ifaddr *, int, int);
  * For now the protocol indepedent versions are the same as the AF_INET ones
  * but this will change.. 
  */
-int rt_getifa_fib(struct rt_addrinfo *, u_int fibnum);
 voidrtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum);
 struct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int);
 int rtioctl_fib(u_long, caddr_t, u_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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Cy Schubert
In message <20191018160935.7dda6...@hermann.fritz.box>, "Hartmann, O." 
writes:
> --Sig_/QDD9BZgeMM6.TJkOIciNb32
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: quoted-printable
>
> On Fri, 18 Oct 2019 14:00:45 +0200
> Gary Jennejohn  wrote:
>
> > On Fri, 18 Oct 2019 12:21:04 +0200
> > "Hartmann, O."  wrote:
> >=20
> > > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > > Conrad Meyer  wrote:
> > >  =20
> > > > Author: cem
> > > > Date: Thu Oct 17 21:33:01 2019
> > > > New Revision: 353700
> > > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > > >=20
> > > > Log:
> > > >   Implement NetGDB(4)
> > > >  =20
> > > >   NetGDB(4) is a component of a system using a panic-time network
> > > > stack to remotely debug crashed FreeBSD kernels over the network,
> > > > instead of traditional serial interfaces.
> > > >  =20
> > > >   There are three pieces in the complete NetGDB system.
> > > >  =20
> > > >   First, a dedicated proxy server must be running to accept
> > > > connections from both NetGDB and gdb(1), and pass bidirectional
> > > > traffic between the two protocols.
> > > >  =20
> > > >   Second, the NetGDB client is activated much like ordinary 'gdb'
> > > > and similarly to 'netdump' in ddb(4) after a panic.  Like other
> > > > debugnet(4) clients (netdump(4)), the network interface on the
> > > > route to the proxy server must be online and support debugnet(4).
> > > >  =20
> > > >   Finally, the remote (k)gdb(1) uses 'target remote
> > > > :' (like any other TCP remote) to connect to the
> > > > proxy server.=20
> > > >   The NetGDB v1 protocol speaks the literal GDB remote serial
> > > > protocol, and uses a 1:1 relationship between GDB packets and
> > > > sequences of debugnet packets (fragmented by MTU).  There is no
> > > > encryption utilized to keep debugging sessions private, so this is
> > > > only appropriate for local segments or trusted networks.
> > > >  =20
> > > >   Submitted by: John Reimer 
> > > > (earlier version) Discussed some with:  emaste, markj
> > > >   Relnotes: sure
> > > >   Differential Revision:https://reviews.freebsd.org/D21568
> > > >=20
> > > > Added:
> > > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > > > Modified:
> > > >   head/share/man/man4/Makefile
> > > >   head/share/man/man4/ddb.4
> > > >   head/sys/amd64/conf/GENERIC
> > > >   head/sys/conf/NOTES
> > > >   head/sys/conf/files
> > > >   head/sys/conf/options
> > > >   head/sys/gdb/gdb.h
> > > >   head/sys/gdb/gdb_int.h
> > > >   head/sys/gdb/gdb_main.c
> > > >   head/sys/gdb/gdb_packet.c
> > > >   head/sys/i386/conf/GENERIC
> > > >   head/sys/kern/subr_kdb.c
> > > >   head/sys/net/debugnet.c
> > > >   head/sys/net/debugnet.h
> > > >   head/sys/net/debugnet_inet.c
> > > >   head/sys/net/debugnet_int.h
> > > >   head/sys/sys/kdb.h
> > > >   head/sys/sys/param.h
> > > >=20
> > > > Modified: head/share/man/man4/Makefile
> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D
> > > > --- head/share/man/man4/MakefileThu Oct 17 21:25:50
> > > > 2019(r353699) +++ head/share/man/man4/Makefile  Thu
> > > > Oct 17 21:33:01 2019(r353700) @@ -307,6 +307,7 @@ MAN=3D
> > > > aac.4 \ net80211.4 \
> > > > netdump.4 \
> > > > netfpga10g_nf10bmac.4 \
> > > > +   netgdb.4 \
> > > > netgraph.4 \
> > > > netintro.4 \
> > > > netmap.4 \
> > > >=20
> > > [...]
> > >=20
> > >=20
> > > Having "nooptions   NETGDB  # netgdb(4) client support"
> > > defined in my kernel config file, buildkernel fails with the error
> > > shown below.
> > >=20
> > > [...]
> > > --- debugnet.o ---
> > > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of
> > > function 'db_printf' is invalid in C99
> > > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not
> > > get route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4:
> > > note: did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5:
> > > note: 'if_printf' declared here int if_printf(struct ifnet *,
> > > const char *, ...) __printflike(2, 3); ^
> > > 1 error generated. =20
> >=20
> > And I also had to add "nooptions NETDUMP" to get the kernel to compile
> > and link.
> >=20
>
> I already had "nooptions NETDUMP" defined.


This will fix it.

Index: sys/net/debugnet.c
===
--- sys/net/debugnet.c  (revision 353717)
+++ sys/net/debugnet.c  (working copy)
@@ -659,8 +659,10 @@
CURVNET_RESTORE();
 
if (dest_rt == NULL) {
+#ifdef DDB
db_printf("%s: Could not get route for that server.\n",
 

Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Hartmann, O.
On Fri, 18 Oct 2019 14:00:45 +0200
Gary Jennejohn  wrote:

> On Fri, 18 Oct 2019 12:21:04 +0200
> "Hartmann, O."  wrote:
> 
> > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > Conrad Meyer  wrote:
> >   
> > > Author: cem
> > > Date: Thu Oct 17 21:33:01 2019
> > > New Revision: 353700
> > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > > 
> > > Log:
> > >   Implement NetGDB(4)
> > >   
> > >   NetGDB(4) is a component of a system using a panic-time network
> > > stack to remotely debug crashed FreeBSD kernels over the network,
> > > instead of traditional serial interfaces.
> > >   
> > >   There are three pieces in the complete NetGDB system.
> > >   
> > >   First, a dedicated proxy server must be running to accept
> > > connections from both NetGDB and gdb(1), and pass bidirectional
> > > traffic between the two protocols.
> > >   
> > >   Second, the NetGDB client is activated much like ordinary 'gdb'
> > > and similarly to 'netdump' in ddb(4) after a panic.  Like other
> > > debugnet(4) clients (netdump(4)), the network interface on the
> > > route to the proxy server must be online and support debugnet(4).
> > >   
> > >   Finally, the remote (k)gdb(1) uses 'target remote
> > > :' (like any other TCP remote) to connect to the
> > > proxy server. 
> > >   The NetGDB v1 protocol speaks the literal GDB remote serial
> > > protocol, and uses a 1:1 relationship between GDB packets and
> > > sequences of debugnet packets (fragmented by MTU).  There is no
> > > encryption utilized to keep debugging sessions private, so this is
> > > only appropriate for local segments or trusted networks.
> > >   
> > >   Submitted by:   John Reimer 
> > > (earlier version) Discussed some with:emaste, markj
> > >   Relnotes:   sure
> > >   Differential Revision:  https://reviews.freebsd.org/D21568
> > > 
> > > Added:
> > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > > Modified:
> > >   head/share/man/man4/Makefile
> > >   head/share/man/man4/ddb.4
> > >   head/sys/amd64/conf/GENERIC
> > >   head/sys/conf/NOTES
> > >   head/sys/conf/files
> > >   head/sys/conf/options
> > >   head/sys/gdb/gdb.h
> > >   head/sys/gdb/gdb_int.h
> > >   head/sys/gdb/gdb_main.c
> > >   head/sys/gdb/gdb_packet.c
> > >   head/sys/i386/conf/GENERIC
> > >   head/sys/kern/subr_kdb.c
> > >   head/sys/net/debugnet.c
> > >   head/sys/net/debugnet.h
> > >   head/sys/net/debugnet_inet.c
> > >   head/sys/net/debugnet_int.h
> > >   head/sys/sys/kdb.h
> > >   head/sys/sys/param.h
> > > 
> > > Modified: head/share/man/man4/Makefile
> > > ==
> > > --- head/share/man/man4/Makefile  Thu Oct 17 21:25:50
> > > 2019  (r353699) +++ head/share/man/man4/Makefile  Thu
> > > Oct 17 21:33:01 2019  (r353700) @@ -307,6 +307,7 @@ MAN=
> > > aac.4 \ net80211.4 \
> > >   netdump.4 \
> > >   netfpga10g_nf10bmac.4 \
> > > + netgdb.4 \
> > >   netgraph.4 \
> > >   netintro.4 \
> > >   netmap.4 \
> > > 
> > [...]
> > 
> > 
> > Having "nooptions   NETGDB  # netgdb(4) client support"
> > defined in my kernel config file, buildkernel fails with the error
> > shown below.
> > 
> > [...]
> > --- debugnet.o ---
> > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of
> > function 'db_printf' is invalid in C99
> > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not
> > get route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4:
> > note: did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5:
> > note: 'if_printf' declared here int if_printf(struct ifnet *,
> > const char *, ...) __printflike(2, 3); ^
> > 1 error generated.  
> 
> And I also had to add "nooptions NETDUMP" to get the kernel to compile
> and link.
> 

I already had "nooptions NETDUMP" defined.



pgpY92aPh4_Ii.pgp
Description: OpenPGP digital signature


svn commit: r353731 - in head/sys: amd64/amd64 conf

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 14:05:13 2019
New Revision: 353731
URL: https://svnweb.freebsd.org/changeset/base/353731

Log:
  Tighten mapping protections on preloaded files on amd64.
  
  - We load the kernel at 0x20.  Memory below that address need not
be executable, so do not map it as such.
  - Remove references to .ldata and related sections in the kernel linker
script.  They come from ld.bfd's default linker script, but are not
used, and we now use ld.lld to link the amd64 kernel.  lld does not
contain a default linker script.
  - Pad the .bss to a 2MB as we do between .text and .data.  This
forces the loader to load additional files starting in the following
2MB page, preserving the use of superpage mappings for kernel data.
  - Map memory above the kernel image with NX.  The kernel linker now
upgrades protections as needed, and other preloaded file types
(e.g., entropy, microcode) need not be mapped with execute permissions
in the first place.
  
  Reviewed by:  kib
  MFC after:1 month
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21859

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Fri Oct 18 13:56:45 2019(r353730)
+++ head/sys/amd64/amd64/pmap.c Fri Oct 18 14:05:13 2019(r353731)
@@ -1422,22 +1422,22 @@ nkpt_init(vm_paddr_t addr)
  *
  * This function operates on 2M pages, since we map the kernel space that
  * way.
- *
- * Note that this doesn't currently provide any protection for modules.
  */
 static inline pt_entry_t
 bootaddr_rwx(vm_paddr_t pa)
 {
 
/*
-* Everything in the same 2M page as the start of the kernel
-* should be static. On the other hand, things in the same 2M
-* page as the end of the kernel could be read-write/executable,
-* as the kernel image is not guaranteed to end on a 2M boundary.
+* The kernel is loaded at a 2MB-aligned address, and memory below that
+* need not be executable.  The .bss section is padded to a 2MB
+* boundary, so memory following the kernel need not be executable
+* either.  Preloaded kernel modules have their mapping permissions
+* fixed up by the linker.
 */
if (pa < trunc_2mpage(btext - KERNBASE) ||
-  pa >= trunc_2mpage(_end - KERNBASE))
-   return (X86_PG_RW);
+   pa >= trunc_2mpage(_end - KERNBASE))
+   return (X86_PG_RW | pg_nx);
+
/*
 * The linker should ensure that the read-only and read-write
 * portions don't share the same 2M page, so this shouldn't
@@ -1446,6 +1446,7 @@ bootaddr_rwx(vm_paddr_t pa)
 */
if (pa >= trunc_2mpage(brwsection - KERNBASE))
return (X86_PG_RW | pg_nx);
+
/*
 * Mark any 2M page containing kernel text as read-only. Mark
 * other pages with read-only data as read-only and not executable.

Modified: head/sys/conf/ldscript.amd64
==
--- head/sys/conf/ldscript.amd64Fri Oct 18 13:56:45 2019
(r353730)
+++ head/sys/conf/ldscript.amd64Fri Oct 18 14:05:13 2019
(r353731)
@@ -45,12 +45,6 @@ SECTIONS
   .rela.got   : { *(.rela.got) }
   .rel.bss: { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
   .rela.bss   : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.ldata  : { *(.rel.ldata .rel.ldata.* .rel.gnu.linkonce.l.*) }
-  .rela.ldata : { *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*) }
-  .rel.lbss   : { *(.rel.lbss .rel.lbss.* .rel.gnu.linkonce.lb.*) }
-  .rela.lbss  : { *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*) }
-  .rel.lrodata: { *(.rel.lrodata .rel.lrodata.* .rel.gnu.linkonce.lr.*) }
-  .rela.lrodata   : { *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*) 
}
   .rel.plt: { *(.rel.plt) }
   .rela.plt   : { *(.rela.plt) }
   .init   :
@@ -179,30 +173,10 @@ SECTIONS
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
-   /* Align here to ensure that the .bss section occupies space up to
-  _end.  Align after .bss to ensure correct alignment even if the
-  .bss section disappears because there are no input sections.
-  FIXME: Why do we need it? When there is no .bss section, we don't
-  pad the .data section.  */
-   . = ALIGN(. != 0 ? 64 / 8 : 1);
+   /* Ensure that the .bss section ends at a superpage boundary.
+  This way it can be mapped using non-executable large pages. */
+   . = ALIGN(0x20);
   }
-  .lbss   :
-  {
-*(.dynlbss)
-*(.lbss .lbss.* .gnu.linkonce.lb.*)
-*(LARGE_COMMON)
-  }
-  . = ALIGN(64 / 8);
-  .lrodata   ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 
1)) :
-  {
-

svn commit: r353730 - in head/sys: kern vm

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 13:56:45 2019
New Revision: 353730
URL: https://svnweb.freebsd.org/changeset/base/353730

Log:
  Apply mapping protections to preloaded kernel modules on amd64.
  
  With an upcoming change the amd64 kernel will map preloaded files RW
  instead of RWX, so the kernel linker must adjust protections
  appropriately using pmap_change_prot().
  
  Reviewed by:  kib
  MFC after:1 month
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21860

Modified:
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c
  head/sys/vm/vm_kern.c

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cFri Oct 18 13:53:14 2019(r353729)
+++ head/sys/kern/link_elf.cFri Oct 18 13:56:45 2019(r353730)
@@ -736,10 +736,47 @@ parse_vnet(elf_file_t ef)
 #endif
 #undef LS_PADDING
 
+/*
+ * Apply the specified protection to the loadable segments of a preloaded 
linker
+ * file.
+ */
 static int
-link_elf_link_preload(linker_class_t cls,
-const char* filename, linker_file_t *result)
+preload_protect(elf_file_t ef, vm_prot_t prot)
 {
+#ifdef __amd64__
+   Elf_Ehdr *hdr;
+   Elf_Phdr *phdr, *phlimit;
+   vm_prot_t nprot;
+   int error;
+
+   error = 0;
+   hdr = (Elf_Ehdr *)ef->address;
+   phdr = (Elf_Phdr *)(ef->address + hdr->e_phoff);
+   phlimit = phdr + hdr->e_phnum;
+   for (; phdr < phlimit; phdr++) {
+   if (phdr->p_type != PT_LOAD)
+   continue;
+
+   nprot = prot | VM_PROT_READ;
+   if ((phdr->p_flags & PF_W) != 0)
+   nprot |= VM_PROT_WRITE;
+   if ((phdr->p_flags & PF_X) != 0)
+   nprot |= VM_PROT_EXECUTE;
+   error = pmap_change_prot((vm_offset_t)ef->address +
+   phdr->p_vaddr, round_page(phdr->p_memsz), nprot);
+   if (error != 0)
+   break;
+   }
+   return (error);
+#else
+   return (0);
+#endif
+}
+
+static int
+link_elf_link_preload(linker_class_t cls, const char *filename,
+linker_file_t *result)
+{
Elf_Addr *ctors_addrp;
Elf_Size *ctors_sizep;
caddr_t modptr, baseptr, sizeptr, dynptr;
@@ -798,6 +835,8 @@ link_elf_link_preload(linker_class_t cls,
if (error == 0)
error = parse_vnet(ef);
 #endif
+   if (error == 0)
+   error = preload_protect(ef, VM_PROT_ALL);
if (error != 0) {
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
return (error);
@@ -815,6 +854,8 @@ link_elf_link_preload_finish(linker_file_t lf)
 
ef = (elf_file_t) lf;
error = relocate_file(ef);
+   if (error == 0)
+   error = preload_protect(ef, VM_PROT_NONE);
if (error != 0)
return (error);
(void)link_elf_preload_parse_symbols(ef);
@@ -1274,6 +1315,7 @@ link_elf_unload_file(linker_file_t file)
 static void
 link_elf_unload_preload(linker_file_t file)
 {
+
if (file->pathname != NULL)
preload_delete_name(file->pathname);
 }

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cFri Oct 18 13:53:14 2019
(r353729)
+++ head/sys/kern/link_elf_obj.cFri Oct 18 13:56:45 2019
(r353730)
@@ -193,7 +193,6 @@ link_elf_init(void *arg)
 
linker_add_class(_elf_class);
 }
-
 SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL);
 
 static void
@@ -209,6 +208,15 @@ link_elf_protect_range(elf_file_t ef, vm_offset_t star
 
if (start == end)
return;
+   if (ef->preloaded) {
+#ifdef __amd64__
+   error = pmap_change_prot(start, end - start, prot);
+   KASSERT(error == 0,
+   ("link_elf_protect_range: pmap_change_prot() returned %d",
+   error));
+#endif
+   return;
+   }
error = vm_map_protect(kernel_map, start, end, prot, FALSE);
KASSERT(error == KERN_SUCCESS,
("link_elf_protect_range: vm_map_protect() returned %d", error));
@@ -564,6 +572,14 @@ link_elf_link_preload(linker_class_t cls, const char *
goto out;
}
 
+   /*
+* The file needs to be writeable and executable while applying
+* relocations.  Mapping protections are applied once relocation
+* processing is complete.
+*/
+   link_elf_protect_range(ef, (vm_offset_t)ef->address,
+   round_page((vm_offset_t)ef->address + ef->lf.size), VM_PROT_ALL);
+
/* Local intra-module relocations */
error = link_elf_reloc_local(lf, false);
if (error != 0)
@@ -616,7 +632,9 @@ link_elf_link_preload_finish(linker_file_t lf)
return (error);
 #endif
 
-   /* Invoke .ctors 

svn commit: r353729 - head/sys/kern

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 13:53:14 2019
New Revision: 353729
URL: https://svnweb.freebsd.org/changeset/base/353729

Log:
  Apply mapping protections to .o kernel modules.
  
  Use the section flags to derive mapping protections.  When multiple
  sections overlap within a page, the union of their protections must be
  applied.  With r353701 the .text and .rodata sections are padded to
  ensure that this does not happen on amd64.
  
  Reviewed by:  kib
  MFC after:1 month
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21896

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cFri Oct 18 13:41:08 2019
(r353728)
+++ head/sys/kern/link_elf_obj.cFri Oct 18 13:53:14 2019
(r353729)
@@ -70,8 +70,8 @@ __FBSDID("$FreeBSD$");
 typedef struct {
void*addr;
Elf_Off size;
-   int flags;
-   int sec;/* Original section */
+   int flags;  /* Section flags. */
+   int sec;/* Original section number. */
char*name;
 } Elf_progent;
 
@@ -196,6 +196,119 @@ link_elf_init(void *arg)
 
 SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL);
 
+static void
+link_elf_protect_range(elf_file_t ef, vm_offset_t start, vm_offset_t end,
+vm_prot_t prot)
+{
+   int error __unused;
+
+   KASSERT(start <= end && start >= (vm_offset_t)ef->address &&
+   end <= round_page((vm_offset_t)ef->address + ef->lf.size),
+   ("link_elf_protect_range: invalid range %#jx-%#jx",
+   (uintmax_t)start, (uintmax_t)end));
+
+   if (start == end)
+   return;
+   error = vm_map_protect(kernel_map, start, end, prot, FALSE);
+   KASSERT(error == KERN_SUCCESS,
+   ("link_elf_protect_range: vm_map_protect() returned %d", error));
+}
+
+/*
+ * Restrict permissions on linker file memory based on section flags.
+ * Sections need not be page-aligned, so overlap within a page is possible.
+ */
+static void
+link_elf_protect(elf_file_t ef)
+{
+   vm_offset_t end, segend, segstart, start;
+   vm_prot_t gapprot, prot, segprot;
+   int i;
+
+   /*
+* If the file was preloaded, the last page may contain other preloaded
+* data which may need to be writeable.  ELF files are always
+* page-aligned, but other preloaded data, such as entropy or CPU
+* microcode may be loaded with a smaller alignment.
+*/
+   gapprot = ef->preloaded ? VM_PROT_RW : VM_PROT_READ;
+
+   start = end = (vm_offset_t)ef->address;
+   prot = VM_PROT_READ;
+   for (i = 0; i < ef->nprogtab; i++) {
+   /*
+* VNET and DPCPU sections have their memory allocated by their
+* respective subsystems.
+*/
+   if (ef->progtab[i].name != NULL && (
+#ifdef VIMAGE
+   strcmp(ef->progtab[i].name, VNET_SETNAME) == 0 ||
+#endif
+   strcmp(ef->progtab[i].name, DPCPU_SETNAME) == 0))
+   continue;
+
+   segstart = trunc_page((vm_offset_t)ef->progtab[i].addr);
+   segend = round_page((vm_offset_t)ef->progtab[i].addr +
+   ef->progtab[i].size);
+   segprot = VM_PROT_READ;
+   if ((ef->progtab[i].flags & SHF_WRITE) != 0)
+   segprot |= VM_PROT_WRITE;
+   if ((ef->progtab[i].flags & SHF_EXECINSTR) != 0)
+   segprot |= VM_PROT_EXECUTE;
+
+   if (end <= segstart) {
+   /*
+* Case 1: there is no overlap between the previous
+* segment and this one.  Apply protections to the
+* previous segment, and protect the gap between the
+* previous and current segments, if any.
+*/
+   link_elf_protect_range(ef, start, end, prot);
+   link_elf_protect_range(ef, end, segstart, gapprot);
+
+   start = segstart;
+   end = segend;
+   prot = segprot;
+   } else if (start < segstart && end == segend) {
+   /*
+* Case 2: the current segment is a subrange of the
+* previous segment.  Apply protections to the
+* non-overlapping portion of the previous segment.
+*/
+   link_elf_protect_range(ef, start, segstart, prot);
+
+   start = segstart;
+   prot |= segprot;
+   } else if (end < segend) {
+   /*
+* Case 3: there is partial 

svn commit: r353728 - stable/12/sys/dev/xen/netback

2019-10-18 Thread Mark Johnston
Author: markj
Date: Fri Oct 18 13:41:08 2019
New Revision: 353728
URL: https://svnweb.freebsd.org/changeset/base/353728

Log:
  MFC r353444:
  Remove an unneeded include of opt_sctp.h.

Modified:
  stable/12/sys/dev/xen/netback/netback.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/xen/netback/netback.c
==
--- stable/12/sys/dev/xen/netback/netback.c Fri Oct 18 12:34:30 2019
(r353727)
+++ stable/12/sys/dev/xen/netback/netback.c Fri Oct 18 13:41:08 2019
(r353728)
@@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
-#include "opt_sctp.h"
-
 #include 
 #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"


Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Kyle Evans
On Fri, Oct 18, 2019 at 7:00 AM Gary Jennejohn  wrote:
>
> On Fri, 18 Oct 2019 12:21:04 +0200
> "Hartmann, O."  wrote:
>
> > On Thu, 17 Oct 2019 21:33:01 + (UTC)
> > Conrad Meyer  wrote:
> >
> > > Author: cem
> > > Date: Thu Oct 17 21:33:01 2019
> > > New Revision: 353700
> > > URL: https://svnweb.freebsd.org/changeset/base/353700
> > >
> > > Log:
> > >   Implement NetGDB(4)
> > >
> > >   NetGDB(4) is a component of a system using a panic-time network
> > > stack to remotely debug crashed FreeBSD kernels over the network,
> > > instead of traditional serial interfaces.
> > >
> > >   There are three pieces in the complete NetGDB system.
> > >
> > >   First, a dedicated proxy server must be running to accept
> > > connections from both NetGDB and gdb(1), and pass bidirectional
> > > traffic between the two protocols.
> > >
> > >   Second, the NetGDB client is activated much like ordinary 'gdb' and
> > >   similarly to 'netdump' in ddb(4) after a panic.  Like other
> > > debugnet(4) clients (netdump(4)), the network interface on the route
> > > to the proxy server must be online and support debugnet(4).
> > >
> > >   Finally, the remote (k)gdb(1) uses 'target remote :'
> > > (like any other TCP remote) to connect to the proxy server.
> > >
> > >   The NetGDB v1 protocol speaks the literal GDB remote serial
> > > protocol, and uses a 1:1 relationship between GDB packets and
> > > sequences of debugnet packets (fragmented by MTU).  There is no
> > > encryption utilized to keep debugging sessions private, so this is
> > > only appropriate for local segments or trusted networks.
> > >
> > >   Submitted by: John Reimer  (earlier
> > > version) Discussed some with:   emaste, markj
> > >   Relnotes: sure
> > >   Differential Revision:https://reviews.freebsd.org/D21568
> > >
> > > Added:
> > >   head/share/man/man4/netgdb.4   (contents, props changed)
> > >   head/sys/gdb/netgdb.c   (contents, props changed)
> > >   head/sys/gdb/netgdb.h   (contents, props changed)
> > > Modified:
> > >   head/share/man/man4/Makefile
> > >   head/share/man/man4/ddb.4
> > >   head/sys/amd64/conf/GENERIC
> > >   head/sys/conf/NOTES
> > >   head/sys/conf/files
> > >   head/sys/conf/options
> > >   head/sys/gdb/gdb.h
> > >   head/sys/gdb/gdb_int.h
> > >   head/sys/gdb/gdb_main.c
> > >   head/sys/gdb/gdb_packet.c
> > >   head/sys/i386/conf/GENERIC
> > >   head/sys/kern/subr_kdb.c
> > >   head/sys/net/debugnet.c
> > >   head/sys/net/debugnet.h
> > >   head/sys/net/debugnet_inet.c
> > >   head/sys/net/debugnet_int.h
> > >   head/sys/sys/kdb.h
> > >   head/sys/sys/param.h
> > >
> > > Modified: head/share/man/man4/Makefile
> > > ==
> > > --- head/share/man/man4/MakefileThu Oct 17 21:25:50
> > > 2019(r353699) +++ head/share/man/man4/Makefile  Thu Oct
> > > 17 21:33:01 2019(r353700) @@ -307,6 +307,7 @@ MAN=
> > > aac.4 \ net80211.4 \
> > > netdump.4 \
> > > netfpga10g_nf10bmac.4 \
> > > +   netgdb.4 \
> > > netgraph.4 \
> > > netintro.4 \
> > > netmap.4 \
> > >
> > [...]
> >
> >
> > Having "nooptions   NETGDB  # netgdb(4) client support"
> > defined in my kernel config file, buildkernel fails with the error
> > shown below.
> >
> > [...]
> > --- debugnet.o ---
> > /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of
> > function 'db_printf' is invalid in C99
> > [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get
> > route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note:
> > did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note:
> > 'if_printf' declared here int if_printf(struct ifnet *, const char
> > *, ...) __printflike(2, 3); ^
> > 1 error generated.
>
> And I also had to add "nooptions NETDUMP" to get the kernel to compile
> and link.
>

diff --git a/sys/conf/files b/sys/conf/files
index e47fe27466c..4bc5770e08c 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -4298,7 +4298,7 @@ netinet/libalias/alias_mod.c  optional
libalias | netgraph_nat
 netinet/libalias/alias_proxy.c optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_util.c  optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_sctp.c  optional libalias inet | netgraph_nat inet
-netinet/netdump/netdump_client.c optional inet netdump
+netinet/netdump/netdump_client.c optional inet debugnet netdump
 netinet6/dest6.c   optional inet6
 netinet6/frag6.c   optional inet6
 netinet6/icmp6.c   optional inet6

That should fix that one.

Thanks,

Kyle Evans
___
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: r353727 - head/sys/dev/gpio

2019-10-18 Thread Andriy Gapon
Author: avg
Date: Fri Oct 18 12:34:30 2019
New Revision: 353727
URL: https://svnweb.freebsd.org/changeset/base/353727

Log:
  gpioiic: add the detach method
  
  bus_generic_detach was not enough, we also need to clean up the iicbus
  child device.
  
  MFC after:1 week

Modified:
  head/sys/dev/gpio/gpioiic.c

Modified: head/sys/dev/gpio/gpioiic.c
==
--- head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:32:01 2019(r353726)
+++ head/sys/dev/gpio/gpioiic.c Fri Oct 18 12:34:30 2019(r353727)
@@ -143,6 +143,15 @@ gpioiic_attach(device_t dev)
return (0);
 }
 
+static int
+gpioiic_detach(device_t dev)
+{
+
+   bus_generic_detach(dev);
+   device_delete_children(dev);
+   return (0);
+}
+
 /*
  * Reset bus by setting SDA first and then SCL. 
  * Must always be called with gpio bus locked.
@@ -241,7 +250,7 @@ static device_method_t gpioiic_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, gpioiic_probe),
DEVMETHOD(device_attach,gpioiic_attach),
-   DEVMETHOD(device_detach,bus_generic_detach),
+   DEVMETHOD(device_detach,gpioiic_detach),
 
/* iicbb interface */
DEVMETHOD(iicbb_setsda, gpioiic_setsda),
___
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: r353726 - in head: sbin/ddb share/man/man4

2019-10-18 Thread Andriy Gapon
Author: avg
Date: Fri Oct 18 12:32:01 2019
New Revision: 353726
URL: https://svnweb.freebsd.org/changeset/base/353726

Log:
  ddb: use 'textdump dump' instead of 'call doadump'
  
  The change is for the example in textdump.4 and the default ddb.conf.
  
  First of all, doadump now requires an argument and it won't do a
  textdump if the argument is not 'true'.
  And 'textdump dump' is more idiomatic anyway.
  
  For what it's worth, ddb 'dump' command seems to always request a vmcore
  dump even if a textdump was requested earlier, e.g., by 'textdump set'.
  Finally, ddb 'call' command is not documented.
  
  MFC after:2 weeks

Modified:
  head/sbin/ddb/ddb.conf
  head/share/man/man4/textdump.4

Modified: head/sbin/ddb/ddb.conf
==
--- head/sbin/ddb/ddb.conf  Fri Oct 18 12:25:33 2019(r353725)
+++ head/sbin/ddb/ddb.conf  Fri Oct 18 12:32:01 2019(r353726)
@@ -9,7 +9,7 @@
 script lockinfo=show locks; show alllocks; show lockedvnods
 
 # kdb.enter.panic  panic(9) was called.
-script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; 
ps; alltrace; capture off; call doadump; reset
+script kdb.enter.panic=textdump set; capture on; run lockinfo; show pcpu; bt; 
ps; alltrace; capture off; textdump dump; reset
 
 # kdb.enter.witnesswitness(4) detected a locking error.
 script kdb.enter.witness=run lockinfo

Modified: head/share/man/man4/textdump.4
==
--- head/share/man/man4/textdump.4  Fri Oct 18 12:25:33 2019
(r353725)
+++ head/share/man/man4/textdump.4  Fri Oct 18 12:32:01 2019
(r353726)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2018
+.Dd October 18, 2019
 .Dt TEXTDUMP 4
 .Os
 .Sh NAME
@@ -162,7 +162,7 @@ invoke panic in order to force a kernel dump to be wri
 reboot:
 .Bd -literal -offset indent
 script kdb.enter.panic=textdump set; capture on; show allpcpu; bt;
-  ps; alltrace; show alllocks; call doadump; reset
+  ps; alltrace; show alllocks; textdump dump; reset
 .Ed
 .Pp
 In the following example, the script
___
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: r353725 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux

2019-10-18 Thread Yuri Pankov
Author: yuripv
Date: Fri Oct 18 12:25:33 2019
New Revision: 353725
URL: https://svnweb.freebsd.org/changeset/base/353725

Log:
  linux: futex_mtx should follow futex_list
  
  Move futex_mtx to linux_common.ko for amd64 and aarch64 along
  with respective list/mutex init/destroy.
  
  PR:   240989
  Reported by:  Alex S 

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/arm64/linux/linux_sysvec.c
  head/sys/compat/linux/linux.c
  head/sys/compat/linux/linux.h
  head/sys/compat/linux/linux_common.c
  head/sys/compat/linux/linux_futex.c
  head/sys/compat/linux/linux_futex.h
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Fri Oct 18 10:28:08 2019
(r353724)
+++ head/sys/amd64/linux/linux_sysvec.c Fri Oct 18 12:25:33 2019
(r353725)
@@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -865,8 +864,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux_ioctl_register_handler(*lihp);
-   LIST_INIT(_list);
-   mtx_init(_mtx, "ftllk64", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
if (bootverbose)
printf("Linux x86-64 ELF exec handler 
installed\n");
@@ -887,7 +884,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux_ioctl_unregister_handler(*lihp);
-   mtx_destroy(_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Fri Oct 18 10:28:08 2019
(r353724)
+++ head/sys/amd64/linux32/linux32_sysvec.c Fri Oct 18 12:25:33 2019
(r353725)
@@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1023,8 +1022,6 @@ linux_elf_modevent(module_t mod, int type, void *data)
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux32_ioctl_register_handler(*lihp);
-   LIST_INIT(_list);
-   mtx_init(_mtx, "ftllk", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
if (bootverbose)
printf("Linux ELF exec handler installed\n");
@@ -1045,7 +1042,6 @@ linux_elf_modevent(module_t mod, int type, void *data)
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux32_ioctl_unregister_handler(*lihp);
-   mtx_destroy(_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else

Modified: head/sys/arm64/linux/linux_sysvec.c
==
--- head/sys/arm64/linux/linux_sysvec.c Fri Oct 18 10:28:08 2019
(r353724)
+++ head/sys/arm64/linux/linux_sysvec.c Fri Oct 18 12:25:33 2019
(r353725)
@@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -494,8 +493,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux_ioctl_register_handler(*lihp);
-   LIST_INIT(_list);
-   mtx_init(_mtx, "ftllk64", NULL, MTX_DEF);
stclohz = (stathz ? stathz : hz);
if (bootverbose)
printf("Linux arm64 ELF exec handler 
installed\n");
@@ -515,7 +512,6 @@ linux64_elf_modevent(module_t mod, int type, void *dat
if (error == 0) {
SET_FOREACH(lihp, linux_ioctl_handler_set)
linux_ioctl_unregister_handler(*lihp);
-   mtx_destroy(_mtx);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else

Modified: head/sys/compat/linux/linux.c
==
--- head/sys/compat/linux/linux.c   Fri Oct 18 

Re: svn commit: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Gary Jennejohn
On Fri, 18 Oct 2019 12:21:04 +0200
"Hartmann, O."  wrote:

> On Thu, 17 Oct 2019 21:33:01 + (UTC)
> Conrad Meyer  wrote:
> 
> > Author: cem
> > Date: Thu Oct 17 21:33:01 2019
> > New Revision: 353700
> > URL: https://svnweb.freebsd.org/changeset/base/353700
> > 
> > Log:
> >   Implement NetGDB(4)
> >   
> >   NetGDB(4) is a component of a system using a panic-time network
> > stack to remotely debug crashed FreeBSD kernels over the network,
> > instead of traditional serial interfaces.
> >   
> >   There are three pieces in the complete NetGDB system.
> >   
> >   First, a dedicated proxy server must be running to accept
> > connections from both NetGDB and gdb(1), and pass bidirectional
> > traffic between the two protocols.
> >   
> >   Second, the NetGDB client is activated much like ordinary 'gdb' and
> >   similarly to 'netdump' in ddb(4) after a panic.  Like other
> > debugnet(4) clients (netdump(4)), the network interface on the route
> > to the proxy server must be online and support debugnet(4).
> >   
> >   Finally, the remote (k)gdb(1) uses 'target remote :'
> > (like any other TCP remote) to connect to the proxy server.
> >   
> >   The NetGDB v1 protocol speaks the literal GDB remote serial
> > protocol, and uses a 1:1 relationship between GDB packets and
> > sequences of debugnet packets (fragmented by MTU).  There is no
> > encryption utilized to keep debugging sessions private, so this is
> > only appropriate for local segments or trusted networks.
> >   
> >   Submitted by: John Reimer  (earlier
> > version) Discussed some with:   emaste, markj
> >   Relnotes: sure
> >   Differential Revision:https://reviews.freebsd.org/D21568
> > 
> > Added:
> >   head/share/man/man4/netgdb.4   (contents, props changed)
> >   head/sys/gdb/netgdb.c   (contents, props changed)
> >   head/sys/gdb/netgdb.h   (contents, props changed)
> > Modified:
> >   head/share/man/man4/Makefile
> >   head/share/man/man4/ddb.4
> >   head/sys/amd64/conf/GENERIC
> >   head/sys/conf/NOTES
> >   head/sys/conf/files
> >   head/sys/conf/options
> >   head/sys/gdb/gdb.h
> >   head/sys/gdb/gdb_int.h
> >   head/sys/gdb/gdb_main.c
> >   head/sys/gdb/gdb_packet.c
> >   head/sys/i386/conf/GENERIC
> >   head/sys/kern/subr_kdb.c
> >   head/sys/net/debugnet.c
> >   head/sys/net/debugnet.h
> >   head/sys/net/debugnet_inet.c
> >   head/sys/net/debugnet_int.h
> >   head/sys/sys/kdb.h
> >   head/sys/sys/param.h
> > 
> > Modified: head/share/man/man4/Makefile
> > ==
> > --- head/share/man/man4/MakefileThu Oct 17 21:25:50
> > 2019(r353699) +++ head/share/man/man4/Makefile  Thu Oct
> > 17 21:33:01 2019(r353700) @@ -307,6 +307,7 @@ MAN=
> > aac.4 \ net80211.4 \
> > netdump.4 \
> > netfpga10g_nf10bmac.4 \
> > +   netgdb.4 \
> > netgraph.4 \
> > netintro.4 \
> > netmap.4 \
> >   
> [...]
> 
> 
> Having "nooptions   NETGDB  # netgdb(4) client support"
> defined in my kernel config file, buildkernel fails with the error
> shown below.
> 
> [...]
> --- debugnet.o ---
> /usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of
> function 'db_printf' is invalid in C99
> [-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get
> route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note:
> did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note:
> 'if_printf' declared here int if_printf(struct ifnet *, const char
> *, ...) __printflike(2, 3); ^
> 1 error generated.

And I also had to add "nooptions NETDUMP" to get the kernel to compile
and link.

-- 
Gary Jennejohn
___
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: r353724 - head/sys/compat/linux

2019-10-18 Thread Yuri Pankov
Author: yuripv
Date: Fri Oct 18 10:28:08 2019
New Revision: 353724
URL: https://svnweb.freebsd.org/changeset/base/353724

Log:
  linux: provide just one instance of futex_list
  
  Move futex_list definition to linux.c which is included once
  in linux.ko (i386) and in linux_common.ko (amd64 and aarch64)
  allowing 32/64 bit linux programs to access the same futexes
  in the latter case.
  
  PR:   240989
  Reviewed by:  dchagin
  Differential Revision:https://reviews.freebsd.org/D22073

Modified:
  head/sys/compat/linux/linux.c
  head/sys/compat/linux/linux.h
  head/sys/compat/linux/linux_futex.c
  head/sys/compat/linux/linux_futex.h

Modified: head/sys/compat/linux/linux.c
==
--- head/sys/compat/linux/linux.c   Fri Oct 18 09:09:32 2019
(r353723)
+++ head/sys/compat/linux/linux.c   Fri Oct 18 10:28:08 2019
(r353724)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+struct futex_list futex_list;
+
 CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ);
 
 static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = {

Modified: head/sys/compat/linux/linux.h
==
--- head/sys/compat/linux/linux.h   Fri Oct 18 09:09:32 2019
(r353723)
+++ head/sys/compat/linux/linux.h   Fri Oct 18 10:28:08 2019
(r353724)
@@ -140,4 +140,6 @@ void bsd_to_linux_sigset(sigset_t *, l_sigset_t *);
 int linux_to_bsd_signal(int sig);
 int bsd_to_linux_signal(int sig);
 
+extern LIST_HEAD(futex_list, futex) futex_list;
+
 #endif /* _LINUX_MI_H_ */

Modified: head/sys/compat/linux/linux_futex.c
==
--- head/sys/compat/linux/linux_futex.c Fri Oct 18 09:09:32 2019
(r353723)
+++ head/sys/compat/linux/linux_futex.c Fri Oct 18 10:28:08 2019
(r353724)
@@ -207,8 +207,6 @@ struct futex {
TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc;
 };
 
-struct futex_list futex_list;
-
 #define FUTEX_LOCK(f)  mtx_lock(&(f)->f_lck)
 #define FUTEX_LOCKED(f)mtx_owned(&(f)->f_lck)
 #define FUTEX_UNLOCK(f)mtx_unlock(&(f)->f_lck)

Modified: head/sys/compat/linux/linux_futex.h
==
--- head/sys/compat/linux/linux_futex.h Fri Oct 18 09:09:32 2019
(r353723)
+++ head/sys/compat/linux/linux_futex.h Fri Oct 18 10:28:08 2019
(r353724)
@@ -38,7 +38,6 @@
 #ifndef _LINUX_FUTEX_H
 #define _LINUX_FUTEX_H
 
-extern LIST_HEAD(futex_list, futex) futex_list;
 extern struct mtx futex_mtx;
 
 #define LINUX_FUTEX_WAIT0
___
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: r353700 - in head: share/man/man4 sys/amd64/conf sys/conf sys/gdb sys/i386/conf sys/kern sys/net sys/sys

2019-10-18 Thread Hartmann, O.
On Thu, 17 Oct 2019 21:33:01 + (UTC)
Conrad Meyer  wrote:

> Author: cem
> Date: Thu Oct 17 21:33:01 2019
> New Revision: 353700
> URL: https://svnweb.freebsd.org/changeset/base/353700
> 
> Log:
>   Implement NetGDB(4)
>   
>   NetGDB(4) is a component of a system using a panic-time network
> stack to remotely debug crashed FreeBSD kernels over the network,
> instead of traditional serial interfaces.
>   
>   There are three pieces in the complete NetGDB system.
>   
>   First, a dedicated proxy server must be running to accept
> connections from both NetGDB and gdb(1), and pass bidirectional
> traffic between the two protocols.
>   
>   Second, the NetGDB client is activated much like ordinary 'gdb' and
>   similarly to 'netdump' in ddb(4) after a panic.  Like other
> debugnet(4) clients (netdump(4)), the network interface on the route
> to the proxy server must be online and support debugnet(4).
>   
>   Finally, the remote (k)gdb(1) uses 'target remote :'
> (like any other TCP remote) to connect to the proxy server.
>   
>   The NetGDB v1 protocol speaks the literal GDB remote serial
> protocol, and uses a 1:1 relationship between GDB packets and
> sequences of debugnet packets (fragmented by MTU).  There is no
> encryption utilized to keep debugging sessions private, so this is
> only appropriate for local segments or trusted networks.
>   
>   Submitted by:   John Reimer  (earlier
> version) Discussed some with: emaste, markj
>   Relnotes:   sure
>   Differential Revision:  https://reviews.freebsd.org/D21568
> 
> Added:
>   head/share/man/man4/netgdb.4   (contents, props changed)
>   head/sys/gdb/netgdb.c   (contents, props changed)
>   head/sys/gdb/netgdb.h   (contents, props changed)
> Modified:
>   head/share/man/man4/Makefile
>   head/share/man/man4/ddb.4
>   head/sys/amd64/conf/GENERIC
>   head/sys/conf/NOTES
>   head/sys/conf/files
>   head/sys/conf/options
>   head/sys/gdb/gdb.h
>   head/sys/gdb/gdb_int.h
>   head/sys/gdb/gdb_main.c
>   head/sys/gdb/gdb_packet.c
>   head/sys/i386/conf/GENERIC
>   head/sys/kern/subr_kdb.c
>   head/sys/net/debugnet.c
>   head/sys/net/debugnet.h
>   head/sys/net/debugnet_inet.c
>   head/sys/net/debugnet_int.h
>   head/sys/sys/kdb.h
>   head/sys/sys/param.h
> 
> Modified: head/share/man/man4/Makefile
> ==
> --- head/share/man/man4/Makefile  Thu Oct 17 21:25:50
> 2019  (r353699) +++ head/share/man/man4/Makefile  Thu Oct
> 17 21:33:01 2019  (r353700) @@ -307,6 +307,7 @@ MAN=
> aac.4 \ net80211.4 \
>   netdump.4 \
>   netfpga10g_nf10bmac.4 \
> + netgdb.4 \
>   netgraph.4 \
>   netintro.4 \
>   netmap.4 \
> 
[...]


Having "nooptions   NETGDB  # netgdb(4) client support"
defined in my kernel config file, buildkernel fails with the error
shown below.

[...]
--- debugnet.o ---
/usr/src/sys/net/debugnet.c:662:4: error: implicit declaration of
function 'db_printf' is invalid in C99
[-Werror,-Wimplicit-function-declaration] db_printf("%s: Could not get
route for that server.\n", ^ /usr/src/sys/net/debugnet.c:662:4: note:
did you mean 'if_printf'? /usr/src/sys/net/if_var.h:679:5: note:
'if_printf' declared here int if_printf(struct ifnet *, const char
*, ...) __printflike(2, 3); ^
1 error generated.


pgpuvjPX3Zy3o.pgp
Description: OpenPGP digital signature


svn commit: r353723 - stable/12/sbin/ipfw

2019-10-18 Thread Andrey V. Elsukov
Author: ae
Date: Fri Oct 18 09:09:32 2019
New Revision: 353723
URL: https://svnweb.freebsd.org/changeset/base/353723

Log:
  MFC r353545:
Explicitly initialize the memory buffer to store O_ICMP6TYPE opcode.
  
By default next_cmd() initializes only first u32 of opcode. O_ICMP6TYPE
opcode has array of bit masks to store corresponding ICMPv6 types.
An opcode that precedes O_ICMP6TYPE, e.g. O_IP6_DST, can have variable
length and during opcode filling it can modify memory that will be used
by O_ICMP6TYPE opcode. Without explicit initialization this leads to
creation of wrong opcode.
  
Reported by:Boris N. Lytochkin
Obtained from:  Yandex LLC

Modified:
  stable/12/sbin/ipfw/ipv6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipv6.c
==
--- stable/12/sbin/ipfw/ipv6.c  Fri Oct 18 08:39:10 2019(r353722)
+++ stable/12/sbin/ipfw/ipv6.c  Fri Oct 18 09:09:32 2019(r353723)
@@ -143,6 +143,7 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb
uint8_t type;
 
CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6));
+   memset(cmd, 0, sizeof(*cmd));
while (*av) {
   if (*av == ',')
   av++;
___
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: r353722 - stable/11/sys/fs/devfs

2019-10-18 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 18 08:39:10 2019
New Revision: 353722
URL: https://svnweb.freebsd.org/changeset/base/353722

Log:
  MFC r353447:
  devfs_vptocnp(): correct the component name when node is not at top.

Modified:
  stable/11/sys/fs/devfs/devfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/devfs/devfs_vnops.c
==
--- stable/11/sys/fs/devfs/devfs_vnops.cFri Oct 18 08:38:07 2019
(r353721)
+++ stable/11/sys/fs/devfs/devfs_vnops.cFri Oct 18 08:39:10 2019
(r353722)
@@ -280,38 +280,27 @@ devfs_vptocnp(struct vop_vptocnp_args *ap)
if (error != 0)
return (error);
 
-   i = *buflen;
+   if (vp->v_type != VCHR && vp->v_type != VDIR) {
+   error = ENOENT;
+   goto finished;
+   }
+
dd = vp->v_data;
+   if (vp->v_type == VDIR && dd == dmp->dm_rootdir) {
+   *dvp = vp;
+   vref(*dvp);
+   goto finished;
+   }
 
-   if (vp->v_type == VCHR) {
-   i -= strlen(dd->de_cdp->cdp_c.si_name);
-   if (i < 0) {
-   error = ENOMEM;
-   goto finished;
-   }
-   bcopy(dd->de_cdp->cdp_c.si_name, buf + i,
-   strlen(dd->de_cdp->cdp_c.si_name));
-   de = dd->de_dir;
-   } else if (vp->v_type == VDIR) {
-   if (dd == dmp->dm_rootdir) {
-   *dvp = vp;
-   vref(*dvp);
-   goto finished;
-   }
-   i -= dd->de_dirent->d_namlen;
-   if (i < 0) {
-   error = ENOMEM;
-   goto finished;
-   }
-   bcopy(dd->de_dirent->d_name, buf + i,
-   dd->de_dirent->d_namlen);
-   de = dd;
-   } else {
-   error = ENOENT;
+   i = *buflen;
+   i -= dd->de_dirent->d_namlen;
+   if (i < 0) {
+   error = ENOMEM;
goto finished;
}
+   bcopy(dd->de_dirent->d_name, buf + i, dd->de_dirent->d_namlen);
*buflen = i;
-   de = devfs_parent_dirent(de);
+   de = devfs_parent_dirent(dd);
if (de == NULL) {
error = ENOENT;
goto finished;
___
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: r353721 - stable/11/sys/fs/msdosfs

2019-10-18 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 18 08:38:07 2019
New Revision: 353721
URL: https://svnweb.freebsd.org/changeset/base/353721

Log:
  MFC r353446:
  Plug the rest of undef behavior places that were missed in r337456.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Oct 18 08:36:08 2019
(r353720)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c  Fri Oct 18 08:38:07 2019
(r353721)
@@ -387,9 +387,10 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn)
pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
-   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
-   == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
-   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
+   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
+   (1U << (cn % N_INUSEBITS))) == 0,
+   ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
+   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little"));
pmp->pm_freeclustercount--;
@@ -408,9 +409,10 @@ usemap_free(struct msdosfsmount *pmp, u_long cn)
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
pmp->pm_flags |= MSDOSFS_FSIMOD;
-   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
-   != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
-   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
+   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
+   (1U << (cn % N_INUSEBITS))) != 0,
+   ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
+   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS));
 }
 
@@ -649,7 +651,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_
idx = start / N_INUSEBITS;
start %= N_INUSEBITS;
map = pmp->pm_inusemap[idx];
-   map &= ~((1 << start) - 1);
+   map &= ~((1U << start) - 1);
if (map) {
len = ffs(map) - 1 - start;
len = MIN(len, count);
___
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: r353720 - stable/12/sys/fs/devfs

2019-10-18 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 18 08:36:08 2019
New Revision: 353720
URL: https://svnweb.freebsd.org/changeset/base/353720

Log:
  MFC r353447:
  devfs_vptocnp(): correct the component name when node is not at top.

Modified:
  stable/12/sys/fs/devfs/devfs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/devfs/devfs_vnops.c
==
--- stable/12/sys/fs/devfs/devfs_vnops.cFri Oct 18 08:34:52 2019
(r353719)
+++ stable/12/sys/fs/devfs/devfs_vnops.cFri Oct 18 08:36:08 2019
(r353720)
@@ -283,38 +283,27 @@ devfs_vptocnp(struct vop_vptocnp_args *ap)
if (error != 0)
return (error);
 
-   i = *buflen;
+   if (vp->v_type != VCHR && vp->v_type != VDIR) {
+   error = ENOENT;
+   goto finished;
+   }
+
dd = vp->v_data;
+   if (vp->v_type == VDIR && dd == dmp->dm_rootdir) {
+   *dvp = vp;
+   vref(*dvp);
+   goto finished;
+   }
 
-   if (vp->v_type == VCHR) {
-   i -= strlen(dd->de_cdp->cdp_c.si_name);
-   if (i < 0) {
-   error = ENOMEM;
-   goto finished;
-   }
-   bcopy(dd->de_cdp->cdp_c.si_name, buf + i,
-   strlen(dd->de_cdp->cdp_c.si_name));
-   de = dd->de_dir;
-   } else if (vp->v_type == VDIR) {
-   if (dd == dmp->dm_rootdir) {
-   *dvp = vp;
-   vref(*dvp);
-   goto finished;
-   }
-   i -= dd->de_dirent->d_namlen;
-   if (i < 0) {
-   error = ENOMEM;
-   goto finished;
-   }
-   bcopy(dd->de_dirent->d_name, buf + i,
-   dd->de_dirent->d_namlen);
-   de = dd;
-   } else {
-   error = ENOENT;
+   i = *buflen;
+   i -= dd->de_dirent->d_namlen;
+   if (i < 0) {
+   error = ENOMEM;
goto finished;
}
+   bcopy(dd->de_dirent->d_name, buf + i, dd->de_dirent->d_namlen);
*buflen = i;
-   de = devfs_parent_dirent(de);
+   de = devfs_parent_dirent(dd);
if (de == NULL) {
error = ENOENT;
goto finished;
___
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: r353719 - stable/12/sys/fs/msdosfs

2019-10-18 Thread Konstantin Belousov
Author: kib
Date: Fri Oct 18 08:34:52 2019
New Revision: 353719
URL: https://svnweb.freebsd.org/changeset/base/353719

Log:
  MFC r353446:
  Plug the rest of undef behavior places that were missed in r337456.

Modified:
  stable/12/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c
==
--- stable/12/sys/fs/msdosfs/msdosfs_fat.c  Fri Oct 18 07:55:01 2019
(r353718)
+++ stable/12/sys/fs/msdosfs/msdosfs_fat.c  Fri Oct 18 08:34:52 2019
(r353719)
@@ -389,9 +389,10 @@ usemap_alloc(struct msdosfsmount *pmp, u_long cn)
pmp->pm_maxcluster));
KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0,
("usemap_alloc on ro msdosfs mount"));
-   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
-   == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
-   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
+   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
+   (1U << (cn % N_INUSEBITS))) == 0,
+   ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS,
+   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS);
KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little"));
pmp->pm_freeclustercount--;
@@ -410,9 +411,10 @@ usemap_free(struct msdosfsmount *pmp, u_long cn)
("usemap_free on ro msdosfs mount"));
pmp->pm_freeclustercount++;
pmp->pm_flags |= MSDOSFS_FSIMOD;
-   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS)))
-   != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
-   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
+   KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] &
+   (1U << (cn % N_INUSEBITS))) != 0,
+   ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS,
+   (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS]));
pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS));
 }
 
@@ -651,7 +653,7 @@ chainlength(struct msdosfsmount *pmp, u_long start, u_
idx = start / N_INUSEBITS;
start %= N_INUSEBITS;
map = pmp->pm_inusemap[idx];
-   map &= ~((1 << start) - 1);
+   map &= ~((1U << start) - 1);
if (map) {
len = ffs(map) - 1 - start;
len = MIN(len, count);
___
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: r353718 - head/usr.bin/ministat

2019-10-18 Thread Poul-Henning Kamp
Author: phk
Date: Fri Oct 18 07:55:01 2019
New Revision: 353718
URL: https://svnweb.freebsd.org/changeset/base/353718

Log:
  Improve the way we calculate variance to reduce the rounding errors
  when variance is small relative to data points.
  
  Now [0, 1, 2] shows same standard deviation as [10, ...1, ...2]
  
  Also:  Various nitpickery from my own tree.

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

Modified: head/usr.bin/ministat/ministat.c
==
--- head/usr.bin/ministat/ministat.cFri Oct 18 03:38:02 2019
(r353717)
+++ head/usr.bin/ministat/ministat.cFri Oct 18 07:55:01 2019
(r353718)
@@ -18,6 +18,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -31,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #define NSTUDENT 100
 #define NCONF 6
 static double const studentpct[] = { 80, 90, 95, 98, 99, 99.5 };
-static double student[NSTUDENT + 1][NCONF] = {
+static double const student[NSTUDENT + 1][NCONF] = {
 /* inf */  {   1.282,  1.645,  1.960,  2.326,  2.576,  3.090  },
 /* 1. */   {   3.078,  6.314,  12.706, 31.821, 63.657, 318.313  },
 /* 2. */   {   1.886,  2.920,  4.303,  6.965,  9.925,  22.327  },
@@ -152,8 +153,11 @@ NewSet(void)
struct dataset *ds;
 
ds = calloc(1, sizeof *ds);
+   assert(ds != NULL);
ds->lpoints = 10;
ds->points = calloc(sizeof *ds->points, ds->lpoints);
+   assert(ds->points != NULL);
+   ds->syy = NAN;
return(ds);
 }
 
@@ -166,55 +170,58 @@ AddPoint(struct dataset *ds, double a)
dp = ds->points;
ds->lpoints *= 4;
ds->points = calloc(sizeof *ds->points, ds->lpoints);
+   assert(ds->points != NULL);
memcpy(ds->points, dp, sizeof *dp * ds->n);
free(dp);
}
ds->points[ds->n++] = a;
ds->sy += a;
-   ds->syy += a * a;
 }
 
 static double
-Min(struct dataset *ds)
+Min(const struct dataset *ds)
 {
 
return (ds->points[0]);
 }
 
 static double
-Max(struct dataset *ds)
+Max(const struct dataset *ds)
 {
 
return (ds->points[ds->n -1]);
 }
 
 static double
-Avg(struct dataset *ds)
+Avg(const struct dataset *ds)
 {
 
return(ds->sy / ds->n);
 }
 
 static double
-Median(struct dataset *ds)
+Median(const struct dataset *ds)
 {
+   const unsigned m = ds->n / 2;
+
if ((ds->n % 2) == 0)
-   return ((ds->points[ds->n / 2] + (ds->points[(ds->n / 2) - 1])) 
/ 2);
-   else
-   return (ds->points[ds->n / 2]);
+   return ((ds->points[m] + (ds->points[m - 1])) / 2);
+   return (ds->points[m]);
 }
 
 static double
 Var(struct dataset *ds)
 {
+   unsigned n;
+   const double a = Avg(ds);
 
-   /*
-* Due to limited precision it is possible that sy^2/n > syy,
-* but variance cannot actually be negative.
-*/
-   if (ds->syy <= ds->sy * ds->sy / ds->n)
-   return (0);
-   return (ds->syy - ds->sy * ds->sy / ds->n) / (ds->n - 1.0);
+   if (isnan(ds->syy)) {
+   ds->syy = 0.0;
+   for (n = 0; n < ds->n; n++)
+   ds->syy += (ds->points[n] - a) * (ds->points[n] - a);
+   }
+
+   return (ds->syy / (ds->n - 1.0));
 }
 
 static double
@@ -265,7 +272,7 @@ Relative(struct dataset *ds, struct dataset *rs, int c
re = t * sqrt(re);
 
if (fabs(d) > e) {
-   
+
printf("Difference at %.1f%% confidence\n", 
studentpct[confidx]);
printf("%g +/- %g\n", d, e);
printf("%g%% +/- %g%%\n", d * 100 / Avg(rs), re * 100 / 
Avg(rs));
@@ -349,13 +356,17 @@ PlotSet(struct dataset *ds, int val)
else
bar = 0;
 
-   if (pl->bar == NULL)
+   if (pl->bar == NULL) {
pl->bar = calloc(sizeof(char *), pl->num_datasets);
+   assert(pl->bar != NULL);
+   }
+
if (pl->bar[bar] == NULL) {
pl->bar[bar] = malloc(pl->width);
+   assert(pl->bar[bar] != NULL);
memset(pl->bar[bar], 0, pl->width);
}
-   
+
m = 1;
i = -1;
j = 0;
@@ -373,6 +384,7 @@ PlotSet(struct dataset *ds, int val)
m += 1;
if (m > pl->height) {
pl->data = realloc(pl->data, pl->width * m);
+   assert(pl->data != NULL);
memset(pl->data + pl->height * pl->width, 0,
(m - pl->height) * pl->width);
}
@@ -477,6 +489,7 @@ ReadSet(FILE *f, const char *n, int column, const char
 
s = NewSet();
s->name = strdup(n);
+   assert(s->name != NULL);
line = 0;
while (fgets(buf, sizeof buf, f) != NULL) {
line++;
@@ -619,7 +632,10 @@ main(int argc, char **argv)
nds = argc;
for (i =