Re: svn commit: r363088 - head/usr.bin/xinstall/tests

2020-07-10 Thread Eugene Grosbein
11.07.2020 8:07, Eugene Grosbein wrote:

>>>  Fix the tests for install(1): add support for STRIPBIN's -o option.
>>  Is this feature now completely gone? Are binaries being stripped 
>> properly in ports, etc?

Support for STRIPBIN has not changed. Stripping of ports etc. still works as 
before, just more quick due to less I/O.

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


Re: svn commit: r363088 - head/usr.bin/xinstall/tests

2020-07-10 Thread Eugene Grosbein
11.07.2020 6:34, Enji Cooper wrote:

>> On Jul 10, 2020, at 3:59 PM, Eugene Grosbein  wrote:
>>
>> Author: eugen
>> Date: Fri Jul 10 22:59:26 2020
>> New Revision: 363088
>> URL: https://svnweb.freebsd.org/changeset/base/363088
>>
>> Log:
>>  Fix the tests for install(1): add support for STRIPBIN's -o option.
> 
>   Is this feature now completely gone? Are binaries being stripped 
> properly in ports, etc?
> Thanks,
> -Enji
> 
>>From install(1) on a host running r362553:
> 
> ENVIRONMENT
>  The install utility checks for the presence of the STRIPBIN environment
>  variable and if present, uses the assigned value as the program to run if
>  and when the -s option has been specified.

Nothing changed at all for install(1) called without -s option.

With this option supplied, install(1) uses "strip -o dst src" instead of making 
another temporary copy
and falls back to previous behaviour if strip/STRIPBIN does not support -o.

Please take a look at https://reviews.freebsd.org/D25551 for details.

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


Re: svn commit: r363088 - head/usr.bin/xinstall/tests

2020-07-10 Thread Enji Cooper


> On Jul 10, 2020, at 3:59 PM, Eugene Grosbein  wrote:
> 
> Author: eugen
> Date: Fri Jul 10 22:59:26 2020
> New Revision: 363088
> URL: https://svnweb.freebsd.org/changeset/base/363088
> 
> Log:
>  Fix the tests for install(1): add support for STRIPBIN's -o option.

Is this feature now completely gone? Are binaries being stripped 
properly in ports, etc?
Thanks,
-Enji

>From install(1) on a host running r362553:

ENVIRONMENT
 The install utility checks for the presence of the STRIPBIN environment
 variable and if present, uses the assigned value as the program to run if
 and when the -s option has been specified.


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


svn commit: r363088 - head/usr.bin/xinstall/tests

2020-07-10 Thread Eugene Grosbein
Author: eugen
Date: Fri Jul 10 22:59:26 2020
New Revision: 363088
URL: https://svnweb.freebsd.org/changeset/base/363088

Log:
  Fix the tests for install(1): add support for STRIPBIN's -o option.
  
  Reported by:  lwhsu
  MFC after:1 week

Modified:
  head/usr.bin/xinstall/tests/install_test.sh

Modified: head/usr.bin/xinstall/tests/install_test.sh
==
--- head/usr.bin/xinstall/tests/install_test.sh Fri Jul 10 21:41:09 2020
(r363087)
+++ head/usr.bin/xinstall/tests/install_test.sh Fri Jul 10 22:59:26 2020
(r363088)
@@ -186,8 +186,12 @@ overwrite_backup_safe_comparing_body() {
 setup_stripbin() {
cat <<\STRIPBIN >stripbin
 #!/bin/sh
-tr z @ <"$1" >"$1.new" && mv -- "$1.new" "$1"
+[ "$1" = "-o" ] && dst="$2" && shift 2
+[ "$1" = "--" ] && shift
+[ -z "$dst" ] && dst="$1"
 STRIPBIN
+   [ "$1" = "true" ] && cmd="cat" || cmd="tr z @"
+   echo $cmd '<"$1" >"$1.new" && mv -- "$1.new" "$dst"' >>stripbin
chmod 755 stripbin
export STRIPBIN="$PWD/stripbin"
 }
@@ -253,7 +257,7 @@ strip_changing_overwrite_eq_comparing_body() {
 
 atf_test_case strip_noop
 strip_noop_body() {
-   export STRIPBIN=true
+   setup_stripbin true
printf 'test\n123\r456\r\n789\0z' >testf
atf_check install -s testf copyf
[ ! testf -nt copyf ] || atf_fail "bad timestamp"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363087 - head/sys/compat/linux

2020-07-10 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Jul 10 21:41:09 2020
New Revision: 363087
URL: https://svnweb.freebsd.org/changeset/base/363087

Log:
  Don't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_mmap.c

Modified: head/sys/compat/linux/linux_mmap.c
==
--- head/sys/compat/linux/linux_mmap.c  Fri Jul 10 19:58:26 2020
(r363086)
+++ head/sys/compat/linux/linux_mmap.c  Fri Jul 10 21:41:09 2020
(r363087)
@@ -371,7 +371,13 @@ linux_madvise_common(struct thread *td, uintptr_t addr
/* Ignored; on FreeBSD huge pages are always on. */
return (0);
case LINUX_MADV_NOHUGEPAGE:
+#if 0
+   /*
+* Don't warn - Firefox uses it a lot, and in real Linux it's
+* an optional feature.
+*/
linux_msg(curthread, "unsupported madvise MADV_NOHUGEPAGE");
+#endif
return (EINVAL);
case LINUX_MADV_DONTDUMP:
return (kern_madvise(td, addr, len, MADV_NOCORE));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363086 - head

2020-07-10 Thread Mark Johnston
Author: markj
Date: Fri Jul 10 19:58:26 2020
New Revision: 363086
URL: https://svnweb.freebsd.org/changeset/base/363086

Log:
  Add a RELNOTES entry for r363084.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Fri Jul 10 19:58:07 2020(r363085)
+++ head/RELNOTES   Fri Jul 10 19:58:26 2020(r363086)
@@ -10,6 +10,9 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r363084:
+   nc(1) now implements SCTP mode, enabled by specifying the --sctp option.
+
 r362158, r362163:
struct export_args has changed so that the "user" specified for
the -maproot and -mapall exports(5) options may be in more than
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363085 - head/contrib/netcat

2020-07-10 Thread Mark Johnston
Author: markj
Date: Fri Jul 10 19:58:07 2020
New Revision: 363085
URL: https://svnweb.freebsd.org/changeset/base/363085

Log:
  Adjust .Dd, missed in r363084.
  
  MFC with: r363084

Modified:
  head/contrib/netcat/nc.1

Modified: head/contrib/netcat/nc.1
==
--- head/contrib/netcat/nc.1Fri Jul 10 19:54:04 2020(r363084)
+++ head/contrib/netcat/nc.1Fri Jul 10 19:58:07 2020(r363085)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 20, 2019
+.Dd July 10, 2020
 .Dt NC 1
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363084 - head/contrib/netcat

2020-07-10 Thread Mark Johnston
Author: markj
Date: Fri Jul 10 19:54:04 2020
New Revision: 363084
URL: https://svnweb.freebsd.org/changeset/base/363084

Log:
  Add a --sctp flag to nc.
  
  The change adds an SCTP mode akin to UDP mode.  This is handy for doing
  smoke testing of SCTP.
  
  Use a long option to minimize the risk of option conflicts with OpenBSD.
  For bonus points, this change unbreaks --no-tcpopt by adding a missing
  case required by getopt_long().
  
  Reviewed by:  delphij, tuexen
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25610

Modified:
  head/contrib/netcat/nc.1
  head/contrib/netcat/netcat.c

Modified: head/contrib/netcat/nc.1
==
--- head/contrib/netcat/nc.1Fri Jul 10 18:30:53 2020(r363083)
+++ head/contrib/netcat/nc.1Fri Jul 10 19:54:04 2020(r363084)
@@ -41,6 +41,7 @@
 .Op Fl I Ar length
 .Op Fl i Ar interval
 .Op Fl -no-tcpopt
+.Op Fl -sctp
 .Op Fl O Ar length
 .Op Fl P Ar proxy_username
 .Op Fl p Ar source_port
@@ -187,6 +188,8 @@ hostnames or ports.
 Disables the use of TCP options on the socket, by setting the boolean
 TCP_NOOPT
 socket option.
+.It Fl -sctp
+Use SCTP instead of the default option of TCP.
 .It Fl O Ar length
 Specifies the size of the TCP send buffer.
 .It Fl P Ar proxy_username

Modified: head/contrib/netcat/netcat.c
==
--- head/contrib/netcat/netcat.cFri Jul 10 18:30:53 2020
(r363083)
+++ head/contrib/netcat/netcat.cFri Jul 10 19:54:04 2020
(r363084)
@@ -93,6 +93,7 @@ int   FreeBSD_Mflag;  /* Measure 
using stats(3) */
 intNflag;  /* shutdown() network socket */
 intnflag;  /* Don't do name look up */
 intFreeBSD_Oflag;  /* Do not use TCP options */
+intFreeBSD_sctp;   /* Use SCTP */
 char   *Pflag; /* Proxy username */
 char   *pflag; /* Localport flag */
 intrflag;  /* Random ports flag */
@@ -160,6 +161,7 @@ main(int argc, char *argv[])
char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE];
struct option longopts[] = {
{ "no-tcpopt",  no_argument,_Oflag, 1 },
+   { "sctp",   no_argument,_sctp,  1 },
{ NULL, 0,  NULL,   0 }
};
 
@@ -324,6 +326,9 @@ main(int argc, char *argv[])
if (Tflag < 0 || Tflag > 255 || errstr || errno)
errx(1, "illegal tos value %s", optarg);
break;
+   case 0:
+   /* Long option. */
+   break;
default:
usage(1);
}
@@ -354,6 +359,12 @@ main(int argc, char *argv[])
errx(1, "cannot use -z and -l");
if (!lflag && kflag)
errx(1, "must use -l with -k");
+   if (FreeBSD_sctp) {
+   if (uflag)
+   errx(1, "cannot use -u and --sctp");
+   if (family == AF_UNIX)
+   errx(1, "cannot use -U and --sctp");
+   }
 
/* Get name of temporary socket for unix datagram client */
if ((family == AF_UNIX) && uflag && !lflag) {
@@ -373,7 +384,8 @@ main(int argc, char *argv[])
memset(, 0, sizeof(struct addrinfo));
hints.ai_family = family;
hints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
-   hints.ai_protocol = uflag ? IPPROTO_UDP : IPPROTO_TCP;
+   hints.ai_protocol = uflag ? IPPROTO_UDP :
+   FreeBSD_sctp ? IPPROTO_SCTP : IPPROTO_TCP;
if (nflag)
hints.ai_flags |= AI_NUMERICHOST;
}
@@ -382,6 +394,9 @@ main(int argc, char *argv[])
if (uflag)
errx(1, "no proxy support for UDP mode");
 
+   if (FreeBSD_sctp)
+   errx(1, "no proxy support for SCTP mode");
+
if (lflag)
errx(1, "no proxy support for listen");
 
@@ -1424,6 +1439,7 @@ help(void)
\t-NShutdown the network socket after EOF on stdin\n\
\t-nSuppress name/port resolutions\n\
\t--no-tcpopt   Disable TCP options\n\
+   \t--sctp\t  SCTP mode\n\
\t-O length TCP send buffer length\n\
\t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\
@@ -1442,7 +1458,7 @@ help(void)
\t-zZero-I/O mode [used for scanning]\n\
Port numbers can be individual or ranges: lo-hi [inclusive]\n");
 

svn commit: r363081 - head/usr.bin/xinstall

2020-07-10 Thread Eugene Grosbein
Author: eugen
Date: Fri Jul 10 17:42:22 2020
New Revision: 363081
URL: https://svnweb.freebsd.org/changeset/base/363081

Log:
  install(1): addition to r363067
  
  Also, make it not break if STRIPBIN points to strip version without -o support
  and destination does not exist before installing.
  
  Reported by:  lwhsu
  MFC after:  1 month
  X-MFC-With: 363064

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

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cFri Jul 10 16:59:06 2020
(r363080)
+++ head/usr.bin/xinstall/xinstall.cFri Jul 10 17:42:22 2020
(r363081)
@@ -1350,9 +1350,9 @@ strip(const char *to_name, const char *from_name, char
/* NOTREACHED */
}
if (status != 0) {
-   (void)unlink(to_name);
if (from_name != NULL)
return (0);
+   (void)unlink(to_name);
errx(EX_SOFTWARE, "strip command %s failed on %s",
stripbin, to_name);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r352558 - head/usr.bin/top

2020-07-10 Thread Steve Wills

On 11/28/19 4:08 PM, Mark Millard via svn-src-head wrote:

Author: daichi
Date: Fri Sep 20 17:37:23 2019
New Revision: 352558
URL:
https://svnweb.freebsd.org/changeset/base/352558


Log:
   top(1): support multibyte characters in command names (ARGV array)
   depending on locale.
   
- add setlocale()

- remove printable() function
- add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
  non-printable characters that do not use C-style backslash sequences
  in three digit octal sequence, or remove it
   
   This change allows multibyte characters to be displayed according to

   locale. If it is recognized as a non-display character according to the
   locale, it is displayed in three digit octal sequence.



Initially picking on tab characters as an example of what is
probably a somewhat broader issue . . .

Ever since this change, characters like tabs that do not fit
in the next character cell when output, but for which they
are !isprintable(...), now mess up the top display. Again
using tab as an example: line wrapping from the text having
been shifted over by more than one character cell. top does
not track the line wrapping result in how it decides what
to output for the following display updates.



Apologies for the way late reply here, but I just now bothered tracking 
this down. This commit seems to be the cause of some corruption I'm 
seeing in long running top(1) as well. As Mark mentions, if I use "hh" 
it clears up. Should I open a bugzilla bug? I can share screenshots of 
the corruption, such as:


https://i.imgur.com/Xqlwf9h.png
https://i.imgur.com/Jv0d5NU.png

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


svn commit: r363080 - head/sys/netinet

2020-07-10 Thread Michael Tuexen
Author: tuexen
Date: Fri Jul 10 16:59:06 2020
New Revision: 363080
URL: https://svnweb.freebsd.org/changeset/base/363080

Log:
  Whitespace changes due to upstreaming r363079.

Modified:
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_os_bsd.h
==
--- head/sys/netinet/sctp_os_bsd.h  Fri Jul 10 14:56:05 2020
(r363079)
+++ head/sys/netinet/sctp_os_bsd.h  Fri Jul 10 16:59:06 2020
(r363080)
@@ -479,7 +479,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed,
 
 #define SCTP_IS_LISTENING(inp) ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) 
!= 0)
 
-intsctp_syscalls_init(void);
-intsctp_syscalls_uninit(void);
+int sctp_syscalls_init(void);
+int sctp_syscalls_uninit(void);
 
 #endif

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Fri Jul 10 14:56:05 2020
(r363079)
+++ head/sys/netinet/sctp_usrreq.c  Fri Jul 10 16:59:06 2020
(r363080)
@@ -100,6 +100,7 @@ sctp_finish(void *unused __unused)
EVENTHANDLER_DEREGISTER(rt_addrmsg, SCTP_BASE_VAR(eh_tag));
sctp_pcb_finish();
 }
+
 VNET_SYSUNINIT(sctp, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, sctp_finish, NULL);
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363061 - in head/usr.sbin/wpa: hostapd wpa_supplicant

2020-07-10 Thread Cy Schubert
In message , "Bjoern A. 
Zeeb"
 writes:
> On 9 Jul 2020, at 23:01, Cy Schubert wrote:
>
> > Author: cy
> > Date: Thu Jul  9 23:01:36 2020
> > New Revision: 363061
> > URL: https://svnweb.freebsd.org/changeset/base/363061
> >
> > Log:
> >   Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
> >   hostapd and wpa_supplicant.
>
> Thank you for also doing wpa_supplicant.

I'll do the ports next. The wpa_supplicant port is done but yet to be 
committed. The hostapd port needs a good deal of work to implement options. 
(I've reinstalled the atheros nic in my sandbox again this morning.)


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

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



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


Re: svn commit: r363061 - in head/usr.sbin/wpa: hostapd wpa_supplicant

2020-07-10 Thread Bjoern A. Zeeb
On 9 Jul 2020, at 23:01, Cy Schubert wrote:

> Author: cy
> Date: Thu Jul  9 23:01:36 2020
> New Revision: 363061
> URL: https://svnweb.freebsd.org/changeset/base/363061
>
> Log:
>   Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
>   hostapd and wpa_supplicant.

Thank you for also doing wpa_supplicant.


>   Submitted by:   bz
>   MFC after:  2 weeks
>   Relnotes:   yes
>   Sponsored by:   Rubicon Communications, LLC (d/b/a "Netgate")
>
> Modified:
>   head/usr.sbin/wpa/hostapd/Makefile
>   head/usr.sbin/wpa/wpa_supplicant/Makefile
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363079 - in head: share/man/man4 sys/modules sys/modules/sctp sys/netinet

2020-07-10 Thread Mark Johnston
Author: markj
Date: Fri Jul 10 14:56:05 2020
New Revision: 363079
URL: https://svnweb.freebsd.org/changeset/base/363079

Log:
  Provide support for building SCTP as a loadable module.
  
  With this change, a kernel compiled with "options SCTP_SUPPORT" and
  without "options SCTP" supports dynamic loading of the SCTP stack.
  
  Currently sctp.ko cannot be unloaded since some prerequisite teardown
  logic is not yet implemented.  Attempts to unload the module will return
  EOPNOTSUPP.
  
  Discussed with:   tuexen
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21997

Added:
  head/sys/modules/sctp/
  head/sys/modules/sctp/Makefile   (contents, props changed)
  head/sys/netinet/sctp_module.c   (contents, props changed)
Modified:
  head/share/man/man4/sctp.4
  head/sys/modules/Makefile
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_syscalls.c
  head/sys/netinet/sctp_usrreq.c

Modified: head/share/man/man4/sctp.4
==
--- head/share/man/man4/sctp.4  Fri Jul 10 12:06:18 2020(r363078)
+++ head/share/man/man4/sctp.4  Fri Jul 10 14:56:05 2020(r363079)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 18, 2020
+.Dd July 9, 2020
 .Dt SCTP 4
 .Os
 .Sh NAME
@@ -144,8 +144,18 @@ The
 transport protocol also provides a unordered service as well.
 The unordered service allows a message to be sent and delivered
 with no regard to the ordering of any other message.
+.Pp
+The
+.Tn SCTP
+kernel implementation may either be compiled into the kernel, or loaded
+dynamically as a module.
+To support dynamic loading of the stack, the kernel must be compiled
+with
+.Cd "options SCTP_SUPPORT" .
 .Ss Extensions
-The FreeBSD implementation of
+The
+.Fx
+implementation of
 .Tn SCTP
 also supports the following extensions:
 .Bl -tag -width "sctp partial reliability"
@@ -609,3 +619,7 @@ Maximum outgoing SCTP buffer size.
 .Xr sctp_recvmsg 3 ,
 .Xr sctp_sendmsg 3 ,
 .Xr blackhole 4
+.Sh BUGS
+The
+.Nm
+kernel module cannot be unloaded.

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Fri Jul 10 12:06:18 2020(r363078)
+++ head/sys/modules/Makefile   Fri Jul 10 14:56:05 2020(r363079)
@@ -319,6 +319,7 @@ SUBDIR= \
${_safe} \
${_sbni} \
scc \
+   ${_sctp} \
sdhci \
${_sdhci_acpi} \
sdhci_pci \
@@ -429,6 +430,9 @@ _if_gre=if_gre
 _ipfw_pmod=ipfw_pmod
 .if ${KERN_OPTS:MIPSEC_SUPPORT} && !${KERN_OPTS:MIPSEC}
 _ipsec=ipsec
+.endif
+.if ${KERN_OPTS:MSCTP_SUPPORT} || ${KERN_OPTS:MSCTP}
+_sctp= sctp
 .endif
 .endif
 

Added: head/sys/modules/sctp/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/sctp/Makefile  Fri Jul 10 14:56:05 2020
(r363079)
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/netinet
+.PATH: ${SRCTOP}/sys/netinet6
+
+KMOD=  sctp
+SRCS=  sctp_asconf.c \
+   sctp_auth.c \
+   sctp_bsd_addr.c \
+   sctp_cc_functions.c \
+   sctp_crc32.c \
+   sctp_indata.c \
+   sctp_input.c \
+   sctp_kdtrace.c \
+   sctp_module.c \
+   sctp_output.c \
+   sctp_pcb.c \
+   sctp_peeloff.c \
+   sctp_ss_functions.c \
+   sctp_syscalls.c \
+   sctp_sysctl.c \
+   sctp_timer.c \
+   sctp_usrreq.c \
+   sctp6_usrreq.c \
+   sctputil.c
+
+SRCS+= device_if.h bus_if.h vnode_if.h
+SRCS+= opt_capsicum.h opt_ktrace.h opt_inet.h opt_inet6.h opt_sctp.h
+
+.include 

Added: head/sys/netinet/sctp_module.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/netinet/sctp_module.c  Fri Jul 10 14:56:05 2020
(r363079)
@@ -0,0 +1,197 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019-2020 The FreeBSD Foundation
+ *
+ * This software was developed by Mark Johnston under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * 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 

svn commit: r363078 - head/sys/compat/linuxkpi/common/include/linux

2020-07-10 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jul 10 12:06:18 2020
New Revision: 363078
URL: https://svnweb.freebsd.org/changeset/base/363078

Log:
  Implement the bitmap_subset() function in the LinuxKPI. This function
  checks if the bitmap pointed to by the first argument is a subset of
  the bitmap pointed to by the second argument. The function returns one
  on success and zero on failure.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitmap.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitmap.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Fri Jul 10 
11:27:54 2020(r363077)
+++ head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Fri Jul 10 
12:06:18 2020(r363078)
@@ -244,6 +244,28 @@ bitmap_equal(const unsigned long *pa,
return (1);
 }
 
+static inline int
+bitmap_subset(const unsigned long *pa,
+const unsigned long *pb, unsigned size)
+{
+   const unsigned end = BIT_WORD(size);
+   const unsigned tail = size & (BITS_PER_LONG - 1);
+   unsigned i;
+
+   for (i = 0; i != end; i++) {
+   if (pa[i] & ~pb[i])
+   return (0);
+   }
+
+   if (tail) {
+   const unsigned long mask = BITMAP_LAST_WORD_MASK(tail);
+
+   if (pa[end] & ~pb[end] & mask)
+   return (0);
+   }
+   return (1);
+}
+
 static inline void
 bitmap_complement(unsigned long *dst, const unsigned long *src,
 const unsigned int size)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363077 - in head/sys: compat/linuxkpi/common/include/linux sys

2020-07-10 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Jul 10 11:27:54 2020
New Revision: 363077
URL: https://svnweb.freebsd.org/changeset/base/363077

Log:
  Implement the array_size() function in the LinuxKPI. This function
  basically multiplies its two arguments and returns SIZE_MAX if the
  result overflows the size_t type.  Else the product of the two
  arguments is returned.
  
  Bump the FreeBSD_version to mitigate issues with existing
  implementation of array_size() in drm-devel-kmod.
  
  Discussed with:   manu@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/overflow.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/overflow.h
==
--- head/sys/compat/linuxkpi/common/include/linux/overflow.hFri Jul 10 
11:15:10 2020(r363076)
+++ head/sys/compat/linuxkpi/common/include/linux/overflow.hFri Jul 10 
11:27:54 2020(r363077)
@@ -31,6 +31,9 @@
 #ifndef __LINUX_OVERFLOW_H__
 #define__LINUX_OVERFLOW_H__
 
+#include 
+#include 
+
 #ifndef__has_builtin
 #define__has_builtin(x)0
 #endif
@@ -45,6 +48,16 @@
 #if __has_builtin(__builtin_mul_overflow)
 #define check_mul_overflow(a, b, c)\
__builtin_mul_overflow(a, b, c)
+
+static inline size_t
+array_size(size_t x, size_t y)
+{
+   size_t retval;
+
+   if (__builtin_mul_overflow(x, y, ))
+   retval = SIZE_MAX;
+   return (retval);
+}
 #else
 #error "Compiler does not support __builtin_mul_overflow"
 #endif

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hFri Jul 10 11:15:10 2020(r363076)
+++ head/sys/sys/param.hFri Jul 10 11:27:54 2020(r363077)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300100  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300101  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363076 - head/sys/netinet

2020-07-10 Thread Michael Tuexen
Author: tuexen
Date: Fri Jul 10 11:15:10 2020
New Revision: 363076
URL: https://svnweb.freebsd.org/changeset/base/363076

Log:
  Fix a use-after-free bug for the userland stack. The kernel
  stack is not affected.
  Thanks to Mark Wodrich from Google for finding and reporting the
  bug.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Fri Jul 10 11:01:05 2020
(r363075)
+++ head/sys/netinet/sctp_indata.c  Fri Jul 10 11:15:10 2020
(r363076)
@@ -1700,6 +1700,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc
 int *break_flag, int last_chunk, uint8_t chk_type)
 {
struct sctp_tmit_chunk *chk = NULL; /* make gcc happy */
+   struct sctp_stream_in *strm;
uint32_t tsn, fsn, gap, mid;
struct mbuf *dmbuf;
int the_len;
@@ -2327,12 +2328,13 @@ finish_express_del:
/* All can be removed */
TAILQ_FOREACH_SAFE(control, >pending_reply_queue, 
next, ncontrol) {
TAILQ_REMOVE(>pending_reply_queue, 
control, next);
+   strm = >strmin[control->sinfo_stream];
sctp_queue_data_to_stream(stcb, asoc, control, 
abort_flag, _reasm_check);
if (*abort_flag) {
return (0);
}
if (need_reasm_check) {
-   (void)sctp_deliver_reasm_check(stcb, 
asoc, >strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD);
+   (void)sctp_deliver_reasm_check(stcb, 
asoc, strm, SCTP_READ_LOCK_NOT_HELD);
need_reasm_check = 0;
}
}
@@ -2347,12 +2349,13 @@ finish_express_del:
 * control->sinfo_tsn > liste->tsn
 */
TAILQ_REMOVE(>pending_reply_queue, 
control, next);
+   strm = >strmin[control->sinfo_stream];
sctp_queue_data_to_stream(stcb, asoc, control, 
abort_flag, _reasm_check);
if (*abort_flag) {
return (0);
}
if (need_reasm_check) {
-   (void)sctp_deliver_reasm_check(stcb, 
asoc, >strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD);
+   (void)sctp_deliver_reasm_check(stcb, 
asoc, strm, SCTP_READ_LOCK_NOT_HELD);
need_reasm_check = 0;
}
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363067 - head/usr.bin/xinstall

2020-07-10 Thread Li-Wen Hsu
On Fri, Jul 10, 2020 at 8:45 AM Eugene Grosbein  wrote:
>
> Author: eugen
> Date: Fri Jul 10 00:45:34 2020
> New Revision: 363067
> URL: https://svnweb.freebsd.org/changeset/base/363067
>
> Log:
>   install(1): correction after r363064
>
>   Make it not break if STRIPBIN points to strip version without -o support.
>   In that case, perform extra copy just like before r363064.

Hi Eugene,

I'm not sure if this commit or r363064, there are 7 test cases related
to install strip are failing these two changes:

https://ci.freebsd.org/job/FreeBSD-head-amd64-test/15801/testReport/

Can you help check if the code or the test need fixing?

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


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

2020-07-10 Thread Peter Holm
On Fri, Jul 10, 2020 at 11:25:52AM +0200, Mateusz Guzik wrote:
> On 7/10/20, Mateusz Guzik  wrote:
> > On 7/10/20, Peter Holm  wrote:
> >> On Fri, Jul 10, 2020 at 06:47:58AM +, Mateusz Guzik wrote:
> >>> Author: mjg
> >>> Date: Fri Jul 10 06:47:58 2020
> >>> New Revision: 363069
> >>> URL: https://svnweb.freebsd.org/changeset/base/363069
> >>>
> >>> Log:
> >>>   vfs: depessimize getfsstat when only the count is requested
> >>>
> >>>   This avoids relocking mountlist_mtx for each entry.
> >>>
> >>> Modified:
> >>>   head/sys/kern/vfs_syscalls.c
> >>>
> >>> Modified: head/sys/kern/vfs_syscalls.c
> >>> ======
> >>> --- head/sys/kern/vfs_syscalls.c  Fri Jul 10 06:46:42 2020
> >>> (r363068)
> >>
> >> Could this one be yours?
> >>
> >> 20200710 09:46:31 all (267/723): procfs.sh
> >> panic: lock (sleep mutex) mountlist not locked @ kern/vfs_syscalls.c:561
> >> cpuid = 4
> >> time = 1594367192
> >> KDB: stack backtrace:
> >> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
> >> 0xfe00377a6910
> >> vpanic() at vpanic+0x182/frame 0xfe00377a6960
> >> panic() at panic+0x43/frame 0xfe00377a69c0
> >> witness_unlock() at witness_unlock+0x147/frame 0xfe00377a6a00
> >> __mtx_unlock_flags() at __mtx_unlock_flags+0x4d/frame 0xfe00377a6a30
> >> kern_getfsstat() at kern_getfsstat+0x40b/frame 0xfe00377a6ab0
> >> sys_getfsstat() at sys_getfsstat+0x22/frame 0xfe00377a6ad0
> >> amd64_syscall() at amd64_syscall+0x159/frame 0xfe00377a6bf0
> >> fast_syscall_common() at fast_syscall_common+0x101/frame
> >> 0xfe00377a6bf0
> >> --- syscall (557, FreeBSD ELF64, sys_getfsstat), rip = 0x80032db1a, rsp =
> >> 0x7fffd738, rbp = 0x7fffd790 ---
> >> KDB: enter: panic
> >>
> >> https://people.freebsd.org/~pho/stress/log/mjguzik030.txt
> >>
> >
> > Does this fix it for you?
> >
> > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
> > index f37a54809e24..2caf09f3412c 100644
> > --- a/sys/kern/vfs_syscalls.c
> > +++ b/sys/kern/vfs_syscalls.c
> > @@ -551,7 +551,7 @@ kern_getfsstat(struct thread *td, struct statfs
> > **buf, size_t bufsize,
> >
> > if (count == maxcount) {
> > vfs_unbusy(mp);
> > -   break;
> > +   goto out;
> > }
> >
> > mtx_lock(_mtx);
> >
> 
> Reproduced and verified the above fixes it, committed here:
> https://svnweb.freebsd.org/changeset/base/363072
> 
> -- 
> Mateusz Guzik 

Yes, thank you. This fixed the problem for me.

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


svn commit: r363073 - head/sys/arm/broadcom/bcm2835

2020-07-10 Thread Andrew Turner
Author: andrew
Date: Fri Jul 10 09:34:47 2020
New Revision: 363073
URL: https://svnweb.freebsd.org/changeset/base/363073

Log:
  Split long lines in the Raspberry Pi FB driver
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Fri Jul 10 09:24:27 2020
(r363072)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Fri Jul 10 09:34:47 2020
(r363073)
@@ -88,17 +88,20 @@ bcm_fb_init(struct bcmsc_softc *sc, struct bcm2835_fb_
if (bcm2835_mbox_fb_get_bpp(fb) != 0)
return (ENXIO);
if (fb->bpp < FB_DEPTH) {
-   device_printf(sc->dev, "changing fb bpp from %d to %d\n", 
fb->bpp, FB_DEPTH);
+   device_printf(sc->dev, "changing fb bpp from %d to %d\n",
+   fb->bpp, FB_DEPTH);
fb->bpp = FB_DEPTH;
} else
-   device_printf(sc->dev, "keeping existing fb bpp of %d\n", 
fb->bpp);
+   device_printf(sc->dev, "keeping existing fb bpp of %d\n",
+   fb->bpp);
 
fb->vxres = fb->xres;
fb->vyres = fb->yres;
fb->xoffset = fb->yoffset = 0;
 
if ((err = bcm2835_mbox_fb_init(fb)) != 0) {
-   device_printf(sc->dev, "bcm2835_mbox_fb_init failed, err=%d\n", 
err);
+   device_printf(sc->dev, "bcm2835_mbox_fb_init failed, err=%d\n",
+   err);
return (ENXIO);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-07-10 Thread Mateusz Guzik
On 7/10/20, Mateusz Guzik  wrote:
> On 7/10/20, Peter Holm  wrote:
>> On Fri, Jul 10, 2020 at 06:47:58AM +, Mateusz Guzik wrote:
>>> Author: mjg
>>> Date: Fri Jul 10 06:47:58 2020
>>> New Revision: 363069
>>> URL: https://svnweb.freebsd.org/changeset/base/363069
>>>
>>> Log:
>>>   vfs: depessimize getfsstat when only the count is requested
>>>
>>>   This avoids relocking mountlist_mtx for each entry.
>>>
>>> Modified:
>>>   head/sys/kern/vfs_syscalls.c
>>>
>>> Modified: head/sys/kern/vfs_syscalls.c
>>> ======
>>> --- head/sys/kern/vfs_syscalls.cFri Jul 10 06:46:42 2020
>>> (r363068)
>>
>> Could this one be yours?
>>
>> 20200710 09:46:31 all (267/723): procfs.sh
>> panic: lock (sleep mutex) mountlist not locked @ kern/vfs_syscalls.c:561
>> cpuid = 4
>> time = 1594367192
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
>> 0xfe00377a6910
>> vpanic() at vpanic+0x182/frame 0xfe00377a6960
>> panic() at panic+0x43/frame 0xfe00377a69c0
>> witness_unlock() at witness_unlock+0x147/frame 0xfe00377a6a00
>> __mtx_unlock_flags() at __mtx_unlock_flags+0x4d/frame 0xfe00377a6a30
>> kern_getfsstat() at kern_getfsstat+0x40b/frame 0xfe00377a6ab0
>> sys_getfsstat() at sys_getfsstat+0x22/frame 0xfe00377a6ad0
>> amd64_syscall() at amd64_syscall+0x159/frame 0xfe00377a6bf0
>> fast_syscall_common() at fast_syscall_common+0x101/frame
>> 0xfe00377a6bf0
>> --- syscall (557, FreeBSD ELF64, sys_getfsstat), rip = 0x80032db1a, rsp =
>> 0x7fffd738, rbp = 0x7fffd790 ---
>> KDB: enter: panic
>>
>> https://people.freebsd.org/~pho/stress/log/mjguzik030.txt
>>
>
> Does this fix it for you?
>
> diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
> index f37a54809e24..2caf09f3412c 100644
> --- a/sys/kern/vfs_syscalls.c
> +++ b/sys/kern/vfs_syscalls.c
> @@ -551,7 +551,7 @@ kern_getfsstat(struct thread *td, struct statfs
> **buf, size_t bufsize,
>
> if (count == maxcount) {
> vfs_unbusy(mp);
> -   break;
> +   goto out;
> }
>
> mtx_lock(_mtx);
>

Reproduced and verified the above fixes it, committed here:
https://svnweb.freebsd.org/changeset/base/363072

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


svn commit: r363072 - head/sys/kern

2020-07-10 Thread Mateusz Guzik
Author: mjg
Date: Fri Jul 10 09:24:27 2020
New Revision: 363072
URL: https://svnweb.freebsd.org/changeset/base/363072

Log:
  vfs: fix early termination of kern_getfsstat
  
  The kernel would unlock already unlocked mutex if the buffer got filled up
  before the mount list ended.
  
  Reported by:  pho
  Fixes:r363069 ("vfs: depessimize getfsstat when only the count is 
requested")

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cFri Jul 10 09:01:36 2020
(r363071)
+++ head/sys/kern/vfs_syscalls.cFri Jul 10 09:24:27 2020
(r363072)
@@ -551,7 +551,7 @@ restart:
 
if (count == maxcount) {
vfs_unbusy(mp);
-   break;
+   goto out;
}
 
mtx_lock(_mtx);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-07-10 Thread Mateusz Guzik
On 7/10/20, Peter Holm  wrote:
> On Fri, Jul 10, 2020 at 06:47:58AM +, Mateusz Guzik wrote:
>> Author: mjg
>> Date: Fri Jul 10 06:47:58 2020
>> New Revision: 363069
>> URL: https://svnweb.freebsd.org/changeset/base/363069
>>
>> Log:
>>   vfs: depessimize getfsstat when only the count is requested
>>
>>   This avoids relocking mountlist_mtx for each entry.
>>
>> Modified:
>>   head/sys/kern/vfs_syscalls.c
>>
>> Modified: head/sys/kern/vfs_syscalls.c
>> ==
>> --- head/sys/kern/vfs_syscalls.c Fri Jul 10 06:46:42 2020
>> (r363068)
>
> Could this one be yours?
>
> 20200710 09:46:31 all (267/723): procfs.sh
> panic: lock (sleep mutex) mountlist not locked @ kern/vfs_syscalls.c:561
> cpuid = 4
> time = 1594367192
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame
> 0xfe00377a6910
> vpanic() at vpanic+0x182/frame 0xfe00377a6960
> panic() at panic+0x43/frame 0xfe00377a69c0
> witness_unlock() at witness_unlock+0x147/frame 0xfe00377a6a00
> __mtx_unlock_flags() at __mtx_unlock_flags+0x4d/frame 0xfe00377a6a30
> kern_getfsstat() at kern_getfsstat+0x40b/frame 0xfe00377a6ab0
> sys_getfsstat() at sys_getfsstat+0x22/frame 0xfe00377a6ad0
> amd64_syscall() at amd64_syscall+0x159/frame 0xfe00377a6bf0
> fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe00377a6bf0
> --- syscall (557, FreeBSD ELF64, sys_getfsstat), rip = 0x80032db1a, rsp =
> 0x7fffd738, rbp = 0x7fffd790 ---
> KDB: enter: panic
>
> https://people.freebsd.org/~pho/stress/log/mjguzik030.txt
>

Does this fix it for you?

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index f37a54809e24..2caf09f3412c 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -551,7 +551,7 @@ kern_getfsstat(struct thread *td, struct statfs
**buf, size_t bufsize,

if (count == maxcount) {
vfs_unbusy(mp);
-   break;
+   goto out;
}

mtx_lock(_mtx);

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


svn commit: r363071 - head/sys/kern

2020-07-10 Thread Mateusz Guzik
Author: mjg
Date: Fri Jul 10 09:01:36 2020
New Revision: 363071
URL: https://svnweb.freebsd.org/changeset/base/363071

Log:
  vfs: fix trivial whitespace issues which don't interefere with blame
  
  .. even without the -w switch

Modified:
  head/sys/kern/vfs_acl.c
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_cluster.c
  head/sys/kern/vfs_export.c
  head/sys/kern/vfs_hash.c
  head/sys/kern/vfs_init.c
  head/sys/kern/vfs_lookup.c
  head/sys/kern/vfs_mountroot.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_acl.c
==
--- head/sys/kern/vfs_acl.c Fri Jul 10 07:26:50 2020(r363070)
+++ head/sys/kern/vfs_acl.c Fri Jul 10 09:01:36 2020(r363071)
@@ -89,7 +89,7 @@ acl_copy_oldacl_into_acl(const struct oldacl *source, 
 
if (source->acl_cnt < 0 || source->acl_cnt > OLDACL_MAX_ENTRIES)
return (EINVAL);
-   
+
bzero(dest, sizeof(*dest));
 
dest->acl_cnt = source->acl_cnt;

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Fri Jul 10 07:26:50 2020(r363070)
+++ head/sys/kern/vfs_bio.c Fri Jul 10 09:01:36 2020(r363071)
@@ -1336,7 +1336,7 @@ bufshutdown(int show_busybufs)
int subiter;
 #endif
 
-   /* 
+   /*
 * Sync filesystems for shutdown
 */
wdog_kern_pat(WD_LASTVAL);
@@ -1662,7 +1662,7 @@ buf_alloc(struct bufdomain *bd)
 
if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0)
panic("getnewbuf_empty: Locked buf %p on free queue.", bp);
-   
+
KASSERT(bp->b_vp == NULL,
("bp: %p still has vnode %p.", bp, bp->b_vp));
KASSERT((bp->b_flags & (B_DELWRI | B_NOREUSE)) == 0,
@@ -1798,7 +1798,7 @@ buf_recycle(struct bufdomain *bd, bool kva)
  * bremfree:
  *
  * Mark the buffer for removal from the appropriate free list.
- * 
+ *
  */
 void
 bremfree(struct buf *bp)
@@ -2473,7 +2473,7 @@ bdirty(struct buf *bp)
  *
  * Since the buffer is not on a queue, we do not update the numfreebuffers
  * count.
- * 
+ *
  * The buffer must be on QUEUE_NONE.
  */
 
@@ -2734,7 +2734,7 @@ brelse(struct buf *bp)
if (bp->b_vp != NULL)
brelvp(bp);
}
-   
+
/*
 * If the buffer has junk contents signal it and eventually
 * clean up B_DELWRI and diassociate the vnode so that gbincore()
@@ -3823,7 +3823,7 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int 
  *
  * getblk() also forces a bwrite() for any B_DELWRI buffer whose
  * B_CACHE bit is clear.
- * 
+ *
  * What this means, basically, is that the caller should use B_CACHE to
  * determine whether the buffer is fully valid or not and should clear
  * B_INVAL prior to issuing a read.  If the caller intends to validate
@@ -4334,7 +4334,7 @@ biowait(struct bio *bp, const char *wchan)
 void
 biofinish(struct bio *bp, struct devstat *stat, int error)
 {
-   
+
if (error) {
bp->bio_error = error;
bp->bio_flags |= BIO_ERROR;
@@ -4660,7 +4660,7 @@ vfs_busy_pages(struct buf *bp, int clear_modify)
  * b_offset itself may be offset from the beginning of the first
  * page.
  */
-void   
+void
 vfs_bio_set_valid(struct buf *bp, int base, int size)
 {
int i, n;

Modified: head/sys/kern/vfs_cluster.c
==
--- head/sys/kern/vfs_cluster.c Fri Jul 10 07:26:50 2020(r363070)
+++ head/sys/kern/vfs_cluster.c Fri Jul 10 09:01:36 2020(r363071)
@@ -173,7 +173,7 @@ cluster_read(struct vnode *vp, u_quad_t filesize, dadd
LK_EXCLUSIVE | LK_NOWAIT, NULL))) {
rbp->b_flags |= B_RAM;
BUF_UNLOCK(rbp);
-   }   
+   }
}
BO_RUNLOCK(bo);
if (i >= maxra) {

Modified: head/sys/kern/vfs_export.c
==
--- head/sys/kern/vfs_export.c  Fri Jul 10 07:26:50 2020(r363070)
+++ head/sys/kern/vfs_export.c  Fri Jul 10 09:01:36 2020(r363071)
@@ -512,7 +512,7 @@ vfs_export_lookup(struct mount *mp, struct sockaddr *n
  * Verify that a host should have access to a filesystem.
  */
 
-int 
+int
 vfs_stdcheckexp(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp,
 struct ucred **credanonp, int *numsecflavors, int *secflavors)
 {

Modified: head/sys/kern/vfs_hash.c
==
--- head/sys/kern/vfs_hash.cFri Jul 10 07:26:50 2020

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

2020-07-10 Thread Peter Holm
On Fri, Jul 10, 2020 at 06:47:58AM +, Mateusz Guzik wrote:
> Author: mjg
> Date: Fri Jul 10 06:47:58 2020
> New Revision: 363069
> URL: https://svnweb.freebsd.org/changeset/base/363069
> 
> Log:
>   vfs: depessimize getfsstat when only the count is requested
>   
>   This avoids relocking mountlist_mtx for each entry.
> 
> Modified:
>   head/sys/kern/vfs_syscalls.c
> 
> Modified: head/sys/kern/vfs_syscalls.c
> ==
> --- head/sys/kern/vfs_syscalls.c  Fri Jul 10 06:46:42 2020
> (r363068)

Could this one be yours?

20200710 09:46:31 all (267/723): procfs.sh
panic: lock (sleep mutex) mountlist not locked @ kern/vfs_syscalls.c:561
cpuid = 4
time = 1594367192
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfe00377a6910
vpanic() at vpanic+0x182/frame 0xfe00377a6960
panic() at panic+0x43/frame 0xfe00377a69c0
witness_unlock() at witness_unlock+0x147/frame 0xfe00377a6a00
__mtx_unlock_flags() at __mtx_unlock_flags+0x4d/frame 0xfe00377a6a30
kern_getfsstat() at kern_getfsstat+0x40b/frame 0xfe00377a6ab0
sys_getfsstat() at sys_getfsstat+0x22/frame 0xfe00377a6ad0
amd64_syscall() at amd64_syscall+0x159/frame 0xfe00377a6bf0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfe00377a6bf0
--- syscall (557, FreeBSD ELF64, sys_getfsstat), rip = 0x80032db1a, rsp = 
0x7fffd738, rbp = 0x7fffd790 ---
KDB: enter: panic

https://people.freebsd.org/~pho/stress/log/mjguzik030.txt

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


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

2020-07-10 Thread Mateusz Guzik
On 7/10/20, Mateusz Guzik  wrote:
> On 7/10/20, Piotr P. Stefaniak  wrote:
>>>  */
>>>-memcpy(sbp, >mnt_stat, sizeof(*sbp));
>>>+if (sbp != >mnt_stat)
>>>+memcpy(sbp, >mnt_stat, sizeof(*sbp));
>>>
>>
>> Slightly unrelated question: wouldn't it be prudent to incorporate this
>> logic into memcpy?
>>
>
> Calls like that are just abusing the routine and indicate design
> problems in the consumer.
> Adding the branch into the routine would add overhead for everyone.
>
> However, now that you mention it, it may be prudent to do something like
> this:
>
> dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry /arg1 == arg2/ {
> @[stack()] = count(); }'
>
> and run your favourite workload.
>

Oops, that should be:
dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry /arg0 == arg1/ {
@[stack()] = count(); }'

You can look for other abuse too, here are 0-sized calls:
dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry,fbt::memset:entry
/arg2 == 0/ { @[probefunc,stack()] = count(); }'

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


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

2020-07-10 Thread Mateusz Guzik
On 7/10/20, Piotr P. Stefaniak  wrote:
>>   */
>>- memcpy(sbp, >mnt_stat, sizeof(*sbp));
>>+ if (sbp != >mnt_stat)
>>+ memcpy(sbp, >mnt_stat, sizeof(*sbp));
>>
>
> Slightly unrelated question: wouldn't it be prudent to incorporate this
> logic into memcpy?
>

Calls like that are just abusing the routine and indicate design
problems in the consumer.
Adding the branch into the routine would add overhead for everyone.

However, now that you mention it, it may be prudent to do something like this:

dtrace -n 'fbt::memcpy:entry,fbt::memmove:entry /arg1 == arg2/ {
@[stack()] = count(); }'

and run your favourite workload.

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


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

2020-07-10 Thread Piotr P. Stefaniak

 */
-   memcpy(sbp, >mnt_stat, sizeof(*sbp));
+   if (sbp != >mnt_stat)
+   memcpy(sbp, >mnt_stat, sizeof(*sbp));



Slightly unrelated question: wouldn't it be prudent to incorporate this
logic into memcpy?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363070 - head/usr.sbin/bhyve

2020-07-10 Thread Peter Grehan
Author: grehan
Date: Fri Jul 10 07:26:50 2020
New Revision: 363070
URL: https://svnweb.freebsd.org/changeset/base/363070

Log:
  Advertise 64-bit physical-address capability.
  
  This fixes a coredump with NetBSD guests when XHCI is configured.
  On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing
  to the lower 32-bits of 64-bit physical address registers. The emulation
  relies on a write to the hi 32-bits to calculate a host virtual address
  for internal use, and has always supported 64-bit addressing.
  
  All other guests were seen to write to both the lo- and hi- address
  registers, regardless of the AC64 setting.
  
  Discussed with:  Leon Dang (author)
  Tested with:  Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests.
  
  MFC after:2 weeks.

Modified:
  head/usr.sbin/bhyve/pci_xhci.c

Modified: head/usr.sbin/bhyve/pci_xhci.c
==
--- head/usr.sbin/bhyve/pci_xhci.c  Fri Jul 10 06:47:58 2020
(r363069)
+++ head/usr.sbin/bhyve/pci_xhci.c  Fri Jul 10 07:26:50 2020
(r363070)
@@ -2805,7 +2805,8 @@ pci_xhci_init(struct vmctx *ctx, struct pci_devinst *p
sc->hcsparams2 = XHCI_SET_HCSP2_ERSTMAX(XHCI_ERST_MAX) |
 XHCI_SET_HCSP2_IST(0x04);
sc->hcsparams3 = 0; /* no latency */
-   sc->hccparams1 = XHCI_SET_HCCP1_NSS(1) |/* no 2nd-streams */
+   sc->hccparams1 = XHCI_SET_HCCP1_AC64(1) |   /* 64-bit addrs */
+XHCI_SET_HCCP1_NSS(1) |/* no 2nd-streams */
 XHCI_SET_HCCP1_SPC(1) |/* short packet */
 XHCI_SET_HCCP1_MAXPSA(XHCI_STREAMS_MAX);
sc->hccparams2 = XHCI_SET_HCCP2_LEC(1) |
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r363069 - head/sys/kern

2020-07-10 Thread Mateusz Guzik
Author: mjg
Date: Fri Jul 10 06:47:58 2020
New Revision: 363069
URL: https://svnweb.freebsd.org/changeset/base/363069

Log:
  vfs: depessimize getfsstat when only the count is requested
  
  This avoids relocking mountlist_mtx for each entry.

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cFri Jul 10 06:46:42 2020
(r363068)
+++ head/sys/kern/vfs_syscalls.cFri Jul 10 06:47:58 2020
(r363069)
@@ -441,7 +441,46 @@ restart:
tofree = sfsp = *buf = malloc(maxcount * sizeof(struct statfs),
M_STATFS, M_WAITOK);
}
+
count = 0;
+
+   /*
+* If there is no target buffer they only want the count.
+*
+* This could be TAILQ_FOREACH but it is open-coded to match the 
original
+* code below.
+*/
+   if (sfsp == NULL) {
+   mtx_lock(_mtx);
+   for (mp = TAILQ_FIRST(); mp != NULL; mp = nmp) {
+   if (prison_canseemount(td->td_ucred, mp) != 0) {
+   nmp = TAILQ_NEXT(mp, mnt_list);
+   continue;
+   }
+#ifdef MAC
+   if (mac_mount_check_stat(td->td_ucred, mp) != 0) {
+   nmp = TAILQ_NEXT(mp, mnt_list);
+   continue;
+   }
+#endif
+   count++;
+   nmp = TAILQ_NEXT(mp, mnt_list);
+   }
+   mtx_unlock(_mtx);
+   *countp = count;
+   return (0);
+   }
+
+   /*
+* They want the entire thing.
+*
+* Short-circuit the corner case of no room for anything, avoids
+* relocking below.
+*/
+   if (maxcount < 1) {
+   goto out;
+   }
+
mtx_lock(_mtx);
for (mp = TAILQ_FIRST(); mp != NULL; mp = nmp) {
if (prison_canseemount(td->td_ucred, mp) != 0) {
@@ -473,53 +512,55 @@ restart:
continue;
}
}
-   if (sfsp != NULL && count < maxcount) {
-   sp = >mnt_stat;
-   /*
-* If MNT_NOWAIT is specified, do not refresh
-* the fsstat cache.
-*/
-   if (mode != MNT_NOWAIT) {
-   error = VFS_STATFS(mp, sp);
-   if (error != 0) {
-   mtx_lock(_mtx);
-   nmp = TAILQ_NEXT(mp, mnt_list);
-   vfs_unbusy(mp);
-   continue;
-   }
+   sp = >mnt_stat;
+   /*
+* If MNT_NOWAIT is specified, do not refresh
+* the fsstat cache.
+*/
+   if (mode != MNT_NOWAIT) {
+   error = VFS_STATFS(mp, sp);
+   if (error != 0) {
+   mtx_lock(_mtx);
+   nmp = TAILQ_NEXT(mp, mnt_list);
+   vfs_unbusy(mp);
+   continue;
}
-   if (priv_check_cred_vfs_generation(td->td_ucred)) {
-   sptmp = malloc(sizeof(struct statfs), M_STATFS,
-   M_WAITOK);
-   *sptmp = *sp;
-   sptmp->f_fsid.val[0] = sptmp->f_fsid.val[1] = 0;
-   prison_enforce_statfs(td->td_ucred, mp, sptmp);
-   sp = sptmp;
-   } else
-   sptmp = NULL;
-   if (bufseg == UIO_SYSSPACE) {
-   bcopy(sp, sfsp, sizeof(*sp));
-   free(sptmp, M_STATFS);
-   } else /* if (bufseg == UIO_USERSPACE) */ {
-   error = copyout(sp, sfsp, sizeof(*sp));
-   free(sptmp, M_STATFS);
-   if (error != 0) {
-   vfs_unbusy(mp);
-   return (error);
-   }
+   }
+   if (priv_check_cred_vfs_generation(td->td_ucred)) {
+   sptmp = malloc(sizeof(struct statfs), M_STATFS,
+   M_WAITOK);
+   *sptmp = *sp;
+   sptmp->f_fsid.val[0] = sptmp->f_fsid.val[1] = 0;
+   prison_enforce_statfs(td->td_ucred, mp, sptmp);
+   sp = sptmp;
+   } else
+

svn commit: r363068 - head/sys/kern

2020-07-10 Thread Mateusz Guzik
Author: mjg
Date: Fri Jul 10 06:46:42 2020
New Revision: 363068
URL: https://svnweb.freebsd.org/changeset/base/363068

Log:
  vfs: avoid spurious memcpy in vfs_statfs
  
  It is quite often called for the very same buffer.

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Fri Jul 10 00:45:34 2020(r363067)
+++ head/sys/kern/vfs_mount.c   Fri Jul 10 06:46:42 2020(r363068)
@@ -2173,7 +2173,8 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp)
 * Filesystems only fill in part of the structure for updates, we
 * have to read the entirety first to get all content.
 */
-   memcpy(sbp, >mnt_stat, sizeof(*sbp));
+   if (sbp != >mnt_stat)
+   memcpy(sbp, >mnt_stat, sizeof(*sbp));
 
/*
 * Set these in case the underlying filesystem fails to do so.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"