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

2020-08-19 Thread Warner Losh
On Wed, Aug 19, 2020 at 11:54 AM Shawn Webb 
wrote:

> On Wed, Aug 19, 2020 at 11:51:10AM -0600, Warner Losh wrote:
> > On Wed, Aug 19, 2020 at 11:48 AM Shawn Webb 
> > wrote:
> >
> > > On Wed, Aug 19, 2020 at 11:44:42AM -0600, Warner Losh wrote:
> > > > On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb <
> shawn.w...@hardenedbsd.org>
> > > > wrote:
> > > >
> > > > > On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > > > > > Author: imp
> > > > > > Date: Wed Aug 19 17:10:04 2020
> > > > > > New Revision: 364402
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/364402
> > > > > >
> > > > > > Log:
> > > > > >   Add VFS FS events for mount and unmount to devctl/devd
> > > > > >
> > > > > >   Report when a filesystem is mounted, remounted or unmounted via
> > > devd,
> > > > > along with
> > > > > >   details about the mount point and mount options.
> > > > > >
> > > > > >   Discussed with: kib@
> > > > > >   Reviewed by: kirk@ (prior version)
> > > > > >   Sponsored by: Netflix
> > > > > >   Diffential Revision: https://reviews.freebsd.org/D25969
> > > > > >
> > > > > > Modified:
> > > > > >   head/sys/kern/vfs_mount.c
> > > > > >
> > > > > > Modified: head/sys/kern/vfs_mount.c
> > > > > >
> > > > >
> > >
> ==
> > > > > > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020
> > > (r364401)
> > > > > > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020
> > > (r364402)
> > > > > > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > +#include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx,
> > > "mountlist",
> > > > > MT
> > > > > >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> > > > > >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> > > > > >
> > > > > > +static void dev_vfs_event(const char *type, struct mount *mp,
> bool
> > > > > donew);
> > > > > > +
> > > > > >  /*
> > > > > >   * Global opts, taken by all filesystems
> > > > > >   */
> > > > > > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> > > > > >   VOP_UNLOCK(vp);
> > > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
> > > > > >   VOP_UNLOCK(newdp);
> > > > > > + dev_vfs_event("MOUNT", mp, false);
> > > > > >   mountcheckdirs(vp, newdp);
> > > > > >   vn_seqc_write_end(vp);
> > > > > >   vn_seqc_write_end(newdp);
> > > > > > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> > > > > >   if (error != 0)
> > > > > >   goto end;
> > > > > >
> > > > > > + dev_vfs_event("REMOUNT", mp, true);
> > > > > >   if (mp->mnt_opt != NULL)
> > > > > >   vfs_freeopts(mp->mnt_opt);
> > > > > >   mp->mnt_opt = mp->mnt_optnew;
> > > > > > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags,
> struct
> > > > > thread *
> > > > > >   TAILQ_REMOVE(, mp, mnt_list);
> > > > > >   mtx_unlock(_mtx);
> > > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > > > > > + dev_vfs_event("UNMOUNT", mp, false);
> > > > > >   if (coveredvp != NULL) {
> > > > > >   coveredvp->v_mountedhere = NULL;
> > > > > >   vn_seqc_write_end(coveredvp);
> > > > > > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> > > > > >
> > > > > >   error = kernel_mount(ma, flags);
> > > > > >   return (error);
> > > > > > +}
> > > > > > +
> > > > > > +/* Map from mount options to printable formats. */
> > > > > > +static struct mntoptnames optnames[] = {
> > > > > > + MNTOPT_NAMES
> > > > > > +};
> > > > > > +
> > > > > > +static void
> > > > > > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct
> > > > > vfsoptlist *opts)
> > > > > > +{
> > > > > > + struct vfsopt *opt;
> > > > > > +
> > > > > > + if (opts == NULL || TAILQ_EMPTY(opts))
> > > > > > + return;
> > > > > > + sbuf_printf(sb, " %s=\"", what);
> > > > > > + TAILQ_FOREACH(opt, opts, link) {
> > > > > > + if (opt->name[0] == '\0' || (opt->len > 0 && *(char
> > > > > *)opt->value == '\0'))
> > > > > > + continue;
> > > > > > + devctl_safe_quote_sb(sb, opt->name);
> > > > > > + if (opt->len > 0) {
> > > > > > + sbuf_putc(sb, '=');
> > > > > > + devctl_safe_quote_sb(sb, opt->value);
> > > > > > + }
> > > > > > + sbuf_putc(sb, ';');
> > > > > > + }
> > > > > > + sbuf_putc(sb, '"');
> > > > > > +}
> > > > > > +
> > > > > > +#define DEVCTL_LEN 1024
> > > > > > +static void
> > > > > > +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> > > > > > +{
> > > > > > + const uint8_t *cp;
> > > > > > + struct mntoptnames *fp;
> > > > > > + struct sbuf sb;
> > > > > > + struct statfs *sfp = >mnt_stat;
> > > > > > + char *buf;
> > > > > > +
> > > > > > + buf = 

svn commit: r364417 - head/usr.sbin/fstyp

2020-08-19 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Aug 20 05:18:08 2020
New Revision: 364417
URL: https://svnweb.freebsd.org/changeset/base/364417

Log:
  usr.sbin/fstyp: Fix incorrect pfs_type test in ondisk inode
  
  "ipdata.meta.pfs_type & HAMMER2_PFSTYPE_SUPROOT" happened to have
  the same result (except HAMMER2_PFSTYPE_DUMMY could also match).
  
  Obtained from: Dragonfly (git 29e6489bbd4f8e237c9c17b300ac8b711f36770)

Modified:
  head/usr.sbin/fstyp/hammer2.c

Modified: head/usr.sbin/fstyp/hammer2.c
==
--- head/usr.sbin/fstyp/hammer2.c   Thu Aug 20 05:08:49 2020
(r364416)
+++ head/usr.sbin/fstyp/hammer2.c   Thu Aug 20 05:18:08 2020
(r364417)
@@ -127,7 +127,7 @@ find_pfs(FILE *fp, const hammer2_blockref_t *bref, con
switch (bref->type) {
case HAMMER2_BREF_TYPE_INODE:
ipdata = media->ipdata;
-   if (ipdata.meta.pfs_type & HAMMER2_PFSTYPE_SUPROOT) {
+   if (ipdata.meta.pfs_type == HAMMER2_PFSTYPE_SUPROOT) {
bscan = [0];
bcount = HAMMER2_SET_COUNT;
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364416 - head/sys/fs/ext2fs

2020-08-19 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Aug 20 05:08:49 2020
New Revision: 364416
URL: https://svnweb.freebsd.org/changeset/base/364416

Log:
  extfs: remove redundant little endian conversion.
  
  The XTIME_TO_NSEC macro already calls the htole32(), so there is no need
  to call it twice. This code does nothing on LE platforms and affects only
  nanosecond and birthtime fields so it's difficult to notice on regular use.
  
  Hinted by:DragonFlyBSD (git ae503f8f6f4b9a413932ffd68be029f20c38cab4)
  
  X-MFC with:   r361136

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Aug 20 03:53:18 2020
(r364415)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Thu Aug 20 05:08:49 2020
(r364416)
@@ -146,11 +146,11 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
ip->i_mtime = le32toh(ei->e2di_mtime);
ip->i_ctime = le32toh(ei->e2di_ctime);
if (E2DI_HAS_XTIME(ip)) {
-   ip->i_atimensec = XTIME_TO_NSEC(le32toh(ei->e2di_atime_extra));
-   ip->i_mtimensec = XTIME_TO_NSEC(le32toh(ei->e2di_mtime_extra));
-   ip->i_ctimensec = XTIME_TO_NSEC(le32toh(ei->e2di_ctime_extra));
+   ip->i_atimensec = XTIME_TO_NSEC(ei->e2di_atime_extra);
+   ip->i_mtimensec = XTIME_TO_NSEC(ei->e2di_mtime_extra);
+   ip->i_ctimensec = XTIME_TO_NSEC(ei->e2di_ctime_extra);
ip->i_birthtime = le32toh(ei->e2di_crtime);
-   ip->i_birthnsec = XTIME_TO_NSEC(le32toh(ei->e2di_crtime_extra));
+   ip->i_birthnsec = XTIME_TO_NSEC(ei->e2di_crtime_extra);
}
ip->i_flags = 0;
ei_flags_host = le32toh(ei->e2di_flags);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364409 - in head/sys: kern sys

2020-08-19 Thread Brandon Bergren
The change you made looks correct to me.

libsysdecode uses pattern matching to find syscall flag definitions for use by 
userspace debug tools. (so stuff like truss can show flag names, etc.) As such, 
anything hidden behind _KERNEL in one of the headers that the tool grovels that 
matches one of the patterns (MSG_ for sys/socket.h in this case) needs to be 
listed by hand so it doesn't automatically get copied into tables.h.

It used to be part of kdump but got split out into a library in 11 so other 
tools could share the same data.

On Wed, Aug 19, 2020, at 10:54 PM, Rick Macklem wrote:
> Done, I guess?
> 
> I had never ever heard of this until now, but. by inspection,
> it seems to want the kernel only MSG_xxx flags listed, so
> I added MSG_TLSAPPDATA.
> 
> If this is not correct, please let me know what needs to be done, rick
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364409 - in head/sys: kern sys

2020-08-19 Thread Rick Macklem
Done, I guess?

I had never ever heard of this until now, but. by inspection,
it seems to want the kernel only MSG_xxx flags listed, so
I added MSG_TLSAPPDATA.

If this is not correct, please let me know what needs to be done, rick


From: Brandon Bergren 
Sent: Wednesday, August 19, 2020 9:14 PM
To: Rick Macklem; src-committ...@freebsd.org; svn-src-...@freebsd.org; 
svn-src-head@freebsd.org
Subject: Re: svn commit: r364409 - in head/sys: kern sys

CAUTION: This email originated from outside of the University of Guelph. Do not 
click links or open attachments unless you recognize the sender and know the 
content is safe. If in doubt, forward suspicious emails to ith...@uoguelph.ca


This broke world build.

Please update the blacklist in lib/sysdecode/mktables.

On Wed, Aug 19, 2020, at 6:42 PM, Rick Macklem wrote:
> Author: rmacklem
> Date: Wed Aug 19 23:42:33 2020
> New Revision: 364409
> URL: https://svnweb.freebsd.org/changeset/base/364409
>
> Log:
>   Add the MSG_TLSAPPDATA flag to indicate "return ENXIO" for non-application 
> TLS
>   data records.
>
>   The kernel RPC cannot process non-application data records when
>   using TLS. It must to an upcall to a userspace daemon that will
>   call SSL_read() to process them.
>
>   This patch adds a new flag called MSG_TLSAPPDATA that the kernel
>   RPC can use to tell sorecieve() to return ENXIO instead of a non-application
>   data record, when that is what is at the top of the receive queue.
>   I put the code in #ifdef KERN_TLS/#endif, although it will build without
>   that, so that it is recognized as only useful when KERN_TLS is enabled.
>   The alternative to doing this is to have the kernel RPC re-queue the
>   non-application data message after receiving it, but that seems more
>   complicated and might introduce message ordering issues when there
>   are multiple non-application data records one after another.
>
>   I do not know what, if any, changes will be required to support TLS1.3.
>
>   Reviewed by:glebius
>   Differential Revision:  https://reviews.freebsd.org/D25923
>
> Modified:
>   head/sys/kern/uipc_socket.c
>   head/sys/sys/socket.h
>
> Modified: head/sys/kern/uipc_socket.c
> ==
> --- head/sys/kern/uipc_socket.c   Wed Aug 19 20:41:22 2020
> (r364408)
> +++ head/sys/kern/uipc_socket.c   Wed Aug 19 23:42:33 2020
> (r364409)
> @@ -2056,6 +2056,32 @@ dontblock:
>   if (m != NULL && m->m_type == MT_CONTROL) {
>   struct mbuf *cm = NULL, *cmn;
>   struct mbuf **cme = 
> +#ifdef KERN_TLS
> + struct cmsghdr *cmsg;
> + struct tls_get_record tgr;
> +
> + /*
> +  * For MSG_TLSAPPDATA, check for a non-application data
> +  * record.  If found, return ENXIO without removing
> +  * it from the receive queue.  This allows a subsequent
> +  * call without MSG_TLSAPPDATA to receive it.
> +  * Note that, for TLS, there should only be a single
> +  * control mbuf with the TLS_GET_RECORD message in it.
> +  */
> + if (flags & MSG_TLSAPPDATA) {
> + cmsg = mtod(m, struct cmsghdr *);
> + if (cmsg->cmsg_type == TLS_GET_RECORD &&
> + cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) {
> + memcpy(, CMSG_DATA(cmsg), sizeof(tgr));
> + /* This will need to change for TLS 1.3. */
> + if (tgr.tls_type != TLS_RLTYPE_APP) {
> + SOCKBUF_UNLOCK(>so_rcv);
> + error = ENXIO;
> + goto release;
> + }
> + }
> + }
> +#endif
>
>   do {
>   if (flags & MSG_PEEK) {
>
> Modified: head/sys/sys/socket.h
> ==
> --- head/sys/sys/socket.h Wed Aug 19 20:41:22 2020(r364408)
> +++ head/sys/sys/socket.h Wed Aug 19 23:42:33 2020(r364409)
> @@ -468,6 +468,7 @@ struct msghdr {
>  #endif
>  #ifdef _KERNEL
>  #define  MSG_MORETOCOME   0x0010 /* additional data pending */
> +#define  MSG_TLSAPPDATA   0x0020 /* only soreceive() app. data 
> (TLS) */
>  #endif
>
>  /*
>

--
  Brandon Bergren
  bdra...@imap.cc

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


svn commit: r364415 - head/lib/libsysdecode

2020-08-19 Thread Rick Macklem
Author: rmacklem
Date: Thu Aug 20 03:53:18 2020
New Revision: 364415
URL: https://svnweb.freebsd.org/changeset/base/364415

Log:
  Add MSG_TLSAPPDATA to lib/libsysdecode/mktables.
  
  I have no idea what this does (and until now that it even existed), but
  apparently it needs this entry changed for the MSG_TLSAPPDATA, since
  it is kernel only.

Modified:
  head/lib/libsysdecode/mktables

Modified: head/lib/libsysdecode/mktables
==
--- head/lib/libsysdecode/mktables  Thu Aug 20 02:54:44 2020
(r364414)
+++ head/lib/libsysdecode/mktables  Thu Aug 20 03:53:18 2020
(r364415)
@@ -153,7 +153,7 @@ gen_table "seekwhence"  "SEEK_[A-Z]+[[:space:]]+[0
 gen_table "fcntlcmd""F_[A-Z0-9_]+[[:space:]]+[0-9]+[[:space:]]+"   
"sys/fcntl.h"   "F_CANCEL|F_..LCK"
 gen_table "mmapflags"   "MAP_[A-Z_]+[[:space:]]+0x[0-9A-Fa-f]+"
"sys/mman.h"
 gen_table "rtpriofuncs" "RTP_[A-Z]+[[:space:]]+[0-9]+" 
"sys/rtprio.h"
-gen_table "msgflags""MSG_[A-Z]+[[:space:]]+0x[0-9]+"   
"sys/socket.h"  "MSG_SOCALLBCK|MSG_MORETOCOME"
+gen_table "msgflags""MSG_[A-Z]+[[:space:]]+0x[0-9]+"   
"sys/socket.h"  "MSG_SOCALLBCK|MSG_MORETOCOME|MSG_TLSAPPDATA"
 gen_table "sigcode" "SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?"   
"sys/signal.h"
 gen_table "umtxcvwaitflags" "CVWAIT_[A-Z_]+[[:space:]]+0x[0-9]+"   
"sys/umtx.h"
 gen_table "umtxrwlockflags" "URWLOCK_PREFER_READER[[:space:]]+0x[0-9]+"
"sys/umtx.h"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364412 - head/cddl/contrib/opensolaris/lib/libzfs/common

2020-08-19 Thread Alan Somers
Author: asomers
Date: Thu Aug 20 01:31:21 2020
New Revision: 364412
URL: https://svnweb.freebsd.org/changeset/base/364412

Log:
  zfs: fix EIO accessing dataset after resuming interrupted receive
  
  ZFS unmounts a dataset while receiving into it and remounts it afterwards.
  But if ZFS is resuming an incomplete receive, it screws up and ends up with
  a dataset that is mounted, but returns EIO for every access. This commit
  fixes that condition.
  
  While the vulnerable code also exists in OpenZFS, the problem is not
  reproducible there. Apparently OpenZFS doesn't unmount the destination
  dataset during receive, like FreeBSD does.
  
  PR:   248606
  Reviewed by:  mmacy
  MFC after:2 weeks
  Sponsored by: Axcient
  Differential Revision:https://reviews.freebsd.org/D26034

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Thu Aug 
20 00:52:53 2020(r364411)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Thu Aug 
20 01:31:21 2020(r364412)
@@ -3434,7 +3434,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const 
}
 
if (!flags->dryrun && zhp->zfs_type == ZFS_TYPE_FILESYSTEM &&
-   stream_wantsnewfs) {
+   (stream_wantsnewfs || resuming)) {
/* We can't do online recv in this case */
clp = changelist_gather(zhp, ZFS_PROP_NAME, 0,
flags->forceunmount ? MS_FORCE : 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364409 - in head/sys: kern sys

2020-08-19 Thread Brandon Bergren
This broke world build.

Please update the blacklist in lib/sysdecode/mktables.

On Wed, Aug 19, 2020, at 6:42 PM, Rick Macklem wrote:
> Author: rmacklem
> Date: Wed Aug 19 23:42:33 2020
> New Revision: 364409
> URL: https://svnweb.freebsd.org/changeset/base/364409
> 
> Log:
>   Add the MSG_TLSAPPDATA flag to indicate "return ENXIO" for non-application 
> TLS
>   data records.
>   
>   The kernel RPC cannot process non-application data records when
>   using TLS. It must to an upcall to a userspace daemon that will
>   call SSL_read() to process them.
>   
>   This patch adds a new flag called MSG_TLSAPPDATA that the kernel
>   RPC can use to tell sorecieve() to return ENXIO instead of a non-application
>   data record, when that is what is at the top of the receive queue.
>   I put the code in #ifdef KERN_TLS/#endif, although it will build without
>   that, so that it is recognized as only useful when KERN_TLS is enabled.
>   The alternative to doing this is to have the kernel RPC re-queue the
>   non-application data message after receiving it, but that seems more
>   complicated and might introduce message ordering issues when there
>   are multiple non-application data records one after another.
>   
>   I do not know what, if any, changes will be required to support TLS1.3.
>   
>   Reviewed by:glebius
>   Differential Revision:  https://reviews.freebsd.org/D25923
> 
> Modified:
>   head/sys/kern/uipc_socket.c
>   head/sys/sys/socket.h
> 
> Modified: head/sys/kern/uipc_socket.c
> ==
> --- head/sys/kern/uipc_socket.c   Wed Aug 19 20:41:22 2020
> (r364408)
> +++ head/sys/kern/uipc_socket.c   Wed Aug 19 23:42:33 2020
> (r364409)
> @@ -2056,6 +2056,32 @@ dontblock:
>   if (m != NULL && m->m_type == MT_CONTROL) {
>   struct mbuf *cm = NULL, *cmn;
>   struct mbuf **cme = 
> +#ifdef KERN_TLS
> + struct cmsghdr *cmsg;
> + struct tls_get_record tgr;
> +
> + /*
> +  * For MSG_TLSAPPDATA, check for a non-application data
> +  * record.  If found, return ENXIO without removing
> +  * it from the receive queue.  This allows a subsequent
> +  * call without MSG_TLSAPPDATA to receive it.
> +  * Note that, for TLS, there should only be a single
> +  * control mbuf with the TLS_GET_RECORD message in it.
> +  */
> + if (flags & MSG_TLSAPPDATA) {
> + cmsg = mtod(m, struct cmsghdr *);
> + if (cmsg->cmsg_type == TLS_GET_RECORD &&
> + cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) {
> + memcpy(, CMSG_DATA(cmsg), sizeof(tgr));
> + /* This will need to change for TLS 1.3. */
> + if (tgr.tls_type != TLS_RLTYPE_APP) {
> + SOCKBUF_UNLOCK(>so_rcv);
> + error = ENXIO;
> + goto release;
> + }
> + }
> + }
> +#endif
>  
>   do {
>   if (flags & MSG_PEEK) {
> 
> Modified: head/sys/sys/socket.h
> ==
> --- head/sys/sys/socket.h Wed Aug 19 20:41:22 2020(r364408)
> +++ head/sys/sys/socket.h Wed Aug 19 23:42:33 2020(r364409)
> @@ -468,6 +468,7 @@ struct msghdr {
>  #endif
>  #ifdef _KERNEL
>  #define  MSG_MORETOCOME   0x0010 /* additional data pending */
> +#define  MSG_TLSAPPDATA   0x0020 /* only soreceive() app. data 
> (TLS) */
>  #endif
>  
>  /*
>

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


svn commit: r364411 - in head/sys: amd64/acpica i386/acpica

2020-08-19 Thread Mark Johnston
Author: markj
Date: Thu Aug 20 00:52:53 2020
New Revision: 364411
URL: https://svnweb.freebsd.org/changeset/base/364411

Log:
  Use pmap_mapbios() to map ACPI tables on amd64 and i386.
  
  The ACPI table-mapping code used pmap_kenter_temporary() to create
  mappings, which in turn uses the fixed-size crashdump map.  Moreover,
  the code was not verifying that the table fits in this map, so when
  mapping large tables we could clobber adjacent mappings.  This use of
  pmap_kenter_temporary() appears to predate support in pmap_mapbios() for
  creating early mappings, but that restriction no longer applies.
  
  PR:   248746
  Reviewed by:  kib, mav
  Tested by:gallatin, Curtis Villamizar 
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26125

Modified:
  head/sys/amd64/acpica/acpi_machdep.c
  head/sys/i386/acpica/acpi_machdep.c

Modified: head/sys/amd64/acpica/acpi_machdep.c
==
--- head/sys/amd64/acpica/acpi_machdep.cThu Aug 20 00:38:32 2020
(r364410)
+++ head/sys/amd64/acpica/acpi_machdep.cThu Aug 20 00:52:53 2020
(r364411)
@@ -91,91 +91,29 @@ acpi_machdep_quirks(int *quirks)
 }
 
 /*
- * Support for mapping ACPI tables during early boot.  Currently this
- * uses the crashdump map to map each table.  However, the crashdump
- * map is created in pmap_bootstrap() right after the direct map, so
- * we should be able to just use pmap_mapbios() here instead.
- *
- * This makes the following assumptions about how we use this KVA:
- * pages 0 and 1 are used to map in the header of each table found via
- * the RSDT or XSDT and pages 2 to n are used to map in the RSDT or
- * XSDT.  This has to use 2 pages for the table headers in case a
- * header spans a page boundary.
- *
- * XXX: We don't ensure the table fits in the available address space
- * in the crashdump map.
+ * Map a table.  First map the header to determine the table length and then 
map
+ * the entire table.
  */
-
-/*
- * Map some memory using the crashdump map.  'offset' is an offset in
- * pages into the crashdump map to use for the start of the mapping.
- */
 static void *
-table_map(vm_paddr_t pa, int offset, vm_offset_t length)
+map_table(vm_paddr_t pa, const char *sig)
 {
-   vm_offset_t va, off;
-   void *data;
-
-   off = pa & PAGE_MASK;
-   length = round_page(length + off);
-   pa = pa & PG_FRAME;
-   va = (vm_offset_t)pmap_kenter_temporary(pa, offset) +
-   (offset * PAGE_SIZE);
-   data = (void *)(va + off);
-   length -= PAGE_SIZE;
-   while (length > 0) {
-   va += PAGE_SIZE;
-   pa += PAGE_SIZE;
-   length -= PAGE_SIZE;
-   pmap_kenter(va, pa);
-   invlpg(va);
-   }
-   return (data);
-}
-
-/* Unmap memory previously mapped with table_map(). */
-static void
-table_unmap(void *data, vm_offset_t length)
-{
-   vm_offset_t va, off;
-
-   va = (vm_offset_t)data;
-   off = va & PAGE_MASK;
-   length = round_page(length + off);
-   va &= ~PAGE_MASK;
-   while (length > 0) {
-   pmap_kremove(va);
-   invlpg(va);
-   va += PAGE_SIZE;
-   length -= PAGE_SIZE;
-   }
-}
-
-/*
- * Map a table at a given offset into the crashdump map.  It first
- * maps the header to determine the table length and then maps the
- * entire table.
- */
-static void *
-map_table(vm_paddr_t pa, int offset, const char *sig)
-{
ACPI_TABLE_HEADER *header;
vm_offset_t length;
void *table;
 
-   header = table_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
+   header = pmap_mapbios(pa, sizeof(ACPI_TABLE_HEADER));
if (strncmp(header->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
-   table_unmap(header, sizeof(ACPI_TABLE_HEADER));
+   pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
return (NULL);
}
length = header->Length;
-   table_unmap(header, sizeof(ACPI_TABLE_HEADER));
-   table = table_map(pa, offset, length);
+   pmap_unmapbios((vm_offset_t)header, sizeof(ACPI_TABLE_HEADER));
+   table = pmap_mapbios(pa, length);
if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
if (bootverbose)
printf("ACPI: Failed checksum for table %s\n", sig);
 #if (ACPI_CHECKSUM_ABORT)
-   table_unmap(table, length);
+   pmap_unmapbios((vm_offset_t)table, length);
return (NULL);
 #endif
}
@@ -190,21 +128,12 @@ static int
 probe_table(vm_paddr_t address, const char *sig)
 {
ACPI_TABLE_HEADER *table;
+   int ret;
 
-   table = table_map(address, 0, sizeof(ACPI_TABLE_HEADER));
-   if (table == NULL) {
-   if (bootverbose)
-   printf("ACPI: Failed to map 

svn commit: r364410 - head/sys/arm64/acpica

2020-08-19 Thread Mark Johnston
Author: markj
Date: Thu Aug 20 00:38:32 2020
New Revision: 364410
URL: https://svnweb.freebsd.org/changeset/base/364410

Log:
  Remove an unused parameter from map_table().
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/acpica/acpi_machdep.c

Modified: head/sys/arm64/acpica/acpi_machdep.c
==
--- head/sys/arm64/acpica/acpi_machdep.cWed Aug 19 23:42:33 2020
(r364409)
+++ head/sys/arm64/acpica/acpi_machdep.cThu Aug 20 00:38:32 2020
(r364410)
@@ -63,7 +63,7 @@ acpi_machdep_quirks(int *quirks)
 }
 
 static void *
-map_table(vm_paddr_t pa, int offset, const char *sig)
+map_table(vm_paddr_t pa, const char *sig)
 {
ACPI_TABLE_HEADER *header;
vm_offset_t length;
@@ -132,7 +132,7 @@ void *
 acpi_map_table(vm_paddr_t pa, const char *sig)
 {
 
-   return (map_table(pa, 0, sig));
+   return (map_table(pa, sig));
 }
 
 /*
@@ -178,7 +178,7 @@ acpi_find_table(const char *sig)
printf("ACPI: RSDP failed extended checksum\n");
return (0);
}
-   xsdt = map_table(rsdp->XsdtPhysicalAddress, 2, ACPI_SIG_XSDT);
+   xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
if (xsdt == NULL) {
if (bootverbose)
printf("ACPI: Failed to map XSDT\n");
@@ -204,7 +204,7 @@ acpi_find_table(const char *sig)
 * Verify that we can map the full table and that its checksum is
 * correct, etc.
 */
-   table = map_table(addr, 0, sig);
+   table = map_table(addr, sig);
if (table == NULL)
return (0);
acpi_unmap_table(table);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364409 - in head/sys: kern sys

2020-08-19 Thread Rick Macklem
Author: rmacklem
Date: Wed Aug 19 23:42:33 2020
New Revision: 364409
URL: https://svnweb.freebsd.org/changeset/base/364409

Log:
  Add the MSG_TLSAPPDATA flag to indicate "return ENXIO" for non-application TLS
  data records.
  
  The kernel RPC cannot process non-application data records when
  using TLS. It must to an upcall to a userspace daemon that will
  call SSL_read() to process them.
  
  This patch adds a new flag called MSG_TLSAPPDATA that the kernel
  RPC can use to tell sorecieve() to return ENXIO instead of a non-application
  data record, when that is what is at the top of the receive queue.
  I put the code in #ifdef KERN_TLS/#endif, although it will build without
  that, so that it is recognized as only useful when KERN_TLS is enabled.
  The alternative to doing this is to have the kernel RPC re-queue the
  non-application data message after receiving it, but that seems more
  complicated and might introduce message ordering issues when there
  are multiple non-application data records one after another.
  
  I do not know what, if any, changes will be required to support TLS1.3.
  
  Reviewed by:  glebius
  Differential Revision:https://reviews.freebsd.org/D25923

Modified:
  head/sys/kern/uipc_socket.c
  head/sys/sys/socket.h

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Wed Aug 19 20:41:22 2020(r364408)
+++ head/sys/kern/uipc_socket.c Wed Aug 19 23:42:33 2020(r364409)
@@ -2056,6 +2056,32 @@ dontblock:
if (m != NULL && m->m_type == MT_CONTROL) {
struct mbuf *cm = NULL, *cmn;
struct mbuf **cme = 
+#ifdef KERN_TLS
+   struct cmsghdr *cmsg;
+   struct tls_get_record tgr;
+
+   /*
+* For MSG_TLSAPPDATA, check for a non-application data
+* record.  If found, return ENXIO without removing
+* it from the receive queue.  This allows a subsequent
+* call without MSG_TLSAPPDATA to receive it.
+* Note that, for TLS, there should only be a single
+* control mbuf with the TLS_GET_RECORD message in it.
+*/
+   if (flags & MSG_TLSAPPDATA) {
+   cmsg = mtod(m, struct cmsghdr *);
+   if (cmsg->cmsg_type == TLS_GET_RECORD &&
+   cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) {
+   memcpy(, CMSG_DATA(cmsg), sizeof(tgr));
+   /* This will need to change for TLS 1.3. */
+   if (tgr.tls_type != TLS_RLTYPE_APP) {
+   SOCKBUF_UNLOCK(>so_rcv);
+   error = ENXIO;
+   goto release;
+   }
+   }
+   }
+#endif
 
do {
if (flags & MSG_PEEK) {

Modified: head/sys/sys/socket.h
==
--- head/sys/sys/socket.h   Wed Aug 19 20:41:22 2020(r364408)
+++ head/sys/sys/socket.h   Wed Aug 19 23:42:33 2020(r364409)
@@ -468,6 +468,7 @@ struct msghdr {
 #endif
 #ifdef _KERNEL
 #defineMSG_MORETOCOME   0x0010 /* additional data pending */
+#defineMSG_TLSAPPDATA   0x0020 /* only soreceive() app. data 
(TLS) */
 #endif
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364408 - head/stand/libsa

2020-08-19 Thread Toomas Soome
Author: tsoome
Date: Wed Aug 19 20:41:22 2020
New Revision: 364408
URL: https://svnweb.freebsd.org/changeset/base/364408

Log:
  libsa: remove leftover whitespace
  
  Tiny cleanup, no functional changes.

Modified:
  head/stand/libsa/environment.c

Modified: head/stand/libsa/environment.c
==
--- head/stand/libsa/environment.c  Wed Aug 19 19:55:12 2020
(r364407)
+++ head/stand/libsa/environment.c  Wed Aug 19 20:41:22 2020
(r364408)
@@ -98,7 +98,7 @@ env_setenv(const char *name, int flags, const void *va
ev->ev_prev = NULL;
ev->ev_next = NULL;
/* Search for the record to insert before */
-   for (last = NULL, curr = environ; curr != NULL; 
+   for (last = NULL, curr = environ; curr != NULL;
last = curr, curr = curr->ev_next) {
 
if (strcmp(ev->ev_name, curr->ev_name) < 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-08-19 Thread Alexander Motin
Author: mav
Date: Wed Aug 19 19:55:12 2020
New Revision: 364407
URL: https://svnweb.freebsd.org/changeset/base/364407

Log:
  Unify AcpiGetTable() KPI use in identify, probe and attach.
  
  While there, change probe order to not call AcpiGetTable() for every
  probed ACPI device.
  
  PR:   248746
  MFC after:3 days

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

Modified: head/sys/dev/acpica/acpi_apei.c
==
--- head/sys/dev/acpica/acpi_apei.c Wed Aug 19 18:52:22 2020
(r364406)
+++ head/sys/dev/acpica/acpi_apei.c Wed Aug 19 19:55:12 2020
(r364407)
@@ -550,20 +550,29 @@ apei_identify(driver_t *driver, device_t parent)
 {
device_tchild;
int found;
+   ACPI_TABLE_HEADER *hest;
+   ACPI_STATUS status;
 
if (acpi_disabled("apei"))
return;
-   if (acpi_find_table(ACPI_SIG_HEST) == 0)
+
+   /* Without HEST table we have nothing to do. */
+   status = AcpiGetTable(ACPI_SIG_HEST, 0, );
+   if (ACPI_FAILURE(status))
return;
+   AcpiPutTable(hest);
+
/* Only one APEI device can exist. */
if (devclass_get_device(apei_devclass, 0))
return;
+
/* Search for ACPI error device to be used. */
found = 0;
AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
100, apei_find, NULL, NULL, (void *));
if (found)
return;
+
/* If not found - create a fake one. */
child = BUS_ADD_CHILD(parent, 2, "apei", 0);
if (child == NULL)
@@ -573,18 +582,27 @@ apei_identify(driver_t *driver, device_t parent)
 static int
 apei_probe(device_t dev)
 {
+   ACPI_TABLE_HEADER *hest;
+   ACPI_STATUS status;
int rv;
 
if (acpi_disabled("apei"))
return (ENXIO);
-   if (acpi_find_table(ACPI_SIG_HEST) == 0)
-   return (ENXIO);
-   if (acpi_get_handle(dev) != NULL)
+
+   if (acpi_get_handle(dev) != NULL) {
rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL);
-   else
+   if (rv > 0)
+   return (rv);
+   } else
rv = 0;
-   if (rv <= 0)
-   device_set_desc(dev, "Platform Error Interface");
+
+   /* Without HEST table we have nothing to do. */
+   status = AcpiGetTable(ACPI_SIG_HEST, 0, );
+   if (ACPI_FAILURE(status))
+   return (ENXIO);
+   AcpiPutTable(hest);
+
+   device_set_desc(dev, "ACPI Platform Error Interface");
return (rv);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-08-19 Thread Mark Johnston
Author: markj
Date: Wed Aug 19 18:52:22 2020
New Revision: 364406
URL: https://svnweb.freebsd.org/changeset/base/364406

Log:
  Add a KCOV man page.
  
  Reviewed by:  andrew, gbe, tuexen
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26108

Added:
  head/share/man/man4/kcov.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileWed Aug 19 17:59:06 2020
(r364405)
+++ head/share/man/man4/MakefileWed Aug 19 18:52:22 2020
(r364406)
@@ -244,6 +244,7 @@ MAN=aac.4 \
jedec_dimm.4 \
jme.4 \
kbdmux.4 \
+   kcov.4 \
keyboard.4 \
kld.4 \
ksyms.4 \

Added: head/share/man/man4/kcov.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/kcov.4  Wed Aug 19 18:52:22 2020(r364406)
@@ -0,0 +1,206 @@
+.\"-
+.\" Copyright (c) 2020 The FreeBSD Foundation
+.\"
+.\" This documentation was written by Mark Johnston under sponsorship from
+.\" the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd August 18, 2020
+.Dt KCOV 4
+.Os
+.Sh NAME
+.Nm kcov
+.Nd interface for collecting kernel code coverage information
+.Sh SYNOPSIS
+To compile KCOV into the kernel, place the following lines in your kernel
+configuration file:
+.Bd -ragged -offset indent
+.Cd "options COVERAGE"
+.Cd "options KCOV"
+.Ed
+.Pp
+The following header file defines the application interface provided
+by KCOV:
+.Pp
+.In sys/kcov.h
+.Sh DESCRIPTION
+.Nm
+is a module that enables collection of code coverage information from the
+kernel.
+It relies on code instrumentation enabled by the
+.Dv COVERAGE
+kernel option.
+When
+.Nm
+is enabled by a user-mode thread, it collects coverage information only for
+that thread, excluding hard interrupt handlers.
+As a result,
+.Nm
+is not suited to collect comprehensive coverage data for the entire kernel;
+its main purpose is to provide input for coverage-guided system call fuzzers.
+.Pp
+In typical usage, a user-mode thread first allocates a chunk of memory to be
+shared with
+.Nm .
+The thread then enables coverage tracing, with coverage data being written by
+the kernel to the shared memory region.
+When tracing is disabled, the kernel relinquishes its access to the shared
+memory region, and the written coverage data may be consumed.
+.Pp
+The shared memory buffer can be treated as a 64-bit unsigned integer followed
+by an array of records.
+The integer records the number of valid records and is updated by the kernel as
+coverage information is recorded.
+The state of the tracing buffer can be reset by writing the value 0 to this
+field.
+The record layout depends on the tracing mode set using the
+.Dv KIOENABLE
+ioctl.
+.Pp
+Two tracing modes are implemented,
+.Dv KCOV_MODE_TRACE_PC
+and
+.Dv KCOV_MODE_TRACE_CMP .
+PC-tracing records a program counter value for each basic block executed while
+tracing is enabled.
+In this mode, each record is a single 64-bit unsigned integer containing the
+program counter value.
+Comparison tracing provides information about data flow; information about
+dynamic variable comparisons is recorded.
+Such records provide information about the results of
+.Xr c 7
+.Ql if
+or
+.Ql switch
+statements, for example.
+In this mode each record consists of four 64-bit unsigned integers.
+The first integer is a bitmask defining attributes of the variables involved in

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

2020-08-19 Thread Ian Lepore
On Wed, 2020-08-19 at 13:54 -0400, Shawn Webb wrote:
> On Wed, Aug 19, 2020 at 11:51:10AM -0600, Warner Losh wrote:
> > On Wed, Aug 19, 2020 at 11:48 AM Shawn Webb <
> > shawn.w...@hardenedbsd.org>
> > wrote:
> > 
> > > On Wed, Aug 19, 2020 at 11:44:42AM -0600, Warner Losh wrote:
> > > > On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb <
> > > > shawn.w...@hardenedbsd.org>
> > > > wrote:
> > > > 
> > > > > On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > > > > > Author: imp
> > > > > > Date: Wed Aug 19 17:10:04 2020
> > > > > > New Revision: 364402
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/364402
> > > > > > 
> > > > > > Log:
> > > > > >   Add VFS FS events for mount and unmount to devctl/devd
> > > > > > 
> > > > > >   Report when a filesystem is mounted, remounted or
> > > > > > unmounted via
> > > 
> > > devd,
> > > > > along with
> > > > > >   details about the mount point and mount options.
> > > > > > 
> > > > > >   Discussed with: kib@
> > > > > >   Reviewed by: kirk@ (prior version)
> > > > > >   Sponsored by: Netflix
> > > > > >   Diffential Revision: https://reviews.freebsd.org/D25969
> > > > > > 
> > > > > > Modified:
> > > > > >   head/sys/kern/vfs_mount.c
> > > > > > 
> > > > > > Modified: head/sys/kern/vfs_mount.c
> > > > > > 
> > > 
> > > =
> > > =
> > > > > > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020
> > > 
> > > (r364401)
> > > > > > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020
> > > 
> > > (r364402)
> > > > > > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > +#include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > >  #include 
> > > > > > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx,
> > > 
> > > "mountlist",
> > > > > MT
> > > > > >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> > > > > >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> > > > > > 
> > > > > > +static void dev_vfs_event(const char *type, struct mount
> > > > > > *mp, bool
> > > > > 
> > > > > donew);
> > > > > > +
> > > > > >  /*
> > > > > >   * Global opts, taken by all filesystems
> > > > > >   */
> > > > > > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> > > > > >   VOP_UNLOCK(vp);
> > > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp,
> > > > > > td);
> > > > > >   VOP_UNLOCK(newdp);
> > > > > > + dev_vfs_event("MOUNT", mp, false);
> > > > > >   mountcheckdirs(vp, newdp);
> > > > > >   vn_seqc_write_end(vp);
> > > > > >   vn_seqc_write_end(newdp);
> > > > > > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> > > > > >   if (error != 0)
> > > > > >   goto end;
> > > > > > 
> > > > > > + dev_vfs_event("REMOUNT", mp, true);
> > > > > >   if (mp->mnt_opt != NULL)
> > > > > >   vfs_freeopts(mp->mnt_opt);
> > > > > >   mp->mnt_opt = mp->mnt_optnew;
> > > > > > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int
> > > > > > flags, struct
> > > > > 
> > > > > thread *
> > > > > >   TAILQ_REMOVE(, mp, mnt_list);
> > > > > >   mtx_unlock(_mtx);
> > > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > > > > > + dev_vfs_event("UNMOUNT", mp, false);
> > > > > >   if (coveredvp != NULL) {
> > > > > >   coveredvp->v_mountedhere = NULL;
> > > > > >   vn_seqc_write_end(coveredvp);
> > > > > > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> > > > > > 
> > > > > >   error = kernel_mount(ma, flags);
> > > > > >   return (error);
> > > > > > +}
> > > > > > +
> > > > > > +/* Map from mount options to printable formats. */
> > > > > > +static struct mntoptnames optnames[] = {
> > > > > > + MNTOPT_NAMES
> > > > > > +};
> > > > > > +
> > > > > > +static void
> > > > > > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what,
> > > > > > struct
> > > > > 
> > > > > vfsoptlist *opts)
> > > > > > +{
> > > > > > + struct vfsopt *opt;
> > > > > > +
> > > > > > + if (opts == NULL || TAILQ_EMPTY(opts))
> > > > > > + return;
> > > > > > + sbuf_printf(sb, " %s=\"", what);
> > > > > > + TAILQ_FOREACH(opt, opts, link) {
> > > > > > + if (opt->name[0] == '\0' || (opt->len > 0 &&
> > > > > > *(char
> > > > > 
> > > > > *)opt->value == '\0'))
> > > > > > + continue;
> > > > > > + devctl_safe_quote_sb(sb, opt->name);
> > > > > > + if (opt->len > 0) {
> > > > > > + sbuf_putc(sb, '=');
> > > > > > + devctl_safe_quote_sb(sb, opt->value);
> > > > > > + }
> > > > > > + sbuf_putc(sb, ';');
> > > > > > + }
> > > > > > + sbuf_putc(sb, '"');
> > > > > > +}
> > > > > > +
> > > > > > +#define DEVCTL_LEN 1024
> > > > > > +static void
> > > > > > +dev_vfs_event(const char *type, struct mount *mp, bool
> > > > > > donew)
> > > > > > +{
> > > > > > + const uint8_t 

svn commit: r364405 - in head/sys/netinet: . tcp_stacks

2020-08-19 Thread Andrew Gallatin
Author: gallatin
Date: Wed Aug 19 17:59:06 2020
New Revision: 364405
URL: https://svnweb.freebsd.org/changeset/base/364405

Log:
  TCP: remove special treatment for hardware (ifnet) TLS
  
  Remove most special treatment for ifnet TLS in the TCP stack, except
  for code to avoid mixing handshakes and bulk data.
  
  This code made heroic efforts to send down entire TLS records to
  NICs. It was added to improve the PCIe bus efficiency of older TLS
  offload NICs which did not keep state per-session, and so would need
  to re-DMA the first part(s) of a TLS record if a TLS record was sent
  in multiple TCP packets or TSOs. Newer TLS offload NICs do not need
  this feature.
  
  At Netflix, we've run extensive QoE tests which show that this feature
  reduces client quality metrics, presumably because the effort to send
  TLS records atomically causes the server to both wait too long to send
  data (leading to buffers running dry), and to send too much data at
  once (leading to packet loss).
  
  Reviewed by:  hselasky,  jhb, rrs
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D26103

Modified:
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Wed Aug 19 17:52:06 2020
(r364404)
+++ head/sys/netinet/tcp_output.c   Wed Aug 19 17:59:06 2020
(r364405)
@@ -1957,17 +1957,6 @@ tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *ple
*pkthdrlen = len_cp;
break;
}
-
-   /*
-* Don't end a send in the middle of a TLS
-* record if it spans multiple TLS records.
-*/
-   if (tls != NULL && (m != start) && len < m->m_len) {
-   *plen = len_cp;
-   if (pkthdrlen != NULL)
-   *pkthdrlen = len_cp;
-   break;
-   }
}
 #endif
mlen = min(len, m->m_len - off);

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Wed Aug 19 17:52:06 2020
(r364404)
+++ head/sys/netinet/tcp_stacks/bbr.c   Wed Aug 19 17:59:06 2020
(r364405)
@@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_ipsec.h"
 #include "opt_tcpdebug.h"
 #include "opt_ratelimit.h"
-#include "opt_kern_tls.h"
 #include 
 #include 
 #include 
@@ -52,9 +51,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#ifdef KERN_TLS
-#include 
-#endif
 #include 
 #include 
 #ifdef STATS
@@ -4600,15 +4596,6 @@ bbr_timeout_tlp(struct tcpcb *tp, struct tcp_bbr *bbr,
bbr_set_state(tp, bbr, 0);
BBR_STAT_INC(bbr_tlp_tot);
maxseg = tp->t_maxseg - bbr->rc_last_options;
-#ifdef KERN_TLS
-   if (bbr->rc_inp->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) {
-   /*
-* For hardware TLS we do *not* want to send
-* new data.
-*/
-   goto need_retran;
-   }
-#endif
/*
 * A TLP timer has expired. We have been idle for 2 rtts. So we now
 * need to figure out how to force a full MSS segment out.
@@ -5802,8 +5789,6 @@ tcp_bbr_tso_size_check(struct tcp_bbr *bbr, uint32_t c
 * Note we do set anything TSO size until we are past the initial
 * window. Before that we gnerally use either a single MSS
 * or we use the full IW size (so we burst a IW at a time)
-* Also note that Hardware-TLS is special and does alternate
-* things to minimize PCI Bus Bandwidth use.
 */
 
if (bbr->rc_tp->t_maxseg > bbr->rc_last_options) {
@@ -5811,19 +5796,12 @@ tcp_bbr_tso_size_check(struct tcp_bbr *bbr, uint32_t c
} else {
maxseg = BBR_MIN_SEG - bbr->rc_last_options;
}
-#ifdef KERN_TLS
-   if (bbr->rc_inp->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) {
-   tls_seg =  ctf_get_opt_tls_size(bbr->rc_inp->inp_socket, 
bbr->rc_tp->snd_wnd);
-   bbr->r_ctl.rc_pace_min_segs = (tls_seg + bbr->rc_last_options);
-   }
-#endif
old_tso = bbr->r_ctl.rc_pace_max_segs;
if (bbr->rc_past_init_win == 0) {
/*
 * Not enough data has been acknowledged to make a
-* judgement unless we are hardware TLS. Set up
-* the initial TSO based on if we are sending a
-* full IW at once or not.
+* judgement. Set up the initial TSO based on if we
+* are sending a full IW at once or not.
 */

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

2020-08-19 Thread Shawn Webb
On Wed, Aug 19, 2020 at 11:51:10AM -0600, Warner Losh wrote:
> On Wed, Aug 19, 2020 at 11:48 AM Shawn Webb 
> wrote:
> 
> > On Wed, Aug 19, 2020 at 11:44:42AM -0600, Warner Losh wrote:
> > > On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb 
> > > wrote:
> > >
> > > > On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > > > > Author: imp
> > > > > Date: Wed Aug 19 17:10:04 2020
> > > > > New Revision: 364402
> > > > > URL: https://svnweb.freebsd.org/changeset/base/364402
> > > > >
> > > > > Log:
> > > > >   Add VFS FS events for mount and unmount to devctl/devd
> > > > >
> > > > >   Report when a filesystem is mounted, remounted or unmounted via
> > devd,
> > > > along with
> > > > >   details about the mount point and mount options.
> > > > >
> > > > >   Discussed with: kib@
> > > > >   Reviewed by: kirk@ (prior version)
> > > > >   Sponsored by: Netflix
> > > > >   Diffential Revision: https://reviews.freebsd.org/D25969
> > > > >
> > > > > Modified:
> > > > >   head/sys/kern/vfs_mount.c
> > > > >
> > > > > Modified: head/sys/kern/vfs_mount.c
> > > > >
> > > >
> > ==
> > > > > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020
> > (r364401)
> > > > > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020
> > (r364402)
> > > > > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> > > > >  #include 
> > > > >  #include 
> > > > >  #include 
> > > > > +#include 
> > > > >  #include 
> > > > >  #include 
> > > > >  #include 
> > > > > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx,
> > "mountlist",
> > > > MT
> > > > >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> > > > >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> > > > >
> > > > > +static void dev_vfs_event(const char *type, struct mount *mp, bool
> > > > donew);
> > > > > +
> > > > >  /*
> > > > >   * Global opts, taken by all filesystems
> > > > >   */
> > > > > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> > > > >   VOP_UNLOCK(vp);
> > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
> > > > >   VOP_UNLOCK(newdp);
> > > > > + dev_vfs_event("MOUNT", mp, false);
> > > > >   mountcheckdirs(vp, newdp);
> > > > >   vn_seqc_write_end(vp);
> > > > >   vn_seqc_write_end(newdp);
> > > > > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> > > > >   if (error != 0)
> > > > >   goto end;
> > > > >
> > > > > + dev_vfs_event("REMOUNT", mp, true);
> > > > >   if (mp->mnt_opt != NULL)
> > > > >   vfs_freeopts(mp->mnt_opt);
> > > > >   mp->mnt_opt = mp->mnt_optnew;
> > > > > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct
> > > > thread *
> > > > >   TAILQ_REMOVE(, mp, mnt_list);
> > > > >   mtx_unlock(_mtx);
> > > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > > > > + dev_vfs_event("UNMOUNT", mp, false);
> > > > >   if (coveredvp != NULL) {
> > > > >   coveredvp->v_mountedhere = NULL;
> > > > >   vn_seqc_write_end(coveredvp);
> > > > > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> > > > >
> > > > >   error = kernel_mount(ma, flags);
> > > > >   return (error);
> > > > > +}
> > > > > +
> > > > > +/* Map from mount options to printable formats. */
> > > > > +static struct mntoptnames optnames[] = {
> > > > > + MNTOPT_NAMES
> > > > > +};
> > > > > +
> > > > > +static void
> > > > > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct
> > > > vfsoptlist *opts)
> > > > > +{
> > > > > + struct vfsopt *opt;
> > > > > +
> > > > > + if (opts == NULL || TAILQ_EMPTY(opts))
> > > > > + return;
> > > > > + sbuf_printf(sb, " %s=\"", what);
> > > > > + TAILQ_FOREACH(opt, opts, link) {
> > > > > + if (opt->name[0] == '\0' || (opt->len > 0 && *(char
> > > > *)opt->value == '\0'))
> > > > > + continue;
> > > > > + devctl_safe_quote_sb(sb, opt->name);
> > > > > + if (opt->len > 0) {
> > > > > + sbuf_putc(sb, '=');
> > > > > + devctl_safe_quote_sb(sb, opt->value);
> > > > > + }
> > > > > + sbuf_putc(sb, ';');
> > > > > + }
> > > > > + sbuf_putc(sb, '"');
> > > > > +}
> > > > > +
> > > > > +#define DEVCTL_LEN 1024
> > > > > +static void
> > > > > +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> > > > > +{
> > > > > + const uint8_t *cp;
> > > > > + struct mntoptnames *fp;
> > > > > + struct sbuf sb;
> > > > > + struct statfs *sfp = >mnt_stat;
> > > > > + char *buf;
> > > > > +
> > > > > + buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
> > > > > + if (buf == NULL)
> > > > > + return;
> > > >
> > > > buf can't be NULL.
> > > >
> > >
> > > The bug here is that M_NOWAIT should have been specified in the malloc.
> > >
> > >
> > > > > + sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
> > > > > + sbuf_cpy(, "mount-point=\"");
> > 

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

2020-08-19 Thread Warner Losh
On Wed, Aug 19, 2020 at 11:48 AM Shawn Webb 
wrote:

> On Wed, Aug 19, 2020 at 11:44:42AM -0600, Warner Losh wrote:
> > On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb 
> > wrote:
> >
> > > On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > > > Author: imp
> > > > Date: Wed Aug 19 17:10:04 2020
> > > > New Revision: 364402
> > > > URL: https://svnweb.freebsd.org/changeset/base/364402
> > > >
> > > > Log:
> > > >   Add VFS FS events for mount and unmount to devctl/devd
> > > >
> > > >   Report when a filesystem is mounted, remounted or unmounted via
> devd,
> > > along with
> > > >   details about the mount point and mount options.
> > > >
> > > >   Discussed with: kib@
> > > >   Reviewed by: kirk@ (prior version)
> > > >   Sponsored by: Netflix
> > > >   Diffential Revision: https://reviews.freebsd.org/D25969
> > > >
> > > > Modified:
> > > >   head/sys/kern/vfs_mount.c
> > > >
> > > > Modified: head/sys/kern/vfs_mount.c
> > > >
> > >
> ==
> > > > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020
> (r364401)
> > > > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020
> (r364402)
> > > > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx,
> "mountlist",
> > > MT
> > > >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> > > >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> > > >
> > > > +static void dev_vfs_event(const char *type, struct mount *mp, bool
> > > donew);
> > > > +
> > > >  /*
> > > >   * Global opts, taken by all filesystems
> > > >   */
> > > > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> > > >   VOP_UNLOCK(vp);
> > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
> > > >   VOP_UNLOCK(newdp);
> > > > + dev_vfs_event("MOUNT", mp, false);
> > > >   mountcheckdirs(vp, newdp);
> > > >   vn_seqc_write_end(vp);
> > > >   vn_seqc_write_end(newdp);
> > > > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> > > >   if (error != 0)
> > > >   goto end;
> > > >
> > > > + dev_vfs_event("REMOUNT", mp, true);
> > > >   if (mp->mnt_opt != NULL)
> > > >   vfs_freeopts(mp->mnt_opt);
> > > >   mp->mnt_opt = mp->mnt_optnew;
> > > > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct
> > > thread *
> > > >   TAILQ_REMOVE(, mp, mnt_list);
> > > >   mtx_unlock(_mtx);
> > > >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > > > + dev_vfs_event("UNMOUNT", mp, false);
> > > >   if (coveredvp != NULL) {
> > > >   coveredvp->v_mountedhere = NULL;
> > > >   vn_seqc_write_end(coveredvp);
> > > > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> > > >
> > > >   error = kernel_mount(ma, flags);
> > > >   return (error);
> > > > +}
> > > > +
> > > > +/* Map from mount options to printable formats. */
> > > > +static struct mntoptnames optnames[] = {
> > > > + MNTOPT_NAMES
> > > > +};
> > > > +
> > > > +static void
> > > > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct
> > > vfsoptlist *opts)
> > > > +{
> > > > + struct vfsopt *opt;
> > > > +
> > > > + if (opts == NULL || TAILQ_EMPTY(opts))
> > > > + return;
> > > > + sbuf_printf(sb, " %s=\"", what);
> > > > + TAILQ_FOREACH(opt, opts, link) {
> > > > + if (opt->name[0] == '\0' || (opt->len > 0 && *(char
> > > *)opt->value == '\0'))
> > > > + continue;
> > > > + devctl_safe_quote_sb(sb, opt->name);
> > > > + if (opt->len > 0) {
> > > > + sbuf_putc(sb, '=');
> > > > + devctl_safe_quote_sb(sb, opt->value);
> > > > + }
> > > > + sbuf_putc(sb, ';');
> > > > + }
> > > > + sbuf_putc(sb, '"');
> > > > +}
> > > > +
> > > > +#define DEVCTL_LEN 1024
> > > > +static void
> > > > +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> > > > +{
> > > > + const uint8_t *cp;
> > > > + struct mntoptnames *fp;
> > > > + struct sbuf sb;
> > > > + struct statfs *sfp = >mnt_stat;
> > > > + char *buf;
> > > > +
> > > > + buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
> > > > + if (buf == NULL)
> > > > + return;
> > >
> > > buf can't be NULL.
> > >
> >
> > The bug here is that M_NOWAIT should have been specified in the malloc.
> >
> >
> > > > + sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
> > > > + sbuf_cpy(, "mount-point=\"");
> > > > + devctl_safe_quote_sb(, sfp->f_mntonname);
> > > > + sbuf_cat(, "\" mount-dev=\"");
> > > > + devctl_safe_quote_sb(, sfp->f_mntfromname);
> > > > + sbuf_cat(, "\" mount-type=\"");
> > > > + devctl_safe_quote_sb(, sfp->f_fstypename);
> > > > + sbuf_cat(, "\" fsid=0x");
> > > > + cp = (const uint8_t 

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

2020-08-19 Thread Ed Maste
Author: emaste
Date: Wed Aug 19 17:52:06 2020
New Revision: 364404
URL: https://svnweb.freebsd.org/changeset/base/364404

Log:
  ipfirewall(4): remove Cuseeme from supported list
  
  Submitted by: Dries Michiels
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26075

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

Modified: head/share/man/man4/ipfirewall.4
==
--- head/share/man/man4/ipfirewall.4Wed Aug 19 17:10:09 2020
(r364403)
+++ head/share/man/man4/ipfirewall.4Wed Aug 19 17:52:06 2020
(r364404)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 21, 2020
+.Dd August 19, 2020
 .Dt IPFW 4
 .Os
 .Sh NAME
@@ -133,7 +133,7 @@ the kernel option
 enables full
 .Xr libalias 3
 functionality in the kernel.
-Full functionality refers to included support for cuseeme, ftp, bbt,
+Full functionality refers to included support for ftp, bbt,
 skinny, irc, pptp and smedia packets, which are missing in the basic
 .Xr libalias 3
 functionality accomplished with the
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-08-19 Thread Shawn Webb
On Wed, Aug 19, 2020 at 11:44:42AM -0600, Warner Losh wrote:
> On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb 
> wrote:
> 
> > On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > > Author: imp
> > > Date: Wed Aug 19 17:10:04 2020
> > > New Revision: 364402
> > > URL: https://svnweb.freebsd.org/changeset/base/364402
> > >
> > > Log:
> > >   Add VFS FS events for mount and unmount to devctl/devd
> > >
> > >   Report when a filesystem is mounted, remounted or unmounted via devd,
> > along with
> > >   details about the mount point and mount options.
> > >
> > >   Discussed with: kib@
> > >   Reviewed by: kirk@ (prior version)
> > >   Sponsored by: Netflix
> > >   Diffential Revision: https://reviews.freebsd.org/D25969
> > >
> > > Modified:
> > >   head/sys/kern/vfs_mount.c
> > >
> > > Modified: head/sys/kern/vfs_mount.c
> > >
> > ==
> > > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020(r364401)
> > > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020(r364402)
> > > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> > >  #include 
> > >  #include 
> > >  #include 
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx, "mountlist",
> > MT
> > >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> > >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> > >
> > > +static void dev_vfs_event(const char *type, struct mount *mp, bool
> > donew);
> > > +
> > >  /*
> > >   * Global opts, taken by all filesystems
> > >   */
> > > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> > >   VOP_UNLOCK(vp);
> > >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
> > >   VOP_UNLOCK(newdp);
> > > + dev_vfs_event("MOUNT", mp, false);
> > >   mountcheckdirs(vp, newdp);
> > >   vn_seqc_write_end(vp);
> > >   vn_seqc_write_end(newdp);
> > > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> > >   if (error != 0)
> > >   goto end;
> > >
> > > + dev_vfs_event("REMOUNT", mp, true);
> > >   if (mp->mnt_opt != NULL)
> > >   vfs_freeopts(mp->mnt_opt);
> > >   mp->mnt_opt = mp->mnt_optnew;
> > > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct
> > thread *
> > >   TAILQ_REMOVE(, mp, mnt_list);
> > >   mtx_unlock(_mtx);
> > >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > > + dev_vfs_event("UNMOUNT", mp, false);
> > >   if (coveredvp != NULL) {
> > >   coveredvp->v_mountedhere = NULL;
> > >   vn_seqc_write_end(coveredvp);
> > > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> > >
> > >   error = kernel_mount(ma, flags);
> > >   return (error);
> > > +}
> > > +
> > > +/* Map from mount options to printable formats. */
> > > +static struct mntoptnames optnames[] = {
> > > + MNTOPT_NAMES
> > > +};
> > > +
> > > +static void
> > > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct
> > vfsoptlist *opts)
> > > +{
> > > + struct vfsopt *opt;
> > > +
> > > + if (opts == NULL || TAILQ_EMPTY(opts))
> > > + return;
> > > + sbuf_printf(sb, " %s=\"", what);
> > > + TAILQ_FOREACH(opt, opts, link) {
> > > + if (opt->name[0] == '\0' || (opt->len > 0 && *(char
> > *)opt->value == '\0'))
> > > + continue;
> > > + devctl_safe_quote_sb(sb, opt->name);
> > > + if (opt->len > 0) {
> > > + sbuf_putc(sb, '=');
> > > + devctl_safe_quote_sb(sb, opt->value);
> > > + }
> > > + sbuf_putc(sb, ';');
> > > + }
> > > + sbuf_putc(sb, '"');
> > > +}
> > > +
> > > +#define DEVCTL_LEN 1024
> > > +static void
> > > +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> > > +{
> > > + const uint8_t *cp;
> > > + struct mntoptnames *fp;
> > > + struct sbuf sb;
> > > + struct statfs *sfp = >mnt_stat;
> > > + char *buf;
> > > +
> > > + buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
> > > + if (buf == NULL)
> > > + return;
> >
> > buf can't be NULL.
> >
> 
> The bug here is that M_NOWAIT should have been specified in the malloc.
> 
> 
> > > + sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
> > > + sbuf_cpy(, "mount-point=\"");
> > > + devctl_safe_quote_sb(, sfp->f_mntonname);
> > > + sbuf_cat(, "\" mount-dev=\"");
> > > + devctl_safe_quote_sb(, sfp->f_mntfromname);
> > > + sbuf_cat(, "\" mount-type=\"");
> > > + devctl_safe_quote_sb(, sfp->f_fstypename);
> > > + sbuf_cat(, "\" fsid=0x");
> > > + cp = (const uint8_t *)>f_fsid.val[0];
> > > + for (int i = 0; i < sizeof(sfp->f_fsid); i++)
> > > + sbuf_printf(, "%02x", cp[i]);
> > > + sbuf_printf(, " owner=%u flags=\"", sfp->f_owner);
> > > + for (fp = optnames; fp->o_opt != 0; fp++) {
> > > + if ((mp->mnt_flag & fp->o_opt) != 0) {
> > > +  

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

2020-08-19 Thread Warner Losh
On Wed, Aug 19, 2020 at 11:26 AM Shawn Webb 
wrote:

> On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> > Author: imp
> > Date: Wed Aug 19 17:10:04 2020
> > New Revision: 364402
> > URL: https://svnweb.freebsd.org/changeset/base/364402
> >
> > Log:
> >   Add VFS FS events for mount and unmount to devctl/devd
> >
> >   Report when a filesystem is mounted, remounted or unmounted via devd,
> along with
> >   details about the mount point and mount options.
> >
> >   Discussed with: kib@
> >   Reviewed by: kirk@ (prior version)
> >   Sponsored by: Netflix
> >   Diffential Revision: https://reviews.freebsd.org/D25969
> >
> > Modified:
> >   head/sys/kern/vfs_mount.c
> >
> > Modified: head/sys/kern/vfs_mount.c
> >
> ==
> > --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020(r364401)
> > +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020(r364402)
> > @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx, "mountlist",
> MT
> >  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
> >  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
> >
> > +static void dev_vfs_event(const char *type, struct mount *mp, bool
> donew);
> > +
> >  /*
> >   * Global opts, taken by all filesystems
> >   */
> > @@ -1020,6 +1023,7 @@ vfs_domount_first(
> >   VOP_UNLOCK(vp);
> >   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
> >   VOP_UNLOCK(newdp);
> > + dev_vfs_event("MOUNT", mp, false);
> >   mountcheckdirs(vp, newdp);
> >   vn_seqc_write_end(vp);
> >   vn_seqc_write_end(newdp);
> > @@ -1221,6 +1225,7 @@ vfs_domount_update(
> >   if (error != 0)
> >   goto end;
> >
> > + dev_vfs_event("REMOUNT", mp, true);
> >   if (mp->mnt_opt != NULL)
> >   vfs_freeopts(mp->mnt_opt);
> >   mp->mnt_opt = mp->mnt_optnew;
> > @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct
> thread *
> >   TAILQ_REMOVE(, mp, mnt_list);
> >   mtx_unlock(_mtx);
> >   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> > + dev_vfs_event("UNMOUNT", mp, false);
> >   if (coveredvp != NULL) {
> >   coveredvp->v_mountedhere = NULL;
> >   vn_seqc_write_end(coveredvp);
> > @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
> >
> >   error = kernel_mount(ma, flags);
> >   return (error);
> > +}
> > +
> > +/* Map from mount options to printable formats. */
> > +static struct mntoptnames optnames[] = {
> > + MNTOPT_NAMES
> > +};
> > +
> > +static void
> > +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct
> vfsoptlist *opts)
> > +{
> > + struct vfsopt *opt;
> > +
> > + if (opts == NULL || TAILQ_EMPTY(opts))
> > + return;
> > + sbuf_printf(sb, " %s=\"", what);
> > + TAILQ_FOREACH(opt, opts, link) {
> > + if (opt->name[0] == '\0' || (opt->len > 0 && *(char
> *)opt->value == '\0'))
> > + continue;
> > + devctl_safe_quote_sb(sb, opt->name);
> > + if (opt->len > 0) {
> > + sbuf_putc(sb, '=');
> > + devctl_safe_quote_sb(sb, opt->value);
> > + }
> > + sbuf_putc(sb, ';');
> > + }
> > + sbuf_putc(sb, '"');
> > +}
> > +
> > +#define DEVCTL_LEN 1024
> > +static void
> > +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> > +{
> > + const uint8_t *cp;
> > + struct mntoptnames *fp;
> > + struct sbuf sb;
> > + struct statfs *sfp = >mnt_stat;
> > + char *buf;
> > +
> > + buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
> > + if (buf == NULL)
> > + return;
>
> buf can't be NULL.
>

The bug here is that M_NOWAIT should have been specified in the malloc.


> > + sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
> > + sbuf_cpy(, "mount-point=\"");
> > + devctl_safe_quote_sb(, sfp->f_mntonname);
> > + sbuf_cat(, "\" mount-dev=\"");
> > + devctl_safe_quote_sb(, sfp->f_mntfromname);
> > + sbuf_cat(, "\" mount-type=\"");
> > + devctl_safe_quote_sb(, sfp->f_fstypename);
> > + sbuf_cat(, "\" fsid=0x");
> > + cp = (const uint8_t *)>f_fsid.val[0];
> > + for (int i = 0; i < sizeof(sfp->f_fsid); i++)
> > + sbuf_printf(, "%02x", cp[i]);
> > + sbuf_printf(, " owner=%u flags=\"", sfp->f_owner);
> > + for (fp = optnames; fp->o_opt != 0; fp++) {
> > + if ((mp->mnt_flag & fp->o_opt) != 0) {
> > + sbuf_cat(, fp->o_name);
> > + sbuf_putc(, ';');
> > + }
> > + }
> > + sbuf_putc(, '"');
> > + dev_vfs_event_mntopt(, "opt", mp->mnt_opt);
> > + if (donew)
> > + dev_vfs_event_mntopt(, "optnew", mp->mnt_optnew);
> > + sbuf_finish();
> > +
> > + devctl_notify("VFS", 

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

2020-08-19 Thread Shawn Webb
On Wed, Aug 19, 2020 at 05:10:05PM +, Warner Losh wrote:
> Author: imp
> Date: Wed Aug 19 17:10:04 2020
> New Revision: 364402
> URL: https://svnweb.freebsd.org/changeset/base/364402
> 
> Log:
>   Add VFS FS events for mount and unmount to devctl/devd
>   
>   Report when a filesystem is mounted, remounted or unmounted via devd, along 
> with
>   details about the mount point and mount options.
>   
>   Discussed with: kib@
>   Reviewed by: kirk@ (prior version)
>   Sponsored by: Netflix
>   Diffential Revision: https://reviews.freebsd.org/D25969
> 
> Modified:
>   head/sys/kern/vfs_mount.c
> 
> Modified: head/sys/kern/vfs_mount.c
> ==
> --- head/sys/kern/vfs_mount.c Wed Aug 19 17:09:58 2020(r364401)
> +++ head/sys/kern/vfs_mount.c Wed Aug 19 17:10:04 2020(r364402)
> @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx, "mountlist", MT
>  EVENTHANDLER_LIST_DEFINE(vfs_mounted);
>  EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
>  
> +static void dev_vfs_event(const char *type, struct mount *mp, bool donew);
> +
>  /*
>   * Global opts, taken by all filesystems
>   */
> @@ -1020,6 +1023,7 @@ vfs_domount_first(
>   VOP_UNLOCK(vp);
>   EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
>   VOP_UNLOCK(newdp);
> + dev_vfs_event("MOUNT", mp, false);
>   mountcheckdirs(vp, newdp);
>   vn_seqc_write_end(vp);
>   vn_seqc_write_end(newdp);
> @@ -1221,6 +1225,7 @@ vfs_domount_update(
>   if (error != 0)
>   goto end;
>  
> + dev_vfs_event("REMOUNT", mp, true);
>   if (mp->mnt_opt != NULL)
>   vfs_freeopts(mp->mnt_opt);
>   mp->mnt_opt = mp->mnt_optnew;
> @@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct thread *
>   TAILQ_REMOVE(, mp, mnt_list);
>   mtx_unlock(_mtx);
>   EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
> + dev_vfs_event("UNMOUNT", mp, false);
>   if (coveredvp != NULL) {
>   coveredvp->v_mountedhere = NULL;
>   vn_seqc_write_end(coveredvp);
> @@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
>  
>   error = kernel_mount(ma, flags);
>   return (error);
> +}
> +
> +/* Map from mount options to printable formats. */
> +static struct mntoptnames optnames[] = {
> + MNTOPT_NAMES
> +};
> +
> +static void
> +dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct vfsoptlist 
> *opts)
> +{
> + struct vfsopt *opt;
> +
> + if (opts == NULL || TAILQ_EMPTY(opts))
> + return;
> + sbuf_printf(sb, " %s=\"", what);
> + TAILQ_FOREACH(opt, opts, link) {
> + if (opt->name[0] == '\0' || (opt->len > 0 && *(char 
> *)opt->value == '\0'))
> + continue;
> + devctl_safe_quote_sb(sb, opt->name);
> + if (opt->len > 0) {
> + sbuf_putc(sb, '=');
> + devctl_safe_quote_sb(sb, opt->value);
> + }
> + sbuf_putc(sb, ';');
> + }
> + sbuf_putc(sb, '"');
> +}
> +
> +#define DEVCTL_LEN 1024
> +static void
> +dev_vfs_event(const char *type, struct mount *mp, bool donew)
> +{
> + const uint8_t *cp;
> + struct mntoptnames *fp;
> + struct sbuf sb;
> + struct statfs *sfp = >mnt_stat;
> + char *buf;
> +
> + buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
> + if (buf == NULL)
> + return;

buf can't be NULL.

> + sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
> + sbuf_cpy(, "mount-point=\"");
> + devctl_safe_quote_sb(, sfp->f_mntonname);
> + sbuf_cat(, "\" mount-dev=\"");
> + devctl_safe_quote_sb(, sfp->f_mntfromname);
> + sbuf_cat(, "\" mount-type=\"");
> + devctl_safe_quote_sb(, sfp->f_fstypename);
> + sbuf_cat(, "\" fsid=0x");
> + cp = (const uint8_t *)>f_fsid.val[0];
> + for (int i = 0; i < sizeof(sfp->f_fsid); i++)
> + sbuf_printf(, "%02x", cp[i]);
> + sbuf_printf(, " owner=%u flags=\"", sfp->f_owner);
> + for (fp = optnames; fp->o_opt != 0; fp++) {
> + if ((mp->mnt_flag & fp->o_opt) != 0) {
> + sbuf_cat(, fp->o_name);
> + sbuf_putc(, ';');
> + }
> + }
> + sbuf_putc(, '"');
> + dev_vfs_event_mntopt(, "opt", mp->mnt_opt);
> + if (donew)
> + dev_vfs_event_mntopt(, "optnew", mp->mnt_optnew);
> + sbuf_finish();
> +
> + devctl_notify("VFS", "FS", type, sbuf_data());
> + sbuf_delete();
> + free(buf, M_MOUNT);
>  }

I don't really see much attention paid to checking for sbuf overflow.
Could that cause issues, especially in case of impartial quotation
termination? Could not performing those checks have security
implications? Would performing those checks adhere to good code
development practices?

Thanks,

-- 
Shawn Webb

svn commit: r364403 - head/sbin/devd

2020-08-19 Thread Warner Losh
Author: imp
Date: Wed Aug 19 17:10:09 2020
New Revision: 364403
URL: https://svnweb.freebsd.org/changeset/base/364403

Log:
  Document the VFS FS events
  
  MOUNT notifies when a filesystem is mounted
  REMOUNT notifies when a filesystem is mounted again
  UNMOUNT notifies when a filesystem is unmounted
  
  These events are asynchronous to the actual state of the event (though the 
data
  is recorded at a time when it is stable). The mount event is reported after 
the
  filesystem is mounted. However, in the interim it may be unmounted by another
  agent. Likewise, umount is called just before the mountpoint is finished 
tearing
  down. It may be remounted (or maybe if the process scheduling is wonky and 
devd
  gets to run before the last few steps are complete).
  
  Sponsored by: Netflix
  Diffential Revision: https://reviews.freebsd.org/D25969

Modified:
  head/sbin/devd/devd.conf.5

Modified: head/sbin/devd/devd.conf.5
==
--- head/sbin/devd/devd.conf.5  Wed Aug 19 17:10:04 2020(r364402)
+++ head/sbin/devd/devd.conf.5  Wed Aug 19 17:10:09 2020(r364403)
@@ -573,6 +573,20 @@ USB interface is detached from a device.
 .Pp
 .Bl -column "System" "Subsystem" "1234567" -compact
 .Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
+.It Li VFS Ta Ta Ta
+Events from the vfs system.
+.It Li VFS Ta Li FS Ta Ta
+Events that change what is mounted to the system.
+.It Li VFS Ta Li FS Ta Li MOUNT Ta
+Notification of a filesystem is mounted for the first time.
+.It Li VFS Ta Li FS Ta Li REMOUNT Ta
+Notification of a filesystem is remounted (whether or not the options actually 
change).
+.It Li VFS Ta Li FS Ta Li UNMOUNT Ta
+Notification of a filesystem being unmounted.
+.El
+.Pp
+.Bl -column "System" "Subsystem" "1234567" -compact
+.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
 .It Li ZFS Ta ZFS Ta Ta
 Events about the ZFS subsystem.
 See
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364401 - in head: sbin/mount sys/sys

2020-08-19 Thread Warner Losh
Author: imp
Date: Wed Aug 19 17:09:58 2020
New Revision: 364401
URL: https://svnweb.freebsd.org/changeset/base/364401

Log:
  Move the mount name to bit mapping into sys/mount.h so it can be shared with 
the
  kernel.
  
  Discussed with: kib@
  Reviewed by: kirk@ (prior version)
  Sponsored by: Netflix
  Diffential Revision: https://reviews.freebsd.org/D25969

Modified:
  head/sbin/mount/mount.c
  head/sys/sys/mount.h

Modified: head/sbin/mount/mount.c
==
--- head/sbin/mount/mount.c Wed Aug 19 17:05:30 2020(r364400)
+++ head/sbin/mount/mount.c Wed Aug 19 17:09:58 2020(r364401)
@@ -42,6 +42,7 @@ static char sccsid[] = "@(#)mount.c   8.25 (Berkeley) 5/
 __FBSDID("$FreeBSD$");
 
 #include 
+#define _WANT_MNTOPTNAMES
 #include 
 #include 
 #include 
@@ -92,36 +93,8 @@ void usage(void);
 char   *flags2opts(int);
 
 /* Map from mount options to printable formats. */
-static struct opt {
-   uint64_t o_opt;
-   const char *o_name;
-} optnames[] = {
-   { MNT_ASYNC,"asynchronous" },
-   { MNT_EXPORTED, "NFS exported" },
-   { MNT_LOCAL,"local" },
-   { MNT_NOATIME,  "noatime" },
-   { MNT_NOEXEC,   "noexec" },
-   { MNT_NOSUID,   "nosuid" },
-   { MNT_NOSYMFOLLOW,  "nosymfollow" },
-   { MNT_QUOTA,"with quotas" },
-   { MNT_RDONLY,   "read-only" },
-   { MNT_SYNCHRONOUS,  "synchronous" },
-   { MNT_UNION,"union" },
-   { MNT_NOCLUSTERR,   "noclusterr" },
-   { MNT_NOCLUSTERW,   "noclusterw" },
-   { MNT_SUIDDIR,  "suiddir" },
-   { MNT_SOFTDEP,  "soft-updates" },
-   { MNT_SUJ,  "journaled soft-updates" },
-   { MNT_MULTILABEL,   "multilabel" },
-   { MNT_ACLS, "acls" },
-   { MNT_NFS4ACLS, "nfsv4acls" },
-   { MNT_GJOURNAL, "gjournal" },
-   { MNT_AUTOMOUNTED,  "automounted" },
-   { MNT_VERIFIED, "verified" },
-   { MNT_UNTRUSTED,"untrusted" },
-   { MNT_NOCOVER,  "nocover" },
-   { MNT_EMPTYDIR, "emptydir" },
-   { 0, NULL }
+static struct mntoptnames optnames[] = {
+   MNTOPT_NAMES
 };
 
 /*
@@ -664,7 +637,7 @@ prmount(struct statfs *sfp)
 {
uint64_t flags;
unsigned int i;
-   struct opt *o;
+   struct mntoptnames *o;
struct passwd *pw;
 
(void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname,

Modified: head/sys/sys/mount.h
==
--- head/sys/sys/mount.hWed Aug 19 17:05:30 2020(r364400)
+++ head/sys/sys/mount.hWed Aug 19 17:09:58 2020(r364401)
@@ -294,6 +294,45 @@ void  __mnt_vnode_markerfree_lazy(struct vnode
 
 #endif /* _KERNEL */
 
+#if defined(_WANT_MNTOPTNAMES) || defined(_KERNEL)
+struct mntoptnames {
+   uint64_t o_opt;
+   const char *o_name;
+};
+#define MNTOPT_NAMES   \
+   { MNT_ASYNC,"asynchronous" },   \
+   { MNT_EXPORTED, "NFS exported" },   \
+   { MNT_LOCAL,"local" },  \
+   { MNT_NOATIME,  "noatime" },\
+   { MNT_NOEXEC,   "noexec" }, \
+   { MNT_NOSUID,   "nosuid" }, \
+   { MNT_NOSYMFOLLOW,  "nosymfollow" },\
+   { MNT_QUOTA,"with quotas" },\
+   { MNT_RDONLY,   "read-only" },  \
+   { MNT_SYNCHRONOUS,  "synchronous" },\
+   { MNT_UNION,"union" },  \
+   { MNT_NOCLUSTERR,   "noclusterr" }, \
+   { MNT_NOCLUSTERW,   "noclusterw" }, \
+   { MNT_SUIDDIR,  "suiddir" },\
+   { MNT_SOFTDEP,  "soft-updates" },   \
+   { MNT_SUJ,  "journaled soft-updates" }, \
+   { MNT_MULTILABEL,   "multilabel" }, \
+   { MNT_ACLS, "acls" },   \
+   { MNT_NFS4ACLS, "nfsv4acls" },  \
+   { MNT_GJOURNAL, "gjournal" },   \
+   { MNT_AUTOMOUNTED,  "automounted" },\
+   { MNT_VERIFIED, "verified" },   \
+   { MNT_UNTRUSTED,"untrusted" },  \
+   { MNT_NOCOVER,  "nocover" },\
+   { MNT_EMPTYDIR, "emptydir" },  

svn commit: r364402 - head/sys/kern

2020-08-19 Thread Warner Losh
Author: imp
Date: Wed Aug 19 17:10:04 2020
New Revision: 364402
URL: https://svnweb.freebsd.org/changeset/base/364402

Log:
  Add VFS FS events for mount and unmount to devctl/devd
  
  Report when a filesystem is mounted, remounted or unmounted via devd, along 
with
  details about the mount point and mount options.
  
  Discussed with:   kib@
  Reviewed by: kirk@ (prior version)
  Sponsored by: Netflix
  Diffential Revision: https://reviews.freebsd.org/D25969

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Wed Aug 19 17:09:58 2020(r364401)
+++ head/sys/kern/vfs_mount.c   Wed Aug 19 17:10:04 2020(r364402)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -101,6 +102,8 @@ MTX_SYSINIT(mountlist, _mtx, "mountlist", MT
 EVENTHANDLER_LIST_DEFINE(vfs_mounted);
 EVENTHANDLER_LIST_DEFINE(vfs_unmounted);
 
+static void dev_vfs_event(const char *type, struct mount *mp, bool donew);
+
 /*
  * Global opts, taken by all filesystems
  */
@@ -1020,6 +1023,7 @@ vfs_domount_first(
VOP_UNLOCK(vp);
EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
VOP_UNLOCK(newdp);
+   dev_vfs_event("MOUNT", mp, false);
mountcheckdirs(vp, newdp);
vn_seqc_write_end(vp);
vn_seqc_write_end(newdp);
@@ -1221,6 +1225,7 @@ vfs_domount_update(
if (error != 0)
goto end;
 
+   dev_vfs_event("REMOUNT", mp, true);
if (mp->mnt_opt != NULL)
vfs_freeopts(mp->mnt_opt);
mp->mnt_opt = mp->mnt_optnew;
@@ -1839,6 +1844,7 @@ dounmount(struct mount *mp, int flags, struct thread *
TAILQ_REMOVE(, mp, mnt_list);
mtx_unlock(_mtx);
EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
+   dev_vfs_event("UNMOUNT", mp, false);
if (coveredvp != NULL) {
coveredvp->v_mountedhere = NULL;
vn_seqc_write_end(coveredvp);
@@ -2425,4 +2431,72 @@ kernel_vmount(int flags, ...)
 
error = kernel_mount(ma, flags);
return (error);
+}
+
+/* Map from mount options to printable formats. */
+static struct mntoptnames optnames[] = {
+   MNTOPT_NAMES
+};
+
+static void
+dev_vfs_event_mntopt(struct sbuf *sb, const char *what, struct vfsoptlist 
*opts)
+{
+   struct vfsopt *opt;
+
+   if (opts == NULL || TAILQ_EMPTY(opts))
+   return;
+   sbuf_printf(sb, " %s=\"", what);
+   TAILQ_FOREACH(opt, opts, link) {
+   if (opt->name[0] == '\0' || (opt->len > 0 && *(char 
*)opt->value == '\0'))
+   continue;
+   devctl_safe_quote_sb(sb, opt->name);
+   if (opt->len > 0) {
+   sbuf_putc(sb, '=');
+   devctl_safe_quote_sb(sb, opt->value);
+   }
+   sbuf_putc(sb, ';');
+   }
+   sbuf_putc(sb, '"');
+}
+
+#define DEVCTL_LEN 1024
+static void
+dev_vfs_event(const char *type, struct mount *mp, bool donew)
+{
+   const uint8_t *cp;
+   struct mntoptnames *fp;
+   struct sbuf sb;
+   struct statfs *sfp = >mnt_stat;
+   char *buf;
+
+   buf = malloc(DEVCTL_LEN, M_MOUNT, M_WAITOK);
+   if (buf == NULL)
+   return;
+   sbuf_new(, buf, DEVCTL_LEN, SBUF_FIXEDLEN);
+   sbuf_cpy(, "mount-point=\"");
+   devctl_safe_quote_sb(, sfp->f_mntonname);
+   sbuf_cat(, "\" mount-dev=\"");
+   devctl_safe_quote_sb(, sfp->f_mntfromname);
+   sbuf_cat(, "\" mount-type=\"");
+   devctl_safe_quote_sb(, sfp->f_fstypename);
+   sbuf_cat(, "\" fsid=0x");
+   cp = (const uint8_t *)>f_fsid.val[0];
+   for (int i = 0; i < sizeof(sfp->f_fsid); i++)
+   sbuf_printf(, "%02x", cp[i]);
+   sbuf_printf(, " owner=%u flags=\"", sfp->f_owner);
+   for (fp = optnames; fp->o_opt != 0; fp++) {
+   if ((mp->mnt_flag & fp->o_opt) != 0) {
+   sbuf_cat(, fp->o_name);
+   sbuf_putc(, ';');
+   }
+   }
+   sbuf_putc(, '"');
+   dev_vfs_event_mntopt(, "opt", mp->mnt_opt);
+   if (donew)
+   dev_vfs_event_mntopt(, "optnew", mp->mnt_optnew);
+   sbuf_finish();
+
+   devctl_notify("VFS", "FS", type, sbuf_data());
+   sbuf_delete();
+   free(buf, M_MOUNT);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364400 - head/lib/clang

2020-08-19 Thread Dimitry Andric
Author: dim
Date: Wed Aug 19 17:05:30 2020
New Revision: 364400
URL: https://svnweb.freebsd.org/changeset/base/364400

Log:
  Fix the mips64 world build after r364284.
  
  Linking the full version of clang 11 results in errors similar to:
  
  lld: error: 
/usr/src/contrib/llvm-project/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:736:(.text._ZN5clang4ento22CreateAnalysisConsumerERNS_16CompilerInstanceE+0xE0):
 relocation R_MIPS_CALL16 out of range: 48920 is not in [-32768, 32767]; 
references operator new(unsigned long)
  
  Add -mxgot to the compilation flags for llvm libraries to work around
  this error. This may be too big of a hammer, but it can always be
  refined later.
  
  MFC after:6 weeks

Modified:
  head/lib/clang/llvm.build.mk

Modified: head/lib/clang/llvm.build.mk
==
--- head/lib/clang/llvm.build.mkWed Aug 19 16:09:36 2020
(r364399)
+++ head/lib/clang/llvm.build.mkWed Aug 19 17:05:30 2020
(r364400)
@@ -106,3 +106,8 @@ CXXSTD?=c++14
 CXXFLAGS+= -fno-exceptions
 CXXFLAGS+= -fno-rtti
 CXXFLAGS.clang+= -stdlib=libc++
+
+.if ${MACHINE_ARCH:Mmips64}
+STATIC_CFLAGS+= -mxgot
+STATIC_CXXFLAGS+= -mxgot
+.endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364399 - in head/sys: amd64/acpica arm64/acpica i386/acpica

2020-08-19 Thread Alexander Motin
Author: mav
Date: Wed Aug 19 16:09:36 2020
New Revision: 364399
URL: https://svnweb.freebsd.org/changeset/base/364399

Log:
  Remove some noisy ACPI tables messages from verbose dmesg.
  
  Those messages were printed hundreds of times during boot, often multiple
  times for each table.  We already print information about the tables in
  more organized form once to not duplicate it when random ACPI drivers are
  attaching.
  
  MFC after:1 week

Modified:
  head/sys/amd64/acpica/acpi_machdep.c
  head/sys/arm64/acpica/acpi_machdep.c
  head/sys/i386/acpica/acpi_machdep.c

Modified: head/sys/amd64/acpica/acpi_machdep.c
==
--- head/sys/amd64/acpica/acpi_machdep.cWed Aug 19 15:27:09 2020
(r364398)
+++ head/sys/amd64/acpica/acpi_machdep.cWed Aug 19 16:09:36 2020
(r364399)
@@ -198,9 +198,6 @@ probe_table(vm_paddr_t address, const char *sig)
(uintmax_t)address);
return (0);
}
-   if (bootverbose)
-   printf("Table '%.4s' at 0x%jx\n", table->Signature,
-   (uintmax_t)address);
 
if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
@@ -312,13 +309,8 @@ acpi_find_table(const char *sig)
acpi_unmap_table(rsdt);
}
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
-   if (addr == 0) {
-   if (bootverbose)
-   printf("ACPI: No %s table found\n", sig);
+   if (addr == 0)
return (0);
-   }
-   if (bootverbose)
-   printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
 
/*
 * Verify that we can map the full table and that its checksum is

Modified: head/sys/arm64/acpica/acpi_machdep.c
==
--- head/sys/arm64/acpica/acpi_machdep.cWed Aug 19 15:27:09 2020
(r364398)
+++ head/sys/arm64/acpica/acpi_machdep.cWed Aug 19 16:09:36 2020
(r364399)
@@ -105,9 +105,6 @@ probe_table(vm_paddr_t address, const char *sig)
(uintmax_t)address);
return (0);
}
-   if (bootverbose)
-   printf("Table '%.4s' at 0x%jx\n", table->Signature,
-   (uintmax_t)address);
 
if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
pmap_unmapbios((vm_offset_t)table, sizeof(ACPI_TABLE_HEADER));
@@ -200,13 +197,8 @@ acpi_find_table(const char *sig)
}
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
 
-   if (addr == 0) {
-   if (bootverbose)
-   printf("ACPI: No %s table found\n", sig);
+   if (addr == 0)
return (0);
-   }
-   if (bootverbose)
-   printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
 
/*
 * Verify that we can map the full table and that its checksum is

Modified: head/sys/i386/acpica/acpi_machdep.c
==
--- head/sys/i386/acpica/acpi_machdep.c Wed Aug 19 15:27:09 2020
(r364398)
+++ head/sys/i386/acpica/acpi_machdep.c Wed Aug 19 16:09:36 2020
(r364399)
@@ -214,9 +214,6 @@ probe_table(vm_paddr_t address, const char *sig)
(uintmax_t)address);
return (0);
}
-   if (bootverbose)
-   printf("Table '%.4s' at 0x%jx\n", table->Signature,
-   (uintmax_t)address);
 
if (strncmp(table->Signature, sig, ACPI_NAMESEG_SIZE) != 0) {
table_unmap(table, sizeof(ACPI_TABLE_HEADER));
@@ -328,13 +325,8 @@ acpi_find_table(const char *sig)
acpi_unmap_table(rsdt);
}
pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
-   if (addr == 0) {
-   if (bootverbose)
-   printf("ACPI: No %s table found\n", sig);
+   if (addr == 0)
return (0);
-   }
-   if (bootverbose)
-   printf("%s: Found table at 0x%jx\n", sig, (uintmax_t)addr);
 
/*
 * Verify that we can map the full table and that its checksum is
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364398 - head/stand/libsa

2020-08-19 Thread Toomas Soome
Author: tsoome
Date: Wed Aug 19 15:27:09 2020
New Revision: 364398
URL: https://svnweb.freebsd.org/changeset/base/364398

Log:
  libsa: make env_discard() public
  
  Allow env_discard() to be used outside environment.c

Modified:
  head/stand/libsa/environment.c
  head/stand/libsa/stand.h

Modified: head/stand/libsa/environment.c
==
--- head/stand/libsa/environment.c  Wed Aug 19 15:20:33 2020
(r364397)
+++ head/stand/libsa/environment.c  Wed Aug 19 15:27:09 2020
(r364398)
@@ -37,8 +37,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-static voidenv_discard(struct env_var *ev);
-
 struct env_var *environ = NULL;
 
 /*
@@ -194,7 +192,7 @@ unsetenv(const char *name)
return (err);
 }
 
-static void
+void
 env_discard(struct env_var *ev)
 {
if (ev->ev_prev)

Modified: head/stand/libsa/stand.h
==
--- head/stand/libsa/stand.hWed Aug 19 15:20:33 2020(r364397)
+++ head/stand/libsa/stand.hWed Aug 19 15:27:09 2020(r364398)
@@ -337,6 +337,7 @@ extern struct env_var   *env_getenv(const char *name);
 extern int env_setenv(const char *name, int flags,
   const void *value, ev_sethook_t sethook,
   ev_unsethook_t unsethook);
+extern voidenv_discard(struct env_var *);
 extern char*getenv(const char *name);
 extern int setenv(const char *name, const char *value,
   int overwrite);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364397 - head/stand/libsa

2020-08-19 Thread Toomas Soome
Author: tsoome
Date: Wed Aug 19 15:20:33 2020
New Revision: 364397
URL: https://svnweb.freebsd.org/changeset/base/364397

Log:
  libsa: cstyle cleanup for environment.c
  
  No functional changes.

Modified:
  head/stand/libsa/environment.c

Modified: head/stand/libsa/environment.c
==
--- head/stand/libsa/environment.c  Wed Aug 19 15:11:27 2020
(r364396)
+++ head/stand/libsa/environment.c  Wed Aug 19 15:20:33 2020
(r364397)
@@ -47,12 +47,12 @@ struct env_var  *environ = NULL;
 struct env_var *
 env_getenv(const char *name)
 {
-struct env_var *ev;
+   struct env_var  *ev;
 
-for (ev = environ; ev != NULL; ev = ev->ev_next)
-   if (!strcmp(ev->ev_name, name))
-   break;
-return(ev);
+   for (ev = environ; ev != NULL; ev = ev->ev_next)
+   if (!strcmp(ev->ev_name, name))
+   break;
+   return (ev);
 }
 
 /*
@@ -65,160 +65,159 @@ env_getenv(const char *name)
  */
 int
 env_setenv(const char *name, int flags, const void *value,
-  ev_sethook_t sethook, ev_unsethook_t unsethook)
+ev_sethook_t sethook, ev_unsethook_t unsethook)
 {
-struct env_var *ev, *curr, *last;
+   struct env_var  *ev, *curr, *last;
 
-if ((ev = env_getenv(name)) != NULL) {
-   /*
-* If there's a set hook, let it do the work (unless we are working
-* for one already.
-*/
-   if ((ev->ev_sethook != NULL) && !(flags & EV_NOHOOK))
-   return (ev->ev_sethook(ev, flags, value));
+   if ((ev = env_getenv(name)) != NULL) {
+   /*
+* If there's a set hook, let it do the work
+* (unless we are working for one already).
+*/
+   if ((ev->ev_sethook != NULL) && !(flags & EV_NOHOOK))
+   return (ev->ev_sethook(ev, flags, value));
 
-   /* If there is data in the variable, discard it. */
-   if (ev->ev_value != NULL && (ev->ev_flags & EV_DYNAMIC) != 0)
-   free(ev->ev_value);
-   ev->ev_value = NULL;
-   ev->ev_flags &= ~EV_DYNAMIC;
+   /* If there is data in the variable, discard it. */
+   if (ev->ev_value != NULL && (ev->ev_flags & EV_DYNAMIC) != 0)
+   free(ev->ev_value);
+   ev->ev_value = NULL;
+   ev->ev_flags &= ~EV_DYNAMIC;
 
-} else {
+   } else {
 
-   /*
-* New variable; create and sort into list
-*/
-   ev = malloc(sizeof(struct env_var));
-   ev->ev_name = strdup(name);
-   ev->ev_value = NULL;
-   ev->ev_flags = 0;
-   /* hooks can only be set when the variable is instantiated */
-   ev->ev_sethook = sethook;
-   ev->ev_unsethook = unsethook;
+   /*
+* New variable; create and sort into list
+*/
+   ev = malloc(sizeof(struct env_var));
+   ev->ev_name = strdup(name);
+   ev->ev_value = NULL;
+   ev->ev_flags = 0;
+   /* hooks can only be set when the variable is instantiated */
+   ev->ev_sethook = sethook;
+   ev->ev_unsethook = unsethook;
 
-   /* Sort into list */
-   ev->ev_prev = NULL;
-   ev->ev_next = NULL;
-   /* Search for the record to insert before */
-   for (last = NULL, curr = environ; 
-curr != NULL; 
-last = curr, curr = curr->ev_next) {
+   /* Sort into list */
+   ev->ev_prev = NULL;
+   ev->ev_next = NULL;
+   /* Search for the record to insert before */
+   for (last = NULL, curr = environ; curr != NULL; 
+   last = curr, curr = curr->ev_next) {
 
-   if (strcmp(ev->ev_name, curr->ev_name) < 0) {
-   if (curr->ev_prev) {
-   curr->ev_prev->ev_next = ev;
-   } else {
-   environ = ev;
+   if (strcmp(ev->ev_name, curr->ev_name) < 0) {
+   if (curr->ev_prev) {
+   curr->ev_prev->ev_next = ev;
+   } else {
+   environ = ev;
+   }
+   ev->ev_next = curr;
+   ev->ev_prev = curr->ev_prev;
+   curr->ev_prev = ev;
+   break;
+   }
}
-   ev->ev_next = curr;
-   ev->ev_prev = curr->ev_prev;
-   curr->ev_prev = ev;
-   break;
-   }
+   if (curr == NULL) {
+   if (last == NULL) {
+   environ = ev;
+   } else {
+   last->ev_next = ev;
+   

svn commit: r364396 - head/usr.sbin/freebsd-update

2020-08-19 Thread Michael Gmelin
Author: grembo (ports committer)
Date: Wed Aug 19 15:11:27 2020
New Revision: 364396
URL: https://svnweb.freebsd.org/changeset/base/364396

Log:
  Unbreak `freebsd-update updatesready'.
  
  The command would only work if PWD happened to be WORKDIR.
  Also, exit 1 in case WORKDIR exists, but isn't accessible
  by the current user.
  
  PR:   242709
  Reported by:  Max Fiedler
  MFC after:1 week

Modified:
  head/usr.sbin/freebsd-update/freebsd-update.sh

Modified: head/usr.sbin/freebsd-update/freebsd-update.sh
==
--- head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Aug 19 15:08:14 
2020(r364395)
+++ head/usr.sbin/freebsd-update/freebsd-update.sh  Wed Aug 19 15:11:27 
2020(r364396)
@@ -3341,8 +3341,18 @@ cmd_upgrade () {
upgrade_run || exit 1
 }
 
-# Check if there are fetched updates ready to install
+# Check if there are fetched updates ready to install.
+# Chdir into the working directory.
 cmd_updatesready () {
+   # Check if working directory exists (if not, no updates pending)
+   if ! [ -e "${WORKDIR}" ]; then
+   echo "No updates are available to install."
+   exit 2
+   fi
+   
+   # Change into working directory (fail if no permission/directory etc.)
+   cd ${WORKDIR} || exit 1
+
# Construct a unique name from ${BASEDIR}
BDHASH=`echo ${BASEDIR} | sha256 -q`
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364395 - head/sys/kern

2020-08-19 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 19 15:08:14 2020
New Revision: 364395
URL: https://svnweb.freebsd.org/changeset/base/364395

Log:
  cache: when adding an already existing entry assert on a complete match

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug 19 15:07:28 2020(r364394)
+++ head/sys/kern/vfs_cache.c   Wed Aug 19 15:08:14 2020(r364395)
@@ -1957,6 +1957,15 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, 
if (n2->nc_dvp == dvp &&
n2->nc_nlen == cnp->cn_namelen &&
!bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) {
+   MPASS(cache_ncp_canuse(n2));
+   if ((n2->nc_flag & NCF_NEGATIVE) != 0)
+   KASSERT(vp == NULL,
+   ("%s: found entry pointing to a different 
vnode (%p != %p)",
+   __func__, NULL, vp));
+   else
+   KASSERT(n2->nc_vp == vp,
+   ("%s: found entry pointing to a different 
vnode (%p != %p)",
+   __func__, n2->nc_vp, vp));
if (tsp != NULL) {
KASSERT((n2->nc_flag & NCF_TS) != 0,
("no NCF_TS"));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364394 - head/sys/kern

2020-08-19 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 19 15:07:28 2020
New Revision: 364394
URL: https://svnweb.freebsd.org/changeset/base/364394

Log:
  cache: tidy up the comment above cache_prehash

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Wed Aug 19 14:11:25 2020(r364393)
+++ head/sys/kern/vfs_cache.c   Wed Aug 19 15:07:28 2020(r364394)
@@ -513,7 +513,7 @@ cache_assert_vnode_locked(struct vnode *vp)
 
 /*
  * TODO: With the value stored we can do better than computing the hash based
- * on the address and the choice of FNV should also be revisisted.
+ * on the address. The choice of FNV should also be revisited.
  */
 static void
 cache_prehash(struct vnode *vp)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364393 - head/sys/kern

2020-08-19 Thread Andrew Turner
Author: andrew
Date: Wed Aug 19 14:11:25 2020
New Revision: 364393
URL: https://svnweb.freebsd.org/changeset/base/364393

Log:
  Mark COVERAGE and KCOV as part of KCSAN
  
  While not strictly true this stops them from trying to use the KCSAN atomic
  hooks and allows these to be compiled into the same kernel.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/kern/kern_kcov.c
  head/sys/kern/subr_coverage.c

Modified: head/sys/kern/kern_kcov.c
==
--- head/sys/kern/kern_kcov.c   Wed Aug 19 13:44:08 2020(r364392)
+++ head/sys/kern/kern_kcov.c   Wed Aug 19 14:11:25 2020(r364393)
@@ -35,6 +35,8 @@
  * $FreeBSD$
  */
 
+#defineKCSAN_RUNTIME
+
 #include 
 __FBSDID("$FreeBSD$");
 

Modified: head/sys/kern/subr_coverage.c
==
--- head/sys/kern/subr_coverage.c   Wed Aug 19 13:44:08 2020
(r364392)
+++ head/sys/kern/subr_coverage.c   Wed Aug 19 14:11:25 2020
(r364393)
@@ -35,6 +35,8 @@
  * $FreeBSD$
  */
 
+#defineKCSAN_RUNTIME
+
 #include 
 __FBSDID("$FreeBSD$");
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364387 - head/share/man/man7

2020-08-19 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Aug 19 13:09:31 2020
New Revision: 364387
URL: https://svnweb.freebsd.org/changeset/base/364387

Log:
  Cross-reference development.7 and tests.7
  
  MFC after:7 days

Modified:
  head/share/man/man7/development.7
  head/share/man/man7/tests.7

Modified: head/share/man/man7/development.7
==
--- head/share/man/man7/development.7   Wed Aug 19 13:07:04 2020
(r364386)
+++ head/share/man/man7/development.7   Wed Aug 19 13:09:31 2020
(r364387)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 23, 2020
+.Dd August 19, 2020
 .Dt DEVELOPMENT 7
 .Os
 .Sh NAME
@@ -173,6 +173,7 @@ make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm
 .Xr hier 7 ,
 .Xr ports 7 ,
 .Xr release 7 ,
+.Xr tests 7 ,
 .Xr locking 9 ,
 .Xr style 9
 .Sh HISTORY

Modified: head/share/man/man7/tests.7
==
--- head/share/man/man7/tests.7 Wed Aug 19 13:07:04 2020(r364386)
+++ head/share/man/man7/tests.7 Wed Aug 19 13:09:31 2020(r364387)
@@ -26,7 +26,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 25, 2020
+.Dd August 19, 2020
 .Dt TESTS 7
 .Os
 .Sh NAME
@@ -217,7 +217,8 @@ Top-level test suite definition file.
 .Sh SEE ALSO
 .Xr kyua 1 ,
 .Xr atf 7 ,
-.Xr build 7
+.Xr build 7 ,
+.Xr development 7
 .Sh HISTORY
 The
 .Fx
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364379 - head/sys/dev/usb/controller

2020-08-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Aug 19 11:50:12 2020
New Revision: 364379
URL: https://svnweb.freebsd.org/changeset/base/364379

Log:
  Avoid evaluating the XHCI control endpoint context.
  
  The XHCI specification says that the XHCI controller should detect
  reception of the USB device descriptors, and automatically update
  the max packet size in the control endpoint context.
  
  Differential Revision:https://reviews.freebsd.org/D26104
  Reviewed by:  kp@
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/usb/controller/xhci.c
  head/sys/dev/usb/controller/xhci.h

Modified: head/sys/dev/usb/controller/xhci.c
==
--- head/sys/dev/usb/controller/xhci.c  Wed Aug 19 10:40:02 2020
(r364378)
+++ head/sys/dev/usb/controller/xhci.c  Wed Aug 19 11:50:12 2020
(r364379)
@@ -2398,8 +2398,6 @@ xhci_configure_endpoint(struct usb_device *udev,
 
/* store endpoint mode */
pepext->trb_ep_mode = ep_mode;
-   /* store bMaxPacketSize for control endpoints */
-   pepext->trb_ep_maxp = edesc->wMaxPacketSize[0];
usb_pc_cpu_flush(pepext->page_cache);
 
if (ep_mode == USB_EP_MODE_STREAMS) {
@@ -2929,17 +2927,6 @@ xhci_transfer_insert(struct usb_xfer *xfer)
return (USB_ERR_NOMEM);
}
 
-   /* check if bMaxPacketSize changed */
-   if (xfer->flags_int.control_xfr != 0 &&
-   pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) {
-
-   DPRINTFN(8, "Reconfigure control endpoint\n");
-
-   /* force driver to reconfigure endpoint */
-   pepext->trb_halted = 1;
-   pepext->trb_running = 0;
-   }
-
/* check for stopped condition, after putting transfer on interrupt 
queue */
if (pepext->trb_running == 0) {
struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus);
@@ -3917,8 +3904,10 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer)
if (!(sc->sc_hw.devs[index].ep_configured & mask)) {
sc->sc_hw.devs[index].ep_configured |= mask;
err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index);
-   } else {
+   } else if (epno != 1) {
err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index);
+   } else {
+   err = 0;
}
 
if (err != 0) {

Modified: head/sys/dev/usb/controller/xhci.h
==
--- head/sys/dev/usb/controller/xhci.h  Wed Aug 19 10:40:02 2020
(r364378)
+++ head/sys/dev/usb/controller/xhci.h  Wed Aug 19 11:50:12 2020
(r364379)
@@ -393,7 +393,6 @@ struct xhci_endpoint_ext {
uint8_t trb_halted;
uint8_t trb_running;
uint8_t trb_ep_mode;
-   uint8_t trb_ep_maxp;
 };
 
 enum {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364375 - head

2020-08-19 Thread Alexander Leidinger
Author: netchild
Date: Wed Aug 19 10:01:05 2020
New Revision: 364375
URL: https://svnweb.freebsd.org/changeset/base/364375

Log:
  Fix the real shared libraries (lib*.so.X) from OLD_FILES to OLD_LIBS,
  as it is supposed to be.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Aug 19 08:05:37 2020(r364374)
+++ head/ObsoleteFiles.inc  Wed Aug 19 10:01:05 2020(r364375)
@@ -537,7 +537,7 @@ OLD_LIBS+=usr/lib32/padlock.so
 OLD_FILES+=usr/include/private/event/event.h
 OLD_FILES+=usr/lib/libprivateevent.a
 OLD_FILES+=usr/lib/libprivateevent.so
-OLD_FILES+=usr/lib/libprivateevent.so.1
+OLD_LIBS+=usr/lib/libprivateevent.so.1
 OLD_FILES+=usr/lib/libprivateevent_p.a
 OLD_DIRS+=usr/include/private/event
 
@@ -2274,7 +2274,7 @@ OLD_FILES+=usr/include/sys/dir.h
 # 20190729: gzip'ed a.out support removed
 OLD_FILES+=usr/include/sys/inflate.h
 # 20190722: cap_random(3) removed
-OLD_FILES+=lib/casper/libcap_random.so.1
+OLD_LIBS+=lib/casper/libcap_random.so.1
 OLD_FILES+=usr/include/casper/cap_random.h
 OLD_FILES+=usr/share/man/man3/cap_random.3.gz
 OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz
@@ -2465,7 +2465,7 @@ OLD_FILES+=usr/share/man/man4/wb.4.gz
 OLD_FILES+=usr/share/man/man4/xe.4.gz
 OLD_FILES+=usr/share/man/man4/if_xe.4.gz
 # 20190513: libcap_sysctl interface change
-OLD_FILES+=lib/casper/libcap_sysctl.so.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.1
 # 20190509: tests/sys/opencrypto requires the net/py-dpkt package.
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.py
 OLD_FILES+=usr/tests/sys/opencrypto/dpkt.pyc
@@ -4585,7 +4585,7 @@ OLD_FILES+=usr/include/netnatm/natm.h
 OLD_FILES+=usr/lib/debug/sbin/atmconfig.debug
 OLD_FILES+=usr/lib/debug/usr/lib/snmp_atm.so.6.debug
 OLD_FILES+=usr/lib/snmp_atm.so
-OLD_FILES+=usr/lib/snmp_atm.so.6
+OLD_LIBS+=usr/lib/snmp_atm.so.6
 OLD_FILES+=usr/share/doc/atm/atmconfig.help
 OLD_FILES+=usr/share/doc/atm/atmconfig_device.help
 OLD_DIRS+=usr/share/doc/atm
@@ -7079,11 +7079,11 @@ OLD_FILES+=usr/share/examples/libusb20/aux.h
 OLD_FILES+=usr/include/_libiconv_compat.h
 OLD_FILES+=usr/lib/libiconv.a
 OLD_FILES+=usr/lib/libiconv.so
-OLD_FILES+=usr/lib/libiconv.so.3
+OLD_LIBS+=usr/lib/libiconv.so.3
 OLD_FILES+=usr/lib/libiconv_p.a
 OLD_FILES+=usr/lib32/libiconv.a
 OLD_FILES+=usr/lib32/libiconv.so
-OLD_FILES+=usr/lib32/libiconv.so.3
+OLD_LIBS+=usr/lib32/libiconv.so.3
 OLD_FILES+=usr/lib32/libiconv_p.a
 # 20131103: removal of utxrm(8), use 'utx rm' instead.
 OLD_FILES+=usr/sbin/utxrm
@@ -9598,14 +9598,14 @@ OLD_FILES+=usr/lib/libalias_pptp.so
 OLD_FILES+=usr/lib/libalias_skinny.so
 OLD_FILES+=usr/lib/libalias_smedia.so
 # 20061201: remove old *.so.4 libalias modules
-OLD_FILES+=lib/libalias_cuseeme.so.4
-OLD_FILES+=lib/libalias_dummy.so.4
-OLD_FILES+=lib/libalias_ftp.so.4
-OLD_FILES+=lib/libalias_irc.so.4
-OLD_FILES+=lib/libalias_nbt.so.4
-OLD_FILES+=lib/libalias_pptp.so.4
-OLD_FILES+=lib/libalias_skinny.so.4
-OLD_FILES+=lib/libalias_smedia.so.4
+OLD_LIBS+=lib/libalias_cuseeme.so.4
+OLD_LIBS+=lib/libalias_dummy.so.4
+OLD_LIBS+=lib/libalias_ftp.so.4
+OLD_LIBS+=lib/libalias_irc.so.4
+OLD_LIBS+=lib/libalias_nbt.so.4
+OLD_LIBS+=lib/libalias_pptp.so.4
+OLD_LIBS+=lib/libalias_skinny.so.4
+OLD_LIBS+=lib/libalias_smedia.so.4
 # 20061126: remove old man page
 OLD_FILES+=usr/share/man/man3/archive_read_set_bytes_per_block.3.gz
 # 20061125: remove old man page
@@ -9988,10 +9988,10 @@ OLD_FILES+=usr/share/man/man3/tree_mung.3.gz
 OLD_FILES+=usr/share/man/man3/tree_srch.3.gz
 OLD_FILES+=usr/share/man/man3/tree_trav.3.gz
 # 2004XXYY: OS internal libs, no ports use them, no need to use OLD_LIBS
-OLD_FILES+=lib/geom/geom_concat.so.1
-OLD_FILES+=lib/geom/geom_label.so.1
-OLD_FILES+=lib/geom/geom_nop.so.1
-OLD_FILES+=lib/geom/geom_stripe.so.1
+OLD_LIBS+=lib/geom/geom_concat.so.1
+OLD_LIBS+=lib/geom/geom_label.so.1
+OLD_LIBS+=lib/geom/geom_nop.so.1
+OLD_LIBS+=lib/geom/geom_stripe.so.1
 # 20040728: GCC 3.4.2
 OLD_DIRS+=usr/include/c++/3.3
 OLD_FILES+=usr/include/c++/3.3/FlexLexer.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364374 - head/sys/dev/sound/usb

2020-08-19 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Aug 19 08:05:37 2020
New Revision: 364374
URL: https://svnweb.freebsd.org/changeset/base/364374

Log:
  Print current buffer latency in dmesg for the USB audio driver and not just
  the maximum.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Wed Aug 19 07:28:01 2020
(r364373)
+++ head/sys/dev/sound/usb/uaudio.c Wed Aug 19 08:05:37 2020
(r364374)
@@ -1031,10 +1031,11 @@ uaudio_attach(device_t dev)
}
for (x = 0; x != sc->sc_play_chan[i].num_alt; x++) {
device_printf(dev, "Play[%u]: %d Hz, %d ch, %s format, "
-   "2x8ms buffer.\n", i,
+   "2x%dms buffer.\n", i,
sc->sc_play_chan[i].usb_alt[x].sample_rate,
sc->sc_play_chan[i].usb_alt[x].channels,
-   sc->sc_play_chan[i].usb_alt[x].p_fmt->description);
+   sc->sc_play_chan[i].usb_alt[x].p_fmt->description,
+   uaudio_buffer_ms);
}
}
if (i == 0)
@@ -1060,10 +1061,11 @@ uaudio_attach(device_t dev)
}
for (x = 0; x != sc->sc_rec_chan[i].num_alt; x++) {
device_printf(dev, "Record[%u]: %d Hz, %d ch, %s 
format, "
-   "2x8ms buffer.\n", i,
+   "2x%dms buffer.\n", i,
sc->sc_rec_chan[i].usb_alt[x].sample_rate,
sc->sc_rec_chan[i].usb_alt[x].channels,
-   sc->sc_rec_chan[i].usb_alt[x].p_fmt->description);
+   sc->sc_rec_chan[i].usb_alt[x].p_fmt->description,
+   uaudio_buffer_ms);
}
}
if (i == 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364373 - in head/sys: fs/cd9660 fs/fuse fs/nfsclient fs/smbfs fs/unionfs kern ufs/ufs

2020-08-19 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 19 07:28:01 2020
New Revision: 364373
URL: https://svnweb.freebsd.org/changeset/base/364373

Log:
  vfs: remove the always-curthread td argument from VOP_RECLAIM

Modified:
  head/sys/fs/cd9660/cd9660_node.c
  head/sys/fs/fuse/fuse_vnops.c
  head/sys/fs/nfsclient/nfs_clnode.c
  head/sys/fs/smbfs/smbfs_node.c
  head/sys/fs/unionfs/union_vnops.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/ufs/ufs/ufs_inode.c

Modified: head/sys/fs/cd9660/cd9660_node.c
==
--- head/sys/fs/cd9660/cd9660_node.cWed Aug 19 02:51:17 2020
(r364372)
+++ head/sys/fs/cd9660/cd9660_node.cWed Aug 19 07:28:01 2020
(r364373)
@@ -86,7 +86,6 @@ int
 cd9660_reclaim(ap)
struct vop_reclaim_args /* {
struct vnode *a_vp;
-   struct thread *a_td;
} */ *ap;
 {
struct vnode *vp = ap->a_vp;

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Wed Aug 19 02:51:17 2020
(r364372)
+++ head/sys/fs/fuse/fuse_vnops.c   Wed Aug 19 07:28:01 2020
(r364373)
@@ -1527,14 +1527,13 @@ out:
 /*
 struct vnop_reclaim_args {
struct vnode *a_vp;
-   struct thread *a_td;
 };
 */
 static int
 fuse_vnop_reclaim(struct vop_reclaim_args *ap)
 {
struct vnode *vp = ap->a_vp;
-   struct thread *td = ap->a_td;
+   struct thread *td = curthread;
struct fuse_vnode_data *fvdat = VTOFUD(vp);
struct fuse_filehandle *fufh, *fufh_tmp;
 

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==
--- head/sys/fs/nfsclient/nfs_clnode.c  Wed Aug 19 02:51:17 2020
(r364372)
+++ head/sys/fs/nfsclient/nfs_clnode.c  Wed Aug 19 07:28:01 2020
(r364373)
@@ -286,7 +286,10 @@ ncl_reclaim(struct vop_reclaim_args *ap)
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
struct nfsdmap *dp, *dp2;
+   struct thread *td;
 
+   td = curthread;
+
/*
 * If the NLM is running, give it a chance to abort pending
 * locks.
@@ -295,7 +298,7 @@ ncl_reclaim(struct vop_reclaim_args *ap)
nfs_reclaim_p(ap);
 
NFSLOCKNODE(np);
-   ncl_releasesillyrename(vp, ap->a_td);
+   ncl_releasesillyrename(vp, td);
NFSUNLOCKNODE(np);
 
if (NFS_ISV4(vp) && vp->v_type == VREG)
@@ -305,7 +308,7 @@ ncl_reclaim(struct vop_reclaim_args *ap)
 * ncl_inactive(), but there are cases where it is not
 * called, so we need to do it again here.
 */
-   (void) nfsrpc_close(vp, 1, ap->a_td);
+   (void) nfsrpc_close(vp, 1, td);
 
vfs_hash_remove(vp);
 

Modified: head/sys/fs/smbfs/smbfs_node.c
==
--- head/sys/fs/smbfs/smbfs_node.c  Wed Aug 19 02:51:17 2020
(r364372)
+++ head/sys/fs/smbfs/smbfs_node.c  Wed Aug 19 07:28:01 2020
(r364373)
@@ -260,7 +260,6 @@ int
 smbfs_reclaim(ap) 
 struct vop_reclaim_args /* {
struct vnode *a_vp;
-   struct thread *a_p;
 } */ *ap;
 {
struct vnode *vp = ap->a_vp;

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Wed Aug 19 02:51:17 2020
(r364372)
+++ head/sys/fs/unionfs/union_vnops.c   Wed Aug 19 07:28:01 2020
(r364373)
@@ -1731,7 +1731,7 @@ unionfs_reclaim(struct vop_reclaim_args *ap)
 {
/* UNIONFS_INTERNAL_DEBUG("unionfs_reclaim: enter\n"); */
 
-   unionfs_noderem(ap->a_vp, ap->a_td);
+   unionfs_noderem(ap->a_vp, curthread);
 
/* UNIONFS_INTERNAL_DEBUG("unionfs_reclaim: leave\n"); */
 

Modified: head/sys/kern/uipc_mqueue.c
==
--- head/sys/kern/uipc_mqueue.c Wed Aug 19 02:51:17 2020(r364372)
+++ head/sys/kern/uipc_mqueue.c Wed Aug 19 07:28:01 2020(r364373)
@@ -1099,7 +1099,6 @@ mqfs_inactive(struct vop_inactive_args *ap)
 struct vop_reclaim_args {
struct vop_generic_args a_gen;
struct vnode *a_vp;
-   struct thread *a_td;
 };
 #endif
 

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Aug 19 02:51:17 2020(r364372)
+++ head/sys/kern/vfs_subr.cWed Aug 19 07:28:01 2020(r364373)
@@ -3879,7 +3879,7 @@ vgonel(struct vnode *vp)
/*
 * Reclaim the vnode.
 */
-   if (VOP_RECLAIM(vp, td))
+   if (VOP_RECLAIM(vp))
panic("vgone: cannot reclaim");
if