Re: svn commit: r360648 - in head: lib/libvmmapi share/man/man5 share/mk sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/conf sys/modules/vmm tools/build/opt

2020-05-05 Thread Li-Wen Hsu
On Tue, May 5, 2020 at 8:02 AM John Baldwin  wrote:
>
> Author: jhb
> Date: Tue May  5 00:02:04 2020
> New Revision: 360648
> URL: https://svnweb.freebsd.org/changeset/base/360648
...
> Added:
>   head/sys/amd64/include/vmm_snapshot.h   (contents, props changed)
>   head/sys/amd64/vmm/vmm_snapshot.c   (contents, props changed)
>   head/tools/build/options/WITH_BHYVE_SNAPSHOT   (contents, props changed)
>   head/usr.sbin/bhyve/snapshot.c   (contents, props changed)
>   head/usr.sbin/bhyve/snapshot.h   (contents, props changed)

These added files all have "THIS SOFTWARE IS PROVIDED BY NETAPP, INC"
in copyright header, but non of the authors look like from NetApp.  Is
it intended or it's better to have "THIS SOFTWARE IS PROVIDED BY THE
AUTHOR AND CONTRIBUTORS"?

Best,
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"


svn commit: r360679 - head/contrib/binutils/gas

2020-05-05 Thread Ed Maste
Author: emaste
Date: Wed May  6 01:08:19 2020
New Revision: 360679
URL: https://svnweb.freebsd.org/changeset/base/360679

Log:
  GNU as: print a deprecation warning on program start
  
  GNU as 2.17.50 will be removed before FreeBSD 13.

Modified:
  head/contrib/binutils/gas/as.c

Modified: head/contrib/binutils/gas/as.c
==
--- head/contrib/binutils/gas/as.c  Wed May  6 00:44:03 2020
(r360678)
+++ head/contrib/binutils/gas/as.c  Wed May  6 01:08:19 2020
(r360679)
@@ -1089,6 +1089,7 @@ main (int argc, char ** argv)
   expandargv (, );
 
   START_PROGRESS (myname, 0);
+  fprintf (stderr, _("warning: as 2.17.50 is deprecated in FreeBSD and will be 
removed\n"));
 
 #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
 #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
___
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: r360678 - head/sys/fs/nfs

2020-05-05 Thread Rick Macklem
Author: rmacklem
Date: Wed May  6 00:44:03 2020
New Revision: 360678
URL: https://svnweb.freebsd.org/changeset/base/360678

Log:
  Delete unused function newnfs_trimleading.
  
  The NFS function called newnfs_trimleading() has not been used by the
  code in long time. To give you a clue, it still had a K style function
  declaration.
  Delete it, since it is just cruft, as a part of the NFS mbuf handling
  cleanup in preparation for adding ext_pgs mbuf support.
  The ext_pgs mbuf support for the build/send side is needed by
  nfs-over-tls.

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfs_var.h

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cWed May  6 00:25:43 2020
(r360677)
+++ head/sys/fs/nfs/nfs_commonsubs.cWed May  6 00:44:03 2020
(r360678)
@@ -1006,53 +1006,6 @@ nfsaddr2_match(NFSSOCKADDR_T nam1, NFSSOCKADDR_T nam2)
return (0);
 }
 
-
-/*
- * Trim the stuff already dissected off the mbuf list.
- */
-APPLESTATIC void
-newnfs_trimleading(nd)
-   struct nfsrv_descript *nd;
-{
-   struct mbuf *m, *n;
-   int offs;
-
-   /*
-* First, free up leading mbufs.
-*/
-   if (nd->nd_mrep != nd->nd_md) {
-   m = nd->nd_mrep;
-   while (m->m_next != nd->nd_md) {
-   if (m->m_next == NULL)
-   panic("nfsm trim leading");
-   m = m->m_next;
-   }
-   m->m_next = NULL;
-   m_freem(nd->nd_mrep);
-   }
-   m = nd->nd_md;
-
-   /*
-* Now, adjust this mbuf, based on nd_dpos.
-*/
-   offs = nd->nd_dpos - mtod(m, caddr_t);
-   if (offs == m->m_len) {
-   n = m;
-   m = m->m_next;
-   if (m == NULL)
-   panic("nfsm trim leading2");
-   n->m_next = NULL;
-   m_freem(n);
-   } else if (offs > 0) {
-   m->m_len -= offs;
-   m->m_data += offs;
-   } else if (offs < 0)
-   panic("nfsm trimleading offs");
-   nd->nd_mrep = m;
-   nd->nd_md = m;
-   nd->nd_dpos = mtod(m, caddr_t);
-}
-
 /*
  * Trim trailing data off the mbuf list being built.
  */

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Wed May  6 00:25:43 2020(r360677)
+++ head/sys/fs/nfs/nfs_var.h   Wed May  6 00:44:03 2020(r360678)
@@ -324,7 +324,6 @@ int nfsm_mbufuio(struct nfsrv_descript *, struct uio *
 int nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int);
 int nfsm_advance(struct nfsrv_descript *, int, int);
 void *nfsm_dissct(struct nfsrv_descript *, int, int);
-void newnfs_trimleading(struct nfsrv_descript *);
 void newnfs_trimtrailing(struct nfsrv_descript *, struct mbuf *,
 caddr_t);
 void newnfs_copycred(struct nfscred *, struct ucred *);
___
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: r360676 - head/usr.bin/elfctl

2020-05-05 Thread Ed Maste
Author: emaste
Date: Tue May  5 21:50:52 2020
New Revision: 360676
URL: https://svnweb.freebsd.org/changeset/base/360676

Log:
  elfctl: update earliest FreeBSD revision to 12.2
  
  elfctl has been merged to stable/12, and so will appear in FreeBSD 12.2
  
  Reported by:  Dewayne Geraghty
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/usr.bin/elfctl/elfctl.1
==
--- head/usr.bin/elfctl/elfctl.1Tue May  5 21:01:43 2020
(r360675)
+++ head/usr.bin/elfctl/elfctl.1Tue May  5 21:50:52 2020
(r360676)
@@ -85,7 +85,7 @@ elfctl -e +aslr file
 .Sh HISTORY
 .Nm
 first appeared in
-.Fx 13.0 .
+.Fx 12.2 .
 .Sh AUTHORS
 .Nm
 was written by
___
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: r360671 - head/sys/netinet

2020-05-05 Thread Michael Tuexen
Author: tuexen
Date: Tue May  5 19:54:30 2020
New Revision: 360671
URL: https://svnweb.freebsd.org/changeset/base/360671

Log:
  Avoid underflowing a variable, which would result in taking more
  data from the stream queues then needed.
  
  Thanks to Timo Voelker for finding this bug and providing a fix.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue May  5 19:31:47 2020
(r360670)
+++ head/sys/netinet/sctp_output.c  Tue May  5 19:54:30 2020
(r360671)
@@ -7763,7 +7763,11 @@ sctp_fill_outqueue(struct sctp_tcb *stcb,
}
strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, 
asoc);
total_moved += moved;
-   space_left -= moved;
+   if (space_left >= moved) {
+   space_left -= moved;
+   } else {
+   space_left = 0;
+   }
if (space_left >= SCTP_DATA_CHUNK_OVERHEAD(stcb)) {
space_left -= SCTP_DATA_CHUNK_OVERHEAD(stcb);
} else {
___
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: r360670 - in head/lib: libc/sys libthr

2020-05-05 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Tue May  5 19:31:47 2020
New Revision: 360670
URL: https://svnweb.freebsd.org/changeset/base/360670

Log:
  Add HISTORY sections to document when this
  functionality first appeared in FreeBSD.
  
  Submitted by: Gordon Bergling gbergling_gmail.com
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D24677

Modified:
  head/lib/libc/sys/thr_exit.2
  head/lib/libc/sys/thr_kill.2
  head/lib/libc/sys/thr_new.2
  head/lib/libc/sys/thr_self.2
  head/lib/libc/sys/thr_set_name.2
  head/lib/libc/sys/thr_suspend.2
  head/lib/libc/sys/thr_wake.2
  head/lib/libthr/libthr.3

Modified: head/lib/libc/sys/thr_exit.2
==
--- head/lib/libc/sys/thr_exit.2Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_exit.2Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2016
+.Dd May 5, 2020
 .Dt THR_EXIT 2
 .Os
 .Sh NAME
@@ -88,3 +88,8 @@ to implement
 .St -p1003.1-2001
 .Xr pthread 3
 functionality.
+.Sh HISTORY
+The
+.Fn thr_exit
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_kill.2
==
--- head/lib/libc/sys/thr_kill.2Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_kill.2Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2016
+.Dd May 5, 2020
 .Dt THR_kill 2
 .Os
 .Sh NAME
@@ -131,3 +131,10 @@ to implement
 .St -p1003.1-2001
 .Xr pthread 3
 functionality.
+.Sh HISTORY
+The
+.Fn thr_kill
+and
+.Fn thr_kill2
+system calls first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_new.2
==
--- head/lib/libc/sys/thr_new.2 Tue May  5 19:00:26 2020(r360669)
+++ head/lib/libc/sys/thr_new.2 Tue May  5 19:31:47 2020(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 2, 2016
+.Dd May 5, 2020
 .Dt THR_NEW 2
 .Os
 .Sh NAME
@@ -243,3 +243,8 @@ to implement
 .St -p1003.1-2001
 .Xr pthread 3
 functionality.
+.Sh HISTORY
+The
+.Fn thr_new
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_self.2
==
--- head/lib/libc/sys/thr_self.2Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_self.2Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 3, 2020
+.Dd May 5, 2020
 .Dt THR_SELF 2
 .Os
 .Sh NAME
@@ -88,3 +88,8 @@ to implement
 .St -p1003.1-2001
 .Xr pthread 3
 functionality.
+.Sh HISTORY
+The
+.Fn thr_self
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_set_name.2
==
--- head/lib/libc/sys/thr_set_name.2Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_set_name.2Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 2, 2016
+.Dd May 5, 2020
 .Dt THR_SET_NAME 2
 .Os
 .Sh NAME
@@ -92,3 +92,8 @@ The
 .Fn thr_set_name
 system call is non-standard and is used by the
 .Lb libthr .
+.Sh HISTORY
+The
+.Fn thr_set_name
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_suspend.2
==
--- head/lib/libc/sys/thr_suspend.2 Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_suspend.2 Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 23, 2016
+.Dd May 5, 2020
 .Dt THR_SUSPEND 2
 .Os
 .Sh NAME
@@ -128,3 +128,8 @@ The sleep was interrupted by a signal.
 The
 .Fn thr_suspend
 system call is non-standard.
+.Sh HISTORY
+The
+.Fn thr_suspend
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libc/sys/thr_wake.2
==
--- head/lib/libc/sys/thr_wake.2Tue May  5 19:00:26 2020
(r360669)
+++ head/lib/libc/sys/thr_wake.2Tue May  5 19:31:47 2020
(r360670)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 23, 2016
+.Dd May 5, 2020
 .Dt THR_WAKE 2
 .Os
 .Sh NAME
@@ -110,3 +110,8 @@ to implement
 .St -p1003.1-2001
 .Xr pthread 3
 functionality.
+.Sh HISTORY
+The
+.Fn thr_suspend
+system call first appeared in
+.Fx 5.2 .

Modified: head/lib/libthr/libthr.3
==
--- head/lib/libthr/libthr.3Tue May  5 19:00:26 2020(r360669)
+++ head/lib/libthr/libthr.3Tue May  5 19:31:47 2020(r360670)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 17, 2016
+.Dd May 5, 2020
 .Dt LIBTHR 3
 .Os
 .Sh NAME
@@ -279,6 +279,11 @@ logs.
 .Xr pthread_create 3 ,
 .Xr 

svn commit: r360669 - head/share/man/man4

2020-05-05 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Tue May  5 19:00:26 2020
New Revision: 360669
URL: https://svnweb.freebsd.org/changeset/base/360669

Log:
  Fix broken links in the man page by pointing to a
  source that works or is the new location on the
  same page.
  
  Submitted by: alfix86_gmail.com
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D23769

Modified:
  head/share/man/man4/pcm.4

Modified: head/share/man/man4/pcm.4
==
--- head/share/man/man4/pcm.4   Tue May  5 18:49:04 2020(r360668)
+++ head/share/man/man4/pcm.4   Tue May  5 19:00:26 2020(r360669)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 22, 2012
+.Dd May 5, 2020
 .Dt SOUND 4
 .Os
 .Sh NAME
@@ -743,8 +743,8 @@ A device node is not created properly.
 .Xr mixer 8 ,
 .Xr sysctl 8
 .Rs
-.%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert 
Bristow-Johnson"
-.%U "http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt;
+.%T "Cookbook formulae for audio EQ biquad filter coefficients 
(Audio-EQ-Cookbook.txt), by Robert Bristow-Johnson"
+.%U "https://www.musicdsp.org/en/latest/Filters/197-rbj-audio-eq-cookbook.html;
 .Re
 .Rs
 .%T "Julius O'Smith's Digital Audio Resampling"
@@ -752,7 +752,7 @@ A device node is not created properly.
 .Re
 .Rs
 .%T "Polynomial Interpolators for High-Quality Resampling of Oversampled 
Audio, by Olli Niemitalo"
-.%U "http://www.student.oulu.fi/~oniemita/dsp/deip.pdf;
+.%U "http://yehar.com/blog/wp-content/uploads/2009/08/deip.pdf;
 .Re
 .Rs
 .%T "The OSS API"
___
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: r360665 - head/bin/ls

2020-05-05 Thread Conrad Meyer
Author: cem
Date: Tue May  5 18:06:32 2020
New Revision: 360665
URL: https://svnweb.freebsd.org/changeset/base/360665

Log:
  ls(1): Fix trivial SEGV due to NULL deref in OOM path
  
  Reported by:  Anton Rang 
  Sponsored by: Dell EMC Isilon

Modified:
  head/bin/ls/ls.c

Modified: head/bin/ls/ls.c
==
--- head/bin/ls/ls.cTue May  5 17:57:04 2020(r360664)
+++ head/bin/ls/ls.cTue May  5 18:06:32 2020(r360665)
@@ -838,7 +838,21 @@ display(const FTSENT *p, FTSENT *list, int options)
group = ngroup;
} else {
user = user_from_uid(sp->st_uid, 0);
+   /*
+* user_from_uid(..., 0) only returns
+* NULL in OOM conditions.  We could
+* format the uid here, but (1) in
+* general ls(1) exits on OOM, and (2)
+* there is another allocation/exit
+* path directly below, which will
+* likely exit anyway.
+*/
+   if (user == NULL)
+   err(1, "user_from_uid");
group = group_from_gid(sp->st_gid, 0);
+   /* Ditto. */
+   if (group == NULL)
+   err(1, "group_from_gid");
}
if ((ulen = strlen(user)) > maxuser)
maxuser = ulen;
___
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: r360664 - head/lib/libc/string

2020-05-05 Thread Conrad Meyer
Author: cem
Date: Tue May  5 17:57:04 2020
New Revision: 360664
URL: https://svnweb.freebsd.org/changeset/base/360664

Log:
  strdup.3: Slightly canonicalize OOM return/error status
  
  Attempted to clean up the language around "this is a malloc'd object."  May be
  passed as a parameter to free(3) is a bit obtuse.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/string/strdup.3

Modified: head/lib/libc/string/strdup.3
==
--- head/lib/libc/string/strdup.3   Tue May  5 17:55:45 2020
(r360663)
+++ head/lib/libc/string/strdup.3   Tue May  5 17:57:04 2020
(r360664)
@@ -28,7 +28,7 @@
 .\" @(#)strdup.3   8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd June 6, 2018
+.Dd May 5, 2020
 .Dt STRDUP 3
 .Os
 .Sh NAME
@@ -51,15 +51,12 @@ allocates sufficient memory for a copy
 of the string
 .Fa str ,
 does the copy, and returns a pointer to it.
-The pointer may subsequently be used as an
-argument to the function
-.Xr free 3 .
+The memory is allocated with
+.Xr malloc 3
+and should be released with
+.Xr free 3
+when no longer needed.
 .Pp
-If insufficient memory is available, NULL is returned and
-.Va errno
-is set to
-.Er ENOMEM .
-.Pp
 The
 .Fn strndup
 function copies at most
@@ -69,6 +66,14 @@ characters from the string
 always
 .Dv NUL
 terminating the copied string.
+.Sh RETURN VALUES
+If insufficient memory is available, NULL is returned and
+.Va errno
+is set to
+.Er ENOMEM .
+Otherwise, the
+.Fn strdup
+family of functions return a pointer to the copied string.
 .Sh SEE ALSO
 .Xr free 3 ,
 .Xr malloc 3 ,
___
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: r360663 - head/contrib/libc-pwcache

2020-05-05 Thread Conrad Meyer
Author: cem
Date: Tue May  5 17:55:45 2020
New Revision: 360663
URL: https://svnweb.freebsd.org/changeset/base/360663

Log:
  pwcache.3: Explicitly document OOM condition
  
  The pwcache functions allocate memory, and may return NULL pointers if that
  allocation fails and the corresponding uid or gid was not found in the local
  password database.  Document this behavior.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/libc-pwcache/pwcache.3

Modified: head/contrib/libc-pwcache/pwcache.3
==
--- head/contrib/libc-pwcache/pwcache.3 Tue May  5 17:52:44 2020
(r360662)
+++ head/contrib/libc-pwcache/pwcache.3 Tue May  5 17:55:45 2020
(r360663)
@@ -56,7 +56,7 @@
 .\"
 .\" @(#)pwcache.3  8.1 (Berkeley) 6/9/93
 .\"
-.Dd October 19, 2012
+.Dd May 5, 2020
 .Dt PWCACHE 3
 .Os
 .Sh NAME
@@ -193,6 +193,15 @@ and
 may be
 .Dv NULL
 pointers.
+.Sh ERRORS
+If insufficient memory is available,
+.Fn user_from_uid
+and
+.Fn group_from_gid
+may return NULL pointers.
+.Va errno
+is set to
+.Er ENOMEM .
 .Sh SEE ALSO
 .Xr getgrgid 3 ,
 .Xr getgrnam 3 ,
___
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: r360662 - head/sys/netinet

2020-05-05 Thread Michael Tuexen
Author: tuexen
Date: Tue May  5 17:52:44 2020
New Revision: 360662
URL: https://svnweb.freebsd.org/changeset/base/360662

Log:
  Fix the computation of the numbers of entries of the mapping array to
  look at when generating a SACK. This was wrong in case of sequence
  numbers wrap arounds.
  
  Thanks to Gwenael FOURRE for reporting the issue for the userland stack:
  https://github.com/sctplab/usrsctp/issues/462
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue May  5 17:50:27 2020
(r360661)
+++ head/sys/netinet/sctp_output.c  Tue May  5 17:52:44 2020
(r360662)
@@ -10713,7 +10713,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked
if (highest_tsn > asoc->mapping_array_base_tsn) {
siz = (((highest_tsn - asoc->mapping_array_base_tsn) + 
1) + 7) / 8;
} else {
-   siz = (((MAX_TSN - highest_tsn) + 1) + highest_tsn + 7) 
/ 8;
+   siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + 
highest_tsn + 7) / 8;
}
} else {
sack = NULL;
___
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: r360648 - in head: lib/libvmmapi share/man/man5 share/mk sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/conf sys/modules/vmm tools/build/opt

2020-05-05 Thread John Baldwin
On 5/4/20 5:02 PM, John Baldwin wrote:
> Author: jhb
> Date: Tue May  5 00:02:04 2020
> New Revision: 360648
> URL: https://svnweb.freebsd.org/changeset/base/360648
> 
> Log:
>   Initial support for bhyve save and restore.

This represents a lot of work by the folks at UPB.  I merely fixed a few
nits.  This does need further maturing, but it is easier to do that in
the tree at this point than to keep maintaining this patchset out-of-tree.

You can find instructions on using this and testing it here:

https://github.com/FreeBSD-UPB/freebsd/wiki/Save-and-Restore-a-virtual-machine-using-bhyve

Though you will want to build world with WITH_BHYVE_SNAPSHOT=yes and
add 'options BHYVE_SNAPSHOT' to your kernel config.

My own todo list of small cleanups is below, but a bigger issue is defining
a more flexible file format for snapshots that encodes the machine
configuration and is not as tied to internal ABIs of device models.  That
is quite a lift, but one that can be done somewhat incrementally I think.

My next set of cleanups:

- Remove int arg from VM_RESTORE_TIME ioctl
- Remove 'ctx' from vm_snapshot ioctl structure
- Add /var/run/bhyve to mtree, remove makedirs, remove checkpoint
  subdir
- block_if.c
  - Change blockif_flush_bc to return ioctl / fsync return value
  - Axe bc_paused_cond and just use bc_cond
  - Use pointer arith for idx in block_if.c
- snapshot.c
  - rewrite strcat_extension to use asprintf
  - review other bits of this file
- remove lseek from vm_mem_read_file?
- remove  from vmm_snapshot.h?
- fix to work with capsicum

-- 
John Baldwin
___
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: r360648 - in head: lib/libvmmapi share/man/man5 share/mk sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/conf sys/modules/vmm tools/build/

2020-05-05 Thread Cy Schubert
In message <202005050002.04502576094...@repo.freebsd.org>, John Baldwin 
writes:
> Author: jhb
> Date: Tue May  5 00:02:04 2020
> New Revision: 360648
> URL: https://svnweb.freebsd.org/changeset/base/360648
>
> Log:
>   Initial support for bhyve save and restore.
>   
>   Save and restore (also known as suspend and resume) permits a snapshot
>   to be taken of a guest's state that can later be resumed.  In the
>   current implementation, bhyve(8) creates a UNIX domain socket that is
>   used by bhyvectl(8) to send a request to save a snapshot (and
>   optionally exit after the snapshot has been taken).  A snapshot
>   currently consists of two files: the first holds a copy of guest RAM,
>   and the second file holds other guest state such as vCPU register
>   values and device model state.
>   
>   To resume a guest, bhyve(8) must be started with a matching pair of
>   command line arguments to instantiate the same set of device models as
>   well as a pointer to the saved snapshot.
>   
>   While the current implementation is useful for several uses cases, it
>   has a few limitations.  The file format for saving the guest state is
>   tied to the ABI of internal bhyve structures and is not
>   self-describing (in that it does not communicate the set of device
>   models present in the system).  In addition, the state saved for some
>   device models closely matches the internal data structures which might
>   prove a challenge for compatibility of snapshot files across a range
>   of bhyve versions.  The file format also does not currently support
>   versioning of individual chunks of state.  As a result, the current
>   file format is not a fixed binary format and future revisions to save
>   and restore will break binary compatiblity of snapshot files.  The
>   goal is to move to a more flexible format that adds versioning,
>   etc. and at that point to commit to providing a reasonable level of
>   compatibility.  As a result, the current implementation is not enabled
>   by default.  It can be enabled via the WITH_BHYVE_SNAPSHOT=yes option
>   for userland builds, and the kernel option BHYVE_SHAPSHOT.
>   
>   Submitted by:   Mihai Tiganus, Flavius Anton, Darius Mihai
>   Submitted by:   Elena Mihailescu, Mihai Carabas, Sergiu Weisz
>   Relnotes:   yes
>   Sponsored by:   University Politehnica of Bucharest
>   Sponsored by:   Matthew Grooms (student scholarships)
>   Sponsored by:   iXsystems
>   Differential Revision:  https://reviews.freebsd.org/D19495

Could also be the basis of a vmotion-like function. And possibly a 
hot-failover facility like VMware has.

Vmotion and hot-failover require shared disk but we could use ZFS snapshots 
instead.


-- 
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"


svn commit: r360657 - head/sys/dev/acpica

2020-05-05 Thread Andriy Gapon
Author: avg
Date: Tue May  5 12:14:11 2020
New Revision: 360657
URL: https://svnweb.freebsd.org/changeset/base/360657

Log:
  acpi_video: try our best to work on systems without non-essential methods
  
  Only _BCL and _BCM methods seem to be essential to the driver's
  operation.  If _BQC is missing then we can assume that the current
  brightness is whatever we set by the last _BCM invocation.  If _DCS or
  _DGS is missing the we can make assumptions as well.
  
  The change is based on a patch suggested by Anthony Jenkins
   in PR 207086.
  
  PR:   207086
  Submitted by: Anthony Jenkins https://reviews.freebsd.org/D24653

Modified:
  head/sys/dev/acpica/acpi_video.c

Modified: head/sys/dev/acpica/acpi_video.c
==
--- head/sys/dev/acpica/acpi_video.cTue May  5 11:14:28 2020
(r360656)
+++ head/sys/dev/acpica/acpi_video.cTue May  5 12:14:11 2020
(r360657)
@@ -52,6 +52,8 @@ struct acpi_video_output {
int num;
STAILQ_ENTRY(acpi_video_output) next;
} vo_unit;
+   int vo_hasbqc;  /* Query method is present. */
+   int vo_level;   /* Cached level when !vo_hasbqc. */
int vo_brightness;
int vo_fullpower;
int vo_economy;
@@ -96,8 +98,8 @@ static void   vid_set_switch_policy(ACPI_HANDLE, UINT32)
 static int vid_enum_outputs(ACPI_HANDLE,
void(*)(ACPI_HANDLE, UINT32, void *), void *);
 static int vo_get_brightness_levels(ACPI_HANDLE, int **);
-static int vo_get_brightness(ACPI_HANDLE);
-static voidvo_set_brightness(ACPI_HANDLE, int);
+static int vo_get_brightness(struct acpi_video_output *);
+static voidvo_set_brightness(struct acpi_video_output *, int);
 static UINT32  vo_get_device_status(ACPI_HANDLE);
 static UINT32  vo_get_graphics_state(ACPI_HANDLE);
 static voidvo_set_device_state(ACPI_HANDLE, UINT32);
@@ -327,9 +329,9 @@ acpi_video_resume(device_t dev)
if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0)
continue;
 
-   level = vo_get_brightness(vo->handle);
+   level = vo_get_brightness(vo);
if (level != -1)
-   vo_set_brightness(vo->handle, level);
+   vo_set_brightness(vo, level);
}
ACPI_SERIAL_END(video_output);
ACPI_SERIAL_END(video);
@@ -419,7 +421,7 @@ acpi_video_power_profile(void *context)
ACPI_SERIAL_BEGIN(video_output);
STAILQ_FOREACH(vo, >vid_outputs, vo_next) {
if (vo->vo_levels != NULL && vo->vo_brightness == -1)
-   vo_set_brightness(vo->handle,
+   vo_set_brightness(vo,
state == POWER_PROFILE_ECONOMY ?
vo->vo_economy : vo->vo_fullpower);
}
@@ -518,6 +520,8 @@ acpi_video_vo_init(UINT32 adr)
vo->handle = NULL;
vo->adr = adr;
vo->vo_unit.num = n;
+   vo->vo_hasbqc = -1;
+   vo->vo_level = -1;
vo->vo_brightness = -1;
vo->vo_fullpower = -1;  /* TODO: override with tunables */
vo->vo_economy = -1;
@@ -698,7 +702,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT3
case VID_NOTIFY_ZERO_BRN:
if (vo->vo_levels == NULL)
goto out;
-   level = vo_get_brightness(handle);
+   level = vo_get_brightness(vo);
if (level < 0)
goto out;
break;
@@ -742,7 +746,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT3
break;
}
if (new_level != level) {
-   vo_set_brightness(handle, new_level);
+   vo_set_brightness(vo, new_level);
vo->vo_brightness = new_level;
}
 
@@ -807,7 +811,7 @@ acpi_video_vo_bright_sysctl(SYSCTL_HANDLER_ARGS)
if (level != -1 && (err = acpi_video_vo_check_level(vo, level)))
goto out;
vo->vo_brightness = level;
-   vo_set_brightness(vo->handle, (level == -1) ? preset : level);
+   vo_set_brightness(vo, (level == -1) ? preset : level);
 
 out:
ACPI_SERIAL_END(video_output);
@@ -848,7 +852,7 @@ acpi_video_vo_presets_sysctl(SYSCTL_HANDLER_ARGS)
goto out;
 
if (vo->vo_brightness == -1 && (power_profile_get_state() == arg2))
-   vo_set_brightness(vo->handle, level);
+   vo_set_brightness(vo, level);
*preset = level;
 
 out:
@@ -1018,15 +1022,39 @@ out:
 }
 
 static int
-vo_get_brightness(ACPI_HANDLE handle)
+vo_get_bqc(struct acpi_video_output *vo, UINT32 *level)
 {
+   ACPI_STATUS status;
+
+   switch (vo->vo_hasbqc) {
+   case 1:
+   case -1:
+   status = 

svn commit: r360655 - head/stand/efi/boot1

2020-05-05 Thread Andrew Turner
Author: andrew
Date: Tue May  5 10:01:10 2020
New Revision: 360655
URL: https://svnweb.freebsd.org/changeset/base/360655

Log:
  Fix the EFI_DEBUG case, prio_str is only used when EFI_DEBUG is unset.
  
  Sponsored by: Innovate UK

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

Modified: head/stand/efi/boot1/proto.c
==
--- head/stand/efi/boot1/proto.cTue May  5 09:42:26 2020
(r360654)
+++ head/stand/efi/boot1/proto.cTue May  5 10:01:10 2020
(r360655)
@@ -38,12 +38,14 @@ __FBSDID("$FreeBSD$");
 static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL;
 static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
 
+#ifndef EFI_DEBUG
 static const char *prio_str[] = {
"error",
"not supported",
"good",
"better"
 };
+#endif
 
 /*
  * probe_handle determines if the passed handle represents a logical partition
___
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: r360654 - head/stand/efi/boot1

2020-05-05 Thread Andrew Turner
Author: andrew
Date: Tue May  5 09:42:26 2020
New Revision: 360654
URL: https://svnweb.freebsd.org/changeset/base/360654

Log:
  As with r352446 align blocks in boot1.efi
  
  We need to ensure the buffers are aligned before passing them to ReadBlocks.
  Assume 512 bytes is enough for now.
  
  Reviewed by:  imp
  MFC after:1 month
  Sponsored by: Innovate UK

Modified:
  head/stand/efi/boot1/ufs_module.c

Modified: head/stand/efi/boot1/ufs_module.c
==
--- head/stand/efi/boot1/ufs_module.c   Tue May  5 04:42:47 2020
(r360653)
+++ head/stand/efi/boot1/ufs_module.c   Tue May  5 09:42:26 2020
(r360654)
@@ -73,12 +73,12 @@ dskread(void *buf, uint64_t lba, int nblk)
 
 #include "ufsread.c"
 
-static struct dmadat __dmadat;
+static struct dmadat __dmadat __aligned(512);
+static char ufs_buffer[BSD_LABEL_BUFFER] __aligned(512);
 
 static int
 init_dev(dev_info_t* dev)
 {
-   char buffer[BSD_LABEL_BUFFER];
struct disklabel *dl;
uint64_t bs;
int ok;
@@ -109,14 +109,14 @@ init_dev(dev_info_t* dev)
 * will retry fsread(0) only if there's a label found with a non-zero
 * offset.
 */
-   if (dskread(buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0)
+   if (dskread(ufs_buffer, 0, BSD_LABEL_BUFFER / DEV_BSIZE) != 0)
return (-1);
dl = NULL;
bs = devinfo->dev->Media->BlockSize;
if (bs != 0 && bs <= BSD_LABEL_BUFFER / 2)
-   dl = (struct disklabel *)[bs];
+   dl = (struct disklabel *)_buffer[bs];
if (dl == NULL || dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC)
-   dl = (struct disklabel *)[BSD_LABEL_OFFSET];
+   dl = (struct disklabel *)_buffer[BSD_LABEL_OFFSET];
if (dl->d_magic != BSD_MAGIC || dl->d_magic2 != BSD_MAGIC ||
dl->d_partitions[0].p_offset == 0)
return (-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"


Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311

2020-05-05 Thread Mark Millard via svn-src-head
[This report just shows an interesting rpcbind crash:
a pointer was filled with part of a string instead,
leading to a failed memory access attempt from the junk
address produced.]

Core was generated by `/usr/sbin/rpcbind'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x5024405c in rendezvous_request (xprt=, msg=) at /usr/src/lib/libc/rpc/svc_vc.c:335
335 cd->recvsize = r->recvsize;

(gdb) list
330 _setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, , 
sizeof (len));
331 }
332 
333 cd = (struct cf_conn *)newxprt->xp_p1;
334 
335 cd->recvsize = r->recvsize;
336 cd->sendsize = r->sendsize;
337 cd->maxrec = r->maxrec;
338 
339 if (cd->maxrec != 0) {

(gdb) print/c *cd
Cannot access memory at address 0x2d202020

FYI:

. . .
   0x50244050 <+452>:   bl  0x502e3404 <.plt_pic32._setsockopt>
   0x50244054 <+456>:   lwz r27,80(r29)
   0x50244058 <+460>:   lwz r3,4(r24)
=> 0x5024405c <+464>:   stw r3,436(r27)

Note the 80(r29) use.

(gdb) info reg
r0 0x50244020  1344552992
r1 0xb400  4294947840
r2 0x500a1018  1342836760
r3 0x2328  9000
r4 0x32ef559c  854545820
r5 0x0 0
r6 0xb360  4294947680
r7 0xb364  4294947684
r8 0x5004733c  1342468924
r9 0x0 0
r100x2032
r110x50252ea0  1344614048
r120x24200ca0  606080160
r130x0 0
r140x0 0
r150xbc28  4294949928
r160x10002848  268445768
r170x1004  268697600
r180x2 2
r190x0 0
r200x1 1
r210x5004c044  1342488644
r220xb63c  4294948412
r230x80128
r240x50048010  1342472208
r250x1420
r260xb630  4294948400
r270x2d202020  757080096
r280xf 15
r290x50047308  1342468872
r300x5030112c  1345327404
r310x1004  268697600
pc 0x5024405c  0x5024405c 
msr
cr 0x842000a0  2216689824
lr 0x50244020  0x50244020 
ctr0x50252ea0  1344614048
xer0x0 0
fpscr  0x0 0
vscr   
vrsave 

(gdb) x/s 0x50047308+72
0x50047350: " -  -   -\n"

So it tried to use "-   " as a pointer value.

It appears that the r29 value was from:

   0x50243f90 <+260>:   mr  r28,r3
   0x50243f94 <+264>:   lwz r4,0(r24)
   0x50243f98 <+268>:   lwz r5,4(r24)
   0x50243f9c <+272>:   mr  r3,r28
   0x50243fa0 <+276>:   bl  0x5024308c 
   0x50243fa4 <+280>:   lwz r27,36(r1)
   0x50243fa8 <+284>:   mr  r29,r3

The makefd_xprt being used as part of:

/*
 * make a new transporter (re-uses xprt)
 */
newxprt = makefd_xprt(sock, r->sendsize, r->recvsize);
newxprt->xp_rtaddr.buf = mem_alloc(len);
if (newxprt->xp_rtaddr.buf == NULL)
return (FALSE);
memcpy(newxprt->xp_rtaddr.buf, , len);
newxprt->xp_rtaddr.len = len;
#ifdef PORTMAP
if (addr.ss_family == AF_INET || addr.ss_family == AF_LOCAL) {
newxprt->xp_raddr = *(struct sockaddr_in 
*)newxprt->xp_rtaddr.buf;
newxprt->xp_addrlen = sizeof (struct sockaddr_in);
}
#endif  /* PORTMAP */
if (__rpc_fd2sockinfo(sock, ) && si.si_proto == IPPROTO_TCP) {
len = 1;
/* XXX fvdl - is this useful? */
_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, , sizeof (len));
}
 
cd = (struct cf_conn *)newxprt->xp_p1;
 
cd->recvsize = r->recvsize;
cd->sendsize = r->sendsize;
cd->maxrec = r->maxrec;

FYI:

(gdb) print *r
$5 = {sendsize = 9000, recvsize = 9000, maxrec = 9000}

There is more evidence of strings in pointers in *newxprt
(xp_tp, oa_base, xp_p1, xp_p2, xp_p3):

(gdb) print *newxprt
$7 = {xp_fd = 15, xp_port = 0, xp_ops = 0x50329e1c, xp_addrlen = 16, xp_raddr = 
{sin_len = 16 '\020', sin_family = 1 '\001', sin_port = 0, sin_addr = {s_addr = 
0}, 
sin_zero = "\000\000\000\000\000\000\000"}, xp_ops2 = 0x756e6978, xp_tp = 
0x2020 , 
  xp_netid = 0x1001 , 
xp_ltaddr = {maxlen = 0, len = 0, buf = 0x0}, xp_rtaddr = {maxlen = 539828256, 
len = 16, buf = 0x50047330}, xp_verf = {
oa_flavor = 0, oa_base = 0x202d2020 , oa_length = 538976288}, xp_p1 = 0x2d202020, xp_p2 = 0x20202020, 
xp_p3 =