svn commit: r351735 - stable/12/sbin/fsck_msdosfs

2019-09-02 Thread Xin LI
Author: delphij
Date: Tue Sep  3 06:52:21 2019
New Revision: 351735
URL: https://svnweb.freebsd.org/changeset/base/351735

Log:
  MFC r351204:
  
  Remove redundant check and wrong fix: fat.c checks already take care
  about cluster chains.
  
  Obtained from:OpenBSD

Modified:
  stable/12/sbin/fsck_msdosfs/dir.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/fsck_msdosfs/dir.c
==
--- stable/12/sbin/fsck_msdosfs/dir.c   Tue Sep  3 06:41:19 2019
(r351734)
+++ stable/12/sbin/fsck_msdosfs/dir.c   Tue Sep  3 06:52:21 2019
(r351735)
@@ -219,7 +219,6 @@ int
 resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
 {
int b1, b2;
-   cl_t cl;
int ret = FSOK;
size_t len;
 
@@ -252,24 +251,9 @@ resetDosDirSection(struct bootblock *boot, struct fatE
   boot->bpbRootClust);
return FSFATAL;
}
-   cl = fat[boot->bpbRootClust].next;
-   if (cl < CLUST_FIRST
-   || (cl >= CLUST_RSRVD && cl< CLUST_EOFS)
-   || fat[boot->bpbRootClust].head != boot->bpbRootClust) {
-   if (cl == CLUST_FREE)
-   pwarn("Root directory starts with free 
cluster\n");
-   else if (cl >= CLUST_RSRVD)
-   pwarn("Root directory starts with cluster 
marked %s\n",
- rsrvdcltype(cl));
-   else {
-   pfatal("Root directory doesn't start a cluster 
chain");
-   return FSFATAL;
-   }
-   if (ask(1, "Fix")) {
-   fat[boot->bpbRootClust].next = CLUST_FREE;
-   ret = FSFATMOD;
-   } else
-   ret = FSFATAL;
+   if (fat[boot->bpbRootClust].head != boot->bpbRootClust) {
+   pfatal("Root directory doesn't start a cluster chain");
+   return FSFATAL;
}
 
fat[boot->bpbRootClust].flags |= FAT_USED;
___
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: r351734 - stable/11/sys/kern

2019-09-02 Thread Konstantin Belousov
Author: kib
Date: Tue Sep  3 06:41:19 2019
New Revision: 351734
URL: https://svnweb.freebsd.org/changeset/base/351734

Log:
  MFC r351542:
  vn_vget_ino_gen(): relock the lower vnode on error.

Modified:
  stable/11/sys/kern/vfs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/vfs_vnops.c
==
--- stable/11/sys/kern/vfs_vnops.c  Tue Sep  3 06:40:17 2019
(r351733)
+++ stable/11/sys/kern/vfs_vnops.c  Tue Sep  3 06:41:19 2019
(r351734)
@@ -2080,7 +2080,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, 
VOP_UNLOCK(vp, 0);
error = alloc(mp, alloc_arg, lkflags, rvp);
vfs_unbusy(mp);
-   if (*rvp != vp)
+   if (error != 0 || *rvp != vp)
vn_lock(vp, ltype | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
if (error == 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: r351733 - stable/12/sys/kern

2019-09-02 Thread Konstantin Belousov
Author: kib
Date: Tue Sep  3 06:40:17 2019
New Revision: 351733
URL: https://svnweb.freebsd.org/changeset/base/351733

Log:
  MFC r351542:
  vn_vget_ino_gen(): relock the lower vnode on error.

Modified:
  stable/12/sys/kern/vfs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/vfs_vnops.c
==
--- stable/12/sys/kern/vfs_vnops.c  Tue Sep  3 05:58:43 2019
(r351732)
+++ stable/12/sys/kern/vfs_vnops.c  Tue Sep  3 06:40:17 2019
(r351733)
@@ -2078,7 +2078,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, 
VOP_UNLOCK(vp, 0);
error = alloc(mp, alloc_arg, lkflags, rvp);
vfs_unbusy(mp);
-   if (*rvp != vp)
+   if (error != 0 || *rvp != vp)
vn_lock(vp, ltype | LK_RETRY);
if (vp->v_iflag & VI_DOOMED) {
if (error == 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"


Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Konstantin Belousov
On Tue, Sep 03, 2019 at 01:42:58AM +, Rick Macklem wrote:
> Oh, and RPC_MAXDATASIZE seems to be set at 9000.
> (This is probably only a limit for UDP, but may be wired into all RPCs?)
> 
> rick
> 
> 
> From: owner-src-committ...@freebsd.org  on 
> behalf of Rick Macklem 
> Sent: Monday, September 2, 2019 9:30:45 PM
> To: Konstantin Belousov; src-committ...@freebsd.org; svn-src-all@freebsd.org; 
> svn-src-sta...@freebsd.org; svn-src-stable...@freebsd.org
> Subject: Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net 
> lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap 
> usr.sbin/yppush usr.sbin/ypserv
> 
> Konstantin Belousov wrote:
> >
> >Author: kib
> >Date: Mon Sep  2 08:20:02 2019
> >New Revision: 351691
> >URL: https://svnweb.freebsd.org/changeset/base/351691
> >
> >Log:
> >  MFC r350957:
> >  Increase YPMAXRECORD to 16M to be compatible with Linux.
> 
> I am not familiar with the userland RPC libraries, but for the krpc, the size 
> of an
> RPC message is limited by the maximum sockbuf size allowed, as set by
> soreserve() and limited by kern.maxsockbuf.
> 
> You might want to look to see if the userland RPC library does the 
> setsockopt()
> { or whatever it is? } that does the soreserve()/sbreserve() for the socket 
> in the
> kernel, to see how large it gets set.

My understanding is that socket buffers in fact limit the size of the
single read in userspace, but userspace RPC must do and does collection
of the partial reads into stream to xdr encode/decode the messages.

The patch was tested in the practical settings where 1K limit was exceeded,
I did not tried to determine a breaking point above it.

> 
> I think you can get to about 2M by default?
> 
> To be honest, I'm surprised (but maybe not amazed) that people still use
> NIS/YP.
Yes, they are, in quite large setups.

> Just in case it matters, rick
> 
___
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: r351730 - stable/11/lib/libutil

2019-09-02 Thread Sean Eric Fagan
Author: sef
Date: Tue Sep  3 04:50:39 2019
New Revision: 351730
URL: https://svnweb.freebsd.org/changeset/base/351730

Log:
  MFC r343881, r343882
  
  r339008 broke repquota for UFS.  This rectifies that.
  
  PR:   233849

Modified:
  stable/11/lib/libutil/quotafile.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libutil/quotafile.c
==
--- stable/11/lib/libutil/quotafile.c   Tue Sep  3 04:16:30 2019
(r351729)
+++ stable/11/lib/libutil/quotafile.c   Tue Sep  3 04:50:39 2019
(r351730)
@@ -116,7 +116,8 @@ quota_open(struct fstab *fs, int quotatype, int openfl
struct dqhdr64 dqh;
struct group *grp;
struct stat st;
-   int qcmd, serrno;
+   int qcmd, serrno = 0;
+   int ufs;
 
if ((qf = calloc(1, sizeof(*qf))) == NULL)
return (NULL);
@@ -127,15 +128,21 @@ quota_open(struct fstab *fs, int quotatype, int openfl
goto error;
qf->dev = st.st_dev;
qcmd = QCMD(Q_GETQUOTASIZE, quotatype);
+   ufs = strcmp(fs->fs_vfstype, "ufs") == 0;
+   /*
+* On UFS, hasquota() fills in qf->qfname. But we only care about
+* this for UFS.  So we need to call hasquota() for UFS, first.
+*/
+   if (ufs) {
+   serrno = hasquota(fs, quotatype, qf->qfname,
+   sizeof(qf->qfname));
+   }
if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0)
return (qf);
-   /* We only check the quota file for ufs */
-   if (strcmp(fs->fs_vfstype, "ufs")) {
+   if (!ufs) {
errno = 0;
goto error;
-   }
-   serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname));
-   if (serrno == 0) {
+   } else if (serrno == 0) {
errno = EOPNOTSUPP;
goto error;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351729 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2019-09-02 Thread Mateusz Guzik
Author: mjg
Date: Tue Sep  3 04:16:30 2019
New Revision: 351729
URL: https://svnweb.freebsd.org/changeset/base/351729

Log:
  Add sysctlbyname system call
  
  Previously userspace would issue one syscall to resolve the sysctl and then
  another one to actually use it. Do it all in one trip.
  
  Fallback is provided in case newer libc happens to be running on an older
  kernel.
  
  Submitted by: Pawel Biernacki
  Reported by:  kib, brooks
  Differential Revision:https://reviews.freebsd.org/D17282

Modified:
  head/lib/libc/gen/sysctlbyname.c
  head/lib/libc/sys/Symbol.map
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/capabilities.conf
  head/sys/kern/init_sysent.c
  head/sys/kern/kern_sysctl.c
  head/sys/kern/syscalls.c
  head/sys/kern/syscalls.master
  head/sys/kern/systrace_args.c
  head/sys/sys/param.h
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysctl.h
  head/sys/sys/sysproto.h

Modified: head/lib/libc/gen/sysctlbyname.c
==
--- head/lib/libc/gen/sysctlbyname.cMon Sep  2 21:57:57 2019
(r351728)
+++ head/lib/libc/gen/sysctlbyname.cTue Sep  3 04:16:30 2019
(r351729)
@@ -1,28 +1,59 @@
-/*
- * 
- * "THE BEER-WARE LICENSE" (Revision 42):
- *  wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * 
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+  *
+ * Copyright 2019 Pawel Biernacki, Mysterious Code Ltd.
  *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include 
 #include 
+#include 
 
+#include "libc_private.h"
+
+#defineSYSCTLBYNAME_OSREL  1300045
+
+extern int __sysctlbyname(const char *name, size_t namelen, void *oldp,
+size_t *oldlenp, const void *newp, size_t newlen);
+
 int
 sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
 const void *newp, size_t newlen)
 {
-   int real_oid[CTL_MAXNAME+2];
-   size_t oidlen;
+   int oid[CTL_MAXNAME];
+   size_t len;
 
-   oidlen = sizeof(real_oid) / sizeof(int);
-   if (sysctlnametomib(name, real_oid, &oidlen) < 0)
+   if (__getosreldate() >= SYSCTLBYNAME_OSREL) {
+   len = strlen(name);
+   return (__sysctlbyname(name, len, oldp, oldlenp, newp,
+   newlen));
+   }
+   len = nitems(oid);
+   if (sysctlnametomib(name, oid, &len) == -1)
return (-1);
-   return (sysctl(real_oid, oidlen, oldp, oldlenp, newp, newlen));
+   return (sysctl(oid, len, oldp, oldlenp, newp, newlen));
 }

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapMon Sep  2 21:57:57 2019
(r351728)
+++ head/lib/libc/sys/Symbol.mapTue Sep  3 04:16:30 2019
(r351729)
@@ -402,6 +402,7 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+   __sysctlbyname;
copy_file_range;
fhlink;
fhlinkat;

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
===

Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Pedro Giffuni



On 2019-09-02 20:42, Rick Macklem wrote:

Oh, and RPC_MAXDATASIZE seems to be set at 9000.
(This is probably only a limit for UDP, but may be wired into all RPCs?)

rick


FWIW, the previous value matches what illumos has in 
usr/src/head/rpcsvc/yp_prot.h :


#define YPMAXRECORD ((uint_t)1024)



From: owner-src-committ...@freebsd.org  on behalf 
of Rick Macklem 
Sent: Monday, September 2, 2019 9:30:45 PM
To: Konstantin Belousov; src-committ...@freebsd.org; svn-src-all@freebsd.org; 
svn-src-sta...@freebsd.org; svn-src-stable...@freebsd.org
Subject: Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net 
lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap 
usr.sbin/yppush usr.sbin/ypserv

Konstantin Belousov wrote:

Author: kib
Date: Mon Sep  2 08:20:02 2019
New Revision: 351691
URL: https://svnweb.freebsd.org/changeset/base/351691

Log:
  MFC r350957:
  Increase YPMAXRECORD to 16M to be compatible with Linux.

I am not familiar with the userland RPC libraries, but for the krpc, the size 
of an
RPC message is limited by the maximum sockbuf size allowed, as set by
soreserve() and limited by kern.maxsockbuf.

You might want to look to see if the userland RPC library does the setsockopt()
{ or whatever it is? } that does the soreserve()/sbreserve() for the socket in 
the
kernel, to see how large it gets set.

I think you can get to about 2M by default?

To be honest, I'm surprised (but maybe not amazed) that people still use
NIS/YP.
Just in case it matters, rick

   Sponsored by: Mellanox Technologies

Modified:
   stable/12/include/rpcsvc/yp.x
   stable/12/include/rpcsvc/yp_prot.h
   stable/12/include/rpcsvc/ypxfrd.x
   stable/12/lib/libc/net/gethostbynis.c
   stable/12/lib/libc/net/getnetbynis.c
   stable/12/lib/libc/net/getservent.c
   stable/12/lib/libc/rpc/getrpcent.c
   stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
   stable/12/usr.sbin/rpc.ypupdated/yp_dbupdate.c
   stable/12/usr.sbin/ypldap/yp.c
   stable/12/usr.sbin/yppush/yppush_main.c
   stable/12/usr.sbin/ypserv/yp_server.c
Directory Properties:
   stable/12/   (props changed)

Modified: stable/12/include/rpcsvc/yp.x
==
--- stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -40,7 +40,7 @@
  %__FBSDID("$FreeBSD$");
  #endif

-const YPMAXRECORD = 1024;
+const YPMAXRECORD = 16777216;
  const YPMAXDOMAIN = 64;
  const YPMAXMAP = 64;
  const YPMAXPEER = 64;

Modified: stable/12/include/rpcsvc/yp_prot.h
==
--- stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:20:02 2019
(r351691)
@@ -79,7 +79,7 @@ typedef u_int bool;
  #define YPPROG ((u_long)14)
  #define YPVERS ((u_long)2)
  #define YPVERS_ORIG((u_long)1)
-#define YPMAXRECORD((u_long)1024)
+#define YPMAXRECORD((u_long)16 * 1024 * 1024)
  #define YPMAXDOMAIN((u_long)64)
  #define YPMAXMAP   ((u_long)64)
  #define YPMAXPEER  ((u_long)256)

Modified: stable/12/include/rpcsvc/ypxfrd.x
==
--- stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -70,7 +70,7 @@
  #endif

  /* XXX cribbed from yp.x */
-const _YPMAXRECORD = 1024;
+const _YPMAXRECORD = 16777216;
  const _YPMAXDOMAIN = 64;
  const _YPMAXMAP = 64;
  const _YPMAXPEER = 64;

Modified: stable/12/lib/libc/net/gethostbynis.c
==
--- stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _gethostbynis(const char *name, char *map, int af, str
 char *cp, **q;
 char *result;
 int resultlen, size, addrok = 0;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
 res_state statp;

 statp = __res_state();
@@ -88,10 +88,11 @@ _gethostbynis(const char *name, char *map, int af, str
 }

 /* avoid potential memory leak */
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
 ypbuf[resultlen] = '\0';
 free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;

 if ((cp = strchr(result, '\n')))
 *cp = '\0';

Modified: stable/12/lib/libc/net/getnetbynis.c
==
--- stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:03:29 

Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Rick Macklem
Oh, and RPC_MAXDATASIZE seems to be set at 9000.
(This is probably only a limit for UDP, but may be wired into all RPCs?)

rick


From: owner-src-committ...@freebsd.org  on 
behalf of Rick Macklem 
Sent: Monday, September 2, 2019 9:30:45 PM
To: Konstantin Belousov; src-committ...@freebsd.org; svn-src-all@freebsd.org; 
svn-src-sta...@freebsd.org; svn-src-stable...@freebsd.org
Subject: Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net 
lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap 
usr.sbin/yppush usr.sbin/ypserv

Konstantin Belousov wrote:
>
>Author: kib
>Date: Mon Sep  2 08:20:02 2019
>New Revision: 351691
>URL: https://svnweb.freebsd.org/changeset/base/351691
>
>Log:
>  MFC r350957:
>  Increase YPMAXRECORD to 16M to be compatible with Linux.

I am not familiar with the userland RPC libraries, but for the krpc, the size 
of an
RPC message is limited by the maximum sockbuf size allowed, as set by
soreserve() and limited by kern.maxsockbuf.

You might want to look to see if the userland RPC library does the setsockopt()
{ or whatever it is? } that does the soreserve()/sbreserve() for the socket in 
the
kernel, to see how large it gets set.

I think you can get to about 2M by default?

To be honest, I'm surprised (but maybe not amazed) that people still use
NIS/YP.
Just in case it matters, rick

  Sponsored by: Mellanox Technologies

Modified:
  stable/12/include/rpcsvc/yp.x
  stable/12/include/rpcsvc/yp_prot.h
  stable/12/include/rpcsvc/ypxfrd.x
  stable/12/lib/libc/net/gethostbynis.c
  stable/12/lib/libc/net/getnetbynis.c
  stable/12/lib/libc/net/getservent.c
  stable/12/lib/libc/rpc/getrpcent.c
  stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
  stable/12/usr.sbin/rpc.ypupdated/yp_dbupdate.c
  stable/12/usr.sbin/ypldap/yp.c
  stable/12/usr.sbin/yppush/yppush_main.c
  stable/12/usr.sbin/ypserv/yp_server.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/rpcsvc/yp.x
==
--- stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -40,7 +40,7 @@
 %__FBSDID("$FreeBSD$");
 #endif

-const YPMAXRECORD = 1024;
+const YPMAXRECORD = 16777216;
 const YPMAXDOMAIN = 64;
 const YPMAXMAP = 64;
 const YPMAXPEER = 64;

Modified: stable/12/include/rpcsvc/yp_prot.h
==
--- stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:20:02 2019
(r351691)
@@ -79,7 +79,7 @@ typedef u_int bool;
 #define YPPROG ((u_long)14)
 #define YPVERS ((u_long)2)
 #define YPVERS_ORIG((u_long)1)
-#define YPMAXRECORD((u_long)1024)
+#define YPMAXRECORD((u_long)16 * 1024 * 1024)
 #define YPMAXDOMAIN((u_long)64)
 #define YPMAXMAP   ((u_long)64)
 #define YPMAXPEER  ((u_long)256)

Modified: stable/12/include/rpcsvc/ypxfrd.x
==
--- stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -70,7 +70,7 @@
 #endif

 /* XXX cribbed from yp.x */
-const _YPMAXRECORD = 1024;
+const _YPMAXRECORD = 16777216;
 const _YPMAXDOMAIN = 64;
 const _YPMAXMAP = 64;
 const _YPMAXPEER = 64;

Modified: stable/12/lib/libc/net/gethostbynis.c
==
--- stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _gethostbynis(const char *name, char *map, int af, str
char *cp, **q;
char *result;
int resultlen, size, addrok = 0;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
res_state statp;

statp = __res_state();
@@ -88,10 +88,11 @@ _gethostbynis(const char *name, char *map, int af, str
}

/* avoid potential memory leak */
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;

if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/12/lib/libc/net/getnetbynis.c
==
--- stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _getnetbynis(const char *name, char *map, int af, stru
char *cp

Re: svn commit: r351691 - in stable/12: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Rick Macklem
Konstantin Belousov wrote:
>
>Author: kib
>Date: Mon Sep  2 08:20:02 2019
>New Revision: 351691
>URL: https://svnweb.freebsd.org/changeset/base/351691
>
>Log:
>  MFC r350957:
>  Increase YPMAXRECORD to 16M to be compatible with Linux.

I am not familiar with the userland RPC libraries, but for the krpc, the size 
of an
RPC message is limited by the maximum sockbuf size allowed, as set by
soreserve() and limited by kern.maxsockbuf.

You might want to look to see if the userland RPC library does the setsockopt()
{ or whatever it is? } that does the soreserve()/sbreserve() for the socket in 
the
kernel, to see how large it gets set.

I think you can get to about 2M by default?

To be honest, I'm surprised (but maybe not amazed) that people still use
NIS/YP.
Just in case it matters, rick

  Sponsored by: Mellanox Technologies

Modified:
  stable/12/include/rpcsvc/yp.x
  stable/12/include/rpcsvc/yp_prot.h
  stable/12/include/rpcsvc/ypxfrd.x
  stable/12/lib/libc/net/gethostbynis.c
  stable/12/lib/libc/net/getnetbynis.c
  stable/12/lib/libc/net/getservent.c
  stable/12/lib/libc/rpc/getrpcent.c
  stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
  stable/12/usr.sbin/rpc.ypupdated/yp_dbupdate.c
  stable/12/usr.sbin/ypldap/yp.c
  stable/12/usr.sbin/yppush/yppush_main.c
  stable/12/usr.sbin/ypserv/yp_server.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/rpcsvc/yp.x
==
--- stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -40,7 +40,7 @@
 %__FBSDID("$FreeBSD$");
 #endif

-const YPMAXRECORD = 1024;
+const YPMAXRECORD = 16777216;
 const YPMAXDOMAIN = 64;
 const YPMAXMAP = 64;
 const YPMAXPEER = 64;

Modified: stable/12/include/rpcsvc/yp_prot.h
==
--- stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:20:02 2019
(r351691)
@@ -79,7 +79,7 @@ typedef u_int bool;
 #define YPPROG ((u_long)14)
 #define YPVERS ((u_long)2)
 #define YPVERS_ORIG((u_long)1)
-#define YPMAXRECORD((u_long)1024)
+#define YPMAXRECORD((u_long)16 * 1024 * 1024)
 #define YPMAXDOMAIN((u_long)64)
 #define YPMAXMAP   ((u_long)64)
 #define YPMAXPEER  ((u_long)256)

Modified: stable/12/include/rpcsvc/ypxfrd.x
==
--- stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -70,7 +70,7 @@
 #endif

 /* XXX cribbed from yp.x */
-const _YPMAXRECORD = 1024;
+const _YPMAXRECORD = 16777216;
 const _YPMAXDOMAIN = 64;
 const _YPMAXMAP = 64;
 const _YPMAXPEER = 64;

Modified: stable/12/lib/libc/net/gethostbynis.c
==
--- stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _gethostbynis(const char *name, char *map, int af, str
char *cp, **q;
char *result;
int resultlen, size, addrok = 0;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
res_state statp;

statp = __res_state();
@@ -88,10 +88,11 @@ _gethostbynis(const char *name, char *map, int af, str
}

/* avoid potential memory leak */
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;

if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/12/lib/libc/net/getnetbynis.c
==
--- stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _getnetbynis(const char *name, char *map, int af, stru
char *cp, **q;
char *result;
int resultlen, len;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;

switch(af) {
case AF_INET:
@@ -77,10 +77,11 @@ _getnetbynis(const char *name, char *map, int af, stru
&resultlen))
return (-1);

-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;

if ((cp = strchr(result, '\n')))
*cp = '\

Re: svn commit: r351727 - head/sys/amd64/amd64

2019-09-02 Thread Mark Johnston
On Mon, Sep 02, 2019 at 09:54:09PM +, Mark Johnston wrote:
> Author: markj
> Date: Mon Sep  2 21:54:08 2019
> New Revision: 351727
> URL: https://svnweb.freebsd.org/changeset/base/351727
> 
> Log:
>   Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.
>   
>   No functional change intended.
>   
>   Reviewed by:kib
>   MFC after:  1 week
>   Sponsored by:   The FreeBSD Foundation

Sorry, this should have been Sponsored by: Netflix.  It was split out
from the patch committed as r351728.
___
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: r351728 - head/sys/amd64/amd64

2019-09-02 Thread Mark Johnston
Author: markj
Date: Mon Sep  2 21:57:57 2019
New Revision: 351728
URL: https://svnweb.freebsd.org/changeset/base/351728

Log:
  Add a sysctl to dump kernel mappings and their properties on amd64.
  
  The sysctl is called vm.pmap.kernel_maps.  It dumps address ranges
  and their corresponding protection and mapping mode, as well as
  counts of 2MB and 1GB pages in the range.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21380

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Sep  2 21:54:08 2019(r351727)
+++ head/sys/amd64/amd64/pmap.c Mon Sep  2 21:57:57 2019(r351728)
@@ -124,6 +124,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2112,6 +2113,41 @@ pmap_cache_mask(pmap_t pmap, boolean_t is_pde)
return (mask);
 }
 
+static int
+pmap_pat_index(pmap_t pmap, pt_entry_t pte, bool is_pde)
+{
+   int pat_flag, pat_idx;
+
+   pat_idx = 0;
+   switch (pmap->pm_type) {
+   case PT_X86:
+   case PT_RVI:
+   /* The PAT bit is different for PTE's and PDE's. */
+   pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT;
+
+   if ((pte & pat_flag) != 0)
+   pat_idx |= 0x4;
+   if ((pte & PG_NC_PCD) != 0)
+   pat_idx |= 0x2;
+   if ((pte & PG_NC_PWT) != 0)
+   pat_idx |= 0x1;
+   break;
+   case PT_EPT:
+   if ((pte & EPT_PG_IGNORE_PAT) != 0)
+   panic("EPT PTE %#lx has no PAT memory type", pte);
+   pat_idx = (pte & EPT_PG_MEMORY_TYPE(0x7)) >> 3;
+   break;
+   }
+
+   /* See pmap_init_pat(). */
+   if (pat_idx == 4)
+   pat_idx = 0;
+   if (pat_idx == 7)
+   pat_idx = 3;
+
+   return (pat_idx);
+}
+
 bool
 pmap_ps_enabled(pmap_t pmap)
 {
@@ -9980,6 +10016,268 @@ pmap_pkru_clear(pmap_t pmap, vm_offset_t sva, vm_offse
}
return (error);
 }
+
+/*
+ * Track a range of the kernel's virtual address space that is contiguous
+ * in various mapping attributes.
+ */
+struct pmap_kernel_map_range {
+   vm_offset_t sva;
+   pt_entry_t attrs;
+   int ptes;
+   int pdes;
+   int pdpes;
+};
+
+static void
+sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range,
+vm_offset_t eva)
+{
+   const char *mode;
+   int i, pat_idx;
+
+   if (eva <= range->sva)
+   return;
+
+   pat_idx = pmap_pat_index(kernel_pmap, range->attrs, true);
+   for (i = 0; i < PAT_INDEX_SIZE; i++)
+   if (pat_index[i] == pat_idx)
+   break;
+
+   switch (i) {
+   case PAT_WRITE_BACK:
+   mode = "WB";
+   break;
+   case PAT_WRITE_THROUGH:
+   mode = "WT";
+   break;
+   case PAT_UNCACHEABLE:
+   mode = "UC";
+   break;
+   case PAT_WRITE_PROTECTED:
+   mode = "WP";
+   break;
+   case PAT_WRITE_COMBINING:
+   mode = "WC";
+   break;
+   default:
+   printf("%s: unknown PAT mode %#x for range %#016lx-%#016lx\n",
+   __func__, i, range->sva, eva);
+   mode = "??";
+   break;
+   }
+
+   sbuf_printf(sb, "%#016lx-%#016lx r%c%c%c%c %s %d %d %d\n",
+   range->sva, eva,
+   (range->attrs & X86_PG_RW) != 0 ? 'w' : '-',
+   (range->attrs & pg_nx) != 0 ? '-' : 'x',
+   (range->attrs & X86_PG_U) != 0 ? 'u' : 's',
+   (range->attrs & X86_PG_G) != 0 ? 'g' : '-',
+   mode, range->pdpes, range->pdes, range->ptes);
+
+   /* Reset to sentinel value. */
+   range->sva = KVADDR(NPML4EPG - 1, NPDPEPG - 1, NPDEPG - 1, NPTEPG - 1);
+}
+
+/*
+ * Determine whether the attributes specified by a page table entry match those
+ * being tracked by the current range.  This is not quite as simple as a direct
+ * flag comparison since some PAT modes have multiple representations.
+ */
+static bool
+sysctl_kmaps_match(struct pmap_kernel_map_range *range, pt_entry_t attrs)
+{
+   pt_entry_t diff, mask;
+
+   mask = X86_PG_G | X86_PG_RW | X86_PG_U | X86_PG_PDE_CACHE | pg_nx;
+   diff = (range->attrs ^ attrs) & mask;
+   if (diff == 0)
+   return (true);
+   if ((diff & ~X86_PG_PDE_PAT) == 0 &&
+   pmap_pat_index(kernel_pmap, range->attrs, true) ==
+   pmap_pat_index(kernel_pmap, attrs, true))
+   return (true);
+   return (false);
+}
+
+static void
+sysctl_kmaps_reinit(struct pmap_kernel_map_range *range, vm_offset_t va,
+pt_entry_t attrs)
+{
+
+   memset(range, 0, sizeof(*range));
+   rang

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

2019-09-02 Thread Mark Johnston
Author: markj
Date: Mon Sep  2 21:54:08 2019
New Revision: 351727
URL: https://svnweb.freebsd.org/changeset/base/351727

Log:
  Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.
  
  No functional change intended.
  
  Reviewed by:  kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Sep  2 21:52:18 2019(r351726)
+++ head/sys/amd64/amd64/pmap.c Mon Sep  2 21:54:08 2019(r351727)
@@ -424,8 +424,8 @@ static int pmap_flags = PMAP_PDE_SUPERPAGE; /* flags f
 
 static vmem_t *large_vmem;
 static u_int lm_ents;
-#definePMAP_LARGEMAP_MAX_ADDRESS() \
-(LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents)
+#definePMAP_ADDRESS_IN_LARGEMAP(va)((va) >= LARGEMAP_MIN_ADDRESS 
&& \
+   (va) < LARGEMAP_MIN_ADDRESS + NBPML4 * (u_long)lm_ents)
 
 int pmap_pcid_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
@@ -3091,8 +3091,7 @@ pmap_kextract(vm_offset_t va)
 
if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) {
pa = DMAP_TO_PHYS(va);
-   } else if (LARGEMAP_MIN_ADDRESS <= va &&
-   va < PMAP_LARGEMAP_MAX_ADDRESS()) {
+   } else if (PMAP_ADDRESS_IN_LARGEMAP(va)) {
pa = pmap_large_map_kextract(va);
} else {
pde = *vtopde(va);
@@ -9022,7 +9021,7 @@ pmap_large_map_kextract(vm_offset_t va)
pd_entry_t *pde, pd;
pt_entry_t *pte, pt;
 
-   KASSERT(LARGEMAP_MIN_ADDRESS <= va && va < PMAP_LARGEMAP_MAX_ADDRESS(),
+   KASSERT(PMAP_ADDRESS_IN_LARGEMAP(va),
("not largemap range %#lx", (u_long)va));
pdpe = pmap_large_map_pdpe(va);
pdp = *pdpe;
@@ -9164,8 +9163,8 @@ pmap_large_unmap(void *svaa, vm_size_t len)
return;
 
SLIST_INIT(&spgf);
-   KASSERT(LARGEMAP_MIN_ADDRESS <= sva &&
-   sva + len <= PMAP_LARGEMAP_MAX_ADDRESS(),
+   KASSERT(PMAP_ADDRESS_IN_LARGEMAP(sva) &&
+   PMAP_ADDRESS_IN_LARGEMAP(sva + len - 1),
("not largemap range %#lx %#lx", (u_long)svaa, (u_long)svaa + len));
PMAP_LOCK(kernel_pmap);
for (va = sva; va < sva + len; va += inc) {
___
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: r351726 - stable/12/sys/vm

2019-09-02 Thread Mark Johnston
Author: markj
Date: Mon Sep  2 21:52:18 2019
New Revision: 351726
URL: https://svnweb.freebsd.org/changeset/base/351726

Log:
  MFC r351518:
  Fix a few nits in vm_pqbatch_process_page().

Modified:
  stable/12/sys/vm/vm_page.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Mon Sep  2 19:04:02 2019(r351725)
+++ stable/12/sys/vm/vm_page.c  Mon Sep  2 21:52:18 2019(r351726)
@@ -3104,9 +3104,10 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
 * the page queue lock held.  In this case it is about to free the page,
 * which must not have any queue state.
 */
-   qflags = atomic_load_8(&m->aflags) & PGA_QUEUE_STATE_MASK;
-   KASSERT(pq == vm_page_pagequeue(m) || qflags == 0,
-   ("page %p doesn't belong to queue %p but has queue state %#x",
+   qflags = atomic_load_8(&m->aflags);
+   KASSERT(pq == vm_page_pagequeue(m) ||
+   (qflags & PGA_QUEUE_STATE_MASK) == 0,
+   ("page %p doesn't belong to queue %p but has aflags %#x",
m, pq, qflags));
 
if ((qflags & PGA_DEQUEUE) != 0) {
@@ -3120,6 +3121,13 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
vm_pagequeue_cnt_inc(pq);
vm_page_aflag_set(m, PGA_ENQUEUED);
}
+
+   /*
+* Give PGA_REQUEUE_HEAD precedence over PGA_REQUEUE.
+* In particular, if both flags are set in close succession,
+* only PGA_REQUEUE_HEAD will be applied, even if it was set
+* first.
+*/
if ((qflags & PGA_REQUEUE_HEAD) != 0) {
KASSERT(m->queue == PQ_INACTIVE,
("head enqueue not supported for page %p", m));
@@ -3128,12 +3136,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
} else
TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q);
 
-   /*
-* PGA_REQUEUE and PGA_REQUEUE_HEAD must be cleared after
-* setting PGA_ENQUEUED in order to synchronize with the
-* page daemon.
-*/
-   vm_page_aflag_clear(m, PGA_REQUEUE | PGA_REQUEUE_HEAD);
+   vm_page_aflag_clear(m, qflags & (PGA_REQUEUE |
+   PGA_REQUEUE_HEAD));
}
 }
 
___
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: r351725 - in head/sys/netinet: . tcp_stacks

2019-09-02 Thread Michael Tuexen
Author: tuexen
Date: Mon Sep  2 19:04:02 2019
New Revision: 351725
URL: https://svnweb.freebsd.org/changeset/base/351725

Log:
  This patch improves the DSACK handling to conform with RFC 2883.
  The lowest SACK block is used when multiple Blocks would be elegible as
  DSACK blocks ACK blocks get reordered - while maintaining the ordering of
  SACK blocks not relevant in the DSACK context is maintained.
  
  Reviewed by:  rrs@, tuexen@
  Obtained from:Richard Scheffenegger
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21038

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_sack.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/rack_bbr_common.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cMon Sep  2 18:32:08 2019
(r351724)
+++ head/sys/netinet/tcp_input.cMon Sep  2 19:04:02 2019
(r351725)
@@ -1486,7 +1486,6 @@ tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, stru
} else {
tp->rfbuf_cnt += tlen;  /* add up */
}
-
return (newsize);
 }
 

Modified: head/sys/netinet/tcp_sack.c
==
--- head/sys/netinet/tcp_sack.c Mon Sep  2 18:32:08 2019(r351724)
+++ head/sys/netinet/tcp_sack.c Mon Sep  2 19:04:02 2019(r351725)
@@ -149,7 +149,109 @@ SYSCTL_INT(_net_inet_tcp_sack, OID_AUTO, globalholes, 
 &VNET_NAME(tcp_sack_globalholes), 0,
 "Global number of TCP SACK holes currently allocated");
 
+
 /*
+ * This function will find overlaps with the currently stored sackblocks
+ * and add any overlap as a dsack block upfront
+ */
+void
+tcp_update_dsack_list(struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end)
+{
+   struct sackblk head_blk,mid_blk,saved_blks[MAX_SACK_BLKS];
+   int i, j, n, identical;
+   tcp_seq start, end;
+
+   INP_WLOCK_ASSERT(tp->t_inpcb);
+
+   KASSERT(SEQ_LT(rcv_start, rcv_end), ("rcv_start < rcv_end"));
+
+   if (tp->t_inpcb->inp_socket->so_options & SO_DEBUG) {
+   log(LOG_DEBUG, "\nDSACK update: %d..%d, rcv_nxt: %u\n",
+   rcv_start, rcv_end, tp->rcv_nxt);
+   }
+
+   if (SEQ_LT(rcv_end, tp->rcv_nxt) ||
+   ((rcv_end == tp->rcv_nxt) &&
+(tp->rcv_numsacks > 0 ) &&
+(tp->sackblks[0].end == tp->rcv_nxt))) {
+   saved_blks[0].start = rcv_start;
+   saved_blks[0].end = rcv_end;
+   } else {
+   saved_blks[0].start = saved_blks[0].end = 0;
+   }
+
+   head_blk.start = head_blk.end = 0;
+   mid_blk.start = rcv_start;
+   mid_blk.end = rcv_end;
+   identical = 0;
+
+   for (i = 0; i < tp->rcv_numsacks; i++) {
+   start = tp->sackblks[i].start;
+   end = tp->sackblks[i].end;
+   if (SEQ_LT(rcv_end, start)) {
+   /* pkt left to sack blk */
+   continue;
+   }
+   if (SEQ_GT(rcv_start, end)) {
+   /* pkt right to sack blk */
+   continue;
+   }
+   if (SEQ_GT(tp->rcv_nxt, end)) {
+   if ((SEQ_MAX(rcv_start, start) != SEQ_MIN(rcv_end, 
end)) &&
+   (SEQ_GT(head_blk.start, SEQ_MAX(rcv_start, start)) 
||
+   (head_blk.start == head_blk.end))) {
+   head_blk.start = SEQ_MAX(rcv_start, start);
+   head_blk.end = SEQ_MIN(rcv_end, end);
+   }
+   continue;
+   }
+   if (((head_blk.start == head_blk.end) ||
+SEQ_LT(start, head_blk.start)) &&
+(SEQ_GT(end, rcv_start) &&
+ SEQ_LEQ(start, rcv_end))) {
+   head_blk.start = start;
+   head_blk.end = end;
+   }
+   mid_blk.start = SEQ_MIN(mid_blk.start, start);
+   mid_blk.end = SEQ_MAX(mid_blk.end, end);
+   if ((mid_blk.start == start) &&
+   (mid_blk.end == end))
+   identical = 1;
+   }
+   if (SEQ_LT(head_blk.start, head_blk.end)) {
+   /* store overlapping range */
+   saved_blks[0].start = SEQ_MAX(rcv_start, head_blk.start);
+   saved_blks[0].end   = SEQ_MIN(rcv_end, head_blk.end);
+   }
+   n = 1;
+   /*
+* Second, if not ACKed, store the SACK block that
+* overlaps with the DSACK block unless it is identical
+*/
+   if ((SEQ_LT(tp->rcv_nxt, mid_blk.end) &&
+   !((mid_blk.start == saved_blks[0].start) &&
+   (mid_blk.end == saved_blks[0].end))) ||
+   identical == 1) {
+

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

2019-09-02 Thread Ian Lepore
Author: ian
Date: Mon Sep  2 18:32:08 2019
New Revision: 351724
URL: https://svnweb.freebsd.org/changeset/base/351724

Log:
  Fix the name of the devicetree bindings document file cited in the manpage.
  
  Reported by:  thj@

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

Modified: head/share/man/man4/ads111x.4
==
--- head/share/man/man4/ads111x.4   Mon Sep  2 18:10:35 2019
(r351723)
+++ head/share/man/man4/ads111x.4   Mon Sep  2 18:32:08 2019
(r351724)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 12, 2019
+.Dd September 2, 2019
 .Dt ADS111x 4
 .Os
 .Sh NAME
@@ -160,7 +160,7 @@ based system, the
 device is defined as a slave device subnode
 of the i2c bus controller node.
 All properties documented in the
-.Va ads1115.txt
+.Va ads1015.txt
 bindings document can be used with the
 .Nm
 device.
@@ -182,7 +182,7 @@ I2c slave address of device.
 .Pp
 Specific channels can be configured by adding child nodes to the
 .Nm
-node, as described in the standard ads1115.txt bindings document.
+node, as described in the standard ads1015.txt bindings document.
 If no channels are configured, sysctl variables will be created
 for all possible channels supported by the device type, otherwise
 only the specified channels are created.
___
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: r351723 - head/sys/compat/linux

2019-09-02 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Sep  2 18:10:35 2019
New Revision: 351723
URL: https://svnweb.freebsd.org/changeset/base/351723

Log:
  Bump Linux version to 3.2.0.  Without it, binaries linked against
  glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old".
  
  This alone is not enough to make newer binaries actually work;
  fix/hack/workaround is pending review at https://reviews.freebsd.org/D20687.
  
  Reviewed by:  emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20757

Modified:
  head/sys/compat/linux/linux_mib.h

Modified: head/sys/compat/linux/linux_mib.h
==
--- head/sys/compat/linux/linux_mib.h   Mon Sep  2 17:55:39 2019
(r351722)
+++ head/sys/compat/linux/linux_mib.h   Mon Sep  2 18:10:35 2019
(r351723)
@@ -46,9 +46,9 @@ int   linux_get_oss_version(struct thread *td);
 
 intlinux_kernver(struct thread *td);
 
-#defineLINUX_KVERSION  2
-#defineLINUX_KPATCHLEVEL   6
-#defineLINUX_KSUBLEVEL 36
+#defineLINUX_KVERSION  3
+#defineLINUX_KPATCHLEVEL   2
+#defineLINUX_KSUBLEVEL 0
 
 #defineLINUX_KERNVER(a,b,c)(((a) << 16) + ((b) << 8) + (c))
 #defineLINUX_VERSION_CODE  LINUX_KERNVER(LINUX_KVERSION,   
\
___
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: r351616 - head/sys/dev/usb/net

2019-09-02 Thread Oleksandr Tymoshenko
Hans Petter Selasky (h...@selasky.org) wrote:
> On 2019-09-02 02:29, Oleksandr Tymoshenko wrote:
> > Gleb Smirnoff (gleb...@freebsd.org) wrote:
> >> Author: glebius
> >> Date: Fri Aug 30 00:05:04 2019
> >> New Revision: 351616
> >> URL: https://svnweb.freebsd.org/changeset/base/351616
> >>
> >> Log:
> >>Use mbuf queue instead of ifqueue in USB network drivers.
> > 
> > Hi Gleb,
> > 
> > This change broke NFS root on RPi. I suspect it's not just NFS root
> > but USB ethernet functionality in general. Patch below fixes it for me.
> > The same patch probably should also be applied to if_axe and if_axge.
> > 
> 
> Hi,
> 
> 1) axe and axge use the common code, so no patch needed there from what 
> I can see.
> 
> 2) This queue should be unlimited.
> 
> See:
> https://svnweb.freebsd.org/changeset/base/351692

Thanks for a quick fix. Can confirm that latest HEAD boots fine now with
NFS root.

-- 
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: r351718 - in vendor/lld/dist-release_90: . COFF ELF ELF/Arch docs

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:30 2019
New Revision: 351718
URL: https://svnweb.freebsd.org/changeset/base/351718

Log:
  Vendor import of lld release_90 branch r370514:
  https://llvm.org/svn/llvm-project/lld/branches/release_90@370514

Modified:
  vendor/lld/dist-release_90/CMakeLists.txt
  vendor/lld/dist-release_90/COFF/Config.h
  vendor/lld/dist-release_90/COFF/Driver.cpp
  vendor/lld/dist-release_90/COFF/Driver.h
  vendor/lld/dist-release_90/COFF/InputFiles.cpp
  vendor/lld/dist-release_90/COFF/InputFiles.h
  vendor/lld/dist-release_90/COFF/SymbolTable.cpp
  vendor/lld/dist-release_90/COFF/SymbolTable.h
  vendor/lld/dist-release_90/COFF/Symbols.cpp
  vendor/lld/dist-release_90/COFF/Symbols.h
  vendor/lld/dist-release_90/COFF/Writer.cpp
  vendor/lld/dist-release_90/ELF/Arch/PPC.cpp
  vendor/lld/dist-release_90/ELF/Arch/PPC64.cpp
  vendor/lld/dist-release_90/ELF/InputFiles.cpp
  vendor/lld/dist-release_90/ELF/Symbols.cpp
  vendor/lld/dist-release_90/ELF/Symbols.h
  vendor/lld/dist-release_90/docs/ReleaseNotes.rst

Modified: vendor/lld/dist-release_90/CMakeLists.txt
==
--- vendor/lld/dist-release_90/CMakeLists.txt   Mon Sep  2 17:49:27 2019
(r351717)
+++ vendor/lld/dist-release_90/CMakeLists.txt   Mon Sep  2 17:49:30 2019
(r351718)
@@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   include(HandleLLVMOptions)
 
   if(LLVM_INCLUDE_TESTS)
-set(Python_ADDITIONAL_VERSIONS 2.7)
 include(FindPythonInterp)
 if(NOT PYTHONINTERP_FOUND)
   message(FATAL_ERROR

Modified: vendor/lld/dist-release_90/COFF/Config.h
==
--- vendor/lld/dist-release_90/COFF/Config.hMon Sep  2 17:49:27 2019
(r351717)
+++ vendor/lld/dist-release_90/COFF/Config.hMon Sep  2 17:49:30 2019
(r351718)
@@ -189,6 +189,7 @@ struct Configuration {
   // Used for /thinlto-object-suffix-replace:
   std::pair thinLTOObjectSuffixReplace;
 
+  uint64_t align = 4096;
   uint64_t imageBase = -1;
   uint64_t fileAlign = 512;
   uint64_t stackReserve = 1024 * 1024;

Modified: vendor/lld/dist-release_90/COFF/Driver.cpp
==
--- vendor/lld/dist-release_90/COFF/Driver.cpp  Mon Sep  2 17:49:27 2019
(r351717)
+++ vendor/lld/dist-release_90/COFF/Driver.cpp  Mon Sep  2 17:49:30 2019
(r351718)
@@ -36,6 +36,7 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/LEB128.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/TarWriter.h"
@@ -270,13 +271,12 @@ void LinkerDriver::addArchiveBuffer(MemoryBufferRef mb
 }
 
 void LinkerDriver::enqueueArchiveMember(const Archive::Child &c,
-StringRef symName,
+const Archive::Symbol &sym,
 StringRef parentName) {
 
-  auto reportBufferError = [=](Error &&e,
-  StringRef childName) {
+  auto reportBufferError = [=](Error &&e, StringRef childName) {
 fatal("could not get the buffer for the member defining symbol " +
-  symName + ": " + parentName + "(" + childName + "): " +
+  toCOFFString(sym) + ": " + parentName + "(" + childName + "): " +
   toString(std::move(e)));
   };
 
@@ -287,7 +287,8 @@ void LinkerDriver::enqueueArchiveMember(const Archive:
   reportBufferError(mbOrErr.takeError(), check(c.getFullName()));
 MemoryBufferRef mb = mbOrErr.get();
 enqueueTask([=]() {
-  driver->addArchiveBuffer(mb, symName, parentName, offsetInArchive);
+  driver->addArchiveBuffer(mb, toCOFFString(sym), parentName,
+   offsetInArchive);
 });
 return;
   }
@@ -295,15 +296,16 @@ void LinkerDriver::enqueueArchiveMember(const Archive:
   std::string childName = CHECK(
   c.getFullName(),
   "could not get the filename for the member defining symbol " +
-  symName);
+  toCOFFString(sym));
   auto future = std::make_shared>(
   createFutureForFile(childName));
   enqueueTask([=]() {
 auto mbOrErr = future->get();
 if (mbOrErr.second)
   reportBufferError(errorCodeToError(mbOrErr.second), childName);
-driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), symName,
- parentName, /* OffsetInArchive */ 0);
+driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)),
+ toCOFFString(sym), parentName,
+ /*OffsetInArchive=*/0);
   });
 }
 
@@ -1053,6 +1055,12 @@ void LinkerDriver::maybeExportMinGWSymbols(const opt::
   });
 }
 
+static const char *libcallRoutineNames[] = {
+#define HANDLE_LIBCALL(code, name) name,
+#include "llvm/IR/RuntimeLibcalls.def"
+#undef

svn commit: r351714 - vendor/compiler-rt/compiler-rt-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:19 2019
New Revision: 351714
URL: https://svnweb.freebsd.org/changeset/base/351714

Log:
  Tag compiler-rt release_90 branch r370514.

Added:
  vendor/compiler-rt/compiler-rt-release_90-r370514/
 - copied from r351713, vendor/compiler-rt/dist-release_90/
___
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: r351716 - vendor/libc++/libc++-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:24 2019
New Revision: 351716
URL: https://svnweb.freebsd.org/changeset/base/351716

Log:
  Tag libc++ release_90 branch r370514.

Added:
  vendor/libc++/libc++-release_90-r370514/
 - copied from r351715, vendor/libc++/dist-release_90/
___
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: r351713 - in vendor/compiler-rt/dist-release_90/lib: asan msan sanitizer_common

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:15 2019
New Revision: 351713
URL: https://svnweb.freebsd.org/changeset/base/351713

Log:
  Vendor import of compiler-rt release_90 branch r370514:
  https://llvm.org/svn/llvm-project/compiler-rt/branches/release_90@370514

Modified:
  vendor/compiler-rt/dist-release_90/lib/asan/asan_rtl.cc
  vendor/compiler-rt/dist-release_90/lib/msan/msan.cc
  vendor/compiler-rt/dist-release_90/lib/sanitizer_common/sanitizer_linux.cc

Modified: vendor/compiler-rt/dist-release_90/lib/asan/asan_rtl.cc
==
--- vendor/compiler-rt/dist-release_90/lib/asan/asan_rtl.cc Mon Sep  2 
17:49:13 2019(r351712)
+++ vendor/compiler-rt/dist-release_90/lib/asan/asan_rtl.cc Mon Sep  2 
17:49:15 2019(r351713)
@@ -402,7 +402,6 @@ static void AsanInitInternal() {
   asan_init_is_running = true;
 
   CacheBinaryName();
-  CheckASLR();
 
   // Initialize flags. This must be done early, because most of the
   // initialization steps look at flags().
@@ -450,6 +449,7 @@ static void AsanInitInternal() {
   SetLowLevelAllocateCallback(OnLowLevelAllocate);
 
   InitializeAsanInterceptors();
+  CheckASLR();
 
   // Enable system log ("adb logcat") on Android.
   // Doing this before interceptors are initialized crashes in:

Modified: vendor/compiler-rt/dist-release_90/lib/msan/msan.cc
==
--- vendor/compiler-rt/dist-release_90/lib/msan/msan.cc Mon Sep  2 17:49:13 
2019(r351712)
+++ vendor/compiler-rt/dist-release_90/lib/msan/msan.cc Mon Sep  2 17:49:15 
2019(r351713)
@@ -403,7 +403,6 @@ void __msan_init() {
   AvoidCVE_2016_2143();
 
   CacheBinaryName();
-  CheckASLR();
   InitializeFlags();
 
   // Install tool-specific callbacks in sanitizer_common.
@@ -412,6 +411,7 @@ void __msan_init() {
   __sanitizer_set_report_path(common_flags()->log_path);
 
   InitializeInterceptors();
+  CheckASLR();
   InitTlsSize();
   InstallDeadlySignalHandlers(MsanOnDeadlySignal);
   InstallAtExitHandler(); // Needs __cxa_atexit interceptor.

Modified: 
vendor/compiler-rt/dist-release_90/lib/sanitizer_common/sanitizer_linux.cc
==
--- vendor/compiler-rt/dist-release_90/lib/sanitizer_common/sanitizer_linux.cc  
Mon Sep  2 17:49:13 2019(r351712)
+++ vendor/compiler-rt/dist-release_90/lib/sanitizer_common/sanitizer_linux.cc  
Mon Sep  2 17:49:15 2019(r351713)
@@ -2011,6 +2011,35 @@ void CheckASLR() {
 CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
 ReExec();
   }
+#elif SANITIZER_FREEBSD
+  int aslr_pie;
+  uptr len = sizeof(aslr_pie);
+#if SANITIZER_WORDSIZE == 64
+  if (UNLIKELY(internal_sysctlbyname("kern.elf64.aslr.pie_enable",
+  &aslr_pie, &len, NULL, 0) == -1)) {
+// We're making things less 'dramatic' here since
+// the OID is not necessarily guaranteed to be here
+// just yet regarding FreeBSD release
+return;
+  }
+
+  if (aslr_pie > 0) {
+Printf("This sanitizer is not compatible with enabled ASLR "
+   "and binaries compiled with PIE\n");
+Die();
+  }
+#endif
+  // there might be 32 bits compat for 64 bits
+  if (UNLIKELY(internal_sysctlbyname("kern.elf32.aslr.pie_enable",
+  &aslr_pie, &len, NULL, 0) == -1)) {
+return;
+  }
+
+  if (aslr_pie > 0) {
+Printf("This sanitizer is not compatible with enabled ASLR "
+   "and binaries compiled with PIE\n");
+Die();
+  }
 #else
   // Do nothing
 #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: r351712 - vendor/clang/clang-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:13 2019
New Revision: 351712
URL: https://svnweb.freebsd.org/changeset/base/351712

Log:
  Tag clang release_90 branch r370514.

Added:
  vendor/clang/clang-release_90-r370514/
 - copied from r351711, vendor/clang/dist-release_90/
___
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: r351719 - vendor/lld/lld-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:36 2019
New Revision: 351719
URL: https://svnweb.freebsd.org/changeset/base/351719

Log:
  Tag lld release_90 branch r370514.

Added:
  vendor/lld/lld-release_90-r370514/
 - copied from r351718, vendor/lld/dist-release_90/
___
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: r351720 - vendor/lldb/lldb-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:39 2019
New Revision: 351720
URL: https://svnweb.freebsd.org/changeset/base/351720

Log:
  Tag lldb release_90 branch r370514.

Added:
  vendor/lldb/lldb-release_90-r370514/
 - copied from r351719, vendor/lldb/dist-release_90/
___
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: r351715 - vendor/libc++/dist-release_90/include

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:21 2019
New Revision: 351715
URL: https://svnweb.freebsd.org/changeset/base/351715

Log:
  Vendor import of libc++ release_90 branch r370514:
  https://llvm.org/svn/llvm-project/libcxx/branches/release_90@370514

Modified:
  vendor/libc++/dist-release_90/include/__locale
  vendor/libc++/dist-release_90/include/__threading_support

Modified: vendor/libc++/dist-release_90/include/__locale
==
--- vendor/libc++/dist-release_90/include/__locale  Mon Sep  2 17:49:19 
2019(r351714)
+++ vendor/libc++/dist-release_90/include/__locale  Mon Sep  2 17:49:21 
2019(r351715)
@@ -409,7 +409,7 @@ class _LIBCPP_TYPE_VIS ctype_base (public)
 static const mask xdigit = _ISxdigit;
 static const mask blank  = _ISblank;
 #if defined(__mips__)
-static const mask __regex_word = static_cast(_ISbit(15));
+static const mask __regex_word = static_cast(_ISbit(15));
 #else
 static const mask __regex_word = 0x80;
 #endif

Modified: vendor/libc++/dist-release_90/include/__threading_support
==
--- vendor/libc++/dist-release_90/include/__threading_support   Mon Sep  2 
17:49:19 2019(r351714)
+++ vendor/libc++/dist-release_90/include/__threading_support   Mon Sep  2 
17:49:21 2019(r351715)
@@ -23,16 +23,11 @@
 # include <__external_threading>
 #elif !defined(_LIBCPP_HAS_NO_THREADS)
 
-typedef ::timespec __libcpp_timespec_t;
-
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 # include 
 # include 
 #endif
 
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
 #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
 defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
 defined(_LIBCPP_HAS_THREAD_API_WIN32)
@@ -47,8 +42,16 @@ _LIBCPP_PUSH_MACROS
 #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
 #endif
 
+typedef ::timespec __libcpp_timespec_t;
+#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 // Mutex
 typedef pthread_mutex_t __libcpp_mutex_t;
@@ -76,7 +79,7 @@ typedef pthread_t __libcpp_thread_t;
 typedef pthread_key_t __libcpp_tls_key;
 
 #define _LIBCPP_TLS_DESTRUCTOR_CC
-#else
+#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 // Mutex
 typedef void* __libcpp_mutex_t;
 #define _LIBCPP_MUTEX_INITIALIZER 0
@@ -109,8 +112,9 @@ typedef void* __libcpp_thread_t;
 typedef long __libcpp_tls_key;
 
 #define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
-#endif
+#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && 
!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 
+#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 // Mutex
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
@@ -205,6 +209,8 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 
+#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+
 #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
  defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \
 defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
@@ -475,10 +481,10 @@ get_id() _NOEXCEPT
 
 }  // this_thread
 
+#endif // !_LIBCPP_HAS_NO_THREADS
+
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
-
-#endif // !_LIBCPP_HAS_NO_THREADS
 
 #endif // _LIBCPP_THREADING_SUPPORT
___
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: r351710 - vendor/llvm/llvm-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:06 2019
New Revision: 351710
URL: https://svnweb.freebsd.org/changeset/base/351710

Log:
  Tag llvm release_90 branch r370514.

Added:
  vendor/llvm/llvm-release_90-r370514/
 - copied from r351709, vendor/llvm/dist-release_90/
___
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: r351711 - in vendor/clang/dist-release_90: include/clang/Frontend lib/Basic/Targets lib/Headers lib/Sema

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:08 2019
New Revision: 351711
URL: https://svnweb.freebsd.org/changeset/base/351711

Log:
  Vendor import of clang release_90 branch r370514:
  https://llvm.org/svn/llvm-project/cfe/branches/release_90@370514

Modified:
  vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def
  vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cpp
  vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h
  vendor/clang/dist-release_90/lib/Headers/opencl-c.h
  vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp
  vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp
  vendor/clang/dist-release_90/lib/Sema/SemaType.cpp

Modified: vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def
==
--- vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def   
Mon Sep  2 17:49:06 2019(r351710)
+++ vendor/clang/dist-release_90/include/clang/Frontend/LangStandards.def   
Mon Sep  2 17:49:08 2019(r351711)
@@ -165,7 +165,7 @@ LANGSTANDARD(opencl12, "cl1.2",
 LANGSTANDARD(opencl20, "cl2.0",
  OpenCL, "OpenCL 2.0",
  LineComment | C99 | Digraphs | HexFloat | OpenCL)
-LANGSTANDARD(openclcpp, "c++",
+LANGSTANDARD(openclcpp, "clc++",
  OpenCL, "C++ for OpenCL",
  LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 
|
  Digraphs | HexFloat | OpenCL)

Modified: vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cpp
==
--- vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cppMon Sep  2 
17:49:06 2019(r351710)
+++ vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.cppMon Sep  2 
17:49:08 2019(r351711)
@@ -60,6 +60,10 @@ bool RISCVTargetInfo::validateAsmConstraint(
 // A floating-point register.
 Info.setAllowsRegister();
 return true;
+  case 'A':
+// An address that is held in a general-purpose register.
+Info.setAllowsMemory();
+return true;
   }
 }
 

Modified: vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h
==
--- vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h  Mon Sep  2 
17:49:06 2019(r351710)
+++ vendor/clang/dist-release_90/lib/Basic/Targets/RISCV.h  Mon Sep  2 
17:49:08 2019(r351711)
@@ -93,6 +93,13 @@ class LLVM_LIBRARY_VISIBILITY RISCV32TargetInfo : publ
 }
 return false;
   }
+
+  void setMaxAtomicWidth() override {
+MaxAtomicPromoteWidth = 128;
+
+if (HasA)
+  MaxAtomicInlineWidth = 32;
+  }
 };
 class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : public RISCVTargetInfo {
 public:
@@ -109,6 +116,13 @@ class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : publ
   return true;
 }
 return false;
+  }
+
+  void setMaxAtomicWidth() override {
+MaxAtomicPromoteWidth = 128;
+
+if (HasA)
+  MaxAtomicInlineWidth = 64;
   }
 };
 } // namespace targets

Modified: vendor/clang/dist-release_90/lib/Headers/opencl-c.h
==
--- vendor/clang/dist-release_90/lib/Headers/opencl-c.h Mon Sep  2 17:49:06 
2019(r351710)
+++ vendor/clang/dist-release_90/lib/Headers/opencl-c.h Mon Sep  2 17:49:08 
2019(r351711)
@@ -15350,7 +15350,7 @@ ndrange_t __ovld ndrange_3D(const size_t[3]);
 ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3]);
 ndrange_t __ovld ndrange_3D(const size_t[3], const size_t[3], const size_t[3]);
 
-int __ovld enqueue_marker(queue_t, uint, const __private clk_event_t*, 
__private clk_event_t*);
+int __ovld enqueue_marker(queue_t, uint, const clk_event_t*, clk_event_t*);
 
 void __ovld retain_event(clk_event_t);
 

Modified: vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp
==
--- vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp   Mon Sep  2 
17:49:06 2019(r351710)
+++ vendor/clang/dist-release_90/lib/Sema/SemaDeclCXX.cpp   Mon Sep  2 
17:49:08 2019(r351711)
@@ -1225,7 +1225,8 @@ static bool checkTupleLikeDecomposition(Sema &S,
 if (E.isInvalid())
   return true;
 RefVD->setInit(E.get());
-RefVD->checkInitIsICE();
+if (!E.get()->isValueDependent())
+  RefVD->checkInitIsICE();
 
 E = S.BuildDeclarationNameExpr(CXXScopeSpec(),
DeclarationNameInfo(B->getDeclName(), Loc),

Modified: vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp
==
--- vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp  Mon Sep  2 
17:49:06 2019(r351710)
+++ vendor/clang/dist-release_90/lib/Sema/SemaTemplate.cpp  Mon Sep  2 
17:49:08 2019(r351711)
@@ -4692,6 +4692,7 @@ SubstD

svn commit: r351721 - vendor/llvm-openmp/openmp-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:42 2019
New Revision: 351721
URL: https://svnweb.freebsd.org/changeset/base/351721

Log:
  Tag LLVM openmp release_90 branch r370514.

Added:
  vendor/llvm-openmp/openmp-release_90-r370514/
 - copied from r351720, vendor/llvm-openmp/dist-release_90/
___
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: r351717 - vendor/llvm-libunwind/libunwind-release_90-r370514

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:49:27 2019
New Revision: 351717
URL: https://svnweb.freebsd.org/changeset/base/351717

Log:
  Tag LLVM libunwind release_90 branch r370514.

Added:
  vendor/llvm-libunwind/libunwind-release_90-r370514/
 - copied from r351716, vendor/llvm-libunwind/dist-release_90/
___
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: r351709 - in vendor/llvm/dist-release_90: include/llvm/Analysis include/llvm/IR lib/Analysis lib/IR lib/Target lib/Target/AArch64 lib/Target/Mips/AsmParser lib/Target/RISCV lib/Target/X...

2019-09-02 Thread Dimitry Andric
Author: dim
Date: Mon Sep  2 17:48:59 2019
New Revision: 351709
URL: https://svnweb.freebsd.org/changeset/base/351709

Log:
  Vendor import of llvm release_90 branch r370514:
  https://llvm.org/svn/llvm-project/llvm/branches/release_90@370514

Modified:
  vendor/llvm/dist-release_90/include/llvm/Analysis/InstructionSimplify.h
  vendor/llvm/dist-release_90/include/llvm/IR/InlineAsm.h
  vendor/llvm/dist-release_90/lib/Analysis/InstructionSimplify.cpp
  vendor/llvm/dist-release_90/lib/IR/Core.cpp
  vendor/llvm/dist-release_90/lib/Target/AArch64/AArch64ISelLowering.cpp
  vendor/llvm/dist-release_90/lib/Target/AArch64/AArch64ISelLowering.h
  vendor/llvm/dist-release_90/lib/Target/AArch64/AArch64InstrInfo.cpp
  vendor/llvm/dist-release_90/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  vendor/llvm/dist-release_90/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
  vendor/llvm/dist-release_90/lib/Target/RISCV/RISCVISelLowering.cpp
  vendor/llvm/dist-release_90/lib/Target/RISCV/RISCVISelLowering.h
  vendor/llvm/dist-release_90/lib/Target/TargetMachine.cpp
  vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist-release_90/lib/Target/X86/X86ISelLowering.h
  vendor/llvm/dist-release_90/lib/Target/X86/X86Subtarget.cpp
  vendor/llvm/dist-release_90/lib/Transforms/Utils/LoopUnroll.cpp

Modified: 
vendor/llvm/dist-release_90/include/llvm/Analysis/InstructionSimplify.h
==
--- vendor/llvm/dist-release_90/include/llvm/Analysis/InstructionSimplify.h 
Mon Sep  2 17:32:57 2019(r351708)
+++ vendor/llvm/dist-release_90/include/llvm/Analysis/InstructionSimplify.h 
Mon Sep  2 17:48:59 2019(r351709)
@@ -31,6 +31,7 @@
 #ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
 #define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
 
+#include "llvm/ADT/SetVector.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/Operator.h"
 #include "llvm/IR/User.h"
@@ -263,12 +264,14 @@ Value *SimplifyInstruction(Instruction *I, const Simpl
 /// This first performs a normal RAUW of I with SimpleV. It then recursively
 /// attempts to simplify those users updated by the operation. The 'I'
 /// instruction must not be equal to the simplified value 'SimpleV'.
+/// If UnsimplifiedUsers is provided, instructions that could not be simplified
+/// are added to it.
 ///
 /// The function returns true if any simplifications were performed.
-bool replaceAndRecursivelySimplify(Instruction *I, Value *SimpleV,
-   const TargetLibraryInfo *TLI = nullptr,
-   const DominatorTree *DT = nullptr,
-   AssumptionCache *AC = nullptr);
+bool replaceAndRecursivelySimplify(
+Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI = nullptr,
+const DominatorTree *DT = nullptr, AssumptionCache *AC = nullptr,
+SmallSetVector *UnsimplifiedUsers = nullptr);
 
 /// Recursively attempt to simplify an instruction.
 ///

Modified: vendor/llvm/dist-release_90/include/llvm/IR/InlineAsm.h
==
--- vendor/llvm/dist-release_90/include/llvm/IR/InlineAsm.h Mon Sep  2 
17:32:57 2019(r351708)
+++ vendor/llvm/dist-release_90/include/llvm/IR/InlineAsm.h Mon Sep  2 
17:48:59 2019(r351709)
@@ -244,6 +244,7 @@ class InlineAsm final : public Value { (public)
 Constraint_m,
 Constraint_o,
 Constraint_v,
+Constraint_A,
 Constraint_Q,
 Constraint_R,
 Constraint_S,

Modified: vendor/llvm/dist-release_90/lib/Analysis/InstructionSimplify.cpp
==
--- vendor/llvm/dist-release_90/lib/Analysis/InstructionSimplify.cppMon Sep 
 2 17:32:57 2019(r351708)
+++ vendor/llvm/dist-release_90/lib/Analysis/InstructionSimplify.cppMon Sep 
 2 17:48:59 2019(r351709)
@@ -5221,14 +5221,16 @@ Value *llvm::SimplifyInstruction(Instruction *I, const
 /// If we have a pre-simplified value in 'SimpleV', that is forcibly used to
 /// replace the instruction 'I'. Otherwise, we simply add 'I' to the list of
 /// instructions to process and attempt to simplify it using
-/// InstructionSimplify.
+/// InstructionSimplify. Recursively visited users which could not be
+/// simplified themselves are to the optional UnsimplifiedUsers set for
+/// further processing by the caller.
 ///
 /// This routine returns 'true' only when *it* simplifies something. The passed
 /// in simplified value does not count toward this.
-static bool replaceAndRecursivelySimplifyImpl(Instruction *I, Value *SimpleV,
-  const TargetLibraryInfo *TLI,
-  const DominatorTree *DT,
-  AssumptionCache *AC) {
+static bool replaceAndRecursivelySimplifyImpl(
+Instruction *I, Value *SimpleV, const TargetLibraryI

svn commit: r351704 - head/sys/dev/nvme

2019-09-02 Thread Warner Losh
Author: imp
Date: Mon Sep  2 17:10:46 2019
New Revision: 351704
URL: https://svnweb.freebsd.org/changeset/base/351704

Log:
  Add a brief comment explaining why we can return ETIMEDOUT from the call to 
the
  polled interface. Normally this would have the potential to corrupt stack 
memory
  because the completion routines would run after we return. In this case,
  however, we're doing a dump so it's safe for reasons explained in the comment.

Modified:
  head/sys/dev/nvme/nvme_ns_cmd.c

Modified: head/sys/dev/nvme/nvme_ns_cmd.c
==
--- head/sys/dev/nvme/nvme_ns_cmd.c Mon Sep  2 16:57:42 2019
(r351703)
+++ head/sys/dev/nvme/nvme_ns_cmd.c Mon Sep  2 17:10:46 2019
(r351704)
@@ -191,6 +191,14 @@ nvme_ns_dump(struct nvme_namespace *ns, void *virt, of
nvme_qpair_process_completions(req->qpair);
}
 
+   /*
+* Normally, when using the polling interface, we can't return a
+* timeout error because we don't know when the completion routines
+* will be called if the command later completes. However, in this
+* case we're running a system dump, so all interrupts are turned
+* off, the scheduler isn't running so there's nothing to complete
+* the transaction.
+*/
if (status.done == FALSE)
return (ETIMEDOUT);
 
___
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: r351705 - head/sys/dev/nvme

2019-09-02 Thread Warner Losh
Author: imp
Date: Mon Sep  2 17:11:27 2019
New Revision: 351705
URL: https://svnweb.freebsd.org/changeset/base/351705

Log:
  In all the places that we use the polled for completion interface, except 
crash
  dump support code, move the while loop into an inline function. These aren't
  done in the fast path, so if the compiler choses to not inline, any 
performance
  hit is tiny.

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Mon Sep  2 17:10:46 2019
(r351704)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Mon Sep  2 17:11:27 2019
(r351705)
@@ -394,8 +394,7 @@ nvme_ctrlr_identify(struct nvme_controller *ctrlr)
status.done = 0;
nvme_ctrlr_cmd_identify_controller(ctrlr, &ctrlr->cdata,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_identify_controller failed!\n");
return (ENXIO);
@@ -424,8 +423,7 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrl
status.done = 0;
nvme_ctrlr_cmd_set_num_queues(ctrlr, ctrlr->num_io_queues,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_ctrlr_set_num_qpairs failed!\n");
return (ENXIO);
@@ -463,8 +461,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr
status.done = 0;
nvme_ctrlr_cmd_create_io_cq(ctrlr, qpair, qpair->vector,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_create_io_cq failed!\n");
return (ENXIO);
@@ -473,8 +470,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr
status.done = 0;
nvme_ctrlr_cmd_create_io_sq(qpair->ctrlr, qpair,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_create_io_sq failed!\n");
return (ENXIO);
@@ -496,8 +492,7 @@ nvme_ctrlr_destroy_qpairs(struct nvme_controller *ctrl
status.done = 0;
nvme_ctrlr_cmd_delete_io_sq(ctrlr, qpair,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_destroy_io_sq failed!\n");
return (ENXIO);
@@ -506,8 +501,7 @@ nvme_ctrlr_destroy_qpairs(struct nvme_controller *ctrl
status.done = 0;
nvme_ctrlr_cmd_delete_io_cq(ctrlr, qpair,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl)) {
nvme_printf(ctrlr, "nvme_destroy_io_cq failed!\n");
return (ENXIO);
@@ -789,8 +783,7 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr
status.done = 0;
nvme_ctrlr_cmd_get_feature(ctrlr, NVME_FEAT_TEMPERATURE_THRESHOLD,
0, NULL, 0, nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_int(&status.done))
-   pause("nvme", 1);
+   nvme_completion_poll(&status);
if (nvme_completion_is_error(&status.cpl) ||
(status.cpl.cdw0 & 0x) == 0x ||
(status.cpl.cdw0 & 0x) == 0x) {

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Mon Sep  2 17:10:46 2019(r351704)
+++ head/sys/dev/nvme/nvme_ns.c Mon Sep  2 17:11:27 2019(r351705)
@@ -530,8 +530,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
status.done = 0;
nvme_ctrlr_cmd_identify_namespace(ctrlr, id, &ns->data,
nvme_completion_poll_cb, &status);
-   while (!atomic_load_acq_in

svn commit: r351706 - head/sys/dev/nvme

2019-09-02 Thread Warner Losh
Author: imp
Date: Mon Sep  2 17:11:32 2019
New Revision: 351706
URL: https://svnweb.freebsd.org/changeset/base/351706

Log:
  In nvme_completion_poll, add a sanity check to make sure that we complete the
  polling within a second. Panic if we don't. All the commands that use this
  interface should typically complete within a few tens to hundreds of
  microseconds. Panic rather than return ETIMEDOUT because if the command 
somehow
  does later complete, it will randomly corrupt memory. Also, it helps to get a
  traceback from where the unexpected failure happens, rather than an infinite
  loop.

Modified:
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme_private.h
==
--- head/sys/dev/nvme/nvme_private.hMon Sep  2 17:11:27 2019
(r351705)
+++ head/sys/dev/nvme/nvme_private.hMon Sep  2 17:11:32 2019
(r351706)
@@ -446,12 +446,24 @@ int   nvme_attach(device_t dev);
 intnvme_shutdown(device_t dev);
 intnvme_detach(device_t dev);
 
+/*
+ * Wait for a command to complete using the nvme_completion_poll_cb.
+ * Used in limited contexts where the caller knows it's OK to block
+ * briefly while the command runs. The ISR will run the callback which
+ * will set status->done to true.usually within microseconds. A 1s
+ * pause means something is seriously AFU and we should panic to
+ * provide the proper context to diagnose.
+ */
 static __inline
 void
 nvme_completion_poll(struct nvme_completion_poll_status *status)
 {
-   while (!atomic_load_acq_int(&status->done))
+   int sanity = hz * 1;
+
+   while (!atomic_load_acq_int(&status->done) && --sanity > 0)
pause("nvme", 1);
+   if (sanity <= 0)
+   panic("NVME polled command failed to complete within 1s.");
 }
 
 static __inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-09-02 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Sep  2 16:57:42 2019
New Revision: 351703
URL: https://svnweb.freebsd.org/changeset/base/351703

Log:
  Relax compat.linux.osrelease checks.  This way one can do eg
  'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which
  corresponds to CentOS 7.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20685

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

Modified: head/sys/compat/linux/linux_mib.c
==
--- head/sys/compat/linux/linux_mib.c   Mon Sep  2 15:24:25 2019
(r351702)
+++ head/sys/compat/linux/linux_mib.c   Mon Sep  2 16:57:42 2019
(r351703)
@@ -146,7 +146,8 @@ linux_map_osrel(char *osrelease, int *osrel)
return (EINVAL);
osrelease = sep + 1;
v2 = strtol(osrelease, &sep, 10);
-   if (osrelease == sep || sep != eosrelease)
+   if (osrelease == sep ||
+   (sep != eosrelease && (sep + 1 >= eosrelease || *sep != '-')))
return (EINVAL);
 
v = LINUX_KERNVER(v0, v1, v2);
___
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: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation

2019-09-02 Thread Rodney W. Grimes
> 
> > On Aug 31, 2019, at 16:29, Warner Losh  wrote:
> > 
> > 
> > 
> >> On Sat, Aug 31, 2019 at 5:29 PM Conrad Meyer  wrote:
> >> Thanks Li-Wen!  Might it be less fragile to have the test fixture
> >> create a file, if the test(s) will expect one to be present to read?
> > 
> > Or just use the realpath $0, which you know has to exist :)
> 
> I don?t know if this would work, with other some of the dtrace tests are 
> called. Plus, that relies on a FreeBSD utility which doesn?t necessarily 
> exist on Linux and I don?t think exists on IllumOS.
> 
> It makes more sense to create a file with mktemp and test for it in the loop 
> to make the tests portable over to IllumOS, since that?s where they 
> originally came from and can be contributed back to.

Agreed, especially if these tests are expected to be portable the
assumption of existance of /COPYRIGHT is a mistake/bug.

> Thanks,
> -Enji
-- 
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"


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

2019-09-02 Thread Mateusz Guzik
On 9/2/19, Mark Johnston  wrote:
> On Mon, Sep 02, 2019 at 03:24:26PM +, Mateusz Guzik wrote:
>> Author: mjg
>> Date: Mon Sep  2 15:24:25 2019
>> New Revision: 351702
>> URL: https://svnweb.freebsd.org/changeset/base/351702
>>
>> Log:
>>   vfs: restore mp null check in vop_stdgetwritemount
>>
>>   The initially read mount point can already be NULL.
>>
>>   Reported by:   markj
>
> Just a correction: it was Peter that found the bug, not me.
>

Yup, apologies. Automatically credited the person who sent the e-mail.

>>   Fixes: r351656 ("vfs: stop refing freed mount points in
>> vop_stdgetwritemount")
>>   Sponsored by:  The FreeBSD Foundation
>>
>> Modified:
>>   head/sys/kern/vfs_default.c
>>
>> Modified: head/sys/kern/vfs_default.c
>> ==
>> --- head/sys/kern/vfs_default.c  Mon Sep  2 14:51:59 2019
>> (r351701)
>> +++ head/sys/kern/vfs_default.c  Mon Sep  2 15:24:25 2019
>> (r351702)
>> @@ -601,6 +601,8 @@ vop_stdgetwritemount(ap)
>>   */
>>  vp = ap->a_vp;
>>  mp = vp->v_mount;
>> +if (mp == NULL)
>> +goto out;
>>  MNT_ILOCK(mp);
>>  if (mp != vp->v_mount) {
>>  MNT_IUNLOCK(mp);
>>
>


-- 
Mateusz Guzik 
___
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: r351702 - head/sys/kern

2019-09-02 Thread Mark Johnston
On Mon, Sep 02, 2019 at 03:24:26PM +, Mateusz Guzik wrote:
> Author: mjg
> Date: Mon Sep  2 15:24:25 2019
> New Revision: 351702
> URL: https://svnweb.freebsd.org/changeset/base/351702
> 
> Log:
>   vfs: restore mp null check in vop_stdgetwritemount
>   
>   The initially read mount point can already be NULL.
>   
>   Reported by:markj

Just a correction: it was Peter that found the bug, not me.

>   Fixes: r351656 ("vfs: stop refing freed mount points in 
> vop_stdgetwritemount")
>   Sponsored by:   The FreeBSD Foundation
> 
> Modified:
>   head/sys/kern/vfs_default.c
> 
> Modified: head/sys/kern/vfs_default.c
> ==
> --- head/sys/kern/vfs_default.c   Mon Sep  2 14:51:59 2019
> (r351701)
> +++ head/sys/kern/vfs_default.c   Mon Sep  2 15:24:25 2019
> (r351702)
> @@ -601,6 +601,8 @@ vop_stdgetwritemount(ap)
>*/
>   vp = ap->a_vp;
>   mp = vp->v_mount;
> + if (mp == NULL)
> + goto out;
>   MNT_ILOCK(mp);
>   if (mp != vp->v_mount) {
>   MNT_IUNLOCK(mp);
> 
___
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: r351702 - head/sys/kern

2019-09-02 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep  2 15:24:25 2019
New Revision: 351702
URL: https://svnweb.freebsd.org/changeset/base/351702

Log:
  vfs: restore mp null check in vop_stdgetwritemount
  
  The initially read mount point can already be NULL.
  
  Reported by:  markj
  Fixes: r351656 ("vfs: stop refing freed mount points in vop_stdgetwritemount")
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Sep  2 14:51:59 2019(r351701)
+++ head/sys/kern/vfs_default.c Mon Sep  2 15:24:25 2019(r351702)
@@ -601,6 +601,8 @@ vop_stdgetwritemount(ap)
 */
vp = ap->a_vp;
mp = vp->v_mount;
+   if (mp == NULL)
+   goto out;
MNT_ILOCK(mp);
if (mp != vp->v_mount) {
MNT_IUNLOCK(mp);
___
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: r351659 - in head: contrib/libc++/include contrib/netbsd-tests/lib/libc/ssp gnu/lib/libssp include lib/libc/stdio

2019-09-02 Thread Pedro Giffuni


On 01/09/2019 22:36, Cy Schubert wrote:

In message 
, Conrad Meyer writes:

Hi Cy,

On Sun, Sep 1, 2019 at 3:23 PM Cy Schubert  wrote:

In message 
c

om>
, Conrad Meyer writes:


Short version: no, we shouldn't [recommend the use of gets_s]. :-)

Longer version:  Annex K functions like gets_s have zero real adoption
(Microsoft's APIs that inspired Annex K are not actually compatible
with the version in the standards); broadly terrible APIs; and in this
particular case and others, unnecessarily duplicate the functionality
of existing long-standing standard C functions (e.g., fgets(3)).

That's not quite true. From the man page:

  The gets_s() function is equivalent to fgets() with a stream of stdin,
  except that the newline character (if any) is not stored in the string

.

I tried to make a distinction earlier that I don't think carried well
over email.  I wrote "unnecessarily duplicate(s) the _functionality_
of existing …" — not "is/are an exact duplicate(s) of …" — because
you're right, gets_s() has (trivial) behavioral differences from
fgets(stdin).

The thing that is important to me is that fgets(3) is portable, super
well understood, and provides a superset of the functionality of
gets_s().  One can easily construct the newline-free version of a line
from one containing a trailing newline.  I don't think this slight
behavioral difference justifies implementing, using, or especially
recommending gets_s().

If Microsoft chooses to ignore or anotherfunctions is their problem.
However in this case, according to the following they do support gets_s().
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/gets-s-getw
s-s?view=vs-2019

Having said all that, glibc is the odd man out here. In that case I'll pull
back my horns. It's sufficient not to not say anything or to highlight both.

BTW. we've had gets_s(3) in our tree for 17 months now. We don't need to
add anything. It's already there.

It is an application developer choice to use one function or another.

As someone who also works on the ports side, the newline is significant
distinction. As gets_s() is closer in function to gets() than fgets() is,
all one
needs to concern oneself with is buffer length. As there are no _other_
differences nothing else needs to be addressed. This is important to ports
maintainers and who must replace gets() with something else. Agreed this
shouldn't be an issue every time but gets_s() is still in our toolbox.


(IMO, it was probably a historical mistake that gets(3) even had
different behavior than fgets(3) to begin with.  gets(3) maybe
predated stdio FILE streams?)

I totally agree.


Some apps may be sensitive to this subtle difference. gets_s() preserves
this behaviour.

Correct conversion of gets()-using programs requires more analysis
than blind replacement with either function.

That's where gets_s() is handy. It requires less analysis. Remember, my
main concern here are our ports maintainers. Upstream developers should
always do analysis. It's not the job of the ports team to perform
significant rewrites of upstream software. IMO, if upsteam software needs
significant rewrite a port maintainer should notify the upstream
maintainer. If the upstream cannot or will not, requiring a maintainer of a
port to make significant changes, DEPRECATED= and EXPIRATION_DATE= are the
best answer. We are not here to rewrite other people's software for them.


Anyway, gets() use is largely behind us so the point is mostly moot —
there are few such programs to convert, and they should be viewed with
an extremely high level of skepticism given they are still using
gets(3) in 2019.

I'm not arguing for keeping gets(3). We already have gets_s(3). Let's use
it where it makes sense. Nor am I saying to use it in exclusion of
fgets(3). It (gets_s()) is in our libc. If it eases the job of maintaining
a port, use it instead.


[Annex K functions] are part of the
standard

They're an optional part of the standard.  Everyone takes the option
of "not."  Literally no one implements Annex K.  It's a bad set of
APIs.

Microsoft and we have chosen to implement some Annex K functions. We
haven't implemented all of them. I don't know if they implemented all _s
functions. Linux glibc has not.

I don't agree that it's a completely bad set of APIs. gets_s() will help
ports maintainers. AFAIK, no ports rely on gets() but that's not to say
some new port might not. Don't forget, my motivation for implementing
gets_s(3) in libc was to ease the pain of deprecating gets() for ports.


and though we support some _s functions it would behoove us to one
day (*) support them all.

If and when the C standard committee adopts Annex K as a required part
of the standard, then I agree we should make every attempt to support
the full standard library.  But in general, I am opposed to the
further adoption of Annex K, and hope the C2x standard committee
finally drops the annex.[1]  (It is weakly defended[2], just to
provide a countera

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

2019-09-02 Thread Johannes Lundberg
Author: johalun
Date: Mon Sep  2 14:51:59 2019
New Revision: 351701
URL: https://svnweb.freebsd.org/changeset/base/351701

Log:
  LinuxKPI: Add sysfs create/remove functions that handles multiple files in 
one call.
  
  Reviewed by:  hps
  Approved by:  imp (mentor), hps
  MFC after:1 week
  Differential Revision:D21475

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

Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h
==
--- head/sys/compat/linuxkpi/common/include/linux/sysfs.h   Mon Sep  2 
13:56:44 2019(r351700)
+++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h   Mon Sep  2 
14:51:59 2019(r351701)
@@ -152,6 +152,29 @@ sysfs_remove_file(struct kobject *kobj, const struct a
sysctl_remove_name(kobj->oidp, attr->name, 1, 1);
 }
 
+static inline int
+sysfs_create_files(struct kobject *kobj, const struct attribute * const *attrs)
+{
+   int error = 0;
+   int i;
+
+   for (i = 0; attrs[i] && !error; i++)
+   error = sysfs_create_file(kobj, attrs[i]);
+   while (error && --i >= 0)
+   sysfs_remove_file(kobj, attrs[i]);
+
+   return (error);
+}
+
+static inline void
+sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attrs)
+{
+   int i;
+
+   for (i = 0; attrs[i]; i++)
+   sysfs_remove_file(kobj, attrs[i]);
+}
+
 static inline void
 sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp)
 {

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Sep  2 13:56:44 2019(r351700)
+++ head/sys/sys/param.hMon Sep  2 14:51:59 2019(r351701)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300043  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300044  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r351700 - head/lib/libc/string

2019-09-02 Thread Ed Maste
Author: emaste
Date: Mon Sep  2 13:56:44 2019
New Revision: 351700
URL: https://svnweb.freebsd.org/changeset/base/351700

Log:
  libc: Use musl's optimized memchr
  
  Parentheses added to HASZERO macro to avoid a GCC warning.
  
  Reviewed by:  kib, mjg
  Obtained from:musl (snapshot at commit 4d0a82170a)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D17631

Modified:
  head/lib/libc/string/memchr.c

Modified: head/lib/libc/string/memchr.c
==
--- head/lib/libc/string/memchr.c   Mon Sep  2 13:55:31 2019
(r351699)
+++ head/lib/libc/string/memchr.c   Mon Sep  2 13:56:44 2019
(r351700)
@@ -1,55 +1,54 @@
 /*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: MIT
  *
- * Copyright (c) 1990, 1993
- * The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 2005-2014 Rich Felker, et al.
  *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
  *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
  *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)memchr.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
+#include 
 
-void *
-memchr(const void *s, int c, size_t n)
-{
-   if (n != 0) {
-   const unsigned char *p = s;
+#define SS (sizeof(size_t))
+#define ALIGN (sizeof(size_t)-1)
+#define ONES ((size_t)-1/UCHAR_MAX)
+#define HIGHS (ONES * (UCHAR_MAX/2+1))
+#define HASZERO(x) (((x)-ONES) & ~(x) & HIGHS)
 
-   do {
-   if (*p++ == (unsigned char)c)
-   return ((void *)(p - 1));
-   } while (--n != 0);
+void *memchr(const void *src, int c, size_t n)
+{
+   const unsigned char *s = src;
+   c = (unsigned char)c;
+#ifdef __GNUC__
+   for (; ((uintptr_t)s & ALIGN) && n && *s != c; s++, n--);
+   if (n && *s != c) {
+   typedef size_t __attribute__((__may_alias__)) word;
+   const word *w;
+   size_t k = ONES * c;
+   for (w = (const void *)s; n>=SS && !HASZERO(*w^k); w++, n-=SS);
+   s = (const void *)w;
}
-   return (NULL);
+#endif
+   for (; n && *s != c; s++, n--);
+   return n ? (void *)s : 0;
 }
__

svn commit: r351699 - head/lib/libutil

2019-09-02 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep  2 13:55:31 2019
New Revision: 351699
URL: https://svnweb.freebsd.org/changeset/base/351699

Log:
  libutil: remove SIGSYS handling from setusercontext
  
  It was a workaround for cases where the kernel lacks setloginclass(2),
  added in the 9.x era.
  
  Submitted by: Pawel Biernacki

Modified:
  head/lib/libutil/login_class.c

Modified: head/lib/libutil/login_class.c
==
--- head/lib/libutil/login_class.c  Mon Sep  2 12:48:18 2019
(r351698)
+++ head/lib/libutil/login_class.c  Mon Sep  2 13:55:31 2019
(r351699)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -428,7 +427,6 @@ setusercontext(login_cap_t *lc, const struct passwd *p
 rlim_t p;
 mode_t mymask;
 login_cap_t *llc = NULL;
-struct sigaction sa, prevsa;
 struct rtprio rtp;
 int error;
 
@@ -521,16 +519,7 @@ setusercontext(login_cap_t *lc, const struct passwd *p
 
 /* Inform the kernel about current login class */
 if (lc != NULL && lc->lc_class != NULL && (flags & LOGIN_SETLOGINCLASS)) {
-   /*
-* XXX: This is a workaround to fail gracefully in case the kernel
-*  does not support setloginclass(2).
-*/
-   bzero(&sa, sizeof(sa));
-   sa.sa_handler = SIG_IGN;
-   sigfillset(&sa.sa_mask);
-   sigaction(SIGSYS, &sa, &prevsa);
error = setloginclass(lc->lc_class);
-   sigaction(SIGSYS, &prevsa, NULL);
if (error != 0) {
syslog(LOG_ERR, "setloginclass(%s): %m", lc->lc_class);
 #ifdef notyet
___
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: r351698 - head/sys/sys

2019-09-02 Thread Ed Maste
Author: emaste
Date: Mon Sep  2 12:48:18 2019
New Revision: 351698
URL: https://svnweb.freebsd.org/changeset/base/351698

Log:
  Belatedly bump __FreeBSD_version for r351659, gets(3) removal
  
  Reported by:  linimon

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Sep  2 12:46:43 2019(r351697)
+++ head/sys/sys/param.hMon Sep  2 12:48:18 2019(r351698)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300042  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300043  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r351697 - head/sys/kern

2019-09-02 Thread Mateusz Guzik
Author: mjg
Date: Mon Sep  2 12:46:43 2019
New Revision: 351697
URL: https://svnweb.freebsd.org/changeset/base/351697

Log:
  proc: clear pid bitmap entry after dropping proctree lock
  
  There is no correctness change here, but the procid lock is contended in
  the fork path and taking it while holding proctree avoidably extends its
  hold time.
  
  Note that there are other ids which can end up getting cleared with the
  lock.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Mon Sep  2 11:04:17 2019(r351696)
+++ head/sys/kern/kern_exit.c   Mon Sep  2 12:46:43 2019(r351697)
@@ -906,7 +906,6 @@ proc_reap(struct thread *td, struct proc *p, int *stat
LIST_REMOVE(p, p_sibling);
reaper_abandon_children(p, true);
reaper_clear(p);
-   proc_id_clear(PROC_ID_PID, p->p_pid);
PROC_LOCK(p);
proc_clear_orphan(p);
PROC_UNLOCK(p);
@@ -914,6 +913,8 @@ proc_reap(struct thread *td, struct proc *p, int *stat
if (p->p_procdesc != NULL)
procdesc_reap(p);
sx_xunlock(&proctree_lock);
+
+   proc_id_clear(PROC_ID_PID, p->p_pid);
 
PROC_LOCK(p);
knlist_detach(p->p_klist);
___
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: r351696 - head/stand/efi/libefi

2019-09-02 Thread Toomas Soome
Author: tsoome
Date: Mon Sep  2 11:04:17 2019
New Revision: 351696
URL: https://svnweb.freebsd.org/changeset/base/351696

Log:
  loader.efi: use and prefer coninex interface
  
  Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Modified:
  head/stand/efi/libefi/efi_console.c

Modified: head/stand/efi/libefi/efi_console.c
==
--- head/stand/efi/libefi/efi_console.c Mon Sep  2 10:45:10 2019
(r351695)
+++ head/stand/efi/libefi/efi_console.c Mon Sep  2 11:04:17 2019
(r351696)
@@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
+static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
 static SIMPLE_TEXT_OUTPUT_INTERFACE*conout;
 static SIMPLE_INPUT_INTERFACE  *conin;
+static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex;
 
 #ifdef TERM_EMU
 #defineDEFAULT_FGCOLOR EFI_LIGHTGRAY
@@ -115,6 +117,8 @@ efi_cons_probe(struct console *cp)
 static int
 efi_cons_init(int arg)
 {
+   EFI_STATUS status;
+
 #ifdef TERM_EMU
conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR,
DEFAULT_BGCOLOR));
@@ -125,7 +129,11 @@ efi_cons_init(int arg)
bg_c = DEFAULT_BGCOLOR;
 #endif
conout->EnableCursor(conout, TRUE);
-   return 0;
+   status = BS->OpenProtocol(ST->ConsoleInHandle, &simple_input_ex_guid,
+   (void **)&coninex, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+   if (status != EFI_SUCCESS)
+   coninex = NULL;
+   return (0);
 }
 
 static void
@@ -524,6 +532,40 @@ efi_readkey(void)
return (false);
 }
 
+static bool
+efi_readkey_ex(void)
+{
+   EFI_STATUS status;
+   EFI_INPUT_KEY *kp;
+   EFI_KEY_DATA  key_data;
+   uint32_t kss;
+
+   status = coninex->ReadKeyStrokeEx(coninex, &key_data);
+   if (status == EFI_SUCCESS) {
+   kss = key_data.KeyState.KeyShiftState;
+   kp = &key_data.Key;
+   if (kss & EFI_SHIFT_STATE_VALID) {
+
+   /*
+* quick mapping to control chars, replace with
+* map lookup later.
+*/
+   if (kss & EFI_RIGHT_CONTROL_PRESSED ||
+   kss & EFI_LEFT_CONTROL_PRESSED) {
+   if (kp->UnicodeChar >= 'a' &&
+   kp->UnicodeChar <= 'z') {
+   kp->UnicodeChar -= 'a';
+   kp->UnicodeChar++;
+   }
+   }
+   }
+
+   keybuf_inschar(kp);
+   return (true);
+   }
+   return (false);
+}
+
 int
 efi_cons_getchar(void)
 {
@@ -534,8 +576,13 @@ efi_cons_getchar(void)
 
key_pending = 0;
 
-   if (efi_readkey())
-   return (keybuf_getchar());
+   if (coninex == NULL) {
+   if (efi_readkey())
+   return (keybuf_getchar());
+   } else {
+   if (efi_readkey_ex())
+   return (keybuf_getchar());
+   }
 
return (-1);
 }
@@ -543,6 +590,7 @@ efi_cons_getchar(void)
 int
 efi_cons_poll(void)
 {
+   EFI_STATUS status;
 
if (keybuf_ischar() || key_pending)
return (1);
@@ -552,10 +600,21 @@ efi_cons_poll(void)
 * WaitForKey().
 * CheckEvent() can clear the signaled state.
 */
-   if (conin->WaitForKey == NULL)
-   key_pending = efi_readkey();
-   else
-   key_pending = BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS;
+   if (coninex != NULL) {
+   if (coninex->WaitForKeyEx == NULL) {
+   key_pending = efi_readkey_ex();
+   } else {
+   status = BS->CheckEvent(coninex->WaitForKeyEx);
+   key_pending = status == EFI_SUCCESS;
+   }
+   } else {
+   if (conin->WaitForKey == NULL) {
+   key_pending = efi_readkey();
+   } else {
+   status = BS->CheckEvent(conin->WaitForKey);
+   key_pending = status == EFI_SUCCESS;
+   }
+   }
 
return (key_pending);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351695 - head/stand/efi/libefi

2019-09-02 Thread Toomas Soome
Author: tsoome
Date: Mon Sep  2 10:45:10 2019
New Revision: 351695
URL: https://svnweb.freebsd.org/changeset/base/351695

Log:
  loader.efi: some systems do not translate scan code 0x8 to backspace
  
  Add scancode translation for backspace.

Modified:
  head/stand/efi/libefi/efi_console.c

Modified: head/stand/efi/libefi/efi_console.c
==
--- head/stand/efi/libefi/efi_console.c Mon Sep  2 10:20:57 2019
(r351694)
+++ head/stand/efi/libefi/efi_console.c Mon Sep  2 10:45:10 2019
(r351695)
@@ -478,27 +478,30 @@ keybuf_inschar(EFI_INPUT_KEY *key)
 {
 
switch (key->ScanCode) {
-   case 0x1: /* UP */
+   case SCAN_UP: /* UP */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'A';
break;
-   case 0x2: /* DOWN */
+   case SCAN_DOWN: /* DOWN */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'B';
break;
-   case 0x3: /* RIGHT */
+   case SCAN_RIGHT: /* RIGHT */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'C';
break;
-   case 0x4: /* LEFT */
+   case SCAN_LEFT: /* LEFT */
keybuf[0] = 0x1b;   /* esc */
keybuf[1] = '[';
keybuf[2] = 'D';
break;
-   case 0x17:
+   case SCAN_DELETE:
+   keybuf[0] = CHAR_BACKSPACE;
+   break;
+   case SCAN_ESC:
keybuf[0] = 0x1b;   /* esc */
break;
default:
___
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: r351694 - in stable/11: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Konstantin Belousov
Author: kib
Date: Mon Sep  2 10:20:57 2019
New Revision: 351694
URL: https://svnweb.freebsd.org/changeset/base/351694

Log:
  MFC r350957:
  Increase YPMAXRECORD to 16M to be compatible with Linux.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/include/rpcsvc/yp.x
  stable/11/include/rpcsvc/yp_prot.h
  stable/11/include/rpcsvc/ypxfrd.x
  stable/11/lib/libc/net/gethostbynis.c
  stable/11/lib/libc/net/getnetbynis.c
  stable/11/lib/libc/net/getservent.c
  stable/11/lib/libc/rpc/getrpcent.c
  stable/11/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
  stable/11/usr.sbin/rpc.ypupdated/yp_dbupdate.c
  stable/11/usr.sbin/ypldap/yp.c
  stable/11/usr.sbin/yppush/yppush_main.c
  stable/11/usr.sbin/ypserv/yp_server.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/include/rpcsvc/yp.x
==
--- stable/11/include/rpcsvc/yp.x   Mon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/include/rpcsvc/yp.x   Mon Sep  2 10:20:57 2019
(r351694)
@@ -40,7 +40,7 @@
 %__FBSDID("$FreeBSD$");
 #endif
 
-const YPMAXRECORD = 1024;
+const YPMAXRECORD = 16777216;
 const YPMAXDOMAIN = 64;
 const YPMAXMAP = 64;
 const YPMAXPEER = 64;

Modified: stable/11/include/rpcsvc/yp_prot.h
==
--- stable/11/include/rpcsvc/yp_prot.h  Mon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/include/rpcsvc/yp_prot.h  Mon Sep  2 10:20:57 2019
(r351694)
@@ -77,7 +77,7 @@ typedef u_int bool;
 #define YPPROG ((u_long)14)
 #define YPVERS ((u_long)2)
 #define YPVERS_ORIG((u_long)1)
-#define YPMAXRECORD((u_long)1024)
+#define YPMAXRECORD((u_long)16 * 1024 * 1024)
 #define YPMAXDOMAIN((u_long)64)
 #define YPMAXMAP   ((u_long)64)
 #define YPMAXPEER  ((u_long)256)

Modified: stable/11/include/rpcsvc/ypxfrd.x
==
--- stable/11/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/include/rpcsvc/ypxfrd.x   Mon Sep  2 10:20:57 2019
(r351694)
@@ -70,7 +70,7 @@
 #endif
 
 /* XXX cribbed from yp.x */
-const _YPMAXRECORD = 1024;
+const _YPMAXRECORD = 16777216;
 const _YPMAXDOMAIN = 64;
 const _YPMAXMAP = 64;
 const _YPMAXPEER = 64;

Modified: stable/11/lib/libc/net/gethostbynis.c
==
--- stable/11/lib/libc/net/gethostbynis.c   Mon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/lib/libc/net/gethostbynis.c   Mon Sep  2 10:20:57 2019
(r351694)
@@ -56,7 +56,7 @@ _gethostbynis(const char *name, char *map, int af, str
char *cp, **q;
char *result;
int resultlen, size, addrok = 0;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
res_state statp;
 
statp = __res_state();
@@ -86,10 +86,11 @@ _gethostbynis(const char *name, char *map, int af, str
}
 
/* avoid potential memory leak */
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;
 
if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/11/lib/libc/net/getnetbynis.c
==
--- stable/11/lib/libc/net/getnetbynis.cMon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/lib/libc/net/getnetbynis.cMon Sep  2 10:20:57 2019
(r351694)
@@ -56,7 +56,7 @@ _getnetbynis(const char *name, char *map, int af, stru
char *cp, **q;
char *result;
int resultlen, len;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
 
switch(af) {
case AF_INET:
@@ -75,10 +75,11 @@ _getnetbynis(const char *name, char *map, int af, stru
&resultlen))
return (-1);
 
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;
 
if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/11/lib/libc/net/getservent.c
==
--- stable/11/lib/libc/net/getservent.c Mon Sep  2 08:34:45 2019
(r351693)
+++ stable/11/lib/libc/net/getservent.c Mon Sep  2 10:20:57 2019
(r351694)
@@ -662,7 +662,7 @@ nis_servent(void *retval, void *mdata, va_list ap)
 {
char *resultbuf, *lastkey;
int resultbuflen;
-   char buf[YPMAXRECORD + 2];
+   char *buf;
 
struct nis_state *st;
int rv;
@@ -679,6 +679,7 @@ nis_servent(void *retval, void *md

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

2019-09-02 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep  2 08:34:45 2019
New Revision: 351693
URL: https://svnweb.freebsd.org/changeset/base/351693

Log:
  Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the 
LinuxKPI.
  This fixes system hangs on reading device registers on aarch64.
  
  Tested with:  Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu
  Submitted by: Greg V 
  Differential Revision:https://reviews.freebsd.org/D20789
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/io.h
==
--- head/sys/compat/linuxkpi/common/include/linux/io.h  Mon Sep  2 08:31:18 
2019(r351692)
+++ head/sys/compat/linuxkpi/common/include/linux/io.h  Mon Sep  2 08:34:45 
2019(r351693)
@@ -396,16 +396,25 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned lon
 #define_ioremap_attr(...) NULL
 #endif
 
+#ifdef VM_MEMATTR_DEVICE
 #defineioremap_nocache(addr, size) 
\
+_ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#defineioremap_wt(addr, size)  
\
+_ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#defineioremap(addr, size) 
\
+_ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#else
+#defineioremap_nocache(addr, size) 
\
 _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
-#defineioremap_wc(addr, size)  
\
-_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
-#defineioremap_wb(addr, size)  
\
-_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
 #defineioremap_wt(addr, size)  
\
 _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_THROUGH)
 #defineioremap(addr, size) 
\
 _ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
+#endif
+#defineioremap_wc(addr, size)  
\
+_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
+#defineioremap_wb(addr, size)  
\
+_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
 void iounmap(void *addr);
 
 #definememset_io(a, b, c)  memset((a), (b), (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"


Re: svn commit: r351616 - head/sys/dev/usb/net

2019-09-02 Thread Hans Petter Selasky

On 2019-09-02 02:29, Oleksandr Tymoshenko wrote:

Gleb Smirnoff (gleb...@freebsd.org) wrote:

Author: glebius
Date: Fri Aug 30 00:05:04 2019
New Revision: 351616
URL: https://svnweb.freebsd.org/changeset/base/351616

Log:
   Use mbuf queue instead of ifqueue in USB network drivers.


Hi Gleb,

This change broke NFS root on RPi. I suspect it's not just NFS root
but USB ethernet functionality in general. Patch below fixes it for me.
The same patch probably should also be applied to if_axe and if_axge.



Hi,

1) axe and axge use the common code, so no patch needed there from what 
I can see.


2) This queue should be unlimited.

See:
https://svnweb.freebsd.org/changeset/base/351692

--HPS
___
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: r351692 - head/sys/dev/usb/net

2019-09-02 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep  2 08:31:18 2019
New Revision: 351692
URL: https://svnweb.freebsd.org/changeset/base/351692

Log:
  Fix regression issue after r351616. Make sure the mbuf queue gets initialized.
  
  Found by: gonzo@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/net/usb_ethernet.c

Modified: head/sys/dev/usb/net/usb_ethernet.c
==
--- head/sys/dev/usb/net/usb_ethernet.c Mon Sep  2 08:20:02 2019
(r351691)
+++ head/sys/dev/usb/net/usb_ethernet.c Mon Sep  2 08:31:18 2019
(r351692)
@@ -219,6 +219,7 @@ ue_attach_post_task(struct usb_proc_msg *_task)
ue->ue_unit = alloc_unr(ueunit);
usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0);
sysctl_ctx_init(&ue->ue_sysctl_ctx);
+   mbufq_init(&ue->ue_rxq, 0 /* unlimited length */);
 
error = 0;
CURVNET_SET_QUIET(vnet0);
@@ -284,6 +285,11 @@ ue_attach_post_task(struct usb_proc_msg *_task)
 
 fail:
CURVNET_RESTORE();
+
+   /* drain mbuf queue */
+   mbufq_drain(&ue->ue_rxq);
+
+   /* free unit */
free_unr(ueunit, ue->ue_unit);
if (ue->ue_ifp != NULL) {
if_free(ue->ue_ifp);
@@ -329,6 +335,9 @@ uether_ifdetach(struct usb_ether *ue)
 
/* free sysctl */
sysctl_ctx_free(&ue->ue_sysctl_ctx);
+
+   /* drain mbuf queue */
+   mbufq_drain(&ue->ue_rxq);
 
/* free unit */
free_unr(ueunit, ue->ue_unit);
___
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: r351691 - in stable/12: include/rpcsvc lib/libc/net lib/libc/rpc usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/ypldap usr.sbin/yppush usr.sbin/ypserv

2019-09-02 Thread Konstantin Belousov
Author: kib
Date: Mon Sep  2 08:20:02 2019
New Revision: 351691
URL: https://svnweb.freebsd.org/changeset/base/351691

Log:
  MFC r350957:
  Increase YPMAXRECORD to 16M to be compatible with Linux.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/include/rpcsvc/yp.x
  stable/12/include/rpcsvc/yp_prot.h
  stable/12/include/rpcsvc/ypxfrd.x
  stable/12/lib/libc/net/gethostbynis.c
  stable/12/lib/libc/net/getnetbynis.c
  stable/12/lib/libc/net/getservent.c
  stable/12/lib/libc/rpc/getrpcent.c
  stable/12/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
  stable/12/usr.sbin/rpc.ypupdated/yp_dbupdate.c
  stable/12/usr.sbin/ypldap/yp.c
  stable/12/usr.sbin/yppush/yppush_main.c
  stable/12/usr.sbin/ypserv/yp_server.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/include/rpcsvc/yp.x
==
--- stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -40,7 +40,7 @@
 %__FBSDID("$FreeBSD$");
 #endif
 
-const YPMAXRECORD = 1024;
+const YPMAXRECORD = 16777216;
 const YPMAXDOMAIN = 64;
 const YPMAXMAP = 64;
 const YPMAXPEER = 64;

Modified: stable/12/include/rpcsvc/yp_prot.h
==
--- stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/yp_prot.h  Mon Sep  2 08:20:02 2019
(r351691)
@@ -79,7 +79,7 @@ typedef u_int bool;
 #define YPPROG ((u_long)14)
 #define YPVERS ((u_long)2)
 #define YPVERS_ORIG((u_long)1)
-#define YPMAXRECORD((u_long)1024)
+#define YPMAXRECORD((u_long)16 * 1024 * 1024)
 #define YPMAXDOMAIN((u_long)64)
 #define YPMAXMAP   ((u_long)64)
 #define YPMAXPEER  ((u_long)256)

Modified: stable/12/include/rpcsvc/ypxfrd.x
==
--- stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/include/rpcsvc/ypxfrd.x   Mon Sep  2 08:20:02 2019
(r351691)
@@ -70,7 +70,7 @@
 #endif
 
 /* XXX cribbed from yp.x */
-const _YPMAXRECORD = 1024;
+const _YPMAXRECORD = 16777216;
 const _YPMAXDOMAIN = 64;
 const _YPMAXMAP = 64;
 const _YPMAXPEER = 64;

Modified: stable/12/lib/libc/net/gethostbynis.c
==
--- stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/gethostbynis.c   Mon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _gethostbynis(const char *name, char *map, int af, str
char *cp, **q;
char *result;
int resultlen, size, addrok = 0;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
res_state statp;
 
statp = __res_state();
@@ -88,10 +88,11 @@ _gethostbynis(const char *name, char *map, int af, str
}
 
/* avoid potential memory leak */
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;
 
if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/12/lib/libc/net/getnetbynis.c
==
--- stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/getnetbynis.cMon Sep  2 08:20:02 2019
(r351691)
@@ -58,7 +58,7 @@ _getnetbynis(const char *name, char *map, int af, stru
char *cp, **q;
char *result;
int resultlen, len;
-   char ypbuf[YPMAXRECORD + 2];
+   char *ypbuf;
 
switch(af) {
case AF_INET:
@@ -77,10 +77,11 @@ _getnetbynis(const char *name, char *map, int af, stru
&resultlen))
return (-1);
 
-   bcopy((char *)result, (char *)&ypbuf, resultlen);
+   ypbuf = alloca(resultlen + 2);
+   bcopy(result, ypbuf, resultlen);
ypbuf[resultlen] = '\0';
free(result);
-   result = (char *)&ypbuf;
+   result = ypbuf;
 
if ((cp = strchr(result, '\n')))
*cp = '\0';

Modified: stable/12/lib/libc/net/getservent.c
==
--- stable/12/lib/libc/net/getservent.c Mon Sep  2 08:03:29 2019
(r351690)
+++ stable/12/lib/libc/net/getservent.c Mon Sep  2 08:20:02 2019
(r351691)
@@ -664,7 +664,7 @@ nis_servent(void *retval, void *mdata, va_list ap)
 {
char *resultbuf, *lastkey;
int resultbuflen;
-   char buf[YPMAXRECORD + 2];
+   char *buf;
 
struct nis_state *st;
int rv;
@@ -681,6 +681,7 @@ nis_servent(void *retval, void *md

svn commit: r351690 - head/libexec/rtld-elf

2019-09-02 Thread Brooks Davis
Author: brooks
Date: Mon Sep  2 08:03:29 2019
New Revision: 351690
URL: https://svnweb.freebsd.org/changeset/base/351690

Log:
  Remove remnants of optimization for > pagesize allocations.
  
  In the past, this allocator seems to have allocated things larger than
  a page seperately. Much of this code was removed at some point (perhaps
  along with sbrk() used) so remove the rest. Instead, keep allocating in
  power-of-two bins up to FIRST_BUCKET_SIZE << (NBUCKETS - 1). If we want
  something more efficent, we should use a fancier allocator.
  
  While here, remove some vestages of sbrk() use. Most importantly, don't
  try to page align the pagepool since it's always page aligned by mmap().
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D21453

Modified:
  head/libexec/rtld-elf/rtld_malloc.c

Modified: head/libexec/rtld-elf/rtld_malloc.c
==
--- head/libexec/rtld-elf/rtld_malloc.c Mon Sep  2 08:02:55 2019
(r351689)
+++ head/libexec/rtld-elf/rtld_malloc.c Mon Sep  2 08:03:29 2019
(r351690)
@@ -89,15 +89,15 @@ static int morepages(int n);
 #defineMAGIC   0xef/* magic # on accounting info */
 
 /*
- * nextf[i] is the pointer to the next free block of size 2^(i+3).  The
- * smallest allocatable block is 8 bytes.  The overhead information
- * precedes the data area returned to the user.
+ * nextf[i] is the pointer to the next free block of size
+ * (FIRST_BUCKET_SIZE << i).  The overhead information precedes the data
+ * area returned to the user.
  */
+#defineFIRST_BUCKET_SIZE   8
 #defineNBUCKETS 30
 static union overhead *nextf[NBUCKETS];
 
 static int pagesz; /* page size */
-static int pagebucket; /* page size bucket */
 
 /*
  * The array of supported page sizes is provided by the user, i.e., the
@@ -112,50 +112,25 @@ __crt_malloc(size_t nbytes)
 {
union overhead *op;
int bucket;
-   ssize_t n;
size_t amt;
 
/*
-* First time malloc is called, setup page size and
-* align break pointer so all data will be page aligned.
+* First time malloc is called, setup page size.
 */
-   if (pagesz == 0) {
-   pagesz = n = pagesizes[0];
-   if (morepages(NPOOLPAGES) == 0)
-   return NULL;
-   op = (union overhead *)(pagepool_start);
-   n = n - sizeof (*op) - ((long)op & (n - 1));
-   if (n < 0)
-   n += pagesz;
-   if (n) {
-   pagepool_start += n;
-   }
-   bucket = 0;
-   amt = 8;
-   while ((unsigned)pagesz > amt) {
-   amt <<= 1;
-   bucket++;
-   }
-   pagebucket = bucket;
-   }
+   if (pagesz == 0)
+   pagesz = pagesizes[0];
/*
 * Convert amount of memory requested into closest block size
 * stored in hash buckets which satisfies request.
 * Account for space used per block for accounting.
 */
-   if (nbytes <= (unsigned long)(n = pagesz - sizeof(*op))) {
-   amt = 8;/* size of first bucket */
-   bucket = 0;
-   n = -sizeof(*op);
-   } else {
-   amt = pagesz;
-   bucket = pagebucket;
-   }
-   while (nbytes > amt + n) {
+   amt = FIRST_BUCKET_SIZE;
+   bucket = 0;
+   while (nbytes > amt - sizeof(*op)) {
amt <<= 1;
-   if (amt == 0)
-   return (NULL);
bucket++;
+   if (amt == 0 || bucket >= NBUCKETS)
+   return (NULL);
}
/*
 * If nothing in hash bucket right now,
@@ -200,18 +175,12 @@ morecore(int bucket)
int amt;/* amount to allocate */
int nblks;  /* how many blocks we get */
 
-   /*
-* sbrk_size <= 0 only for big, FLUFFY, requests (about
-* 2^30 bytes on a VAX, I think) or for a negative arg.
-*/
-   if ((unsigned)bucket >= NBBY * sizeof(int) - 4)
-   return;
-   sz = 1 << (bucket + 3);
+   sz = FIRST_BUCKET_SIZE << bucket;
if (sz < pagesz) {
amt = pagesz;
nblks = amt / sz;
} else {
-   amt = sz + pagesz;
+   amt = sz;
nblks = 1;
}
if (amt > pagepool_end - pagepool_start)
___
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"