svn commit: r368500 - head/usr.bin/truss

2020-12-09 Thread Thomas Munro
Author: tmunro
Date: Thu Dec 10 07:13:15 2020
New Revision: 368500
URL: https://svnweb.freebsd.org/changeset/base/368500

Log:
  truss: Add AIO syscalls.
  
  Display the arguments of aio_read(2), aio_write(2), aio_suspend(2),
  aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2),
  aio_waitcomplete(2) and lio_listio(2) in human-readable form.
  
  Reviewed by:  asomers
  Differential Revision:https://reviews.freebsd.org/D27518

Modified:
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscall.h
==
--- head/usr.bin/truss/syscall.hThu Dec 10 05:50:45 2020
(r368499)
+++ head/usr.bin/truss/syscall.hThu Dec 10 07:13:15 2020
(r368500)
@@ -87,6 +87,7 @@ enum Argtype {
/* Encoded scalar values. */
Accessmode,
Acltype,
+   AiofsyncOp,
Atfd,
Atflags,
CapFcntlRights,
@@ -101,6 +102,7 @@ enum Argtype {
Ioctl,
Kldsymcmd,
Kldunloadflags,
+   LioMode,
Madvice,
Minherit,
Msgflags,
@@ -139,6 +141,8 @@ enum Argtype {
 
/* Pointers to non-structures. */
Ptr,
+   AiocbArray,
+   AiocbPointer,
BinString,
CapRights,
ExecArgs,
@@ -157,6 +161,7 @@ enum Argtype {
StringArray,
 
/* Pointers to structures. */
+   Aiocb,
Itimerval,
Kevent,
Kevent11,
@@ -168,6 +173,7 @@ enum Argtype {
Schedparam,
Sctpsndrcvinfo,
Sigaction,
+   Sigevent,
Siginfo,
Sigset,
Sockaddr,

Modified: head/usr.bin/truss/syscalls.c
==
--- head/usr.bin/truss/syscalls.c   Thu Dec 10 05:50:45 2020
(r368499)
+++ head/usr.bin/truss/syscalls.c   Thu Dec 10 07:13:15 2020
(r368500)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
  * arguments.
  */
 
+#include 
 #include 
 #include 
 #define_WANT_FREEBSD11_KEVENT
@@ -125,6 +126,24 @@ static struct syscall decoded_syscalls[] = {
  .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
{ .name = "access", .ret_type = 1, .nargs = 2,
  .args = { { Name | IN, 0 }, { Accessmode, 1 } } },
+   { .name = "aio_cancel", .ret_type = 1, .nargs = 2,
+ .args = { { Int, 0 }, { Aiocb, 1 } } },
+   { .name = "aio_error", .ret_type = 1, .nargs = 1,
+ .args = { { Aiocb, 0 } } },
+   { .name = "aio_fsync", .ret_type = 1, .nargs = 2,
+ .args = { { AiofsyncOp, 0 }, { Aiocb, 1 } } },
+   { .name = "aio_mlock", .ret_type = 1, .nargs = 1,
+ .args = { { Aiocb, 0 } } },
+   { .name = "aio_read", .ret_type = 1, .nargs = 1,
+ .args = { { Aiocb, 0 } } },
+   { .name = "aio_return", .ret_type = 1, .nargs = 1,
+ .args = { { Aiocb, 0 } } },
+   { .name = "aio_suspend", .ret_type = 1, .nargs = 3,
+ .args = { { AiocbArray, 0 }, { Int, 1 }, { Timespec, 2 } } },
+   { .name = "aio_waitcomplete", .ret_type = 1, .nargs = 2,
+ .args = { { AiocbPointer | OUT, 0 }, { Timespec, 1 } } },
+   { .name = "aio_write", .ret_type = 1, .nargs = 1,
+ .args = { { Aiocb, 0 } } },
{ .name = "bind", .ret_type = 1, .nargs = 3,
  .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Socklent, 2 } } },
{ .name = "bindat", .ret_type = 1, .nargs = 4,
@@ -324,6 +343,9 @@ static struct syscall decoded_syscalls[] = {
{ .name = "linkat", .ret_type = 1, .nargs = 5,
  .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 },
{ Atflags, 4 } } },
+   { .name = "lio_listio", .ret_type = 1, .nargs = 4,
+ .args = { { LioMode, 0 }, { AiocbArray, 1 }, { Int, 2 },
+   { Sigevent, 3 } } },
{ .name = "listen", .ret_type = 1, .nargs = 2,
  .args = { { Int, 0 }, { Int, 1 } } },
{ .name = "lseek", .ret_type = 2, .nargs = 3,
@@ -714,6 +736,21 @@ static struct xlat linux_socketcall_ops[] = {
XEND
 };
 
+static struct xlat lio_modes[] = {
+   X(LIO_WAIT) X(LIO_NOWAIT)
+   XEND
+};
+
+static struct xlat lio_opcodes[] = {
+   X(LIO_WRITE) X(LIO_READ) X(LIO_NOP)
+   XEND
+};
+
+static struct xlat aio_fsync_ops[] = {
+   X(O_SYNC)
+   XEND
+};
+
 #undef X
 #defineX(a){ CLOUDABI_##a, #a },
 
@@ -1333,6 +1370,59 @@ print_iovec(FILE *fp, struct trussinfo *trussinfo, uin
 }
 
 static void
+print_sigval(FILE *fp, union sigval *sv)
+{
+   fprintf(fp, "{ %d, %p }", sv->sival_int, sv->sival_ptr);
+}
+
+static void
+print_sigevent(FILE *fp, struct sigevent *se)
+{
+   fputs("{ sigev_notify=", fp);
+   switch (se->sigev_notify) {
+   case SIGEV_NONE:
+   fputs("SIGEV_NONE", fp);
+   break;
+   case SIGEV_SIGNAL:
+   fprintf(fp, "SIGEV_SIGNAL, sigev_sig

svn commit: r368495 - stable/12/lib/libc/gen

2020-12-09 Thread Cy Schubert
Author: cy
Date: Thu Dec 10 00:43:33 2020
New Revision: 368495
URL: https://svnweb.freebsd.org/changeset/base/368495

Log:
  MFC r368294:
  
  Remove trailing whitespace.

Modified:
  stable/12/lib/libc/gen/glob-compat11.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/glob-compat11.c
==
--- stable/12/lib/libc/gen/glob-compat11.c  Wed Dec  9 22:37:23 2020
(r368494)
+++ stable/12/lib/libc/gen/glob-compat11.c  Thu Dec 10 00:43:33 2020
(r368495)
@@ -77,8 +77,8 @@ __FBSDID("$FreeBSD$");
 struct glob_limit {
size_t  l_brace_cnt;
size_t  l_path_lim;
-   size_t  l_readdir_cnt;  
-   size_t  l_stat_cnt; 
+   size_t  l_readdir_cnt;
+   size_t  l_stat_cnt;
size_t  l_string_cnt;
 };
 
@@ -402,8 +402,8 @@ globtilde(const Char *pattern, Char *patbuf, size_t pa
if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
return (pattern);
 
-   /* 
-* Copy up to the end of the string or / 
+   /*
+* Copy up to the end of the string or /
 */
eb = &patbuf[patbuf_len - 1];
for (p = pattern + 1, b = patbuf;
___
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: r368494 - in stable/12/sys: fs/ext2fs ufs/ufs

2020-12-09 Thread Kirk McKusick
Author: mckusick
Date: Wed Dec  9 22:37:23 2020
New Revision: 368494
URL: https://svnweb.freebsd.org/changeset/base/368494

Log:
  MFC of 368396 and 368425.
  
  Document BA_CLRBUF flag.
  
  Sponsored by: Netflix

Modified:
  stable/12/sys/fs/ext2fs/ext2_extern.h
  stable/12/sys/ufs/ufs/ufs_extern.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/ext2fs/ext2_extern.h
==
--- stable/12/sys/fs/ext2fs/ext2_extern.h   Wed Dec  9 20:38:26 2020
(r368493)
+++ stable/12/sys/fs/ext2fs/ext2_extern.h   Wed Dec  9 22:37:23 2020
(r368494)
@@ -135,6 +135,13 @@ void   ext2_gd_csum_set(struct m_ext2fs *);
 
 /* Flags to low-level allocation routines.
  * The low 16-bits are reserved for IO_ flags from vnode.h.
+ *
+ * The BA_CLRBUF flag specifies that the existing content of the block
+ * will not be completely overwritten by the caller, so buffers for new
+ * blocks must be cleared and buffers for existing blocks must be read.
+ * When BA_CLRBUF is not set the buffer will be completely overwritten
+ * and there is no reason to clear them or to spend I/O fetching existing
+ * data. The BA_CLRBUF flag is handled in the ext2_balloc() functions.
  */
 #defineBA_CLRBUF   0x0001  /* Clear invalid areas of 
buffer. */
 #defineBA_SEQMASK  0x7F00  /* Bits holding seq heuristic. 
*/

Modified: stable/12/sys/ufs/ufs/ufs_extern.h
==
--- stable/12/sys/ufs/ufs/ufs_extern.h  Wed Dec  9 20:38:26 2020
(r368493)
+++ stable/12/sys/ufs/ufs/ufs_extern.h  Wed Dec  9 22:37:23 2020
(r368494)
@@ -119,6 +119,13 @@ void   softdep_revert_rmdir(struct inode *, struct 
inode
  *
  * Note: The general vfs code typically limits the sequential heuristic
  * count to 127.  See sequential_heuristic() in kern/vfs_vnops.c
+ *
+ * The BA_CLRBUF flag specifies that the existing content of the block
+ * will not be completely overwritten by the caller, so buffers for new
+ * blocks must be cleared and buffers for existing blocks must be read.
+ * When BA_CLRBUF is not set the buffer will be completely overwritten
+ * and there is no reason to clear them or to spend I/O fetching existing
+ * data. The BA_CLRBUF flag is handled in the UFS_BALLOC() functions.
  */
 #defineBA_CLRBUF   0x0001  /* Clear invalid areas of 
buffer. */
 #defineBA_METAONLY 0x0002  /* Return indirect block 
buffer. */
___
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: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky

On 12/9/20 9:19 PM, Hans Petter Selasky wrote:

On 12/9/20 9:13 PM, Hans Petter Selasky wrote:

because the date pointed


because the data pointed
   ^^ spelling fix


Just a heads up: I plan on making this a separate direct-commit to 
12-stable tomorrow, because this change depends on, r366917, stacked 
VLANs, which I have no intention of MFC'ing.


The fix for 12-stable looks like this:


Index: sbin/ifconfig/ifclone.c
===
--- sbin/ifconfig/ifclone.c (revision 368297)
+++ sbin/ifconfig/ifclone.c (working copy)
@@ -124,6 +124,7 @@
struct ifreq ifr;
struct clone_defcb *dcp;
clone_callback_func *clone_cb = NULL;
+   const char *ifr_name = strchr(name, '.') ? "vlan" : name;
 
 	memset(&ifr, 0, sizeof(ifr));

(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
@@ -131,7 +132,7 @@
if (clone_cb == NULL) {
/* Try to find a default callback */
SLIST_FOREACH(dcp, &clone_defcbh, next) {
-   if (strncmp(dcp->ifprefix, ifr.ifr_name,
+   if (strncmp(dcp->ifprefix, ifr_name,
strlen(dcp->ifprefix)) == 0) {
clone_cb = dcp->clone_cb;
break;


--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: r368493 - head/release

2020-12-09 Thread Glen Barber
Author: gjb
Date: Wed Dec  9 20:38:26 2020
New Revision: 368493
URL: https://svnweb.freebsd.org/changeset/base/368493

Log:
  Fix staging riscv images.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/Makefile.mirrors

Modified: head/release/Makefile.mirrors
==
--- head/release/Makefile.mirrors   Wed Dec  9 20:13:12 2020
(r368492)
+++ head/release/Makefile.mirrors   Wed Dec  9 20:38:26 2020
(r368493)
@@ -21,7 +21,7 @@ STAGE_TARGETS?=   iso-images-stage
 .endif
 
 .if (defined(EMBEDDED_TARGET) && !empty(EMBEDDED_TARGET)) || 
(defined(EMBEDDEDBUILD) && !empty(EMBEDDEDBUILD))
-. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != ""
+. if ${TARGET:Marm*} != "" || ${EMBEDDED_TARGET:Marm*} != "" || 
${TARGET:Mriscv*} != ""
 EMBEDDED=  1
 . endif
 .endif
@@ -41,7 +41,7 @@ TLD?= ${FTPDIR}/releases
 .endif
 
 .if defined(EMBEDDED) && !empty(EMBEDDED)
-. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == 
"aarch64")
+. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marm*} != "" || ${TARGET_ARCH} == 
"aarch64") || ${TARGET:Mriscv*} != ""
 .  if ${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == 
"PRERELEASE" || ${BRANCH:MALPHA*} != ""
 SNAPSHOT=  1
 .  endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky

On 12/9/20 9:13 PM, Hans Petter Selasky wrote:

because the date pointed


because the data pointed
  ^^ spelling fix

--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: r368492 - head/sbin/ifconfig

2020-12-09 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Dec  9 20:13:12 2020
New Revision: 368492
URL: https://svnweb.freebsd.org/changeset/base/368492

Log:
  Fix bug in ifconfig preventing proper VLAN creation.
  
  Detection of interface type by filter must happen before detection of
  interface type by prefix. Else the following sequence of commands will
  try to create a LAGG interface instead of a VLAN interface, which
  accidentially worked previously, because the date pointed to by the
  ifr_data pointer was not parsed by VLAN create ioctl(2). This is a
  regression after r368229, because the VLAN creation now parses the
  ifr_data field.
  
  How to reproduce:
  # ifconfig lagg0 create
  # ifconfig lagg0.256 create
  
  Differential Revision:https://reviews.freebsd.org/D27521
  Reviewed by:  kib@ and kevans@
  Reported by:  raul.mu...@custos.es
  Sponsored by: Mellanox Technologies // NVIDIA Networking

Modified:
  head/sbin/ifconfig/ifclone.c

Modified: head/sbin/ifconfig/ifclone.c
==
--- head/sbin/ifconfig/ifclone.cWed Dec  9 20:06:37 2020
(r368491)
+++ head/sbin/ifconfig/ifclone.cWed Dec  9 20:13:12 2020
(r368492)
@@ -128,32 +128,32 @@ ifclonecreate(int s, void *arg)
 {
struct ifreq ifr;
struct clone_defcb *dcp;
-   clone_callback_func *clone_cb = NULL;
 
memset(&ifr, 0, sizeof(ifr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
 
-   if (clone_cb == NULL) {
-   /* Try to find a default callback */
+   /* Try to find a default callback by filter */
+   SLIST_FOREACH(dcp, &clone_defcbh, next) {
+   if (dcp->clone_mt == MT_FILTER &&
+   dcp->ifmatch(ifr.ifr_name) != 0)
+   break;
+   }
+
+   if (dcp == NULL) {
+   /* Try to find a default callback by prefix */
SLIST_FOREACH(dcp, &clone_defcbh, next) {
-   if ((dcp->clone_mt == MT_PREFIX) &&
-   (strncmp(dcp->ifprefix, ifr.ifr_name,
-strlen(dcp->ifprefix)) == 0)) {
-   clone_cb = dcp->clone_cb;
+   if (dcp->clone_mt == MT_PREFIX &&
+   strncmp(dcp->ifprefix, ifr.ifr_name,
+   strlen(dcp->ifprefix)) == 0)
break;
-   }
-   if ((dcp->clone_mt == MT_FILTER) &&
- dcp->ifmatch(ifr.ifr_name)) {
-   clone_cb = dcp->clone_cb;
-   break;
-   }
}
}
-   if (clone_cb == NULL) {
+
+   if (dcp == NULL || dcp->clone_cb == NULL) {
/* NB: no parameters */
ioctl_ifcreate(s, &ifr);
} else {
-   clone_cb(s, &ifr);
+   dcp->clone_cb(s, &ifr);
}
 
/*
___
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: r368491 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common

2020-12-09 Thread Alan Somers
Author: asomers
Date: Wed Dec  9 20:06:37 2020
New Revision: 368491
URL: https://svnweb.freebsd.org/changeset/base/368491

Log:
  ZFS: fix spurious EBUSY after zfs receive to an existing dataset
  
  If you do a "zfs send -p  | zfs receive -F " to an existing but
  empty dataset, the receive will complete successfully but spuriously fail
  with exit status 1 and the message "cannot mount 'pool/dataset': mountpoint
  or dataset is busy".
  
  The root cause is a merge error made in r344569 and MFCed in r345578, which
  merged changes a10d50f999 and e63ac16d25 from ZoL.  The merge:
  * failed to flip a == to an != like the upstream change did, and
  * Left out one chunk
  
  Direct commit to stable/12 because head has moved on to OpenZFS.
  
  PR:   251694
  Reviewed by:  bapt
  Sponsored by: Axcient

Modified:
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Dec  9 18:43:58 2020(r368490)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c   
Wed Dec  9 20:06:37 2020(r368491)
@@ -895,13 +895,25 @@ libzfs_mnttab_add(libzfs_handle_t *hdl, const char *sp
mnttab_node_t *mtn;
 
pthread_mutex_lock(&hdl->libzfs_mnttab_cache_lock);
-   if (avl_numnodes(&hdl->libzfs_mnttab_cache) == 0) {
+   if (avl_numnodes(&hdl->libzfs_mnttab_cache) != 0) {
mtn = zfs_alloc(hdl, sizeof (mnttab_node_t));
mtn->mtn_mt.mnt_special = zfs_strdup(hdl, special);
mtn->mtn_mt.mnt_mountp = zfs_strdup(hdl, mountp);
mtn->mtn_mt.mnt_fstype = zfs_strdup(hdl, MNTTYPE_ZFS);
mtn->mtn_mt.mnt_mntopts = zfs_strdup(hdl, mntopts);
-   avl_add(&hdl->libzfs_mnttab_cache, mtn);
+   /*
+* Another thread may have already added this entry
+* via libzfs_mnttab_update. If so we should skip it.
+*/
+   if (avl_find(&hdl->libzfs_mnttab_cache, mtn, NULL) != NULL) {
+   free(mtn->mtn_mt.mnt_special);
+   free(mtn->mtn_mt.mnt_mountp);
+   free(mtn->mtn_mt.mnt_fstype);
+   free(mtn->mtn_mt.mnt_mntopts);
+   free(mtn);
+   } else {
+   avl_add(&hdl->libzfs_mnttab_cache, mtn);
+   }
}
pthread_mutex_unlock(&hdl->libzfs_mnttab_cache_lock);
 }  
___
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: r368490 - in head/sys: dev/iommu x86/iommu

2020-12-09 Thread Ryan Libby
Author: rlibby
Date: Wed Dec  9 18:43:58 2020
New Revision: 368490
URL: https://svnweb.freebsd.org/changeset/base/368490

Log:
  dmar: reserve memory windows of PCIe root port
  
  PCI memory address space is shared between memory-mapped devices (MMIO)
  and host memory (which may be remapped by an IOMMU). Device accesses to
  an address within a memory aperture in a PCIe root port will be treated
  as peer-to-peer and not forwarded to an IOMMU. To avoid this, reserve
  the address space of the root port's memory apertures in the address
  space used by the IOMMU for remapping.
  
  Reviewed by:  kib, tychon
  Discussed with:   Anton Rang 
  Tested by:tychon
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D27503

Modified:
  head/sys/dev/iommu/iommu.h
  head/sys/dev/iommu/iommu_gas.c
  head/sys/x86/iommu/intel_ctx.c

Modified: head/sys/dev/iommu/iommu.h
==
--- head/sys/dev/iommu/iommu.h  Wed Dec  9 18:37:43 2020(r368489)
+++ head/sys/dev/iommu/iommu.h  Wed Dec  9 18:43:58 2020(r368490)
@@ -199,6 +199,8 @@ int iommu_gas_map_region(struct iommu_domain *domain,
 struct iommu_map_entry *entry, u_int eflags, u_int flags, vm_page_t *ma);
 int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start,
 iommu_gaddr_t end, struct iommu_map_entry **entry0);
+int iommu_gas_reserve_region_extend(struct iommu_domain *domain,
+iommu_gaddr_t start, iommu_gaddr_t end);
 
 void iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno);
 bool iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno);

Modified: head/sys/dev/iommu/iommu_gas.c
==
--- head/sys/dev/iommu/iommu_gas.c  Wed Dec  9 18:37:43 2020
(r368489)
+++ head/sys/dev/iommu/iommu_gas.c  Wed Dec  9 18:43:58 2020
(r368490)
@@ -677,6 +677,22 @@ iommu_gas_map_region(struct iommu_domain *domain, stru
return (0);
 }
 
+static int
+iommu_gas_reserve_region_locked(struct iommu_domain *domain,
+iommu_gaddr_t start, iommu_gaddr_t end, struct iommu_map_entry *entry)
+{
+   int error;
+
+   IOMMU_DOMAIN_ASSERT_LOCKED(domain);
+
+   entry->start = start;
+   entry->end = end;
+   error = iommu_gas_alloc_region(domain, entry, IOMMU_MF_CANWAIT);
+   if (error == 0)
+   entry->flags |= IOMMU_MAP_ENTRY_UNMAPPED;
+   return (error);
+}
+
 int
 iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start,
 iommu_gaddr_t end, struct iommu_map_entry **entry0)
@@ -685,17 +701,63 @@ iommu_gas_reserve_region(struct iommu_domain *domain, 
int error;
 
entry = iommu_gas_alloc_entry(domain, IOMMU_PGF_WAITOK);
-   entry->start = start;
-   entry->end = end;
IOMMU_DOMAIN_LOCK(domain);
-   error = iommu_gas_alloc_region(domain, entry, IOMMU_MF_CANWAIT);
-   if (error == 0)
-   entry->flags |= IOMMU_MAP_ENTRY_UNMAPPED;
+   error = iommu_gas_reserve_region_locked(domain, start, end, entry);
IOMMU_DOMAIN_UNLOCK(domain);
if (error != 0)
iommu_gas_free_entry(domain, entry);
else if (entry0 != NULL)
*entry0 = entry;
+   return (error);
+}
+
+/*
+ * As in iommu_gas_reserve_region, reserve [start, end), but allow for existing
+ * entries.
+ */
+int
+iommu_gas_reserve_region_extend(struct iommu_domain *domain,
+iommu_gaddr_t start, iommu_gaddr_t end)
+{
+   struct iommu_map_entry *entry, *next, *prev, key = {};
+   iommu_gaddr_t entry_start, entry_end;
+   int error;
+
+   error = 0;
+   entry = NULL;
+   end = ummin(end, domain->end);
+   while (start < end) {
+   /* Preallocate an entry. */
+   if (entry == NULL)
+   entry = iommu_gas_alloc_entry(domain,
+   IOMMU_PGF_WAITOK);
+   /* Calculate the free region from here to the next entry. */
+   key.start = key.end = start;
+   IOMMU_DOMAIN_LOCK(domain);
+   next = RB_NFIND(iommu_gas_entries_tree, &domain->rb_root, &key);
+   KASSERT(next != NULL, ("domain %p with end %#jx has no entry "
+   "after %#jx", domain, (uintmax_t)domain->end,
+   (uintmax_t)start));
+   entry_end = ummin(end, next->start);
+   prev = RB_PREV(iommu_gas_entries_tree, &domain->rb_root, next);
+   if (prev != NULL)
+   entry_start = ummax(start, prev->end);
+   else
+   entry_start = start;
+   start = next->end;
+   /* Reserve the region if non-empty. */
+   if (entry_start != entry_end) {
+   error = iommu_gas_reserve_region_locked(domain,
+   entry_start, entry_end, e

svn commit: r368489 - head/contrib/llvm-project/clang/lib/Basic/Targets

2020-12-09 Thread Dimitry Andric
Author: dim
Date: Wed Dec  9 18:37:43 2020
New Revision: 368489
URL: https://svnweb.freebsd.org/changeset/base/368489

Log:
  Merge commit 28de0fb48 from llvm git (by Luís Marques):
  
[RISCV] Set __GCC_HAVE_SYNC_COMPARE_AND_SWAP_x defines
  
The RISCV target did not set the GCC atomic compare and swap defines,
unlike other targets. This broke builds for things like glib on
RISCV.
  
Patch by Kristof Provost (kprovost)
  
Differential Revision: https://reviews.llvm.org/D91784
  
  This should fix building glib20 on RISC-V and unblock a number of
  dependent ports.
  
  Requested by: kp
  MFC after:3 days

Modified:
  head/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp

Modified: head/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
==
--- head/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp Wed Dec  9 
17:17:45 2020(r368488)
+++ head/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp Wed Dec  9 
18:37:43 2020(r368489)
@@ -115,8 +115,14 @@ void RISCVTargetInfo::getTargetDefines(const LangOptio
 Builder.defineMacro("__riscv_muldiv");
   }
 
-  if (HasA)
+  if (HasA) {
 Builder.defineMacro("__riscv_atomic");
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+if (Is64Bit)
+  Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+  }
 
   if (HasF || HasD) {
 Builder.defineMacro("__riscv_flen", HasD ? "64" : "32");
___
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: r368488 - stable/12/tests/sys/netpfil/pf

2020-12-09 Thread Kristof Provost
Author: kp
Date: Wed Dec  9 17:17:45 2020
New Revision: 368488
URL: https://svnweb.freebsd.org/changeset/base/368488

Log:
  MFC r368277:
  
  pf tests: Test case for bug #251414
  
  Changing a table from not having counters to having counters (or vice versa)
  may trigger panics.
  
  PR:   251414

Modified:
  stable/12/tests/sys/netpfil/pf/table.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/netpfil/pf/table.sh
==
--- stable/12/tests/sys/netpfil/pf/table.sh Wed Dec  9 15:28:56 2020
(r368487)
+++ stable/12/tests/sys/netpfil/pf/table.sh Wed Dec  9 17:17:45 2020
(r368488)
@@ -108,8 +108,47 @@ v6_counters_cleanup()
pft_cleanup
 }
 
+atf_test_case "pr251414" "cleanup"
+pr251414_head()
+{
+   atf_set descr 'Test PR 251414'
+   atf_set require.user root
+}
+
+pr251414_body()
+{
+   pft_init
+
+   epair_send=$(vnet_mkepair)
+   ifconfig ${epair_send}a 192.0.2.1/24 up
+
+   vnet_mkjail alcatraz ${epair_send}b
+   jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up
+   jexec alcatraz pfctl -e
+
+   pft_set_rules alcatraz \
+   "pass all" \
+   "table  { self }" \
+   "pass in log to "
+
+   pft_set_rules noflush alcatraz \
+   "pass all" \
+   "table  counters { self }" \
+   "pass in log to "
+
+   atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2
+
+   jexec alcatraz pfctl -t tab -T show -vv
+}
+
+pr251414_cleanup()
+{
+   pft_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "v4_counters"
atf_add_test_case "v6_counters"
+   atf_add_test_case "pr251414"
 }
___
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"


Donation From Mrs. Evelyn

2020-12-09 Thread evelynjaxon01

I've invited you to fill out the following form:
Donation From Mrs. Evelyn

To fill it out, visit:
https://docs.google.com/forms/d/e/1FAIpQLSfBNgBc_zExrtQ4F6E4G1GN7S3Wm8Bn8lzeOD_oh8VJ7qevYg/viewform?vc=0&c=0&w=1&flr=0&usp=mail_form_link

Mrs. Evelyn Jaxon

Google Forms: Create and analyze surveys.
___
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: r368487 - head/sys/netgraph

2020-12-09 Thread Kyle Evans
Author: kevans
Date: Wed Dec  9 15:28:56 2020
New Revision: 368487
URL: https://svnweb.freebsd.org/changeset/base/368487

Log:
  netgraph: macfilter: small fixes
  
  Two issues:
  - The DEBUG macro defined is in direct conflict with the DEBUG kernel
option, which broke the -LINT build[0]
  - Building with NG_MACFILTER_DEBUG did not compile on LP64 systems due to
using %d for sizeof().
  
  Reported by:  Jenkins[0]

Modified:
  head/sys/netgraph/ng_macfilter.c

Modified: head/sys/netgraph/ng_macfilter.c
==
--- head/sys/netgraph/ng_macfilter.cWed Dec  9 14:05:08 2020
(r368486)
+++ head/sys/netgraph/ng_macfilter.cWed Dec  9 15:28:56 2020
(r368487)
@@ -76,9 +76,9 @@ MALLOC_DEFINE(M_NETGRAPH_MACFILTER, "netgraph_macfilte
 #define MACTABLE_BLOCKSIZE  128  /* block size for incrementing table 
*/
 
 #ifdef NG_MACFILTER_DEBUG
-#define DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", __FUNCTION__, 
__LINE__, __VA_ARGS__)
+#define MACFILTER_DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", 
__FUNCTION__, __LINE__, __VA_ARGS__)
 #else
-#define DEBUG(fmt, ...)
+#define MACFILTER_DEBUG(fmt, ...)
 #endif
 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
 #define MAC_S_ARGS(v)   (v)[0], (v)[1], (v)[2], (v)[3], (v)[4], (v)[5]
@@ -148,7 +148,7 @@ macfilter_get_upper_hook_count(const struct ng_parse_t
const struct ngm_macfilter_hooks *const ngm_hooks =
(const struct ngm_macfilter_hooks *)(buf - OFFSETOF(struct 
ngm_macfilter_hooks, hooks));
 
-DEBUG("buf %p, ngm_hooks %p, n %d", buf, ngm_hooks, ngm_hooks->n);
+MACFILTER_DEBUG("buf %p, ngm_hooks %p, n %d", buf, ngm_hooks, 
ngm_hooks->n);
 
return ngm_hooks->n;
 }
@@ -294,7 +294,7 @@ macfilter_mactable_resize(macfilter_p mfp)
 n = mfp->mf_mac_allocated + MACTABLE_BLOCKSIZE;
 
 if (n != mfp->mf_mac_allocated) {
-DEBUG("used=%d allocated=%d->%d",
+MACFILTER_DEBUG("used=%d allocated=%d->%d",
   mfp->mf_mac_used, mfp->mf_mac_allocated, n);
 
 mf_mac_p mfp_new = realloc(mfp->mf_macs,
@@ -410,7 +410,7 @@ macfilter_mactable_change(macfilter_p mfp, u_char *eth
 
 mf_mac_p mf_macs = mfp->mf_macs;
 
-DEBUG("ether=" MAC_FMT " found=%d i=%d ether=" MAC_FMT " hookid=%d->%d 
used=%d allocated=%d",
+MACFILTER_DEBUG("ether=" MAC_FMT " found=%d i=%d ether=" MAC_FMT " 
hookid=%d->%d used=%d allocated=%d",
   MAC_S_ARGS(ether), found, i, MAC_S_ARGS(mf_macs[i].ether),
   (found? mf_macs[i].hookid:NG_MACFILTER_HOOK_DEFAULT_ID), hookid,
   mfp->mf_mac_used, mfp->mf_mac_allocated);
@@ -493,7 +493,7 @@ macfilter_find_hook(macfilter_p mfp, const char *hookn
 static int
 macfilter_direct(macfilter_p mfp, struct ngm_macfilter_direct *md)
 {
-DEBUG("ether=" MAC_FMT " hook=%s",
+MACFILTER_DEBUG("ether=" MAC_FMT " hook=%s",
 MAC_S_ARGS(md->ether), md->hookname);
 
 int hookid = macfilter_find_hook(mfp, md->hookname);
@@ -506,7 +506,7 @@ macfilter_direct(macfilter_p mfp, struct ngm_macfilter
 static int
 macfilter_direct_hookid(macfilter_p mfp, struct ngm_macfilter_direct_hookid 
*mdi)
 {
-DEBUG("ether=" MAC_FMT " hookid=%d",
+MACFILTER_DEBUG("ether=" MAC_FMT " hookid=%d",
 MAC_S_ARGS(mdi->ether), mdi->hookid);
 
 if (mdi->hookid >= mfp->mf_upper_cnt)
@@ -545,13 +545,13 @@ macfilter_ether_output(hook_p hook, macfilter_p mfp, s
 mf_macs[i].bytes_out += m->m_len - ETHER_HDR_LEN;
 
 #ifdef NG_MACFILTER_DEBUG_RECVDATA
-DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s -> %s",
+MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s -> %s",
 MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, mf_macs[i].bytes_out,
 NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook));
 #endif
 } else {
 #ifdef NG_MACFILTER_DEBUG_RECVDATA
-DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s",
+MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s",
 MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN,
 NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook));
 #endif
@@ -587,13 +587,13 @@ macfilter_ether_input(hook_p hook, macfilter_p mfp, st
 hookid = mf_macs[i].hookid;
 
 #ifdef NG_MACFILTER_DEBUG_RECVDATA
-DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s->%s",
+MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->%lldb: bytes: %s->%s",
 MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN, mf_macs[i].bytes_in,
 NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook));
 #endif
 } else {
 #ifdef NG_MACFILTER_DEBUG_RECVDATA
-DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s",
+MACFILTER_DEBUG("ether=" MAC_FMT " len=%db->?b: bytes: %s->%s",
 MAC_S_ARGS(ether), m->m_len - ETHER_HDR_LEN,
 NG_HOOK_NAME(hook), NG_HOOK_NAME(*next_hook));
 #endif
@@ -642,7 +642,7 @@ ng_macf

svn commit: r368486 - head/sys/kern

2020-12-09 Thread Mark Johnston
Author: markj
Date: Wed Dec  9 14:05:08 2020
New Revision: 368486
URL: https://svnweb.freebsd.org/changeset/base/368486

Log:
  Plug a race between fd table teardown and several loops
  
  To export information from fd tables we have several loops which do
  this:
  
  FILDESC_SLOCK(fdp);
  for (i = 0; fdp->fd_refcount > 0 && i <= lastfile; i++)
;
  FILDESC_SUNLOCK(fdp);
  
  Before r36, fdescfree() acquired the fd table exclusive lock between
  decrementing fdp->fd_refcount and freeing table entries.  This
  serialized with the loop above, so the file at descriptor i would remain
  valid until the lock is dropped.  Now there is no serialization, so the
  loops may race with teardown of file descriptor tables.
  
  Acquire the exclusive fdtable lock after releasing the final table
  reference to provide a barrier synchronizing with these loops.
  
  Reported by:  pho
  Reviewed by:  kib (previous version), mjg
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D27513

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cWed Dec  9 14:04:54 2020
(r368485)
+++ head/sys/kern/kern_descrip.cWed Dec  9 14:05:08 2020
(r368486)
@@ -2463,6 +2463,13 @@ fdescfree_fds(struct thread *td, struct filedesc *fdp,
struct file *fp;
int i, lastfile;
 
+   KASSERT(refcount_load(&fdp->fd_refcnt) == 0,
+   ("%s: fd table %p carries references", __func__, fdp));
+
+   /* Serialize with threads iterating over the table. */
+   FILEDESC_XLOCK(fdp);
+   FILEDESC_XUNLOCK(fdp);
+
lastfile = fdlastfile_single(fdp);
for (i = 0; i <= lastfile; i++) {
fde = &fdp->fd_ofiles[i];
@@ -2536,6 +2543,11 @@ pdescfree(struct thread *td)
 void
 fdescfree_remapped(struct filedesc *fdp)
 {
+#ifdef INVARIANTS
+   /* fdescfree_fds() asserts that fd_refcnt == 0. */
+   if (!refcount_release(&fdp->fd_refcnt))
+   panic("%s: fd table %p has extra references", __func__, fdp);
+#endif
fdescfree_fds(curthread, fdp, 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: r368485 - head/sys/kern

2020-12-09 Thread Mark Johnston
Author: markj
Date: Wed Dec  9 14:04:54 2020
New Revision: 368485
URL: https://svnweb.freebsd.org/changeset/base/368485

Log:
  Use refcount_load(9) to load fd table reference counts
  
  No functional change intended.
  
  Reviewed by:  kib, mjg
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D27512

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cWed Dec  9 09:53:21 2020
(r368484)
+++ head/sys/kern/kern_descrip.cWed Dec  9 14:04:54 2020
(r368485)
@@ -1830,7 +1830,8 @@ fdgrowtable(struct filedesc *fdp, int nfd)
 * which must not be freed.
 */
if (onfiles > NDFILE) {
-   if (curproc->p_numthreads == 1 && fdp->fd_refcnt == 1)
+   if (curproc->p_numthreads == 1 &&
+   refcount_load(&fdp->fd_refcnt) == 1)
free(otable, M_FILEDESC);
else {
ft = (struct freetable *)&otable->fdt_ofiles[onfiles];
@@ -2160,7 +2161,7 @@ static void
 fddrop(struct filedesc *fdp)
 {
 
-   if (fdp->fd_holdcnt > 1) {
+   if (refcount_load(&fdp->fd_holdcnt) > 1) {
if (refcount_release(&fdp->fd_holdcnt) == 0)
return;
}
@@ -2221,7 +,7 @@ fdunshare(struct thread *td)
struct filedesc *tmp;
struct proc *p = td->td_proc;
 
-   if (p->p_fd->fd_refcnt == 1)
+   if (refcount_load(&p->p_fd->fd_refcnt) == 1)
return;
 
tmp = fdcopy(p->p_fd);
@@ -2570,7 +2571,8 @@ fdsetugidsafety(struct thread *td)
int i;
 
fdp = td->td_proc->p_fd;
-   KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+   KASSERT(refcount_load(&fdp->fd_refcnt) == 1,
+   ("the fdtable should not be shared"));
MPASS(fdp->fd_nfiles >= 3);
for (i = 0; i <= 2; i++) {
fp = fdp->fd_ofiles[i].fde_file;
@@ -2621,7 +2623,8 @@ fdcloseexec(struct thread *td)
int i, lastfile;
 
fdp = td->td_proc->p_fd;
-   KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+   KASSERT(refcount_load(&fdp->fd_refcnt) == 1,
+   ("the fdtable should not be shared"));
lastfile = fdlastfile_single(fdp);
for (i = 0; i <= lastfile; i++) {
fde = &fdp->fd_ofiles[i];
@@ -2651,7 +2654,8 @@ fdcheckstd(struct thread *td)
int i, error, devnull;
 
fdp = td->td_proc->p_fd;
-   KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
+   KASSERT(refcount_load(&fdp->fd_refcnt) == 1,
+   ("the fdtable should not be shared"));
MPASS(fdp->fd_nfiles >= 3);
devnull = -1;
for (i = 0; i <= 2; i++) {
@@ -3974,7 +3978,8 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
continue;
FILEDESC_SLOCK(fdp);
lastfile = fdlastfile(fdp);
-   for (n = 0; fdp->fd_refcnt > 0 && n <= lastfile; ++n) {
+   for (n = 0; refcount_load(&fdp->fd_refcnt) > 0 && n <= lastfile;
+   n++) {
if ((fp = fdp->fd_ofiles[n].fde_file) == NULL)
continue;
xf.xf_fd = n;
@@ -4245,7 +4250,7 @@ kern_proc_filedesc_out(struct proc *p,  struct sbuf *s
pwd_drop(pwd);
FILEDESC_SLOCK(fdp);
lastfile = fdlastfile(fdp);
-   for (i = 0; fdp->fd_refcnt > 0 && i <= lastfile; i++) {
+   for (i = 0; refcount_load(&fdp->fd_refcnt) > 0 && i <= lastfile; i++) {
if ((fp = fdp->fd_ofiles[i].fde_file) == NULL)
continue;
 #ifdef CAPABILITIES
@@ -4400,7 +4405,7 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLER_ARGS)
pwd_drop(pwd);
FILEDESC_SLOCK(fdp);
lastfile = fdlastfile(fdp);
-   for (i = 0; fdp->fd_refcnt > 0 && i <= lastfile; i++) {
+   for (i = 0; refcount_load(&fdp->fd_refcnt) > 0 && i <= lastfile; i++) {
if ((fp = fdp->fd_ofiles[i].fde_file) == NULL)
continue;
export_file_to_kinfo(fp, i, NULL, kif, fdp,
___
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"


Freebsd

2020-12-09 Thread Jodie Yorke
Hi,

I am following up to confirm if you are interested in acquiring the 
Visitors/Registrants List.

Usenix Security Symposium 2020
Aug 12, 2020 (Postponed)
Boston, United States
Registrants Counts: 3,100

Each record of the list contains: Contact Name, Email Address, Company Name, 
URL/Website, Phone No, Title/Designation.

Currently the best way to grow your business is through digital. This list will 
help you pass information about your organization and products directly and 
digitally to the buyer. This list will help you to acquire many potential 
clients/leads.

If you are interested in acquiring the list, we can provide you the cost and 
additional details.

I look forward to hearing from you.
Thanks & Regards,
Jodie Yorke
Business Analyst
If you don't want to hear from me again Please unsub



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