Re: svn commit: r361770 - in head: include lib/libthr lib/libthr/thread share/man/man3

2020-06-03 Thread Antoine Brodin
On Thu, Jun 4, 2020 at 4:30 AM Jung-uk Kim  wrote:
>
> On 20. 6. 3., Konstantin Belousov wrote:
> > Author: kib
> > Date: Wed Jun  3 20:54:36 2020
> > New Revision: 361770
> > URL: https://svnweb.freebsd.org/changeset/base/361770
> >
> > Log:
> >   Add pthread_getname_np() and pthread_setname_np() aliases
> >
> >   for pthread_get_name_np() and pthread_set_name_np(), to be
> >   compatible with Linux.
> >
> >   PR: 238404
> >   Proposed and reviewed by:   markj
> >   Sponsored by:   The FreeBSD Foundation
> >   MFC after:  1 week
> >   Differential revision:  https://reviews.freebsd.org/D25117
> >
> > Modified:
> >   head/include/pthread_np.h
> >   head/lib/libthr/pthread.map
> >   head/lib/libthr/thread/thr_info.c
> >   head/share/man/man3/Makefile
> >   head/share/man/man3/pthread_set_name_np.3
> >
> > Modified: head/include/pthread_np.h
> > ==
> > --- head/include/pthread_np.h Wed Jun  3 20:42:52 2020(r361769)
> > +++ head/include/pthread_np.h Wed Jun  3 20:54:36 2020(r361770)
> > @@ -50,6 +50,7 @@ int pthread_attr_get_np(pthread_t, pthread_attr_t *);
> >  int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t 
> > *);
> >  int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t 
> > *);
> >  void pthread_get_name_np(pthread_t, char *, size_t);
> > +void pthread_getname_np(pthread_t, char *, size_t);
> >  int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
> >  int pthread_getthreadid_np(void);
> >  int pthread_main_np(void);
> > @@ -65,6 +66,7 @@ void pthread_resume_all_np(void);
> >  int pthread_resume_np(pthread_t);
> >  int pthread_peekjoin_np(pthread_t, void **);
> >  void pthread_set_name_np(pthread_t, const char *);
> > +void pthread_setname_np(pthread_t, const char *);
> >  int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
> >  int pthread_single_np(void);
> >  void pthread_suspend_all_np(void);
> >
> > Modified: head/lib/libthr/pthread.map
> > ==
> > --- head/lib/libthr/pthread.map   Wed Jun  3 20:42:52 2020
> > (r361769)
> > +++ head/lib/libthr/pthread.map   Wed Jun  3 20:54:36 2020
> > (r361770)
> > @@ -328,5 +328,7 @@ FBSD_1.5 {
> >  };
> >
> >  FBSD_1.6 {
> > +  pthread_getname_np;
> >pthread_peekjoin_np;
> > +  pthread_setname_np;
> >  };
> >
> > Modified: head/lib/libthr/thread/thr_info.c
> > ==
> > --- head/lib/libthr/thread/thr_info.c Wed Jun  3 20:42:52 2020
> > (r361769)
> > +++ head/lib/libthr/thread/thr_info.c Wed Jun  3 20:54:36 2020
> > (r361770)
> > @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
> >  #include "thr_private.h"
> >
> >  __weak_reference(_pthread_set_name_np, pthread_set_name_np);
> > +__weak_reference(_pthread_set_name_np, pthread_setname_np);
> >
> >  static void
> >  thr_set_name_np(struct pthread *thread, const char *name)
> > @@ -89,6 +90,7 @@ thr_get_name_np(struct pthread *thread, char *buf, siz
> >  }
> >
> >  __weak_reference(_pthread_get_name_np, pthread_get_name_np);
> > +__weak_reference(_pthread_get_name_np, pthread_getname_np);
> >
> >  void
> >  _pthread_get_name_np(pthread_t thread, char *buf, size_t len)
> >
> > Modified: head/share/man/man3/Makefile
> > ==
> > --- head/share/man/man3/Makefile  Wed Jun  3 20:42:52 2020
> > (r361769)
> > +++ head/share/man/man3/Makefile  Wed Jun  3 20:54:36 2020
> > (r361770)
> > @@ -493,7 +493,9 @@ PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock
> >  PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
> >  PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \
> >   pthread_schedparam.3 pthread_setschedparam.3
> > -PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3
> > +PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \
> > + pthread_set_name_np.3 pthread_getname_np.3 \
> > + pthread_set_name_np.3 pthread_setname_np.3
> >  PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \
> >   pthread_spin_lock.3 pthread_spin_trylock.3 \
> >   pthread_spin_lock.3 pthread_spin_unlock.3
> >
> > Modified: head/share/man/man3/pthread_set_name_np.3
> > ==
> > --- head/share/man/man3/pthread_set_name_np.3 Wed Jun  3 20:42:52 2020  
> >   (r361769)
> > +++ head/share/man/man3/pthread_set_name_np.3 Wed Jun  3 20:54:36 2020  
> >   (r361770)
> > @@ -24,12 +24,14 @@
> >  .\"
> >  .\" $FreeBSD$
> >  .\"
> > -.Dd August 12, 2018
> > +.Dd June 3, 2020
> >  .Dt PTHREAD_SET_NAME_NP 3
> >  .Os
> >  .Sh NAME
> >  .Nm pthread_get_name_np ,
> > +.Nm pthread_getname_np ,
> >  .Nm pthread_set_name_np

svn commit: r361783 - head/usr.bin/killall

2020-06-03 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Thu Jun  4 04:29:43 2020
New Revision: 361783
URL: https://svnweb.freebsd.org/changeset/base/361783

Log:
  Add EXAMPLES to killall(1)
  
  Submitted by: fernape
  Differential Revision:https://reviews.freebsd.org/D25002

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

Modified: head/usr.bin/killall/killall.1
==
--- head/usr.bin/killall/killall.1  Thu Jun  4 02:36:41 2020
(r361782)
+++ head/usr.bin/killall/killall.1  Thu Jun  4 04:29:43 2020
(r361783)
@@ -145,6 +145,50 @@ utility exits 0 if some processes have been found and
 signalled successfully.
 Otherwise, a status of 1 will be
 returned.
+.Sh EXAMPLES
+Send
+.Dv SIGTERM
+to all firefox processes:
+.Bd -literal -offset indent
+killall firefox
+.Ed
+.Pp
+Send
+.Dv SIGTERM
+to firefox processes belonging to
+.Va USER :
+.Bd -literal -offset indent
+killall -u ${USER} firefox
+.Ed
+.Pp
+Stop all firefox processes:
+.Bd -literal -offset indent
+killall -SIGSTOP firefox
+.Ed
+.Pp
+Resume firefox processes:
+.Bd -literal -offset indent
+killall -SIGCONT firefox
+.Ed
+.Pp
+Show what would be done to firefox processes, but do not actually signal them:
+.Bd -literal -offset indent
+killall -s firefox
+.Ed
+.Pp
+Send
+.Dv SIGKILL
+to csh process running inside jail ID 282:
+.Bd -literal -offset indent
+killall -9 -j282 csh
+.Ed
+.Pp
+Send
+.Dv SIGTERM
+to all processes matching provided pattern (like vim and vimdiff):
+.Bd -literal -offset indent
+killall -m 'vim*'
+.Ed
 .Sh DIAGNOSTICS
 Diagnostic messages will only be printed if requested by
 .Fl d
___
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: r361782 - head/sys/dts/arm64/overlays

2020-06-03 Thread Warner Losh
Unless you got their explicit permission to license this under BSDL, please
back this out.

Warner

On Wed, Jun 3, 2020, 8:36 PM Oleksandr Tymoshenko  wrote:

> Author: gonzo
> Date: Thu Jun  4 02:36:41 2020
> New Revision: 361782
> URL: https://svnweb.freebsd.org/changeset/base/361782
>
> Log:
>   Add copyright headers to spigen overlays for rpi3 and rpi4
>
>   Reported by:  Rodney W. Grimes  (for rpi4)
>
> Modified:
>   head/sys/dts/arm64/overlays/spigen-rpi3.dtso
>   head/sys/dts/arm64/overlays/spigen-rpi4.dtso
>
> Modified: head/sys/dts/arm64/overlays/spigen-rpi3.dtso
>
> ==
> --- head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4
> 01:49:29 2020(r361781)
> +++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4
> 02:36:41 2020(r361782)
> @@ -1,4 +1,31 @@
> -/* $FreeBSD$ */
> +/*-
> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> + *
> + * Copyright (c) 2019 Bob Frazier 
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
> WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + *
> + * $FreeBSD$
> + */
>
>  /dts-v1/;
>  /plugin/;
>
> Modified: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
>
> ==
> --- head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4
> 01:49:29 2020(r361781)
> +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4
> 02:36:41 2020(r361782)
> @@ -1,4 +1,31 @@
> -/* $FreeBSD$ */
> +/*-
> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
> + *
> + * Copyright (c) 2020 Gergely Czuczy 
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
> WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + *
> + * $FreeBSD$
> + */
>
>  /dts-v1/;
>  /plugin/;
>
___
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: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Warner Losh
On Wed, Jun 3, 2020, 8:10 PM Pedro Giffuni  wrote:

>
> On 03/06/2020 19:59, Oleksandr Tymoshenko wrote:
> > Rodney W. Grimes (free...@gndrsh.dnsmgr.net) wrote:
> >> [ Charset UTF-8 unsupported, converting... ]
> >>> Author: gonzo
> >>> Date: Wed Jun  3 22:18:15 2020
> >>> New Revision: 361775
> >>> URL: https://svnweb.freebsd.org/changeset/base/361775
> >>>
> >>> Log:
> >>>Add spigen overlay for Raspberry Pi 4
> >>>
> >>>Submitted by:gergely.czu...@harmless.hu
> >>>
> >>> Added:
> >>>head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props
> changed)
> >>> Modified:
> >>>head/sys/modules/dtb/rpi/Makefile
> >>>
> >>> Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
> >>>
> ==
> >>> --- /dev/null   00:00:00 1970   (empty, because file is newly
> added)
> >>> +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3
> 22:18:15 2020(r361775)
> >>> @@ -0,0 +1,30 @@
> >>> +/* $FreeBSD$ */
> >> This file needs some form of copyright/license.
> > Whom should I put as a copyright folder, The FreeBSD Project or the
> > person who submitted the patch?
>
> The person that submitted the patch.
>

If it can be copyrighted.

Note that the FreeBSD Project is not an entity and cannot hold
> copyrights


True, but the FreeBSD Project can be the name in the copyright line. It is
the eponymous author of the FreeBSD collection.

(The Foundation can but unless they sponsored it, that
> usually involves paperwork).
>

Yup.

Warner

> Pedro.
>
>
___
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: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Warner Losh
On Wed, Jun 3, 2020, 6:28 PM Rodney W. Grimes 
wrote:

> [ Charset UTF-8 unsupported, converting... ]
> > Author: gonzo
> > Date: Wed Jun  3 22:18:15 2020
> > New Revision: 361775
> > URL: https://svnweb.freebsd.org/changeset/base/361775
> >
> > Log:
> >   Add spigen overlay for Raspberry Pi 4
> >
> >   Submitted by:   gergely.czu...@harmless.hu
> >
> > Added:
> >   head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props
> changed)
> > Modified:
> >   head/sys/modules/dtb/rpi/Makefile
> >
> > Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
> >
> ==
> > --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> > +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtso  Wed Jun  3
> 22:18:15 2020(r361775)
> > @@ -0,0 +1,30 @@
> > +/* $FreeBSD$ */
>
> This file needs some form of copyright/license.
>

Dts files are like database files: they likely have no copyright
protection.

Warner


> +
> > +/dts-v1/;
> > +/plugin/;
> > +
> > +/ {
> > + compatible = "brcm,bcm2711";
> > +};
> > +
> > +&{/soc/spi@7e204000} {
> > + status = "okay";
> > + spigen0: spigen0 {
> > + compatible = "freebsd,spigen";
> > + reg = <0>;
> > + spi-max-frequency = <50>; /* Req'd property, override
> with spi(8) */
> > + status = "okay";
> > + };
> > + spigen1: spigen1 {
> > + compatible = "freebsd,spigen";
> > + reg = <1>;
> > + spi-max-frequency = <50>; /* Req'd property, override
> with spi(8) */
> > + status = "okay";
> > + };
> > +};
> > +
> > +&{/soc/gpio@7e20/spi0_cs_pins} {
> > + brcm,pins = <8 7>;
> > + brcm,function = <4>; /* ALT0 */
> > +};
> > +
> >
> > Modified: head/sys/modules/dtb/rpi/Makefile
> >
> ==
> > --- head/sys/modules/dtb/rpi/Makefile Wed Jun  3 22:15:11 2020
> (r361774)
> > +++ head/sys/modules/dtb/rpi/Makefile Wed Jun  3 22:18:15 2020
> (r361775)
> > @@ -6,7 +6,8 @@ DTSO= \
> >   spigen-rpi2.dtso
> >  .elif ${MACHINE_ARCH} == "aarch64"
> >  DTSO=\
> > - spigen-rpi3.dtso
> > + spigen-rpi3.dtso \
> > + spigen-rpi4.dtso
> >  .endif
> >
> >  .include 
> >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361782 - head/sys/dts/arm64/overlays

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Jun  4 02:36:41 2020
New Revision: 361782
URL: https://svnweb.freebsd.org/changeset/base/361782

Log:
  Add copyright headers to spigen overlays for rpi3 and rpi4
  
  Reported by:  Rodney W. Grimes  (for rpi4)

Modified:
  head/sys/dts/arm64/overlays/spigen-rpi3.dtso
  head/sys/dts/arm64/overlays/spigen-rpi4.dtso

Modified: head/sys/dts/arm64/overlays/spigen-rpi3.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 01:49:29 
2020(r361781)
+++ head/sys/dts/arm64/overlays/spigen-rpi3.dtsoThu Jun  4 02:36:41 
2020(r361782)
@@ -1,4 +1,31 @@
-/* $FreeBSD$ */
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Bob Frazier 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
 
 /dts-v1/;
 /plugin/;

Modified: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 01:49:29 
2020(r361781)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoThu Jun  4 02:36:41 
2020(r361782)
@@ -1,4 +1,31 @@
-/* $FreeBSD$ */
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 Gergely Czuczy 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
 
 /dts-v1/;
 /plugin/;
___
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: r361770 - in head: include lib/libthr lib/libthr/thread share/man/man3

2020-06-03 Thread Jung-uk Kim
On 20. 6. 3., Konstantin Belousov wrote:
> Author: kib
> Date: Wed Jun  3 20:54:36 2020
> New Revision: 361770
> URL: https://svnweb.freebsd.org/changeset/base/361770
> 
> Log:
>   Add pthread_getname_np() and pthread_setname_np() aliases
>   
>   for pthread_get_name_np() and pthread_set_name_np(), to be
>   compatible with Linux.
>   
>   PR: 238404
>   Proposed and reviewed by:   markj
>   Sponsored by:   The FreeBSD Foundation
>   MFC after:  1 week
>   Differential revision:  https://reviews.freebsd.org/D25117
> 
> Modified:
>   head/include/pthread_np.h
>   head/lib/libthr/pthread.map
>   head/lib/libthr/thread/thr_info.c
>   head/share/man/man3/Makefile
>   head/share/man/man3/pthread_set_name_np.3
> 
> Modified: head/include/pthread_np.h
> ==
> --- head/include/pthread_np.h Wed Jun  3 20:42:52 2020(r361769)
> +++ head/include/pthread_np.h Wed Jun  3 20:54:36 2020(r361770)
> @@ -50,6 +50,7 @@ int pthread_attr_get_np(pthread_t, pthread_attr_t *);
>  int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);
>  int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);
>  void pthread_get_name_np(pthread_t, char *, size_t);
> +void pthread_getname_np(pthread_t, char *, size_t);
>  int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
>  int pthread_getthreadid_np(void);
>  int pthread_main_np(void);
> @@ -65,6 +66,7 @@ void pthread_resume_all_np(void);
>  int pthread_resume_np(pthread_t);
>  int pthread_peekjoin_np(pthread_t, void **);
>  void pthread_set_name_np(pthread_t, const char *);
> +void pthread_setname_np(pthread_t, const char *);
>  int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
>  int pthread_single_np(void);
>  void pthread_suspend_all_np(void);
> 
> Modified: head/lib/libthr/pthread.map
> ==
> --- head/lib/libthr/pthread.map   Wed Jun  3 20:42:52 2020
> (r361769)
> +++ head/lib/libthr/pthread.map   Wed Jun  3 20:54:36 2020
> (r361770)
> @@ -328,5 +328,7 @@ FBSD_1.5 {
>  };
>  
>  FBSD_1.6 {
> +  pthread_getname_np;
>pthread_peekjoin_np;
> +  pthread_setname_np;
>  };
> 
> Modified: head/lib/libthr/thread/thr_info.c
> ==
> --- head/lib/libthr/thread/thr_info.c Wed Jun  3 20:42:52 2020
> (r361769)
> +++ head/lib/libthr/thread/thr_info.c Wed Jun  3 20:54:36 2020
> (r361770)
> @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
>  #include "thr_private.h"
>  
>  __weak_reference(_pthread_set_name_np, pthread_set_name_np);
> +__weak_reference(_pthread_set_name_np, pthread_setname_np);
>  
>  static void
>  thr_set_name_np(struct pthread *thread, const char *name)
> @@ -89,6 +90,7 @@ thr_get_name_np(struct pthread *thread, char *buf, siz
>  }
>  
>  __weak_reference(_pthread_get_name_np, pthread_get_name_np);
> +__weak_reference(_pthread_get_name_np, pthread_getname_np);
>  
>  void
>  _pthread_get_name_np(pthread_t thread, char *buf, size_t len)
> 
> Modified: head/share/man/man3/Makefile
> ==
> --- head/share/man/man3/Makefile  Wed Jun  3 20:42:52 2020
> (r361769)
> +++ head/share/man/man3/Makefile  Wed Jun  3 20:54:36 2020
> (r361770)
> @@ -493,7 +493,9 @@ PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock
>  PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
>  PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \
>   pthread_schedparam.3 pthread_setschedparam.3
> -PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3
> +PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \
> + pthread_set_name_np.3 pthread_getname_np.3 \
> + pthread_set_name_np.3 pthread_setname_np.3
>  PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \
>   pthread_spin_lock.3 pthread_spin_trylock.3 \
>   pthread_spin_lock.3 pthread_spin_unlock.3
> 
> Modified: head/share/man/man3/pthread_set_name_np.3
> ==
> --- head/share/man/man3/pthread_set_name_np.3 Wed Jun  3 20:42:52 2020
> (r361769)
> +++ head/share/man/man3/pthread_set_name_np.3 Wed Jun  3 20:54:36 2020
> (r361770)
> @@ -24,12 +24,14 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd August 12, 2018
> +.Dd June 3, 2020
>  .Dt PTHREAD_SET_NAME_NP 3
>  .Os
>  .Sh NAME
>  .Nm pthread_get_name_np ,
> +.Nm pthread_getname_np ,
>  .Nm pthread_set_name_np
> +.Nm pthread_setname_np
>  .Nd set and retrieve the thread name
>  .Sh LIBRARY
>  .Lb libpthread
> @@ -38,18 +40,26 @@
>  .Ft void
>  .Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len"
>  .Ft void
> +.Fn pthread_getname_np "pthread_t thread" "char *name" 

Re: svn commit: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Pedro Giffuni



On 03/06/2020 19:59, Oleksandr Tymoshenko wrote:

Rodney W. Grimes (free...@gndrsh.dnsmgr.net) wrote:

[ Charset UTF-8 unsupported, converting... ]

Author: gonzo
Date: Wed Jun  3 22:18:15 2020
New Revision: 361775
URL: https://svnweb.freebsd.org/changeset/base/361775

Log:
   Add spigen overlay for Raspberry Pi 4
   
   Submitted by:	gergely.czu...@harmless.hu


Added:
   head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
Modified:
   head/sys/modules/dtb/rpi/Makefile

Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3 22:18:15 
2020(r361775)
@@ -0,0 +1,30 @@
+/* $FreeBSD$ */

This file needs some form of copyright/license.

Whom should I put as a copyright folder, The FreeBSD Project or the
person who submitted the patch?


The person that submitted the patch.

Note that the FreeBSD Project is not an entity and cannot hold 
copyrights (The Foundation can but unless they sponsored it, that 
usually involves paperwork).


Pedro.

___
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: r361781 - head/sys/vm

2020-06-03 Thread Ed Maste
Author: emaste
Date: Thu Jun  4 01:49:29 2020
New Revision: 361781
URL: https://svnweb.freebsd.org/changeset/base/361781

Log:
  Correct terminology in vm.imply_prot_max sysctl description
  
  As with r361769 (man page), PROT_* are properly called protections, not
  permissions.
  
  MFC after:1 week
  MFC with: r361769
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==
--- head/sys/vm/vm_mmap.c   Thu Jun  4 00:28:20 2020(r361780)
+++ head/sys/vm/vm_mmap.c   Thu Jun  4 01:49:29 2020(r361781)
@@ -106,7 +106,7 @@ SYSCTL_INT(_vm, OID_AUTO, mincore_mapped, CTLFLAG_RWTU
 "mincore reports mappings, not residency");
 static int imply_prot_max = 0;
 SYSCTL_INT(_vm, OID_AUTO, imply_prot_max, CTLFLAG_RWTUN, _prot_max, 0,
-"Imply maximum page permissions in mmap() when none are specified");
+"Imply maximum page protections in mmap() when none are specified");
 
 #ifdef MAP_32BIT
 #defineMAP_32BIT_MAX_ADDR  ((vm_offset_t)1 << 31)
___
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: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Oleksandr Tymoshenko
Rodney W. Grimes (free...@gndrsh.dnsmgr.net) wrote:
> [ Charset UTF-8 unsupported, converting... ]
> > Author: gonzo
> > Date: Wed Jun  3 22:18:15 2020
> > New Revision: 361775
> > URL: https://svnweb.freebsd.org/changeset/base/361775
> > 
> > Log:
> >   Add spigen overlay for Raspberry Pi 4
> >   
> >   Submitted by: gergely.czu...@harmless.hu
> > 
> > Added:
> >   head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
> > Modified:
> >   head/sys/modules/dtb/rpi/Makefile
> > 
> > Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
> > ==
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3 22:18:15 
> > 2020(r361775)
> > @@ -0,0 +1,30 @@
> > +/* $FreeBSD$ */
> 
> This file needs some form of copyright/license.

Whom should I put as a copyright folder, The FreeBSD Project or the
person who submitted the patch?

-- 
gonzo
___
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: r361780 - head/usr.sbin/mountd

2020-06-03 Thread Rick Macklem
Author: rmacklem
Date: Thu Jun  4 00:28:20 2020
New Revision: 361780
URL: https://svnweb.freebsd.org/changeset/base/361780

Log:
  Fix mountd to handle getgrouplist() not returning groups[0] == groups[1].
  
  Prior to r174547, getgrouplist(3) always returned a groups list with
  element 0 and 1 set to the basegid argument, so long as ngroups was > 1.
  Post-r174547 this is not the case. r328304 disabled the deduplication that
  removed the duplicate, but the duplicate still does not occur unless the
  group for a user in the password database is also entered in the group
  database.
  This patch fixes mountd so that it handles the case where a user specified
  with the -maproot or -mapall exports option has a getgrouplist(3) groups
  list where groups[0] != groups[1].
  Found while testing another mountd patch.
  
  MFC after:2 weeks

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

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Jun  3 23:21:44 2020
(r361779)
+++ head/usr.sbin/mountd/mountd.c   Thu Jun  4 00:28:20 2020
(r361780)
@@ -3434,10 +3434,16 @@ parsecred(char *namelist, struct xucred *cr)
/*
 * Compress out duplicate.
 */
-   cr->cr_ngroups = ngroups - 1;
cr->cr_groups[0] = groups[0];
-   for (cnt = 2; cnt < ngroups; cnt++)
-   cr->cr_groups[cnt - 1] = groups[cnt];
+   if (ngroups > 1 && groups[0] == groups[1]) {
+   cr->cr_ngroups = ngroups - 1;
+   for (cnt = 2; cnt < ngroups; cnt++)
+   cr->cr_groups[cnt - 1] = groups[cnt];
+   } else {
+   cr->cr_ngroups = ngroups;
+   for (cnt = 1; cnt < ngroups; cnt++)
+   cr->cr_groups[cnt] = groups[cnt];
+   }
return;
}
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: gonzo
> Date: Wed Jun  3 22:18:15 2020
> New Revision: 361775
> URL: https://svnweb.freebsd.org/changeset/base/361775
> 
> Log:
>   Add spigen overlay for Raspberry Pi 4
>   
>   Submitted by:   gergely.czu...@harmless.hu
> 
> Added:
>   head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
> Modified:
>   head/sys/modules/dtb/rpi/Makefile
> 
> Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
> ==
> --- /dev/null 00:00:00 1970   (empty, because file is newly added)
> +++ head/sys/dts/arm64/overlays/spigen-rpi4.dtso  Wed Jun  3 22:18:15 
> 2020(r361775)
> @@ -0,0 +1,30 @@
> +/* $FreeBSD$ */

This file needs some form of copyright/license.

> +
> +/dts-v1/;
> +/plugin/;
> +
> +/ {
> + compatible = "brcm,bcm2711";
> +};
> + 
> +&{/soc/spi@7e204000} {
> + status = "okay";
> + spigen0: spigen0 {
> + compatible = "freebsd,spigen";
> + reg = <0>;
> + spi-max-frequency = <50>; /* Req'd property, override with 
> spi(8) */
> + status = "okay";
> + };
> + spigen1: spigen1 {
> + compatible = "freebsd,spigen";
> + reg = <1>;
> + spi-max-frequency = <50>; /* Req'd property, override with 
> spi(8) */
> + status = "okay";
> + };
> +};
> +
> +&{/soc/gpio@7e20/spi0_cs_pins} {
> + brcm,pins = <8 7>;
> + brcm,function = <4>; /* ALT0 */
> +};
> +
> 
> Modified: head/sys/modules/dtb/rpi/Makefile
> ==
> --- head/sys/modules/dtb/rpi/Makefile Wed Jun  3 22:15:11 2020
> (r361774)
> +++ head/sys/modules/dtb/rpi/Makefile Wed Jun  3 22:18:15 2020
> (r361775)
> @@ -6,7 +6,8 @@ DTSO= \
>   spigen-rpi2.dtso
>  .elif ${MACHINE_ARCH} == "aarch64"
>  DTSO=\
> - spigen-rpi3.dtso
> + spigen-rpi3.dtso \
> + spigen-rpi4.dtso
>  .endif
>  
>  .include 
> 

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


svn commit: r361779 - head/sys/modules/crypto

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 23:21:44 2020
New Revision: 361779
URL: https://svnweb.freebsd.org/changeset/base/361779

Log:
  Add opt_compat.h needed by r359374.
  
  Reported by:  kevans

Modified:
  head/sys/modules/crypto/Makefile

Modified: head/sys/modules/crypto/Makefile
==
--- head/sys/modules/crypto/MakefileWed Jun  3 22:30:44 2020
(r361778)
+++ head/sys/modules/crypto/MakefileWed Jun  3 23:21:44 2020
(r361779)
@@ -65,6 +65,7 @@ SRCS  += utils.c
 CFLAGS.utils.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT}
 
 SRCS   += opt_param.h cryptodev_if.h bus_if.h device_if.h
+SRCS   += opt_compat.h
 SRCS   += opt_ddb.h
 SRCS   += cbc_mac.c
 SRCS   += xform_cbc_mac.c
___
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: r361778 - head/sys/dev/usb/wlan

2020-06-03 Thread Adrian Chadd
Author: adrian
Date: Wed Jun  3 22:30:44 2020
New Revision: 361778
URL: https://svnweb.freebsd.org/changeset/base/361778

Log:
  [run] Fix up tx/rx frame size.
  
  This specifically fixes that TX frames are large enough now to hold a 3900 odd
  byte AMSDU (the little ones); me flipping it on earlier messed up transmit!
  
  Tested:
  
  * if_run, STA mode, TX/RX TCP/UDP iperf.  TCP is now back to normal and
correctly does ~ 3200 byte AMSDU/fast frames (2x1600ish byte MSDUs).

Modified:
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_runvar.h

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Jun  3 22:19:52 2020
(r361777)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Jun  3 22:30:44 2020
(r361778)
@@ -3050,10 +3050,11 @@ run_bulk_rx_callback(struct usb_xfer *xfer, usb_error_
 tr_setup:
if (sc->rx_m == NULL) {
sc->rx_m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR,
-   MJUMPAGESIZE /* xfer can be bigger than MCLBYTES 
*/);
+   RUN_MAX_RXSZ);
}
if (sc->rx_m == NULL) {
-   RUN_DPRINTF(sc, RUN_DEBUG_RECV | RUN_DEBUG_RECV_DESC,
+   RUN_DPRINTF(sc, RUN_DEBUG_RECV |
+   RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB,
"could not allocate mbuf - idle with stall\n");
counter_u64_add(ic->ic_ierrors, 1);
usbd_xfer_set_stall(xfer);

Modified: head/sys/dev/usb/wlan/if_runvar.h
==
--- head/sys/dev/usb/wlan/if_runvar.h   Wed Jun  3 22:19:52 2020
(r361777)
+++ head/sys/dev/usb/wlan/if_runvar.h   Wed Jun  3 22:30:44 2020
(r361778)
@@ -23,14 +23,15 @@
 #ifndef _IF_RUNVAR_H_
 #define_IF_RUNVAR_H_
 
+/* Support up to 4KB frames - useful for A-MSDU/FF. */
 #defineRUN_MAX_RXSZ\
MIN(4096, MJUMPAGESIZE)
 
-/* NB: "11" is the maximum number of padding bytes needed for Tx */
+/* Support up to 8KB frames - useful for A-MSDU/FF. */
 #defineRUN_MAX_TXSZ\
(sizeof (struct rt2870_txd) +   \
 sizeof (struct rt2860_txwi) +  \
-MCLBYTES + 11)
+8192 + 11)
 
 #defineRUN_TX_TIMEOUT  5000/* ms */
 
___
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: r361777 - head/sys/dev/cxgbe/crypto

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 22:19:52 2020
New Revision: 361777
URL: https://svnweb.freebsd.org/changeset/base/361777

Log:
  Explicitly zero IVs on the stack.
  
  Reviewed by:  delphij
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D25057

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Wed Jun  3 22:18:21 2020
(r361776)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Wed Jun  3 22:19:52 2020
(r361777)
@@ -751,6 +751,7 @@ ccr_blkcipher(struct ccr_softc *sc, struct ccr_session
/* XXX: TODO backpressure */
t4_wrq_tx(sc->adapter, wr);
 
+   explicit_bzero(iv, sizeof(iv));
return (0);
 }
 
@@ -1069,6 +1070,7 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, s
/* XXX: TODO backpressure */
t4_wrq_tx(sc->adapter, wr);
 
+   explicit_bzero(iv, sizeof(iv));
return (0);
 }
 
@@ -1351,6 +1353,7 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, s
/* XXX: TODO backpressure */
t4_wrq_tx(sc->adapter, wr);
 
+   explicit_bzero(iv, sizeof(iv));
return (0);
 }
 
@@ -1818,6 +1821,7 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, s
/* XXX: TODO backpressure */
t4_wrq_tx(sc->adapter, wr);
 
+   explicit_bzero(iv, sizeof(iv));
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361776 - head/sys/dev/cxgbe/crypto

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 22:18:21 2020
New Revision: 361776
URL: https://svnweb.freebsd.org/changeset/base/361776

Log:
  Explicitly zero AES key schedules on the stack.
  
  Reviewed by:  delphij
  MFC after:1 week
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D25057

Modified:
  head/sys/dev/cxgbe/crypto/t4_keyctx.c

Modified: head/sys/dev/cxgbe/crypto/t4_keyctx.c
==
--- head/sys/dev/cxgbe/crypto/t4_keyctx.c   Wed Jun  3 22:18:15 2020
(r361775)
+++ head/sys/dev/cxgbe/crypto/t4_keyctx.c   Wed Jun  3 22:18:21 2020
(r361776)
@@ -75,6 +75,7 @@ t4_init_gmac_hash(const char *key, int klen, char *gha
 
rounds = rijndaelKeySetupEnc(keysched, key, klen * 8);
rijndaelEncrypt(keysched, rounds, zeroes, ghash);
+   explicit_bzero(keysched, sizeof(keysched));
 }
 
 /* Copy out the partial hash state from a software hash implementation. */
@@ -169,4 +170,5 @@ t4_aes_getdeckey(void *dec_key, const void *enc_key, u
break;
}
MPASS(dkey == dec_key);
+   explicit_bzero(ek, sizeof(ek));
 }
___
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: r361775 - in head/sys: dts/arm64/overlays modules/dtb/rpi

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun  3 22:18:15 2020
New Revision: 361775
URL: https://svnweb.freebsd.org/changeset/base/361775

Log:
  Add spigen overlay for Raspberry Pi 4
  
  Submitted by: gergely.czu...@harmless.hu

Added:
  head/sys/dts/arm64/overlays/spigen-rpi4.dtso   (contents, props changed)
Modified:
  head/sys/modules/dtb/rpi/Makefile

Added: head/sys/dts/arm64/overlays/spigen-rpi4.dtso
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dts/arm64/overlays/spigen-rpi4.dtsoWed Jun  3 22:18:15 
2020(r361775)
@@ -0,0 +1,30 @@
+/* $FreeBSD$ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+   compatible = "brcm,bcm2711";
+};
+   
+&{/soc/spi@7e204000} {
+   status = "okay";
+   spigen0: spigen0 {
+   compatible = "freebsd,spigen";
+   reg = <0>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+   spigen1: spigen1 {
+   compatible = "freebsd,spigen";
+   reg = <1>;
+   spi-max-frequency = <50>; /* Req'd property, override with 
spi(8) */
+   status = "okay";
+   };
+};
+
+&{/soc/gpio@7e20/spi0_cs_pins} {
+   brcm,pins = <8 7>;
+   brcm,function = <4>; /* ALT0 */
+};
+

Modified: head/sys/modules/dtb/rpi/Makefile
==
--- head/sys/modules/dtb/rpi/Makefile   Wed Jun  3 22:15:11 2020
(r361774)
+++ head/sys/modules/dtb/rpi/Makefile   Wed Jun  3 22:18:15 2020
(r361775)
@@ -6,7 +6,8 @@ DTSO=   \
spigen-rpi2.dtso
 .elif ${MACHINE_ARCH} == "aarch64"
 DTSO=  \
-   spigen-rpi3.dtso
+   spigen-rpi3.dtso \
+   spigen-rpi4.dtso
 .endif
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361774 - head/sys/crypto/aesni

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 22:15:11 2020
New Revision: 361774
URL: https://svnweb.freebsd.org/changeset/base/361774

Log:
  Explicitly zero on-stack IVs, tags, and HMAC keys.
  
  Reviewed by:  delphij
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D25057

Modified:
  head/sys/crypto/aesni/aesni.c

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Wed Jun  3 22:11:05 2020
(r361773)
+++ head/sys/crypto/aesni/aesni.c   Wed Jun  3 22:15:11 2020
(r361774)
@@ -815,6 +815,8 @@ out:
explicit_bzero(outbuf, crp->crp_payload_length);
free(outbuf, M_AESNI);
}
+   explicit_bzero(iv, sizeof(iv));
+   explicit_bzero(tag, sizeof(tag));
return (error);
 }
 
@@ -826,9 +828,7 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
struct SHA256Context sha2 __aligned(16);
struct sha1_ctxt sha1 __aligned(16);
} sctx;
-   uint8_t hmac_key[SHA1_BLOCK_LEN] __aligned(16);
uint32_t res[SHA2_256_HASH_LEN / sizeof(uint32_t)];
-   uint32_t res2[SHA2_256_HASH_LEN / sizeof(uint32_t)];
const uint8_t *key;
int i, keylen;
 
@@ -839,6 +839,8 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
keylen = csp->csp_auth_klen;
 
if (ses->hmac) {
+   uint8_t hmac_key[SHA1_BLOCK_LEN] __aligned(16);
+
/* Inner hash: (K ^ IPAD) || data */
ses->hash_init();
for (i = 0; i < keylen; i++)
@@ -869,6 +871,7 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
ses->hash_update(, hmac_key, sizeof(hmac_key));
ses->hash_update(, res, ses->hash_len);
ses->hash_finalize(res, );
+   explicit_bzero(hmac_key, sizeof(hmac_key));
} else {
ses->hash_init();
 
@@ -889,10 +892,14 @@ aesni_cipher_mac(struct aesni_session *ses, struct cry
}
 
if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) {
+   uint32_t res2[SHA2_256_HASH_LEN / sizeof(uint32_t)];
+
crypto_copydata(crp, crp->crp_digest_start, ses->mlen, res2);
if (timingsafe_bcmp(res, res2, ses->mlen) != 0)
return (EBADMSG);
+   explicit_bzero(res2, sizeof(res2));
} else
crypto_copyback(crp, crp->crp_digest_start, ses->mlen, res);
+   explicit_bzero(res, sizeof(res));
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361773 - in head/sys: dev/cxgbe/crypto opencrypto

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 22:11:05 2020
New Revision: 361773
URL: https://svnweb.freebsd.org/changeset/base/361773

Log:
  Add explicit bzero's of sensitive data in software crypto consumers.
  
  Explicitly zero IVs, block buffers, and hashes/digests.
  
  Reviewed by:  delphij
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D25057

Modified:
  head/sys/dev/cxgbe/crypto/t4_crypto.c
  head/sys/opencrypto/cryptosoft.c

Modified: head/sys/dev/cxgbe/crypto/t4_crypto.c
==
--- head/sys/dev/cxgbe/crypto/t4_crypto.c   Wed Jun  3 21:22:14 2020
(r361772)
+++ head/sys/dev/cxgbe/crypto/t4_crypto.c   Wed Jun  3 22:11:05 2020
(r361773)
@@ -1495,11 +1495,15 @@ ccr_gcm_soft(struct ccr_session *s, struct cryptop *cr
}
} else
error = EBADMSG;
+   explicit_bzero(digest2, sizeof(digest2));
}
 
 out:
zfree(kschedule, M_CCR);
zfree(auth_ctx, M_CCR);
+   explicit_bzero(block, sizeof(block));
+   explicit_bzero(iv, sizeof(iv));
+   explicit_bzero(digest, sizeof(digest));
crp->crp_etype = error;
crypto_done(crp);
 }
@@ -1953,11 +1957,15 @@ ccr_ccm_soft(struct ccr_session *s, struct cryptop *cr
}
} else
error = EBADMSG;
+   explicit_bzero(digest2, sizeof(digest2));
}
 
 out:
zfree(kschedule, M_CCR);
zfree(auth_ctx, M_CCR);
+   explicit_bzero(block, sizeof(block));
+   explicit_bzero(iv, sizeof(iv));
+   explicit_bzero(digest, sizeof(digest));
crp->crp_etype = error;
crypto_done(crp);
 }

Modified: head/sys/opencrypto/cryptosoft.c
==
--- head/sys/opencrypto/cryptosoft.cWed Jun  3 21:22:14 2020
(r361772)
+++ head/sys/opencrypto/cryptosoft.cWed Jun  3 22:11:05 2020
(r361773)
@@ -131,8 +131,6 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *
(crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0)
return (EINVAL);
 
-   crypto_read_iv(crp, iv);
-
if (crp->crp_cipher_key != NULL) {
csp = crypto_get_params(crp->crp_session);
error = exf->setkey(sw->sw_kschedule,
@@ -141,6 +139,8 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *
return (error);
}
 
+   crypto_read_iv(crp, iv);
+
if (exf->reinit) {
/*
 * xforms that provide a reinit method perform all IV
@@ -277,6 +277,9 @@ swcr_encdec(struct swcr_session *ses, struct cryptop *
crypto_cursor_copyback(_out, resid, blk);
}
 
+   explicit_bzero(blk, sizeof(blk));
+   explicit_bzero(iv, sizeof(iv));
+   explicit_bzero(iv2, sizeof(iv2));
return (0);
 }
 
@@ -314,7 +317,6 @@ static int
 swcr_authcompute(struct swcr_session *ses, struct cryptop *crp)
 {
u_char aalg[HASH_MAX_LEN];
-   u_char uaalg[HASH_MAX_LEN];
const struct crypto_session_params *csp;
struct swcr_auth *sw;
struct auth_hash *axf;
@@ -383,14 +385,18 @@ swcr_authcompute(struct swcr_session *ses, struct cryp
}
 
if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) {
+   u_char uaalg[HASH_MAX_LEN];
+
crypto_copydata(crp, crp->crp_digest_start, sw->sw_mlen, uaalg);
if (timingsafe_bcmp(aalg, uaalg, sw->sw_mlen) != 0)
-   return (EBADMSG);
+   err = EBADMSG;
+   explicit_bzero(uaalg, sizeof(uaalg));
} else {
/* Inject the authentication data */
crypto_copyback(crp, crp->crp_digest_start, sw->sw_mlen, aalg);
}
-   return (0);
+   explicit_bzero(aalg, sizeof(aalg));
+   return (err);
 }
 
 CTASSERT(INT_MAX <= (1ll<<39) - 256);  /* GCM: plain text < 2^39-256 */
@@ -402,14 +408,13 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *cr
uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))];
u_char *blk = (u_char *)blkbuf;
u_char aalg[AALG_MAX_RESULT_LEN];
-   u_char uaalg[AALG_MAX_RESULT_LEN];
u_char iv[EALG_MAX_BLOCK_LEN];
struct crypto_buffer_cursor cc;
union authctx ctx;
struct swcr_auth *swa;
struct auth_hash *axf;
uint32_t *blkp;
-   int blksz, ivlen, len, resid;
+   int blksz, error, ivlen, len, resid;
 
swa = >swcr_auth;
axf = swa->sw_axf;
@@ -440,16 +445,23 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *cr
/* Finalize MAC */
axf->Final(aalg, );
 
+   error = 0;
if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) {
+   u_char uaalg[AALG_MAX_RESULT_LEN];
+
crypto_copydata(crp, 

svn commit: r361772 - releng/11.4/lib/clang/include/clang/Config

2020-06-03 Thread Dimitry Andric
Author: dim
Date: Wed Jun  3 21:22:14 2020
New Revision: 361772
URL: https://svnweb.freebsd.org/changeset/base/361772

Log:
  MF11 r361755:
  
  Disable clang's -fintegrated-cc1 stage by default
  
  In bug 246630, it was found that part of the rescue binary could be
  compiled to very slightly different (but still equivalent) machine code,
  depending on the number of simultaneous make jobs (via the -j option).
  
  This turned out to be caused by the upstream change that made clang's
  first stage compiler (i.e. the -cc1 stage) run as part of the initial
  clang process invocation, instead of forking and exec'ing a new clang
  process.
  
  We are currently investigating the root cause for the difference in
  output, but while that is ongoing, disable the integrated cc1 stage for
  now to work around it. You can always turn it on explicitly by using the
  -fintegrated-cc1 option, or turn it off with -fno-integrated-cc1.
  
  Direct commit to stable/{11,12}, so this can hopefully end up in the
  upcoming 11.4-RELEASE.
  
  Approved by:  re (gjb)
  Reported by:  Fabian Keil 
  PR:   246630

Modified:
  releng/11.4/lib/clang/include/clang/Config/config.h
Directory Properties:
  releng/11.4/   (props changed)

Modified: releng/11.4/lib/clang/include/clang/Config/config.h
==
--- releng/11.4/lib/clang/include/clang/Config/config.h Wed Jun  3 21:19:57 
2020(r361771)
+++ releng/11.4/lib/clang/include/clang/Config/config.h Wed Jun  3 21:22:14 
2020(r361772)
@@ -82,6 +82,6 @@
 /* #undef CLANG_ENABLE_STATIC_ANALYZER */
 
 /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */
-#define CLANG_SPAWN_CC1 0
+#define CLANG_SPAWN_CC1 1
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361771 - head/sys/modules/dtb/rockchip

2020-06-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun  3 21:19:57 2020
New Revision: 361771
URL: https://svnweb.freebsd.org/changeset/base/361771

Log:
  Add dtb for Firefly RK3399 to the list of Rockchip dtbs

Modified:
  head/sys/modules/dtb/rockchip/Makefile

Modified: head/sys/modules/dtb/rockchip/Makefile
==
--- head/sys/modules/dtb/rockchip/Makefile  Wed Jun  3 20:54:36 2020
(r361770)
+++ head/sys/modules/dtb/rockchip/Makefile  Wed Jun  3 21:19:57 2020
(r361771)
@@ -5,6 +5,7 @@ DTS=\
rockchip/rk3399-khadas-edge.dts \
rockchip/rk3399-khadas-edge-v.dts \
rockchip/rk3328-rock64.dts \
+   rockchip/rk3399-firefly.dts \
rockchip/rk3399-rockpro64.dts
 
 DTSO=  rk3328-dwc3.dtso
___
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: r361770 - in head: include lib/libthr lib/libthr/thread share/man/man3

2020-06-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jun  3 20:54:36 2020
New Revision: 361770
URL: https://svnweb.freebsd.org/changeset/base/361770

Log:
  Add pthread_getname_np() and pthread_setname_np() aliases
  
  for pthread_get_name_np() and pthread_set_name_np(), to be
  compatible with Linux.
  
  PR:   238404
  Proposed and reviewed by: markj
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D25117

Modified:
  head/include/pthread_np.h
  head/lib/libthr/pthread.map
  head/lib/libthr/thread/thr_info.c
  head/share/man/man3/Makefile
  head/share/man/man3/pthread_set_name_np.3

Modified: head/include/pthread_np.h
==
--- head/include/pthread_np.h   Wed Jun  3 20:42:52 2020(r361769)
+++ head/include/pthread_np.h   Wed Jun  3 20:54:36 2020(r361770)
@@ -50,6 +50,7 @@ int pthread_attr_get_np(pthread_t, pthread_attr_t *);
 int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);
 int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);
 void pthread_get_name_np(pthread_t, char *, size_t);
+void pthread_getname_np(pthread_t, char *, size_t);
 int pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);
 int pthread_getthreadid_np(void);
 int pthread_main_np(void);
@@ -65,6 +66,7 @@ void pthread_resume_all_np(void);
 int pthread_resume_np(pthread_t);
 int pthread_peekjoin_np(pthread_t, void **);
 void pthread_set_name_np(pthread_t, const char *);
+void pthread_setname_np(pthread_t, const char *);
 int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);
 int pthread_single_np(void);
 void pthread_suspend_all_np(void);

Modified: head/lib/libthr/pthread.map
==
--- head/lib/libthr/pthread.map Wed Jun  3 20:42:52 2020(r361769)
+++ head/lib/libthr/pthread.map Wed Jun  3 20:54:36 2020(r361770)
@@ -328,5 +328,7 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+pthread_getname_np;
 pthread_peekjoin_np;
+pthread_setname_np;
 };

Modified: head/lib/libthr/thread/thr_info.c
==
--- head/lib/libthr/thread/thr_info.c   Wed Jun  3 20:42:52 2020
(r361769)
+++ head/lib/libthr/thread/thr_info.c   Wed Jun  3 20:54:36 2020
(r361770)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include "thr_private.h"
 
 __weak_reference(_pthread_set_name_np, pthread_set_name_np);
+__weak_reference(_pthread_set_name_np, pthread_setname_np);
 
 static void
 thr_set_name_np(struct pthread *thread, const char *name)
@@ -89,6 +90,7 @@ thr_get_name_np(struct pthread *thread, char *buf, siz
 }
 
 __weak_reference(_pthread_get_name_np, pthread_get_name_np);
+__weak_reference(_pthread_get_name_np, pthread_getname_np);
 
 void
 _pthread_get_name_np(pthread_t thread, char *buf, size_t len)

Modified: head/share/man/man3/Makefile
==
--- head/share/man/man3/MakefileWed Jun  3 20:42:52 2020
(r361769)
+++ head/share/man/man3/MakefileWed Jun  3 20:54:36 2020
(r361770)
@@ -493,7 +493,9 @@ PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock
 PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3
 PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \
pthread_schedparam.3 pthread_setschedparam.3
-PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3
+PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \
+   pthread_set_name_np.3 pthread_getname_np.3 \
+   pthread_set_name_np.3 pthread_setname_np.3
 PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \
pthread_spin_lock.3 pthread_spin_trylock.3 \
pthread_spin_lock.3 pthread_spin_unlock.3

Modified: head/share/man/man3/pthread_set_name_np.3
==
--- head/share/man/man3/pthread_set_name_np.3   Wed Jun  3 20:42:52 2020
(r361769)
+++ head/share/man/man3/pthread_set_name_np.3   Wed Jun  3 20:54:36 2020
(r361770)
@@ -24,12 +24,14 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 12, 2018
+.Dd June 3, 2020
 .Dt PTHREAD_SET_NAME_NP 3
 .Os
 .Sh NAME
 .Nm pthread_get_name_np ,
+.Nm pthread_getname_np ,
 .Nm pthread_set_name_np
+.Nm pthread_setname_np
 .Nd set and retrieve the thread name
 .Sh LIBRARY
 .Lb libpthread
@@ -38,18 +40,26 @@
 .Ft void
 .Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len"
 .Ft void
+.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len"
+.Ft void
 .Fn pthread_set_name_np "pthread_t thread" "const char *name"
+.Ft void
+.Fn pthread_setname_np "pthread_t thread" "const char *name"
 .Sh DESCRIPTION
 The
 .Fn pthread_set_name_np
-function applies a copy of the given
+and
+.Fn pthread_setname_np
+functions 

svn commit: r361769 - head/lib/libc/sys

2020-06-03 Thread Ed Maste
Author: emaste
Date: Wed Jun  3 20:42:52 2020
New Revision: 361769
URL: https://svnweb.freebsd.org/changeset/base/361769

Log:
  mmap.2: correct prot argument terminology
  
  One of the error descriptions referred to permissions; in context the
  meaning was probably clear, but the prot values are properly called
  protections.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libc/sys/mmap.2

Modified: head/lib/libc/sys/mmap.2
==
--- head/lib/libc/sys/mmap.2Wed Jun  3 20:25:02 2020(r361768)
+++ head/lib/libc/sys/mmap.2Wed Jun  3 20:42:52 2020(r361769)
@@ -528,8 +528,8 @@ was specified and insufficient memory was available.
 .It Bq Er ENOTSUP
 The
 .Fa prot
-argument contains permissions which are not a subset of the specified
-maximum permissions.
+argument contains protections which are not a subset of the specified
+maximum protections.
 .El
 .Sh SEE ALSO
 .Xr madvise 2 ,
___
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: r361768 - head/sys/dev/otus

2020-06-03 Thread Adrian Chadd
Author: adrian
Date: Wed Jun  3 20:25:02 2020
New Revision: 361768
URL: https://svnweb.freebsd.org/changeset/base/361768

Log:
  [otus] enable 802.11n for 2GHz and 5GHz.
  
  This flips on basic 11n for 2GHz/5GHz station operation.
  
  * It flips on HT20 and MCS rates;
  * It enables A-MPDU decap - the payload format is a bit different;
  * It does do some basic checks for HT40 but I haven't yet flipped on
HT40 support;
  * It enables software A-MSDU transmit; I honestly don't want to make
A-MPDU TX work and there are apparently issues with QoS and A-MPDU TX.
So I totally am ignoring A-MPDU TX;
  * MCS rate transmit is fine.
  
  I haven't:
  
  * A-MPDU TX, as I said above;
  * made radiotap work fully;
  * HT40;
  * short-GI support;
  * lots of other stuff that honestly no-one is likely to use.
  
  But! Hey, this is another ye olde 11n USB NIC that now works pretty OK
  in 11n rates. A-MPDU receive seems fine enough given it's a draft-n
  device from before 2010.
  
  Tested:
  
  * Ye olde UB82 Test NIC (AR9170 + AR9104) - 2GHz/5GHz

Modified:
  head/sys/dev/otus/if_otus.c
  head/sys/dev/otus/if_otusreg.h

Modified: head/sys/dev/otus/if_otus.c
==
--- head/sys/dev/otus/if_otus.c Wed Jun  3 18:59:31 2020(r361767)
+++ head/sys/dev/otus/if_otus.c Wed Jun  3 20:25:02 2020(r361768)
@@ -91,6 +91,7 @@ SYSCTL_INT(_hw_usb_otus, OID_AUTO, debug, CTLFLAG_RWTU
 #defineOTUS_DEBUG_REGIO0x0200
 #defineOTUS_DEBUG_IRQ  0x0400
 #defineOTUS_DEBUG_TXCOMP   0x0800
+#defineOTUS_DEBUG_RX_BUFFER0x1000
 #defineOTUS_DEBUG_ANY  0x
 
 #defineOTUS_DPRINTF(sc, dm, ...) \
@@ -131,7 +132,6 @@ static device_attach_t otus_attach;
 static device_detach_t otus_detach;
 
 static int otus_attachhook(struct otus_softc *);
-void   otus_get_chanlist(struct otus_softc *);
 static voidotus_getradiocaps(struct ieee80211com *, int, int *,
struct ieee80211_channel[]);
 intotus_load_firmware(struct otus_softc *, const char *,
@@ -395,9 +395,8 @@ otus_vap_create(struct ieee80211com *ic, const char na
uvp->newstate = vap->iv_newstate;
vap->iv_newstate = otus_newstate;
 
-   /* XXX TODO: double-check */
-   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_16;
-   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_32K;
+   vap->iv_ampdu_density = IEEE80211_HTCAP_MPDUDENSITY_8;
+   vap->iv_ampdu_rxmax = IEEE80211_HTCAP_MAXRXAMPDU_64K;
 
ieee80211_ratectl_init(vap);
 
@@ -699,6 +698,16 @@ otus_attachhook(struct otus_softc *sc)
IEEE80211_ADDR_COPY(ic->ic_macaddr, sc->eeprom.baseEepHeader.macAddr);
sc->sc_led_newstate = otus_led_newstate_type3;  /* XXX */
 
+   if (sc->txmask == 0x5)
+   ic->ic_txstream = 2;
+   else
+   ic->ic_txstream = 1;
+
+   if (sc->rxmask == 0x5)
+   ic->ic_rxstream = 2;
+   else
+   ic->ic_rxstream = 1;
+
device_printf(sc->sc_dev,
"MAC/BBP AR9170, RF AR%X, MIMO %dT%dR, address %s\n",
(sc->capflags & AR5416_OPFLAGS_11A) ?
@@ -721,33 +730,21 @@ otus_attachhook(struct otus_softc *sc)
IEEE80211_C_WME |   /* WME/QoS */
IEEE80211_C_SHSLOT |/* Short slot time supported. */
IEEE80211_C_FF |/* Atheros fast-frames supported. */
-   IEEE80211_C_MONITOR |
+   IEEE80211_C_MONITOR |   /* Enable monitor mode */
+   IEEE80211_C_SWAMSDUTX | /* Do software A-MSDU TX */
IEEE80211_C_WPA;/* WPA/RSN. */
 
-   /* XXX TODO: 11n */
-
+   ic->ic_htcaps =
+   IEEE80211_HTC_HT |
 #if 0
-   if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) {
-   /* Set supported .11b and .11g rates. */
-   ic->ic_sup_rates[IEEE80211_MODE_11B] =
-   ieee80211_std_rateset_11b;
-   ic->ic_sup_rates[IEEE80211_MODE_11G] =
-   ieee80211_std_rateset_11g;
-   }
-   if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) {
-   /* Set supported .11a rates. */
-   ic->ic_sup_rates[IEEE80211_MODE_11A] =
-   ieee80211_std_rateset_11a;
-   }
+   IEEE80211_HTC_AMPDU |
 #endif
+   IEEE80211_HTC_AMSDU |
+   IEEE80211_HTCAP_MAXAMSDU_3839 |
+   IEEE80211_HTCAP_SMPS_OFF;
 
-#if 0
-   /* Build the list of supported channels. */
-   otus_get_chanlist(sc);
-#else
otus_getradiocaps(ic, IEEE80211_CHAN_MAX, >ic_nchans,
ic->ic_channels);
-#endif
 
ieee80211_ifattach(ic);
ic->ic_raw_xmit = otus_raw_xmit;
@@ -780,38 +777,6 @@ otus_attachhook(struct otus_softc *sc)
return (0);
 }
 
-void
-otus_get_chanlist(struct otus_softc *sc)
-{
-   

Deu a louca na Americanas.com! Smartphone Samsung Galaxy A71 128GB por apenas R$ 639, 50

2020-06-03 Thread Americanas.com


___
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: r361767 - head/lib/libc/sys

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 18:59:31 2020
New Revision: 361767
URL: https://svnweb.freebsd.org/changeset/base/361767

Log:
  Document SO_NO_OFFLOADS and SO_NO_DDP.
  
  Reviewed by:  bcr, np
  MFC after:1 week
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25043

Modified:
  head/lib/libc/sys/getsockopt.2

Modified: head/lib/libc/sys/getsockopt.2
==
--- head/lib/libc/sys/getsockopt.2  Wed Jun  3 18:53:56 2020
(r361766)
+++ head/lib/libc/sys/getsockopt.2  Wed Jun  3 18:59:31 2020
(r361767)
@@ -28,7 +28,7 @@
 .\" @(#)getsockopt.2   8.4 (Berkeley) 5/2/95
 .\" $FreeBSD$
 .\"
-.Dd September 11, 2019
+.Dd June 03, 2020
 .Dt GETSOCKOPT 2
 .Os
 .Sh NAME
@@ -191,6 +191,8 @@ The following options are recognized in
 .It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket 
(uint32_t, set only)"
 .It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by 
SO_TIMESTAMP"
 .It Dv SO_MAX_PACING_RATE Ta "set the maximum transmit rate in bytes per 
second for the socket"
+.It Dv SO_NO_OFFLOAD Ta "disables protocol offloads"
+.It Dv SO_NO_DDP Ta "disables direct data placement offload"
 .El
 .Pp
 .Dv SO_DEBUG
@@ -512,7 +514,6 @@ the error status.
 It may be used to check for asynchronous errors on connected
 datagram sockets or for other asynchronous errors.
 .Pp
-Finally,
 .Dv SO_LABEL
 returns the MAC label of the socket.
 .Dv SO_PEERLABEL
@@ -521,6 +522,7 @@ Note that your kernel must be compiled with MAC suppor
 See
 .Xr mac 3
 for more information.
+.Pp
 .Dv SO_LISTENQLIMIT
 returns the maximal number of queued connections, as set by
 .Xr listen 2 .
@@ -532,6 +534,17 @@ returns the number of unaccepted incomplete connection
 .Dv SO_MAX_PACING_RATE
 instruct the socket and underlying network adapter layers to limit the
 transfer rate to the given unsigned 32-bit value in bytes per second.
+.Pp
+.Dv SO_NO_OFFLOAD
+disables support for protocol offloads.
+At present, this prevents TCP sockets from using TCP offload engines.
+.Dv SO_NO_DDP
+disables support for a specific TCP offload known as direct data
+placement (DDP).
+DDP is an offload supported by Chelsio network adapters that permits
+reassembled TCP data streams to be received via zero-copy in
+user-supplied buffers using
+.Xr aio_read 2 .
 .Sh RETURN VALUES
 .Rv -std
 .Sh ERRORS
___
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: r361764 - head/sys/modules/tcp

2020-06-03 Thread Kyle Evans
On Wed, Jun 3, 2020 at 1:42 PM John Baldwin  wrote:
>
> Author: jhb
> Date: Wed Jun  3 18:42:28 2020
> New Revision: 361764
> URL: https://svnweb.freebsd.org/changeset/base/361764
>
> Log:
>   Revise r361712 to disable tcpmd5.ko for 'options TCP_SIGNATURE'
>
> Modified:
>   head/sys/modules/tcp/Makefile
>
> Modified: head/sys/modules/tcp/Makefile
> ==
> --- head/sys/modules/tcp/Makefile   Wed Jun  3 18:29:32 2020
> (r361763)
> +++ head/sys/modules/tcp/Makefile   Wed Jun  3 18:42:28 2020
> (r361764)
> @@ -16,7 +16,7 @@ _tcp_rack=rack
>
>  .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
> defined(ALL_MODULES)
> -.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
> +.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MTCP_SIGNATURE}
>  _tcpmd5=   tcpmd5
>  .endif
>  .endif

Thanks! =-)
___
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: r361764 - head/sys/modules/tcp

2020-06-03 Thread John Baldwin
Author: jhb
Date: Wed Jun  3 18:42:28 2020
New Revision: 361764
URL: https://svnweb.freebsd.org/changeset/base/361764

Log:
  Revise r361712 to disable tcpmd5.ko for 'options TCP_SIGNATURE'

Modified:
  head/sys/modules/tcp/Makefile

Modified: head/sys/modules/tcp/Makefile
==
--- head/sys/modules/tcp/Makefile   Wed Jun  3 18:29:32 2020
(r361763)
+++ head/sys/modules/tcp/Makefile   Wed Jun  3 18:42:28 2020
(r361764)
@@ -16,7 +16,7 @@ _tcp_rack=rack
 
 .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \
defined(ALL_MODULES)
-.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
+.if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MTCP_SIGNATURE}
 _tcpmd5=   tcpmd5
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361763 - head/stand/common

2020-06-03 Thread Kyle Evans
Author: kevans
Date: Wed Jun  3 18:29:32 2020
New Revision: 361763
URL: https://svnweb.freebsd.org/changeset/base/361763

Log:
  lualoader: drop the filename and word "LUA" from errors
  
  The filename is nearly always wrong since it's /boot/lua/loader.lua, which
  is not useful for diagnostics. The actual errmsg will include a lua filename
  if this is relevant.
  
  Dropping "LUA" while we're here because that's almost universally
  irrelevant to whatever error follows, unless the error states that it's
  actually a lua problem.
  
  Both of these are minor nits that just detract from identifying the
  pertinent information.
  
  MFC after:3 days

Modified:
  head/stand/common/interp_lua.c

Modified: head/stand/common/interp_lua.c
==
--- head/stand/common/interp_lua.c  Wed Jun  3 18:09:32 2020
(r361762)
+++ head/stand/common/interp_lua.c  Wed Jun  3 18:29:32 2020
(r361763)
@@ -126,7 +126,7 @@ interp_init(void)
if (interp_include(filename) != 0) {
const char *errstr = lua_tostring(luap, -1);
errstr = errstr == NULL ? "unknown" : errstr;
-   printf("Startup error in %s:\nLUA ERROR: %s.\n", filename, 
errstr);
+   printf("ERROR: %s.\n", errstr);
lua_pop(luap, 1);
setenv("autoboot_delay", "NO", 1);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361761 - stable/12/sys/dev/bnxt

2020-06-03 Thread Kristof Provost
Author: kp
Date: Wed Jun  3 18:09:31 2020
New Revision: 361761
URL: https://svnweb.freebsd.org/changeset/base/361761

Log:
  MFC r361279:
  
  bnxt: isc_nrxd_max and isc_ntxd_max must be powers of two

Modified:
  stable/12/sys/dev/bnxt/bnxt.h
  stable/12/sys/dev/bnxt/if_bnxt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/bnxt/bnxt.h
==
--- stable/12/sys/dev/bnxt/bnxt.h   Wed Jun  3 17:47:32 2020
(r361760)
+++ stable/12/sys/dev/bnxt/bnxt.h   Wed Jun  3 18:09:31 2020
(r361761)
@@ -87,6 +87,11 @@ __FBSDID("$FreeBSD$");
 #define NETXTREME_E_VF20x16d3
 #define NETXTREME_E_VF30x16dc
 
+/* Maximum numbers of RX and TX descriptors. iflib requires this to be a power
+ * of two. The hardware has no particular limitation. */
+#define BNXT_MAX_RXD   ((INT32_MAX >> 1) + 1)
+#define BNXT_MAX_TXD   ((INT32_MAX >> 1) + 1)
+
 #define CSUM_OFFLOAD   (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
 CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
 CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)

Modified: stable/12/sys/dev/bnxt/if_bnxt.c
==
--- stable/12/sys/dev/bnxt/if_bnxt.cWed Jun  3 17:47:32 2020
(r361760)
+++ stable/12/sys/dev/bnxt/if_bnxt.cWed Jun  3 18:09:31 2020
(r361761)
@@ -315,11 +315,11 @@ static struct if_shared_ctx bnxt_sctx_init = {
.isc_nrxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 8,
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd),
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd)},
-   .isc_nrxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+   .isc_nrxd_max = {BNXT_MAX_RXD, BNXT_MAX_RXD, BNXT_MAX_RXD},
.isc_ntxd_min = {16, 16, 16},
.isc_ntxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 2,
PAGE_SIZE / sizeof(struct tx_bd_short)},
-   .isc_ntxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+   .isc_ntxd_max = {BNXT_MAX_TXD, BNXT_MAX_TXD, BNXT_MAX_TXD},
 
.isc_admin_intrcnt = 1,
.isc_vendor_info = bnxt_vendor_info_array,
___
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: r361762 - stable/11/sys/dev/bnxt

2020-06-03 Thread Kristof Provost
Author: kp
Date: Wed Jun  3 18:09:32 2020
New Revision: 361762
URL: https://svnweb.freebsd.org/changeset/base/361762

Log:
  MFC r361279:
  
  bnxt: isc_nrxd_max and isc_ntxd_max must be powers of two

Modified:
  stable/11/sys/dev/bnxt/bnxt.h
  stable/11/sys/dev/bnxt/if_bnxt.c

Modified: stable/11/sys/dev/bnxt/bnxt.h
==
--- stable/11/sys/dev/bnxt/bnxt.h   Wed Jun  3 18:09:31 2020
(r361761)
+++ stable/11/sys/dev/bnxt/bnxt.h   Wed Jun  3 18:09:32 2020
(r361762)
@@ -87,6 +87,11 @@ __FBSDID("$FreeBSD$");
 #define NETXTREME_E_VF20x16d3
 #define NETXTREME_E_VF30x16dc
 
+/* Maximum numbers of RX and TX descriptors. iflib requires this to be a power
+ * of two. The hardware has no particular limitation. */
+#define BNXT_MAX_RXD   ((INT32_MAX >> 1) + 1)
+#define BNXT_MAX_TXD   ((INT32_MAX >> 1) + 1)
+
 #define CSUM_OFFLOAD   (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \
 CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \
 CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP)

Modified: stable/11/sys/dev/bnxt/if_bnxt.c
==
--- stable/11/sys/dev/bnxt/if_bnxt.cWed Jun  3 18:09:31 2020
(r361761)
+++ stable/11/sys/dev/bnxt/if_bnxt.cWed Jun  3 18:09:32 2020
(r361762)
@@ -313,11 +313,11 @@ static struct if_shared_ctx bnxt_sctx_init = {
.isc_nrxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 8,
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd),
PAGE_SIZE / sizeof(struct rx_prod_pkt_bd)},
-   .isc_nrxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+   .isc_nrxd_max = {BNXT_MAX_RXD, BNXT_MAX_RXD, BNXT_MAX_RXD},
.isc_ntxd_min = {16, 16, 16},
.isc_ntxd_default = {PAGE_SIZE / sizeof(struct cmpl_base) * 2,
PAGE_SIZE / sizeof(struct tx_bd_short)},
-   .isc_ntxd_max = {INT32_MAX, INT32_MAX, INT32_MAX},
+   .isc_ntxd_max = {BNXT_MAX_TXD, BNXT_MAX_TXD, BNXT_MAX_TXD},
 
.isc_admin_intrcnt = 1,
.isc_vendor_info = bnxt_vendor_info_array,
___
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: r361760 - head/sys/dev/netmap

2020-06-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 17:47:32 2020
New Revision: 361760
URL: https://svnweb.freebsd.org/changeset/base/361760

Log:
  netmap: vtnet: clean up rxsync disabled logs
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/if_vtnet_netmap.h

Modified: head/sys/dev/netmap/if_vtnet_netmap.h
==
--- head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:46:21 2020
(r361759)
+++ head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:47:32 2020
(r361760)
@@ -363,8 +363,6 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
kring->nr_hwtail = nm_i;
kring->nr_kflags &= ~NKR_PENDINTR;
}
-   nm_prdis("[B] h %d c %d hwcur %d hwtail %d", ring->head, ring->cur,
-   kring->nr_hwcur, kring->nr_hwtail);
 
/*
 * Second part: skip past packets that userspace has released.
@@ -387,8 +385,8 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
virtqueue_notify(vq);
}
 
-   nm_prdis("[C] h %d c %d t %d hwcur %d hwtail %d", ring->head, ring->cur,
-   ring->tail, kring->nr_hwcur, kring->nr_hwtail);
+   nm_prdis("h %d c %d t %d hwcur %d hwtail %d", kring->rhead,
+   kring->rcur, kring->rtail, kring->nr_hwcur, kring->nr_hwtail);
 
return 0;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361759 - head/sys/dev/netmap

2020-06-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 17:46:21 2020
New Revision: 361759
URL: https://svnweb.freebsd.org/changeset/base/361759

Log:
  netmap: vtnet: fix race condition in rxsync
  
  This change prevents a race that happens when rxsync dequeues
  N-1 rx packets (with N being the size of the netmap rx ring).
  In this situation, the loop exits without re-enabling the
  rx interrupts, thus causing the VQ to stall.
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/if_vtnet_netmap.h

Modified: head/sys/dev/netmap/if_vtnet_netmap.h
==
--- head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:42:17 2020
(r361758)
+++ head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:46:21 2020
(r361759)
@@ -310,8 +310,11 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
/*
 * First part: import newly received packets.
 * Only accept our own buffers (matching the token). We should only get
-* matching buffers. We may need to stop early to avoid hwtail to 
overrun
-* hwcur.
+* matching buffers. The hwtail should never overrun hwcur, because
+* we publish only N-1 receive buffers (and non N).
+* In any case we must not leave this routine with the interrupts
+* disabled, pending packets in the VQ and hwtail == (hwcur - 1),
+* otherwise the pending packets could stall.
 */
if (netmap_no_pendintr || force_update) {
uint32_t hwtail_lim = nm_prev(kring->nr_hwcur, lim);
@@ -320,10 +323,17 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
vtnet_rxq_disable_intr(rxq);
 
nm_i = kring->nr_hwtail;
-   while (nm_i != hwtail_lim) {
+   for (;;) {
int len;
token = virtqueue_dequeue(vq, );
if (token == NULL) {
+   /*
+* Enable the interrupts again and double-check
+* for more work. We can go on until we win the
+* race condition, since we are not replenishing
+* in the meanwhile, and thus we will process at
+* most N-1 slots.
+*/
if (interrupts && vtnet_rxq_enable_intr(rxq)) {
vtnet_rxq_disable_intr(rxq);
continue;
@@ -333,6 +343,11 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
if (unlikely(token != (void *)rxq)) {
nm_prerr("BUG: RX token mismatch");
} else {
+   if (nm_i == hwtail_lim) {
+   KASSERT(false, ("hwtail would "
+   "overrun hwcur"));
+   }
+
/* Skip the virtio-net header. */
len -= sc->vtnet_hdr_size;
if (unlikely(len < 0)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361758 - in head/sys/dev: netmap virtio/network

2020-06-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jun  3 17:42:17 2020
New Revision: 361758
URL: https://svnweb.freebsd.org/changeset/base/361758

Log:
  netmap: vtnet: add vtnrx_nm_refill index to receive queues
  
  The new index tracks the next netmap slot that is going
  to be enqueued into the virtqueue. The index is necessary
  to prevent the receive VQ and the netmap rx ring from going
  out of sync, considering that we never enqueue N slots, but
  at most N-1. This change fixes a bug that causes the VQ
  and the netmap ring to go out of sync after N-1 packets
  have been received.
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/if_vtnet_netmap.h
  head/sys/dev/virtio/network/if_vtnetvar.h

Modified: head/sys/dev/netmap/if_vtnet_netmap.h
==
--- head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:26:00 2020
(r361757)
+++ head/sys/dev/netmap/if_vtnet_netmap.h   Wed Jun  3 17:42:17 2020
(r361758)
@@ -196,9 +196,11 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl
 }
 
 /*
- * Publish (up to) num netmap receive buffers to the host,
- * starting from the first one that the user made available
- * (kring->nr_hwcur).
+ * Publish 'num 'netmap receive buffers to the host, starting
+ * from the next available one (rx->vtnrx_nm_refill).
+ * Return a positive error code on error, and 0 on success.
+ * If we could not publish all of the buffers that's an error,
+ * since the netmap ring and the virtqueue would go out of sync.
  */
 static int
 vtnet_netmap_kring_refill(struct netmap_kring *kring, u_int num)
@@ -208,7 +210,7 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, 
struct netmap_ring *ring = kring->ring;
u_int ring_nr = kring->ring_id;
u_int const lim = kring->nkr_num_slots - 1;
-   u_int nm_i = kring->nr_hwcur;
+   u_int nm_i;
 
/* device-specific */
struct vtnet_softc *sc = ifp->if_softc;
@@ -219,7 +221,8 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, 
struct sglist_seg ss[2];
struct sglist sg = { ss, 0, 0, 2 };
 
-   for (; num > 0; nm_i = nm_next(nm_i, lim), num--) {
+   for (nm_i = rxq->vtnrx_nm_refill; num > 0;
+   nm_i = nm_next(nm_i, lim), num--) {
struct netmap_slot *slot = >slot[nm_i];
uint64_t paddr;
void *addr = PNMB(na, slot, );
@@ -227,7 +230,7 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, 
 
if (addr == NETMAP_BUF_BASE(na)) { /* bad buf */
if (netmap_ring_reinit(kring))
-   return -1;
+   return EFAULT;
}
 
slot->flags &= ~NS_BUF_CHANGED;
@@ -240,14 +243,14 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, 
err = virtqueue_enqueue(vq, /*cookie=*/rxq, ,
/*readable=*/0, /*writeable=*/sg.sg_nseg);
if (unlikely(err)) {
-   if (err != ENOSPC)
-   nm_prerr("virtqueue_enqueue(%s) failed: %d",
-   kring->name, err);
+   nm_prerr("virtqueue_enqueue(%s) failed: %d",
+   kring->name, err);
break;
}
}
+   rxq->vtnrx_nm_refill = nm_i;
 
-   return nm_i;
+   return num == 0 ? 0 : ENOSPC;
 }
 
 /*
@@ -274,11 +277,14 @@ vtnet_netmap_rxq_populate(struct vtnet_rxq *rxq)
/* Expose all the RX netmap buffers we can. In case of no indirect
 * buffers, the number of netmap slots in the RX ring matches the
 * maximum number of 2-elements sglist that the RX virtqueue can
-* accommodate (minus 1 to avoid netmap ring wraparound). */
+* accommodate. We need to start from kring->nr_hwcur, which is 0
+* on netmap register and may be different from 0 if a virtio
+* re-init happens while the device is in use by netmap. */
+   rxq->vtnrx_nm_refill = kring->nr_hwcur;
error = vtnet_netmap_kring_refill(kring, na->num_rx_desc - 1);
virtqueue_notify(rxq->vtnrx_vq);
 
-   return error < 0 ? ENXIO : 0;
+   return error;
 }
 
 /* Reconcile kernel and user view of the receive ring. */
@@ -350,15 +356,19 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl
 */
nm_i = kring->nr_hwcur; /* netmap ring index */
if (nm_i != head) {
-   int howmany = head - nm_i;
-   int nm_j;
+   int released;
+   int error;
 
-   if (howmany < 0)
-   howmany += kring->nkr_num_slots;
-   nm_j = vtnet_netmap_kring_refill(kring, howmany);
-   if (nm_j < 0)
-   return nm_j;
-   kring->nr_hwcur = nm_j;
+   released = head - nm_i;
+   if (released < 0)
+  

svn commit: r361757 - head/sys/netinet6

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 17:26:00 2020
New Revision: 361757
URL: https://svnweb.freebsd.org/changeset/base/361757

Log:
  Fix typo in previous commit
  
  Applied the wrong patch
  
  Reported by:  Michael Butler 
  Approved by:  mav (mentor)
  Sponsored by: iXsystems.com

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==
--- head/sys/netinet6/scope6.c  Wed Jun  3 16:57:30 2020(r361756)
+++ head/sys/netinet6/scope6.c  Wed Jun  3 17:26:00 2020(r361757)
@@ -422,7 +422,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
struct epoch_tracker et;
 
NET_EPOCH_ENTER(et);
-   if (ifp->if_afinfo[AF_INET6] == NULL) {
+   if (ifp->if_afdata[AF_INET6] == NULL) {
NET_EPOCH_EXIT(et);
return (ENETDOWN);
}
___
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: r361756 - head/sys/netinet6

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 16:57:30 2020
New Revision: 361756
URL: https://svnweb.freebsd.org/changeset/base/361756

Log:
  scope6: Check for NULL afdata before dereferencing
  
  Narrows the race window with if_detach.
  
  Approved by:  mav (mentor)
  MFC after:3 days
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25017

Modified:
  head/sys/netinet6/scope6.c

Modified: head/sys/netinet6/scope6.c
==
--- head/sys/netinet6/scope6.c  Wed Jun  3 16:51:30 2020(r361755)
+++ head/sys/netinet6/scope6.c  Wed Jun  3 16:57:30 2020(r361756)
@@ -422,6 +422,10 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, 
struct epoch_tracker et;
 
NET_EPOCH_ENTER(et);
+   if (ifp->if_afinfo[AF_INET6] == NULL) {
+   NET_EPOCH_EXIT(et);
+   return (ENETDOWN);
+   }
sid = SID(ifp);
zoneid = sid->s6id_list[scope];
NET_EPOCH_EXIT(et);
___
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: r361755 - in stable: 11/lib/clang/include/clang/Config 12/lib/clang/include/clang/Config

2020-06-03 Thread Dimitry Andric
Author: dim
Date: Wed Jun  3 16:51:30 2020
New Revision: 361755
URL: https://svnweb.freebsd.org/changeset/base/361755

Log:
  Disable clang's -fintegrated-cc1 stage by default
  
  In bug 246630, it was found that part of the rescue binary could be
  compiled to very slightly different (but still equivalent) machine code,
  depending on the number of simultaneous make jobs (via the -j option).
  
  This turned out to be caused by the upstream change that made clang's
  first stage compiler (i.e. the -cc1 stage) run as part of the initial
  clang process invocation, instead of forking and exec'ing a new clang
  process.
  
  We are currently investigating the root cause for the difference in
  output, but while that is ongoing, disable the integrated cc1 stage for
  now to work around it. You can always turn it on explicitly by using the
  -fintegrated-cc1 option, or turn it off with -fno-integrated-cc1.
  
  Direct commit to stable/{11,12}, so this can hopefully end up in the
  upcoming 11.4-RELEASE.
  
  Reported by:  Fabian Keil 
  PR:   246630

Modified:
  stable/11/lib/clang/include/clang/Config/config.h

Changes in other areas also in this revision:
Modified:
  stable/12/lib/clang/include/clang/Config/config.h

Modified: stable/11/lib/clang/include/clang/Config/config.h
==
--- stable/11/lib/clang/include/clang/Config/config.h   Wed Jun  3 16:38:16 
2020(r361754)
+++ stable/11/lib/clang/include/clang/Config/config.h   Wed Jun  3 16:51:30 
2020(r361755)
@@ -82,6 +82,6 @@
 /* #undef CLANG_ENABLE_STATIC_ANALYZER */
 
 /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */
-#define CLANG_SPAWN_CC1 0
+#define CLANG_SPAWN_CC1 1
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361755 - in stable: 11/lib/clang/include/clang/Config 12/lib/clang/include/clang/Config

2020-06-03 Thread Dimitry Andric
Author: dim
Date: Wed Jun  3 16:51:30 2020
New Revision: 361755
URL: https://svnweb.freebsd.org/changeset/base/361755

Log:
  Disable clang's -fintegrated-cc1 stage by default
  
  In bug 246630, it was found that part of the rescue binary could be
  compiled to very slightly different (but still equivalent) machine code,
  depending on the number of simultaneous make jobs (via the -j option).
  
  This turned out to be caused by the upstream change that made clang's
  first stage compiler (i.e. the -cc1 stage) run as part of the initial
  clang process invocation, instead of forking and exec'ing a new clang
  process.
  
  We are currently investigating the root cause for the difference in
  output, but while that is ongoing, disable the integrated cc1 stage for
  now to work around it. You can always turn it on explicitly by using the
  -fintegrated-cc1 option, or turn it off with -fno-integrated-cc1.
  
  Direct commit to stable/{11,12}, so this can hopefully end up in the
  upcoming 11.4-RELEASE.
  
  Reported by:  Fabian Keil 
  PR:   246630

Modified:
  stable/12/lib/clang/include/clang/Config/config.h

Changes in other areas also in this revision:
Modified:
  stable/11/lib/clang/include/clang/Config/config.h

Modified: stable/12/lib/clang/include/clang/Config/config.h
==
--- stable/12/lib/clang/include/clang/Config/config.h   Wed Jun  3 16:38:16 
2020(r361754)
+++ stable/12/lib/clang/include/clang/Config/config.h   Wed Jun  3 16:51:30 
2020(r361755)
@@ -82,6 +82,6 @@
 /* #undef CLANG_ENABLE_STATIC_ANALYZER */
 
 /* Spawn a new process clang.exe for the CC1 tool invocation, when necessary */
-#define CLANG_SPAWN_CC1 0
+#define CLANG_SPAWN_CC1 1
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361754 - head/stand/efi/gptboot

2020-06-03 Thread Mitchell Horne
Author: mhorne
Date: Wed Jun  3 16:38:16 2020
New Revision: 361754
URL: https://svnweb.freebsd.org/changeset/base/361754

Log:
  gptboot.efi: align secbuf to 4K
  
  The u-boot EFI implementation of the ReadBlocks and WriteBlocks methods
  requires that the provided buffer meet the IO alignment requirements of
  the underlying disk. Unlike loader.efi, gptboot.efi doesn't check this
  requirement, and therefore fails to perform a successful read. Adjust
  secbuf's alignment to 4K in hopes that we will always meet this
  requirement.
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25111

Modified:
  head/stand/efi/gptboot/proto.c

Modified: head/stand/efi/gptboot/proto.c
==
--- head/stand/efi/gptboot/proto.c  Wed Jun  3 14:54:54 2020
(r361753)
+++ head/stand/efi/gptboot/proto.c  Wed Jun  3 16:38:16 2020
(r361754)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
 #include "gpt.h"
 #include 
 static const uuid_t freebsd_ufs_uuid = GPT_ENT_TYPE_FREEBSD_UFS;
-static char secbuf[4096];
+static char secbuf[4096] __aligned(4096);
 static struct dsk dsk;
 static dev_info_t *devices = NULL;
 static dev_info_t *raw_device = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361753 - stable/12/usr.sbin/ctld

2020-06-03 Thread Mark Johnston
Author: markj
Date: Wed Jun  3 14:54:54 2020
New Revision: 361753
URL: https://svnweb.freebsd.org/changeset/base/361753

Log:
  MFC r361654:
  ctld: Fix a memory leak in uclparse_conf().
  
  PR:   246596

Modified:
  stable/12/usr.sbin/ctld/uclparse.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/ctld/uclparse.c
==
--- stable/12/usr.sbin/ctld/uclparse.c  Wed Jun  3 14:16:40 2020
(r361752)
+++ stable/12/usr.sbin/ctld/uclparse.c  Wed Jun  3 14:54:54 2020
(r361753)
@@ -914,6 +914,7 @@ int
 uclparse_conf(struct conf *newconf, const char *path)
 {
struct ucl_parser *parser;
+   ucl_object_t *top;
int error; 
 
conf = newconf;
@@ -922,10 +923,14 @@ uclparse_conf(struct conf *newconf, const char *path)
if (!ucl_parser_add_file(parser, path)) {
log_warn("unable to parse configuration file %s: %s", path,
ucl_parser_get_error(parser));
+   ucl_parser_free(parser);
return (1);
}
 
-   error = uclparse_toplevel(ucl_parser_get_object(parser));
+   top = ucl_parser_get_object(parser);
+   error = uclparse_toplevel(top);
+   ucl_object_unref(top);
+   ucl_parser_free(parser);
 
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-06-03 Thread Rodney W. Grimes
> Author: rrs
> Date: Wed Jun  3 14:16:40 2020
> New Revision: 361752
> URL: https://svnweb.freebsd.org/changeset/base/361752
> 
> Log:
>   We should never allow either the broadcast or IN_ADDR_ANY to be
>   connected to or sent to. This was fond when working with Michael
>   Tuexen and Skyzaller. Skyzaller seems to want to use either of
>   these two addresses to connect to at times. And it really is
>   an error to do so, so lets not allow that behavior.

It would be preferable if possible to use the macros from
netinet/in.h.
#define INADDR_ANY  ((in_addr_t)0x)
#define in_nullhost(x)  ((x).s_addr == INADDR_ANY)

There is an in_broadcast, but thats a function doing a
more complicated test checking for all possible local
broadcast addresses, which may be what you really want
to do here.

I am also finding it odd that we need to do this at the TCP layer,
there should already be stuff in place that prevents this from
occuring at the IP layer.  I guess this stuff is setup and ends
up in a tcb, that later fails when it goes to xmit a packet?

>   
>   Sponsored by:   Netflix Inc.
>   Differential Revision:  https://reviews.freebsd.org/D24852
> 
> Modified:
>   head/sys/netinet/tcp_usrreq.c
> 
> Modified: head/sys/netinet/tcp_usrreq.c
> ==
> --- head/sys/netinet/tcp_usrreq.c Wed Jun  3 14:07:31 2020
> (r361751)
> +++ head/sys/netinet/tcp_usrreq.c Wed Jun  3 14:16:40 2020
> (r361752)
> @@ -552,6 +552,10 @@ tcp_usr_connect(struct socket *so, struct sockaddr *na
>   if (sinp->sin_family == AF_INET
>   && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr)))
>   return (EAFNOSUPPORT);
> + if ((sinp->sin_family == AF_INET) &&
> + ((ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) ||
> +  (sinp->sin_addr.s_addr == INADDR_ANY)))
> + return(EAFNOSUPPORT);
>   if ((error = prison_remote_ip4(td->td_ucred, >sin_addr)) != 0)
>   return (error);
>  
> @@ -652,6 +656,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
>   error = EAFNOSUPPORT;
>   goto out;
>   }
> + if ((ntohl(sin.sin_addr.s_addr) == INADDR_BROADCAST) ||
> + (sin.sin_addr.s_addr == INADDR_ANY)) {
> + error = EAFNOSUPPORT;
> + goto out;
> + }
>   if ((error = prison_remote_ip4(td->td_ucred,
>   _addr)) != 0)
>   goto out;
> @@ -1019,6 +1028,13 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
>   goto out;
>   }
>   if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
> + if (m)
> + m_freem(m);
> + error = EAFNOSUPPORT;
> + goto out;
> + }
> + if ((ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) 
> ||
> + (sinp->sin_addr.s_addr == INADDR_ANY)) {
>   if (m)
>   m_freem(m);
>   error = EAFNOSUPPORT;
> 

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


svn commit: r361752 - head/sys/netinet

2020-06-03 Thread Randall Stewart
Author: rrs
Date: Wed Jun  3 14:16:40 2020
New Revision: 361752
URL: https://svnweb.freebsd.org/changeset/base/361752

Log:
  We should never allow either the broadcast or IN_ADDR_ANY to be
  connected to or sent to. This was fond when working with Michael
  Tuexen and Skyzaller. Skyzaller seems to want to use either of
  these two addresses to connect to at times. And it really is
  an error to do so, so lets not allow that behavior.
  
  Sponsored by: Netflix Inc.
  Differential Revision:https://reviews.freebsd.org/D24852

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Wed Jun  3 14:07:31 2020
(r361751)
+++ head/sys/netinet/tcp_usrreq.c   Wed Jun  3 14:16:40 2020
(r361752)
@@ -552,6 +552,10 @@ tcp_usr_connect(struct socket *so, struct sockaddr *na
if (sinp->sin_family == AF_INET
&& IN_MULTICAST(ntohl(sinp->sin_addr.s_addr)))
return (EAFNOSUPPORT);
+   if ((sinp->sin_family == AF_INET) &&
+   ((ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) ||
+(sinp->sin_addr.s_addr == INADDR_ANY)))
+   return(EAFNOSUPPORT);
if ((error = prison_remote_ip4(td->td_ucred, >sin_addr)) != 0)
return (error);
 
@@ -652,6 +656,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
error = EAFNOSUPPORT;
goto out;
}
+   if ((ntohl(sin.sin_addr.s_addr) == INADDR_BROADCAST) ||
+   (sin.sin_addr.s_addr == INADDR_ANY)) {
+   error = EAFNOSUPPORT;
+   goto out;
+   }
if ((error = prison_remote_ip4(td->td_ucred,
_addr)) != 0)
goto out;
@@ -1019,6 +1028,13 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf
goto out;
}
if (IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) {
+   if (m)
+   m_freem(m);
+   error = EAFNOSUPPORT;
+   goto out;
+   }
+   if ((ntohl(sinp->sin_addr.s_addr) == INADDR_BROADCAST) 
||
+   (sinp->sin_addr.s_addr == INADDR_ANY)) {
if (m)
m_freem(m);
error = EAFNOSUPPORT;
___
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: r361751 - in head/sys/netinet: . tcp_stacks

2020-06-03 Thread Randall Stewart
Author: rrs
Date: Wed Jun  3 14:07:31 2020
New Revision: 361751
URL: https://svnweb.freebsd.org/changeset/base/361751

Log:
  This fixes a couple of skyzaller crashes. Most
  of them have to do with TFO. Even the default stack
  had one of the issues:
  
  1) We need to make sure for rack that we don't advance
 snd_nxt beyond iss when we are not doing fast open. We
 otherwise can get a bunch of SYN's sent out incorrectly
 with the seq number advancing.
  2) When we complete the 3-way handshake we should not ever
 append to reassembly if the tlen is 0, if TFO is enabled
 prior to this fix we could still call the reasemmbly. Note
 this effects all three stacks.
  3) Rack like its cousin BBR should track if a SYN is on a
 send map entry.
  4) Both bbr and rack need to only consider len incremented on a SYN
 if the starting seq is iss, otherwise we don't increment len which
 may mean we return without adding a sendmap entry.
  
  This work was done in collaberation with Michael Tuexen, thanks for
  all the testing!
  Sponsored by: Netflix Inc
  Differential Revision:https://reviews.freebsd.org/D25000

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/tcp_rack.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Jun  3 13:51:53 2020
(r361750)
+++ head/sys/netinet/tcp_input.cWed Jun  3 14:07:31 2020
(r361751)
@@ -2989,7 +2989,7 @@ dodata:   
/* XXX */
 */
tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) &&
   IS_FASTOPEN(tp->t_flags));
-   if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
+   if ((tlen || (thflags & TH_FIN) || (tfo_syn && tlen > 0)) &&
TCPS_HAVERCVDFIN(tp->t_state) == 0) {
tcp_seq save_start = th->th_seq;
tcp_seq save_rnxt  = tp->rcv_nxt;

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Wed Jun  3 13:51:53 2020
(r361750)
+++ head/sys/netinet/tcp_stacks/bbr.c   Wed Jun  3 14:07:31 2020
(r361751)
@@ -6028,7 +6028,7 @@ bbr_log_output(struct tcp_bbr *bbr, struct tcpcb *tp, 
 * or FIN if seq_out is adding more on and a FIN is present
 * (and we are not resending).
 */
-   if (th_flags & TH_SYN)
+   if ((th_flags & TH_SYN) && (tp->iss == seq_out))
len++;
if (th_flags & TH_FIN)
len++;
@@ -8369,7 +8369,7 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, st
 */
tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) &&
   IS_FASTOPEN(tp->t_flags));
-   if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
+   if ((tlen || (thflags & TH_FIN) || (tfo_syn && tlen > 0)) &&
TCPS_HAVERCVDFIN(tp->t_state) == 0) {
tcp_seq save_start = th->th_seq;
tcp_seq save_rnxt  = tp->rcv_nxt;

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Wed Jun  3 13:51:53 2020
(r361750)
+++ head/sys/netinet/tcp_stacks/rack.c  Wed Jun  3 14:07:31 2020
(r361751)
@@ -6237,7 +6237,7 @@ rack_log_output(struct tcpcb *tp, struct tcpopt *to, i
 * or FIN if seq_out is adding more on and a FIN is present
 * (and we are not resending).
 */
-   if (th_flags & TH_SYN)
+   if ((th_flags & TH_SYN) && (seq_out == tp->iss)) 
len++;
if (th_flags & TH_FIN)
len++;
@@ -6280,6 +6280,7 @@ again:
rsm->usec_orig_send = us_cts;
if (th_flags & TH_SYN) {
/* The data space is one beyond snd_una */
+   rsm->r_flags |= RACK_HAS_SIN;
rsm->r_start = seq_out + 1;
rsm->r_end = rsm->r_start + (len - 1);
} else {
@@ -8724,7 +8725,7 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, s
 */
tfo_syn = ((tp->t_state == TCPS_SYN_RECEIVED) &&
   IS_FASTOPEN(tp->t_flags));
-   if ((tlen || (thflags & TH_FIN) || tfo_syn) &&
+   if ((tlen || (thflags & TH_FIN) || (tfo_syn && tlen > 0)) &&
TCPS_HAVERCVDFIN(tp->t_state) == 0) {
tcp_seq save_start = th->th_seq;
tcp_seq save_rnxt  = tp->rcv_nxt;
@@ -12563,8 +12564,10 @@ again:
len = 0;
}
/* Without fast-open there should never be data sent on a SYN */
-   if ((flags & TH_SYN) && 

svn commit: r361750 - head/sys/netinet

2020-06-03 Thread Michael Tuexen
Author: tuexen
Date: Wed Jun  3 13:51:53 2020
New Revision: 361750
URL: https://svnweb.freebsd.org/changeset/base/361750

Log:
  Restrict enabling TCP-FASTOPEN to end-points in CLOSED or LISTEN state
  
  Enabling TCP-FASTOPEN on an end-point which is in a state other than
  CLOSED or LISTEN, is a bug in the application. So it should not work.
  Also the TCP code does not (and needs not to) handle this.
  While there, also simplify the setting of the TF_FASTOPEN flag.
  
  This issue was found by running syzkaller.
  
  Reviewed by:  rrs
  MFC after:1 week
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D25115

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Wed Jun  3 13:02:31 2020
(r361749)
+++ head/sys/netinet/tcp_usrreq.c   Wed Jun  3 13:51:53 2020
(r361750)
@@ -2239,6 +2239,11 @@ unlock_and_done:
return (error);
 
INP_WLOCK_RECHECK(inp);
+   if ((tp->t_state != TCPS_CLOSED) &&
+   (tp->t_state != TCPS_LISTEN)) {
+   error = EINVAL;
+   goto unlock_and_done;
+   }
if (tfo_optval.enable) {
if (tp->t_state == TCPS_LISTEN) {
if (!V_tcp_fastopen_server_enable) {
@@ -2246,7 +2251,6 @@ unlock_and_done:
goto unlock_and_done;
}
 
-   tp->t_flags |= TF_FASTOPEN;
if (tp->t_tfo_pending == NULL)
tp->t_tfo_pending =

tcp_fastopen_alloc_counter();
@@ -2265,8 +2269,8 @@ unlock_and_done:
tp->t_tfo_client_cookie_len =
TCP_FASTOPEN_PSK_LEN;
}
-   tp->t_flags |= TF_FASTOPEN;
}
+   tp->t_flags |= TF_FASTOPEN;
} else
tp->t_flags &= ~TF_FASTOPEN;
goto unlock_and_done;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361749 - head/sys/net

2020-06-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jun  3 13:02:31 2020
New Revision: 361749
URL: https://svnweb.freebsd.org/changeset/base/361749

Log:
  Add if_reassing method to all tunneling interfaces.
  
  After r339550 tunneling interfaces have started handle appearing and
  disappearing of ingress IP address on the host system.
  When such interfaces are moving into VNET jail, they lose ability to
  properly handle ifaddr_event_ext event. And this leads to need to
  reconfigure tunnel to make it working again.
  
  Since moving an interface into VNET jail leads to removing of all IP
  addresses, it looks consistent, that tunnel configuration should also
  be cleared. This is what will do if_reassing method.
  
  Reported by:  John W. O'Brien 
  MFC after:1 week

Modified:
  head/sys/net/if_gif.c
  head/sys/net/if_gre.c
  head/sys/net/if_ipsec.c
  head/sys/net/if_me.c

Modified: head/sys/net/if_gif.c
==
--- head/sys/net/if_gif.c   Wed Jun  3 09:38:51 2020(r361748)
+++ head/sys/net/if_gif.c   Wed Jun  3 13:02:31 2020(r361749)
@@ -104,6 +104,9 @@ void(*ng_gif_input_orphan_p)(struct ifnet *ifp, 
struc
 void   (*ng_gif_attach_p)(struct ifnet *ifp);
 void   (*ng_gif_detach_p)(struct ifnet *ifp);
 
+#ifdef VIMAGE
+static voidgif_reassign(struct ifnet *, struct vnet *, char *);
+#endif
 static voidgif_delete_tunnel(struct gif_softc *);
 static int gif_ioctl(struct ifnet *, u_long, caddr_t);
 static int gif_transmit(struct ifnet *, struct mbuf *);
@@ -150,6 +153,9 @@ gif_clone_create(struct if_clone *ifc, int unit, caddr
GIF2IFP(sc)->if_transmit = gif_transmit;
GIF2IFP(sc)->if_qflush = gif_qflush;
GIF2IFP(sc)->if_output = gif_output;
+#ifdef VIMAGE
+   GIF2IFP(sc)->if_reassign = gif_reassign;
+#endif
GIF2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
GIF2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(GIF2IFP(sc));
@@ -159,6 +165,21 @@ gif_clone_create(struct if_clone *ifc, int unit, caddr
 
return (0);
 }
+
+#ifdef VIMAGE
+static void
+gif_reassign(struct ifnet *ifp, struct vnet *new_vnet __unused,
+char *unused __unused)
+{
+   struct gif_softc *sc;
+
+   sx_xlock(_ioctl_sx);
+   sc = ifp->if_softc;
+   if (sc != NULL)
+   gif_delete_tunnel(sc);
+   sx_xunlock(_ioctl_sx);
+}
+#endif /* VIMAGE */
 
 static void
 gif_clone_destroy(struct ifnet *ifp)

Modified: head/sys/net/if_gre.c
==
--- head/sys/net/if_gre.c   Wed Jun  3 09:38:51 2020(r361748)
+++ head/sys/net/if_gre.c   Wed Jun  3 13:02:31 2020(r361749)
@@ -107,6 +107,9 @@ static void gre_clone_destroy(struct ifnet *);
 VNET_DEFINE_STATIC(struct if_clone *, gre_cloner);
 #defineV_gre_clonerVNET(gre_cloner)
 
+#ifdef VIMAGE
+static voidgre_reassign(struct ifnet *, struct vnet *, char *);
+#endif
 static voidgre_qflush(struct ifnet *);
 static int gre_transmit(struct ifnet *, struct mbuf *);
 static int gre_ioctl(struct ifnet *, u_long, caddr_t);
@@ -183,12 +186,30 @@ gre_clone_create(struct if_clone *ifc, int unit, caddr
GRE2IFP(sc)->if_ioctl = gre_ioctl;
GRE2IFP(sc)->if_transmit = gre_transmit;
GRE2IFP(sc)->if_qflush = gre_qflush;
+#ifdef VIMAGE
+   GRE2IFP(sc)->if_reassign = gre_reassign;
+#endif
GRE2IFP(sc)->if_capabilities |= IFCAP_LINKSTATE;
GRE2IFP(sc)->if_capenable |= IFCAP_LINKSTATE;
if_attach(GRE2IFP(sc));
bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t));
return (0);
 }
+
+#ifdef VIMAGE
+static void
+gre_reassign(struct ifnet *ifp, struct vnet *new_vnet __unused,
+char *unused __unused)
+{
+   struct gre_softc *sc;
+
+   sx_xlock(_ioctl_sx);
+   sc = ifp->if_softc;
+   if (sc != NULL)
+   gre_delete_tunnel(sc);
+   sx_xunlock(_ioctl_sx);
+}
+#endif /* VIMAGE */
 
 static void
 gre_clone_destroy(struct ifnet *ifp)

Modified: head/sys/net/if_ipsec.c
==
--- head/sys/net/if_ipsec.c Wed Jun  3 09:38:51 2020(r361748)
+++ head/sys/net/if_ipsec.c Wed Jun  3 13:02:31 2020(r361749)
@@ -170,6 +170,9 @@ static int  ipsec_set_addresses(struct ifnet *, struct 
 static int ipsec_set_reqid(struct ipsec_softc *, uint32_t);
 static voidipsec_set_running(struct ipsec_softc *);
 
+#ifdef VIMAGE
+static voidipsec_reassign(struct ifnet *, struct vnet *, char *);
+#endif
 static voidipsec_srcaddr(void *, const struct sockaddr *, int);
 static int ipsec_ioctl(struct ifnet *, u_long, caddr_t);
 static int ipsec_transmit(struct ifnet *, struct mbuf *);
@@ -201,11 +204,29 @@ ipsec_clone_create(struct if_clone *ifc, int unit, cad
ifp->if_transmit  = ipsec_transmit;
ifp->if_qflush  = ipsec_qflush;

svn commit: r361748 - in head/sys: fs/tmpfs sys

2020-06-03 Thread Ryan Moeller
Author: freqlabs
Date: Wed Jun  3 09:38:51 2020
New Revision: 361748
URL: https://svnweb.freebsd.org/changeset/base/361748

Log:
  tmpfs: Preserve alignment of struct fid fields
  
  On 64-bit platforms, the two short fields in `struct tmpfs_fid` are padded to
  the 64-bit alignment of the long field.  This pushes the offsets of the
  subsequent fields by 4 bytes and makes `struct tmpfs_fid` bigger than
  `struct fid`.  `tmpfs_vptofh()` casts a `struct fid *` to `struct tmpfs_fid 
*`,
  causing 4 bytes of adjacent memory to be overwritten when the struct fields 
are
  set.  Through several layers of indirection and embedded structs, the adjacent
  memory for one particular call to `tmpfs_vptofh()` happens to be the stack
  canary for `nfsrvd_compound()`.  Half of the canary ends up being clobbered,
  going unnoticed until eventually the stack check fails when 
`nfsrvd_compound()`
  returns and a panic is triggered.
  
  Instead of duplicating fields of `struct fid` in `struct tmpfs_fid`, narrow 
the
  struct to cover only the unique fields for tmpfs and assert at compile time
  that the struct fits in the allotted space.  This way we don't have to
  replicate the offsets of `struct fid` fields, we just use them directly.
  
  Reviewed by:  kib, mav, rmacklem
  Approved by:  mav (mentor)
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D25077

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_vfsops.c
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/sys/mount.h

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Wed Jun  3 05:49:19 2020(r361747)
+++ head/sys/fs/tmpfs/tmpfs.h   Wed Jun  3 09:38:51 2020(r361748)
@@ -37,6 +37,7 @@
 #ifndef _FS_TMPFS_TMPFS_H_
 #define _FS_TMPFS_TMPFS_H_
 
+#include 
 #include 
 #include 
 
@@ -393,12 +394,12 @@ struct tmpfs_mount {
  * This structure maps a file identifier to a tmpfs node.  Used by the
  * NFS code.
  */
-struct tmpfs_fid {
-   uint16_ttf_len;
-   uint16_ttf_pad;
-   ino_t   tf_id;
-   unsigned long   tf_gen;
+struct tmpfs_fid_data {
+   ino_t   tfd_id;
+   unsigned long   tfd_gen;
 };
+_Static_assert(sizeof(struct tmpfs_fid_data) <= MAXFIDSZ,
+"(struct tmpfs_fid_data) is larger than (struct fid).fid_data");
 
 struct tmpfs_dir_cursor {
struct tmpfs_dirent *tdc_current;

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cWed Jun  3 05:49:19 2020
(r361747)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cWed Jun  3 09:38:51 2020
(r361748)
@@ -566,24 +566,29 @@ static int
 tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
 struct vnode **vpp)
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_mount *tmp;
struct tmpfs_node *node;
int error;
 
+   if (fhp->fid_len != sizeof(tfd))
+   return (EINVAL);
+
+   /*
+* Copy from fid_data onto the stack to avoid unaligned pointer use.
+* See the comment in sys/mount.h on struct fid for details.
+*/
+   memcpy(, fhp->fid_data, fhp->fid_len);
+
tmp = VFS_TO_TMPFS(mp);
 
-   tfhp = (struct tmpfs_fid *)fhp;
-   if (tfhp->tf_len != sizeof(struct tmpfs_fid))
+   if (tfd.tfd_id >= tmp->tm_nodes_max)
return (EINVAL);
 
-   if (tfhp->tf_id >= tmp->tm_nodes_max)
-   return (EINVAL);
-
TMPFS_LOCK(tmp);
LIST_FOREACH(node, >tm_nodes_used, tn_entries) {
-   if (node->tn_id == tfhp->tf_id &&
-   node->tn_gen == tfhp->tf_gen) {
+   if (node->tn_id == tfd.tfd_id &&
+   node->tn_gen == tfd.tfd_gen) {
tmpfs_ref_node(node);
break;
}

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jun  3 05:49:19 2020
(r361747)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Jun  3 09:38:51 2020
(r361748)
@@ -1435,16 +1435,28 @@ tmpfs_pathconf(struct vop_pathconf_args *v)
 
 static int
 tmpfs_vptofh(struct vop_vptofh_args *ap)
+/*
+vop_vptofh {
+   IN struct vnode *a_vp;
+   IN struct fid *a_fhp;
+};
+*/
 {
-   struct tmpfs_fid *tfhp;
+   struct tmpfs_fid_data tfd;
struct tmpfs_node *node;
+   struct fid *fhp;
 
-   tfhp = (struct tmpfs_fid *)ap->a_fhp;
node = VP_TO_TMPFS_NODE(ap->a_vp);
+   fhp = ap->a_fhp;
+   fhp->fid_len = sizeof(tfd);
 
-   tfhp->tf_len = sizeof(struct tmpfs_fid);
-   tfhp->tf_id = node->tn_id;
-   tfhp->tf_gen = node->tn_gen;
+