svn commit: r360142 - in stable/11/sys/fs: nfs nfsserver

2020-04-20 Thread Rick Macklem
Author: rmacklem
Date: Tue Apr 21 05:00:35 2020
New Revision: 360142
URL: https://svnweb.freebsd.org/changeset/base/360142

Log:
  MFC: r359679
  Fix noisy NFSv4 server printf.
  
  Peter reported that his dmesg was getting cluttered with
  nfsrv_cache_session: no session
  messages when he rebooted his NFS server and they did not seem useful.
  He was correct, in that these messages are "normal" and expected when
  NFSv4.1 or NFSv4.2 are mounted and the server is rebooted.
  This patch silences the printf() during the grace period after a reboot.
  It also adds the client IP address to the printf(), so that the message
  is more useful if/when it occurs. If this happens outside of the
  server's grace period, it does indicate something is not working correctly.
  Instead of adding yet another nd_XXX argument, the arguments for
  nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *".

Modified:
  stable/11/sys/fs/nfs/nfs_var.h
  stable/11/sys/fs/nfsserver/nfs_nfsdkrpc.c
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs_var.h
==
--- stable/11/sys/fs/nfs/nfs_var.h  Tue Apr 21 04:47:42 2020
(r360141)
+++ stable/11/sys/fs/nfs/nfs_var.h  Tue Apr 21 05:00:35 2020
(r360142)
@@ -136,7 +136,7 @@ void nfsrv_throwawayallstate(NFSPROC_T *);
 int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
 uint32_t *, int, uint32_t *, NFSPROC_T *);
 int nfsrv_checkreclaimcomplete(struct nfsrv_descript *, int);
-void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **);
+void nfsrv_cache_session(struct nfsrv_descript *, struct mbuf **);
 void nfsrv_freeallbackchannel_xprts(void);
 
 /* nfs_nfsdserv.c */

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdkrpc.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdkrpc.c   Tue Apr 21 04:47:42 2020
(r360141)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdkrpc.c   Tue Apr 21 05:00:35 2020
(r360142)
@@ -387,8 +387,7 @@ nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVC
} else
m = NULL;
if ((nd->nd_flag & ND_HASSEQUENCE) != 0)
-   nfsrv_cache_session(nd->nd_sessionid,
-   nd->nd_slotid, nd->nd_repstat, );
+   nfsrv_cache_session(nd, );
if (nd->nd_repstat == NFSERR_REPLYFROMCACHE)
nd->nd_repstat = 0;
cacherep = RC_REPLY;

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Tue Apr 21 04:47:42 2020
(r360141)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Tue Apr 21 05:00:35 2020
(r360142)
@@ -6156,22 +6156,56 @@ nfsrv_checkreclaimcomplete(struct nfsrv_descript *nd, 
  * Cache the reply in a session slot.
  */
 void
-nfsrv_cache_session(uint8_t *sessionid, uint32_t slotid, int repstat,
-   struct mbuf **m)
+nfsrv_cache_session(struct nfsrv_descript *nd, struct mbuf **m)
 {
struct nfsdsession *sep;
struct nfssessionhash *shp;
+   char *buf, *cp;
+#ifdef INET
+   struct sockaddr_in *sin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *sin6;
+#endif
 
-   shp = NFSSESSIONHASH(sessionid);
+   shp = NFSSESSIONHASH(nd->nd_sessionid);
NFSLOCKSESSION(shp);
-   sep = nfsrv_findsession(sessionid);
+   sep = nfsrv_findsession(nd->nd_sessionid);
if (sep == NULL) {
NFSUNLOCKSESSION(shp);
-   printf("nfsrv_cache_session: no session\n");
+   if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0) {
+   buf = malloc(INET6_ADDRSTRLEN, M_TEMP, M_WAITOK);
+   switch (nd->nd_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   sin = (struct sockaddr_in *)nd->nd_nam;
+   cp = inet_ntop(sin->sin_family,
+   >sin_addr.s_addr, buf,
+   INET6_ADDRSTRLEN);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   sin6 = (struct sockaddr_in6 *)nd->nd_nam;
+   cp = inet_ntop(sin6->sin6_family,
+   >sin6_addr, buf, INET6_ADDRSTRLEN);
+   break;
+#endif
+   default:
+   cp = NULL;
+   }
+   if (cp != NULL)
+   printf("nfsrv_cache_session: no session "
+   

svn commit: r360141 - in stable/12/sys/fs: nfs nfsserver

2020-04-20 Thread Rick Macklem
Author: rmacklem
Date: Tue Apr 21 04:47:42 2020
New Revision: 360141
URL: https://svnweb.freebsd.org/changeset/base/360141

Log:
  MFC: r359679
  Fix noisy NFSv4 server printf.
  
  Peter reported that his dmesg was getting cluttered with
  nfsrv_cache_session: no session
  messages when he rebooted his NFS server and they did not seem useful.
  He was correct, in that these messages are "normal" and expected when
  NFSv4.1 or NFSv4.2 are mounted and the server is rebooted.
  This patch silences the printf() during the grace period after a reboot.
  It also adds the client IP address to the printf(), so that the message
  is more useful if/when it occurs. If this happens outside of the
  server's grace period, it does indicate something is not working correctly.
  Instead of adding yet another nd_XXX argument, the arguments for
  nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *".

Modified:
  stable/12/sys/fs/nfs/nfs_var.h
  stable/12/sys/fs/nfsserver/nfs_nfsdkrpc.c
  stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_var.h
==
--- stable/12/sys/fs/nfs/nfs_var.h  Tue Apr 21 03:57:30 2020
(r360140)
+++ stable/12/sys/fs/nfs/nfs_var.h  Tue Apr 21 04:47:42 2020
(r360141)
@@ -142,7 +142,7 @@ void nfsrv_throwawayallstate(NFSPROC_T *);
 int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
 uint32_t *, int, uint32_t *, NFSPROC_T *);
 int nfsrv_checkreclaimcomplete(struct nfsrv_descript *, int);
-void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **);
+void nfsrv_cache_session(struct nfsrv_descript *, struct mbuf **);
 void nfsrv_freeallbackchannel_xprts(void);
 int nfsrv_layoutcommit(struct nfsrv_descript *, vnode_t, int, int, uint64_t,
 uint64_t, uint64_t, int, struct timespec *, int, nfsv4stateid_t *,

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdkrpc.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdkrpc.c   Tue Apr 21 03:57:30 2020
(r360140)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdkrpc.c   Tue Apr 21 04:47:42 2020
(r360141)
@@ -394,8 +394,7 @@ nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVC
} else
m = NULL;
if ((nd->nd_flag & ND_HASSEQUENCE) != 0)
-   nfsrv_cache_session(nd->nd_sessionid,
-   nd->nd_slotid, nd->nd_repstat, );
+   nfsrv_cache_session(nd, );
if (nd->nd_repstat == NFSERR_REPLYFROMCACHE)
nd->nd_repstat = 0;
cacherep = RC_REPLY;

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdstate.c  Tue Apr 21 03:57:30 2020
(r360140)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdstate.c  Tue Apr 21 04:47:42 2020
(r360141)
@@ -6279,22 +6279,56 @@ nfsrv_checkreclaimcomplete(struct nfsrv_descript *nd, 
  * Cache the reply in a session slot.
  */
 void
-nfsrv_cache_session(uint8_t *sessionid, uint32_t slotid, int repstat,
-   struct mbuf **m)
+nfsrv_cache_session(struct nfsrv_descript *nd, struct mbuf **m)
 {
struct nfsdsession *sep;
struct nfssessionhash *shp;
+   char *buf, *cp;
+#ifdef INET
+   struct sockaddr_in *sin;
+#endif
+#ifdef INET6
+   struct sockaddr_in6 *sin6;
+#endif
 
-   shp = NFSSESSIONHASH(sessionid);
+   shp = NFSSESSIONHASH(nd->nd_sessionid);
NFSLOCKSESSION(shp);
-   sep = nfsrv_findsession(sessionid);
+   sep = nfsrv_findsession(nd->nd_sessionid);
if (sep == NULL) {
NFSUNLOCKSESSION(shp);
-   printf("nfsrv_cache_session: no session\n");
+   if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0) {
+   buf = malloc(INET6_ADDRSTRLEN, M_TEMP, M_WAITOK);
+   switch (nd->nd_nam->sa_family) {
+#ifdef INET
+   case AF_INET:
+   sin = (struct sockaddr_in *)nd->nd_nam;
+   cp = inet_ntop(sin->sin_family,
+   >sin_addr.s_addr, buf,
+   INET6_ADDRSTRLEN);
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   sin6 = (struct sockaddr_in6 *)nd->nd_nam;
+   cp = inet_ntop(sin6->sin6_family,
+   >sin6_addr, buf, INET6_ADDRSTRLEN);
+   break;
+#endif
+   default:
+   cp = NULL;
+   }
+   

svn commit: r360140 - head/sys/kern

2020-04-20 Thread Kyle Evans
Author: kevans
Date: Tue Apr 21 03:57:30 2020
New Revision: 360140
URL: https://svnweb.freebsd.org/changeset/base/360140

Log:
  kqueue: fix conversion of timer data to sbintime
  
  This unbreaks the i386 kqueue timer tests after a recent change switched
  NOTE_ABSTIME over to using microseconds. Notably, the data argument (which
  holds useconds) is an int64_t, but we were passing it to timer2sbintime
  which takes an intptr_t. Perhaps in a previous incarnation, intptr_t would
  have made sense, but now it just leads to the timestamp getting truncated
  and subsequently rejected when it no longer fits in an intptr_t.
  
  PR:   245768
  Reported by:  lwhsu / CI
  MFC after:1 week

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Tue Apr 21 00:37:55 2020(r360139)
+++ head/sys/kern/kern_event.c  Tue Apr 21 03:57:30 2020(r360140)
@@ -619,7 +619,7 @@ knote_fork(struct knlist *list, int pid)
 (NOTE_SECONDS | NOTE_MSECONDS | NOTE_USECONDS | NOTE_NSECONDS)
 
 static sbintime_t
-timer2sbintime(intptr_t data, int flags)
+timer2sbintime(int64_t data, int flags)
 {
int64_t secs;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-20 Thread Kyle Evans
On Mon, Apr 20, 2020 at 9:14 PM Kyle Evans  wrote:
>
> On Mon, Apr 20, 2020 at 8:15 PM Eric van Gyzen  wrote:
> >
> >  +  sz = asprintf(, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
> >  +  jailname);
> >  +  if (sz < 0) {
> >  +  /* Fall back to a random mac address. */
> > >>>
> > >>>
> > >>> I was wondering if it would be valuable to give this fall back something
> > >>> like:
> > >>>
> > >>> printf("%s: unable to create fixed mac address; using random
> > >>> mac address", if_name(ifp));
> > >>>
> > >>> This will only be printed in rare circumstances. But in that case will
> > >>> provide valuable information.
> > >>>
> > >> That would potentially be valuable, yes. On the other hand, we 
> > >> traditionally
> > >> don???t sprinkle a lot of printf()s around in the kernel. This is 
> > >> extremely
> > >> unlikely to happen, and if it does odds are attaching the interface will
> > >> fail at an earlier or later point, you may struggle to pass packets and 
> > >> run
> > >> into any number of other issues.
> > >> It???s also possible to diagnose absent the printf(), because the MAC
> > >> address will be locally administered rather than within the FreeBSD OUI.
> > >>
> > >> So, in short: not a bad idea. You can argue it both ways, and I find 
> > >> myself
> > >> (weakly) on the opposite side.
> > >
> > > Would displaying the message only when verbose boot mode is enabled be
> > > a suitable compromise?
> >
> > We could completely avoid the problems of dynamic allocation by calling
> > SHA1Update three times, feeding each piece of data separately.
> >
> > For bonus points, use a single char[] to save stack space, too.  Maybe
> > use a union, for legibility, and to ensure the proper size without ugly
> > assertions.
> >
>
> To be honest, I'd be more inclined to just revert this part of it and
> push it all back onto the stack. It's still < 512 bytes and pretty
> much always called in short paths because it's generally only used
> during initial creation of some ifnet; I found the concern about the
> stack usage here, specifically, a bit dubious in the first place, and
> this follow-up hasn't left me enjoying it any further.
>

Sorry, to clarify: I'm also pretty much OK with SHA1Update 3x if I'm
alone in the "don't really care about this particular stack usage"
camp, but I've found it useful that they're currently joined into a
single buffer as I've had occasion to dump it in the past to confirm
my understanding of the pedigree of the output, in case of, e.g.,
generated conflicts.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-20 Thread Kyle Evans
On Mon, Apr 20, 2020 at 8:15 PM Eric van Gyzen  wrote:
>
>  +  sz = asprintf(, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
>  +  jailname);
>  +  if (sz < 0) {
>  +  /* Fall back to a random mac address. */
> >>>
> >>>
> >>> I was wondering if it would be valuable to give this fall back something
> >>> like:
> >>>
> >>> printf("%s: unable to create fixed mac address; using random
> >>> mac address", if_name(ifp));
> >>>
> >>> This will only be printed in rare circumstances. But in that case will
> >>> provide valuable information.
> >>>
> >> That would potentially be valuable, yes. On the other hand, we 
> >> traditionally
> >> don???t sprinkle a lot of printf()s around in the kernel. This is extremely
> >> unlikely to happen, and if it does odds are attaching the interface will
> >> fail at an earlier or later point, you may struggle to pass packets and run
> >> into any number of other issues.
> >> It???s also possible to diagnose absent the printf(), because the MAC
> >> address will be locally administered rather than within the FreeBSD OUI.
> >>
> >> So, in short: not a bad idea. You can argue it both ways, and I find myself
> >> (weakly) on the opposite side.
> >
> > Would displaying the message only when verbose boot mode is enabled be
> > a suitable compromise?
>
> We could completely avoid the problems of dynamic allocation by calling
> SHA1Update three times, feeding each piece of data separately.
>
> For bonus points, use a single char[] to save stack space, too.  Maybe
> use a union, for legibility, and to ensure the proper size without ugly
> assertions.
>

To be honest, I'd be more inclined to just revert this part of it and
push it all back onto the stack. It's still < 512 bytes and pretty
much always called in short paths because it's generally only used
during initial creation of some ifnet; I found the concern about the
stack usage here, specifically, a bit dubious in the first place, and
this follow-up hasn't left me enjoying it any further.

Thanks,

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


Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-20 Thread Eric van Gyzen

+   sz = asprintf(, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
+   jailname);
+   if (sz < 0) {
+   /* Fall back to a random mac address. */



I was wondering if it would be valuable to give this fall back something
like:

printf("%s: unable to create fixed mac address; using random
mac address", if_name(ifp));

This will only be printed in rare circumstances. But in that case will
provide valuable information.


That would potentially be valuable, yes. On the other hand, we traditionally
don???t sprinkle a lot of printf()s around in the kernel. This is extremely
unlikely to happen, and if it does odds are attaching the interface will
fail at an earlier or later point, you may struggle to pass packets and run
into any number of other issues.
It???s also possible to diagnose absent the printf(), because the MAC
address will be locally administered rather than within the FreeBSD OUI.

So, in short: not a bad idea. You can argue it both ways, and I find myself
(weakly) on the opposite side.


Would displaying the message only when verbose boot mode is enabled be
a suitable compromise?


We could completely avoid the problems of dynamic allocation by calling 
SHA1Update three times, feeding each piece of data separately.


For bonus points, use a single char[] to save stack space, too.  Maybe 
use a union, for legibility, and to ensure the proper size without ugly 
assertions.


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


svn commit: r360139 - head/bin/sh

2020-04-20 Thread Bryan Drewery
Author: bdrewery
Date: Tue Apr 21 00:37:55 2020
New Revision: 360139
URL: https://svnweb.freebsd.org/changeset/base/360139

Log:
  Fix build with NO_HISTORY set
  
  Reviewed by:  jilles
  Differential Revision:https://reviews.freebsd.org/D24458

Modified:
  head/bin/sh/histedit.c

Modified: head/bin/sh/histedit.c
==
--- head/bin/sh/histedit.c  Mon Apr 20 23:32:49 2020(r360138)
+++ head/bin/sh/histedit.c  Tue Apr 21 00:37:55 2020(r360139)
@@ -54,12 +54,12 @@ __FBSDID("$FreeBSD$");
 #include "main.h"
 #include "output.h"
 #include "mystring.h"
+#include "builtins.h"
 #ifndef NO_HISTORY
 #include "myhistedit.h"
 #include "error.h"
 #include "eval.h"
 #include "memalloc.h"
-#include "builtins.h"
 
 #define MAXHISTLOOPS   4   /* max recursions through fc */
 #define DEFEDITOR  "ed"/* default editor *should* be $EDITOR */
@@ -503,7 +503,7 @@ bindcmd(int argc, char **argv)
 #include "error.h"
 
 int
-histcmd(int argc, char **argv)
+histcmd(int argc __unused, char **argv __unused)
 {
 
error("not compiled with history support");
@@ -512,7 +512,7 @@ histcmd(int argc, char **argv)
 }
 
 int
-bindcmd(int argc, char **argv)
+bindcmd(int argc __unused, char **argv __unused)
 {
 
error("not compiled with line editing support");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360138 - head/contrib/bsnmp/snmpd

2020-04-20 Thread Gleb Smirnoff
Author: glebius
Date: Mon Apr 20 23:32:49 2020
New Revision: 360138
URL: https://svnweb.freebsd.org/changeset/base/360138

Log:
  Fix immediate crash when snmpd is bound to a specific IP address.
  
  The code that sets up msghdr must first fully fill in the msghdr
  itself, and only then use CMSG_xxx() macros.
  
  Silence from: harti, one week

Modified:
  head/contrib/bsnmp/snmpd/trans_inet.c

Modified: head/contrib/bsnmp/snmpd/trans_inet.c
==
--- head/contrib/bsnmp/snmpd/trans_inet.c   Mon Apr 20 22:57:15 2020
(r360137)
+++ head/contrib/bsnmp/snmpd/trans_inet.c   Mon Apr 20 23:32:49 2020
(r360138)
@@ -71,7 +71,7 @@ typedef void input_func(int, void *);
 typedef int activate_func(struct inet_port *);
 typedef void deactivate_func(struct inet_port *);
 typedef void parse_ctrl_func(struct port_sock *, const struct msghdr *);
-typedef void setsrc_func(struct port_sock *, struct msghdr *);
+typedef void setsrc_func(struct port_sock *, struct msghdr *, char *);
 
 static create_func ipv4_create;
 static input_func ipv4_input;
@@ -401,13 +401,12 @@ inet_send2(struct tport *tp, const u_char *buf, size_t
msg.msg_name = (void *)pi->peer;
msg.msg_namelen = pi->peerlen;
 
-   msg.msg_control = NULL;
-   msg.msg_controllen = 0;
-
char cbuf[XMIT_CBUF_SIZE];
if (s->set_ret_source) {
-   msg.msg_control = cbuf;
-   s->setsrc(s, );
+   s->setsrc(s, , cbuf);
+   } else {
+   msg.msg_control = NULL;
+   msg.msg_controllen = 0;
}
 
return (sendmsg(s->input.fd, , 0));
@@ -638,18 +637,20 @@ ipv4_parse_ctrl(struct port_sock *sock, const struct m
  * \param msg  message
  */
 static void
-ipv4_setsrc(struct port_sock *sock, struct msghdr *msg)
+ipv4_setsrc(struct port_sock *sock, struct msghdr *msg, char *cbuf)
 {
-   struct cmsghdr *cmsg = CMSG_FIRSTHDR(msg);
+   struct cmsghdr *cmsg;
 
+   msg->msg_control = cbuf;
+   msg->msg_controllen = CMSG_SPACE(sizeof(struct in_addr));
+
/* select outgoing interface by setting source address */
+   cmsg = CMSG_FIRSTHDR(msg);
cmsg->cmsg_level = IPPROTO_IP;
cmsg->cmsg_type = IP_SENDSRCADDR;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
memcpy(CMSG_DATA(cmsg), >ret_source.a4,
sizeof(struct in_addr));
-
-   msg->msg_controllen = CMSG_SPACE(sizeof(struct in_addr));
 }
 
 /**
@@ -878,18 +879,20 @@ ipv6_parse_ctrl(struct port_sock *sock, const struct m
  * \param msg  message
  */
 static void
-ipv6_setsrc(struct port_sock *sock, struct msghdr *msg)
+ipv6_setsrc(struct port_sock *sock, struct msghdr *msg, char *cbuf)
 {
-   struct cmsghdr *cmsg = CMSG_FIRSTHDR(msg);
+   struct cmsghdr *cmsg;
 
+   msg->msg_control = cbuf;
+   msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
+
/* select outgoing interface by setting source address */
+   cmsg = CMSG_FIRSTHDR(msg);
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
memcpy(CMSG_DATA(cmsg), >ret_source.a6,
sizeof(struct in6_pktinfo));
-
-   msg->msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
 }
 
 /**
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360137 - head/sys/netipsec

2020-04-20 Thread John Baldwin
Author: jhb
Date: Mon Apr 20 22:57:15 2020
New Revision: 360137
URL: https://svnweb.freebsd.org/changeset/base/360137

Log:
  Update comments about IVs used in IPsec ESP.
  
  Add some prose and a diagram describing the layout of the cipher IV
  for AES-CTR and AES-GCM and how it relates to the ESP IV stored in the
  packet after the ESP header.  Also, remove an XXX comment about the
  initial block counter value used for AES-CTR in esp_output as the
  current code matches the RFC (and the equivalent code in esp_input
  didn't have the XXX comment).
  
  Discussed with:   cem

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Mon Apr 20 22:24:49 2020
(r360136)
+++ head/sys/netipsec/xform_esp.c   Mon Apr 20 22:57:15 2020
(r360137)
@@ -406,22 +406,38 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk
crp->crp_payload_start = skip + hlen;
crp->crp_payload_length = m->m_pkthdr.len - (skip + hlen + alen);
 
+   /* Generate or read cipher IV. */
if (SAV_ISCTRORGCM(sav)) {
ivp = >crp_iv[0];
 
-   /* GCM IV Format: RFC4106 4 */
-   /* CTR IV Format: RFC3686 4 */
-   /* Salt is last four bytes of key, RFC4106 8.1 */
-   /* Nonce is last four bytes of key, RFC3686 5.1 */
+   /*
+* AES-GCM and AES-CTR use similar cipher IV formats
+* defined in RFC 4106 section 4 and RFC 3686 section
+* 4, respectively.
+*
+* The first 4 bytes of the cipher IV contain an
+* implicit salt, or nonce, obtained from the last 4
+* bytes of the encryption key.  The next 8 bytes hold
+* an explicit IV unique to each packet.  This
+* explicit IV is used as the ESP IV for the packet.
+* The last 4 bytes hold a big-endian block counter
+* incremented for each block.  For AES-GCM, the block
+* counter's initial value is defined as part of the
+* algorithm.  For AES-CTR, the block counter's
+* initial value for each packet is defined as 1 by
+* RFC 3686.
+*
+* --
+* | Salt | Explicit ESP IV | Block Counter |
+* --
+*  4 bytes 8 bytes  4 bytes
+*/
memcpy(ivp, sav->key_enc->key_data +
_KEYLEN(sav->key_enc) - 4, 4);
-
+   m_copydata(m, skip + hlen - sav->ivlen, sav->ivlen, [4]);
if (SAV_ISCTR(sav)) {
-   /* Initial block counter is 1, RFC3686 4 */
be32enc([sav->ivlen + 4], 1);
}
-
-   m_copydata(m, skip + hlen - sav->ivlen, sav->ivlen, [4]);
crp->crp_flags |= CRYPTO_F_IV_SEPARATE;
} else if (sav->ivlen != 0)
crp->crp_iv_start = skip + hlen - sav->ivlen;
@@ -813,22 +829,20 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc
crp->crp_payload_length = m->m_pkthdr.len - (skip + hlen + alen);
crp->crp_op = CRYPTO_OP_ENCRYPT;
 
-   /* Generate IV / nonce. */
+   /* Generate cipher and ESP IVs. */
ivp = >crp_iv[0];
if (SAV_ISCTRORGCM(sav)) {
-   /* GCM IV Format: RFC4106 4 */
-   /* CTR IV Format: RFC3686 4 */
-   /* Salt is last four bytes of key, RFC4106 8.1 */
-   /* Nonce is last four bytes of key, RFC3686 5.1 */
+   /*
+* See comment in esp_input() for details on the
+* cipher IV.  A simple per-SA counter stored in
+* 'cntr' is used as the explicit ESP IV.
+*/
memcpy(ivp, sav->key_enc->key_data +
_KEYLEN(sav->key_enc) - 4, 4);
be64enc([4], cntr);
if (SAV_ISCTR(sav)) {
-   /* Initial block counter is 1, RFC3686 4 */
-   /* XXXAE: should we use this only for first packet? */
be32enc([sav->ivlen + 4], 1);
}
-
m_copyback(m, skip + hlen - sav->ivlen, sav->ivlen, [4]);
crp->crp_flags |= CRYPTO_F_IV_SEPARATE;
} else if (sav->ivlen != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360136 - in head: share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/ccp sys/crypto/via sys/dev/cesa sys/dev/cxgbe/crypto sys/dev/glxsb sys/dev/hifn sys/dev/safe sys/dev/sec s...

2020-04-20 Thread John Baldwin
Author: jhb
Date: Mon Apr 20 22:24:49 2020
New Revision: 360136
URL: https://svnweb.freebsd.org/changeset/base/360136

Log:
  Retire the CRYPTO_F_IV_GENERATE flag.
  
  The sole in-tree user of this flag has been retired, so remove this
  complexity from all drivers.  While here, add a helper routine drivers
  can use to read the current request's IV into a local buffer.  Use
  this routine to replace duplicated code in nearly all drivers.
  
  Reviewed by:  cem
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D24450

Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/crypto_driver.9
  head/share/man/man9/crypto_request.9
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/armv8/armv8_crypto.c
  head/sys/crypto/ccp/ccp_hardware.c
  head/sys/crypto/via/padlock_cipher.c
  head/sys/dev/cesa/cesa.c
  head/sys/dev/cxgbe/crypto/t4_crypto.c
  head/sys/dev/glxsb/glxsb.c
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/safe/safe.c
  head/sys/dev/sec/sec.c
  head/sys/dev/ubsec/ubsec.c
  head/sys/mips/cavium/cryptocteon/cryptocteon.c
  head/sys/mips/nlm/dev/sec/nlmsec.c
  head/sys/opencrypto/crypto.c
  head/sys/opencrypto/cryptodev.h
  head/sys/opencrypto/cryptosoft.c

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileMon Apr 20 22:20:26 2020
(r360135)
+++ head/share/man/man9/MakefileMon Apr 20 22:24:49 2020
(r360136)
@@ -904,6 +904,7 @@ MLINKS+=crypto_driver.9 crypto_apply.9 \
crypto_driver.9 crypto_done.9 \
crypto_driver.9 crypto_get_driverid.9 \
crypto_driver.9 crypto_get_driver_session.9 \
+   crypto_driver.9 crypto_read_iv.9 \
crypto_driver.9 crypto_unblock.9 \
crypto_driver.9 crypto_unregister_all.9 \
crypto_driver.9 CRYPTODEV_FREESESSION.9 \

Modified: head/share/man/man9/crypto_driver.9
==
--- head/share/man/man9/crypto_driver.9 Mon Apr 20 22:20:26 2020
(r360135)
+++ head/share/man/man9/crypto_driver.9 Mon Apr 20 22:24:49 2020
(r360136)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 27, 2020
+.Dd April 20, 2020
 .Dt CRYPTO_DRIVER 9
 .Os
 .Sh NAME
@@ -62,6 +62,8 @@
 .Fn crypto_get_driverid "device_t dev" "size_t session_size" "int flags"
 .Ft void *
 .Fn crypto_get_driver_session "crypto_session_t crypto_session"
+.Ft void
+.Fn crypto_read_iv "struct cryptop *crp" "void *iv"
 .Ft int
 .Fn crypto_unblock "uint32_t driverid" "int what"
 .Ft int
@@ -260,6 +262,12 @@ into the data buffer for
 The bytes are written starting at an offset of
 .Fa off
 bytes in the request's data buffer.
+.Pp
+.Fn crypto_read_iv
+copies the IV or nonce for
+.Fa crp
+into the the local buffer pointed to by
+.Fa iv .
 .Pp
 A driver calls
 .Fn crypto_done

Modified: head/share/man/man9/crypto_request.9
==
--- head/share/man/man9/crypto_request.9Mon Apr 20 22:20:26 2020
(r360135)
+++ head/share/man/man9/crypto_request.9Mon Apr 20 22:24:49 2020
(r360136)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 27, 2020
+.Dd April 20, 2020
 .Dt CRYPTO_REQUEST 9
 .Os
 .Sh NAME
@@ -225,16 +225,6 @@ should be set in
 and
 .Fa crp_digest_start
 should be left as zero.
-.Pp
-An encryption request using an IV stored in the IV region may set
-.Dv CRYPTO_F_IV_GENERATE
-in
-.Fa crp_flags
-to request that the driver generate a random IV.
-Note that
-.Dv CRYPTO_F_IV_GENERATE
-cannot be used with decryption operations or in combination with
-.Dv CRYPTO_F_IV_SEPARATE .
 .Pp
 Requests that store part, but not all, of the IV in the data buffer should
 store the partial IV in the data buffer and pass the full IV separately in

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Mon Apr 20 22:20:26 2020
(r360135)
+++ head/sys/crypto/aesni/aesni.c   Mon Apr 20 22:24:49 2020
(r360136)
@@ -704,14 +704,7 @@ aesni_cipher_crypt(struct aesni_session *ses, struct c
aesni_cipher_setup_common(ses, csp, crp->crp_cipher_key,
csp->csp_cipher_klen);
 
-   /* Setup iv */
-   if (crp->crp_flags & CRYPTO_F_IV_GENERATE) {
-   arc4rand(iv, csp->csp_ivlen, 0);
-   crypto_copyback(crp, crp->crp_iv_start, csp->csp_ivlen, iv);
-   } else if (crp->crp_flags & CRYPTO_F_IV_SEPARATE)
-   memcpy(iv, crp->crp_iv, csp->csp_ivlen);
-   else
-   crypto_copydata(crp, crp->crp_iv_start, csp->csp_ivlen, iv);
+   crypto_read_iv(crp, iv);
 
switch (csp->csp_cipher_alg) {
case CRYPTO_AES_CBC:

Modified: head/sys/crypto/armv8/armv8_crypto.c
==
--- 

svn commit: r360135 - head/sys/netipsec

2020-04-20 Thread John Baldwin
Author: jhb
Date: Mon Apr 20 22:20:26 2020
New Revision: 360135
URL: https://svnweb.freebsd.org/changeset/base/360135

Log:
  Generate IVs directly in esp_output.
  
  This is the only place that uses CRYPTO_F_IV_GENERATE.  All crypto
  drivers currently duplicate the same boilerplate code to handle this
  case.  Doing the generation directly removes complexity from drivers.
  It also simplifies support for separate input and output buffers.
  
  Reviewed by:  cem
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D24449

Modified:
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Mon Apr 20 19:16:10 2020
(r360134)
+++ head/sys/netipsec/xform_esp.c   Mon Apr 20 22:20:26 2020
(r360135)
@@ -813,10 +813,9 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc
crp->crp_payload_length = m->m_pkthdr.len - (skip + hlen + alen);
crp->crp_op = CRYPTO_OP_ENCRYPT;
 
-   /* Encryption operation. */
+   /* Generate IV / nonce. */
+   ivp = >crp_iv[0];
if (SAV_ISCTRORGCM(sav)) {
-   ivp = >crp_iv[0];
-
/* GCM IV Format: RFC4106 4 */
/* CTR IV Format: RFC3686 4 */
/* Salt is last four bytes of key, RFC4106 8.1 */
@@ -833,8 +832,9 @@ esp_output(struct mbuf *m, struct secpolicy *sp, struc
m_copyback(m, skip + hlen - sav->ivlen, sav->ivlen, [4]);
crp->crp_flags |= CRYPTO_F_IV_SEPARATE;
} else if (sav->ivlen != 0) {
+   arc4rand(ivp, sav->ivlen, 0);
crp->crp_iv_start = skip + hlen - sav->ivlen;
-   crp->crp_flags |= CRYPTO_F_IV_GENERATE;
+   m_copyback(m, crp->crp_iv_start, sav->ivlen, ivp);
}
 
/* Callback parameters */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360134 - head/contrib/llvm-project/llvm/lib/Target/PowerPC

2020-04-20 Thread Dimitry Andric
Author: dim
Date: Mon Apr 20 19:16:10 2020
New Revision: 360134
URL: https://svnweb.freebsd.org/changeset/base/360134

Log:
  Merge commit 64b31d96d from llvm git (by Nemanja Ivanovic):
  
[PowerPC] Do not attempt to reuse load for 64-bit FP_TO_UINT without
FPCVT
  
We call the function that attempts to reuse the conversion without
checking whether the target matches the constraints that the callee
expects. This patch adds the check prior to the call.
  
Fixes: https://bugs.llvm.org/show_bug.cgi?id=43976
  
Differential revision: https://reviews.llvm.org/D77564
  
  This should fix 'Assertion failed: ((Op.getOpcode() == ISD::FP_TO_SINT
  || Subtarget.hasFPCVT()) && "i64 FP_TO_UINT is supported only with
  FPCVT"), function LowerFP_TO_INTForReuse, file
  /usr/src/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp, line 7276'
  when building the devel/libslang2 port (and a few others) for PowerPC64.
  
  Requested by: pkubaj
  MFC after:6 weeks
  X-MFC-With:   358851

Modified:
  head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
==
--- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Mon Apr 20 19:08:45 2020(r360133)
+++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp   
Mon Apr 20 19:16:10 2020(r360134)
@@ -7848,9 +7848,10 @@ bool PPCTargetLowering::canReuseLoadAddress(SDValue Op
 SelectionDAG ,
 ISD::LoadExtType ET) const {
   SDLoc dl(Op);
+  bool ValidFPToUint = Op.getOpcode() == ISD::FP_TO_UINT &&
+   (Subtarget.hasFPCVT() || Op.getValueType() == MVT::i32);
   if (ET == ISD::NON_EXTLOAD &&
-  (Op.getOpcode() == ISD::FP_TO_UINT ||
-   Op.getOpcode() == ISD::FP_TO_SINT) &&
+  (ValidFPToUint || Op.getOpcode() == ISD::FP_TO_SINT) &&
   isOperationLegalOrCustom(Op.getOpcode(),
Op.getOperand(0).getValueType())) {
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Vladimir Kondratyev
On 20.04.2020 19:39, Justin Hibbits wrote:
> But I'm curious, why not attach to sysmouse(4) and kbdmux(4)?  What
> breakage does that cause?  I could maybe see not attaching to
> sysmouse(4) by default, if the protocol isn't expressive enough, but
> kbdmux(4) should be sufficient.
>
> - Justin

kbdmux(4) is pretty good for standard 102-104-keys keyboards found at
common desktops.

But it does not work that good with some laptop ones.

There are no "Flight mode on/off", "Touchpad on/off" e.t.c. events
defined in AT-keyset but they exist in evdev-keyset.

Unfortunately, we do not support keymap uploading in our drivers yet to
make utilization of this advantage easy

but IMO its better to switch to direct key-event reporting earlier
rather than later.

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


svn commit: r360133 - stable/12/sys/dev/sound/pci/hda

2020-04-20 Thread Ed Maste
Author: emaste
Date: Mon Apr 20 19:08:45 2020
New Revision: 360133
URL: https://svnweb.freebsd.org/changeset/base/360133

Log:
  MFC r360053: hdac: update comment to match function name
  
  snd_hda was rewritten in r230130; one function retained a comment
  referencing the previous name.

Modified:
  stable/12/sys/dev/sound/pci/hda/hdac.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pci/hda/hdac.c
==
--- stable/12/sys/dev/sound/pci/hda/hdac.c  Mon Apr 20 18:23:31 2020
(r360132)
+++ stable/12/sys/dev/sound/pci/hda/hdac.c  Mon Apr 20 19:08:45 2020
(r360133)
@@ -962,7 +962,7 @@ hdac_unsolq_flush(struct hdac_softc *sc)
 }
 
 /
- * uint32_t hdac_command_sendone_internal
+ * uint32_t hdac_send_command
  *
  * Wrapper function that sends only one command to a given codec
  /
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Niclas Zeising

On 2020-04-20 20:13, Conrad Meyer wrote:

Hi Niclas,

On Mon, Apr 20, 2020 at 9:57 AM Niclas Zeising  wrote:


On 2020-04-20 18:39, Justin Hibbits wrote:

For just powerpc32,
you should have:

#if defined(__powerpc__) && !defined(__powerpc64__)


Ok, I wasn't aware of that, I'll fix it.


FYI, arch(7) is a great resource here (thanks, emaste@):

"""
  Architecture-specific macros:

ArchitecturePredefined macros
...
powerpc __powerpc__
powerpcspe  __powerpc__, __SPE__
powerpc64   __powerpc__, __powerpc64__
"""

For other predefined macros not covered in arch(7), I highly recommend
https://sourceforge.net/p/predef/wiki/Home/ .



I'll remember that for next time, thanks!
In any case, this should be fixed with r360132, sorry about that.
Regards
--
Niclas Zeising
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360122 - head/sys/vm

2020-04-20 Thread Conrad Meyer
Thanks!

On Mon, Apr 20, 2020 at 7:45 AM Mark Johnston  wrote:
>
> Author: markj
> Date: Mon Apr 20 14:45:17 2020
> New Revision: 360122
> URL: https://svnweb.freebsd.org/changeset/base/360122
>
> Log:
>   Handle trashed queue pointers in vm_page_acquire_unlocked().
>
>   vm_page_acquire_unlocked() relies on type-stability of vm_page
>   structures and assumes that the listq linkage pointers always point to a
>   vm_page or are NULL.  QUEUE_MACRO_DEBUG_TRASH breaks that assumption, so
>   add an explicit check for a trashed queue pointer before dereferencing.
>
>   Reported and tested by:   pho
>   Reviewed by:  kib
>   Sponsored by: The FreeBSD Foundation
>   Differential Revision:https://reviews.freebsd.org/D24472
>
> Modified:
>   head/sys/vm/vm_page.c
>
> Modified: head/sys/vm/vm_page.c
> ==
> --- head/sys/vm/vm_page.c   Mon Apr 20 14:24:13 2020(r360121)
> +++ head/sys/vm/vm_page.c   Mon Apr 20 14:45:17 2020(r360122)
> @@ -4438,7 +4438,7 @@ vm_page_acquire_unlocked(vm_object_t object, vm_pindex
>  * without barriers.  Switch to radix to verify.
>  */
> if (prev == NULL || (m = TAILQ_NEXT(prev, listq)) == NULL ||
> -   m->pindex != pindex ||
> +   QMD_IS_TRASHED(m) || m->pindex != pindex ||
> atomic_load_ptr(>object) != object) {
> prev = NULL;
> /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360132 - head/sys/dev/evdev

2020-04-20 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Mon Apr 20 18:23:31 2020
New Revision: 360132
URL: https://svnweb.freebsd.org/changeset/base/360132

Log:
  Fix kern.evdev.rcpt_mask on powerpc
  
  In r360126, I meant to have a different mask only on powerpc, not powerpc64.
  Update the check to check that we're not compiling for powerpc64.
  
  Reported by:  jhibbits
  Approved by:  wulf (implicit)
  MFC after:2 weeks
  X-MFC-Note:   12 only
  X-MFC-With:   r360126
  Differential Revision:D24370 (followup)

Modified:
  head/sys/dev/evdev/evdev.c

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Mon Apr 20 18:01:45 2020(r360131)
+++ head/sys/dev/evdev/evdev.c  Mon Apr 20 18:23:31 2020(r360132)
@@ -67,7 +67,7 @@ enum evdev_sparse_result
 MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory");
 
 /* adb keyboard driver used on powerpc does not support evdev yet */
-#ifdef __powerpc__
+#if defined(__powerpc__) && !defined(__powerpc64__)
 int evdev_rcpt_mask = EVDEV_RCPT_KBDMUX | EVDEV_RCPT_HW_MOUSE;
 #else
 int evdev_rcpt_mask = EVDEV_RCPT_HW_MOUSE | EVDEV_RCPT_HW_KBD;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Conrad Meyer
Hi Niclas,

On Mon, Apr 20, 2020 at 9:57 AM Niclas Zeising  wrote:
>
> On 2020-04-20 18:39, Justin Hibbits wrote:
> > For just powerpc32,
> > you should have:
> >
> > #if defined(__powerpc__) && !defined(__powerpc64__)
>
> Ok, I wasn't aware of that, I'll fix it.

FYI, arch(7) is a great resource here (thanks, emaste@):

"""
 Architecture-specific macros:

   ArchitecturePredefined macros
...
   powerpc __powerpc__
   powerpcspe  __powerpc__, __SPE__
   powerpc64   __powerpc__, __powerpc64__
"""

For other predefined macros not covered in arch(7), I highly recommend
https://sourceforge.net/p/predef/wiki/Home/ .

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


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

2020-04-20 Thread Conrad Meyer
Author: cem
Date: Mon Apr 20 18:01:45 2020
New Revision: 360131
URL: https://svnweb.freebsd.org/changeset/base/360131

Log:
  acpi_ec(4): Do not probe "successfully" if an error occurred
  
  All of the 'goto out;' cases in this probe routine without explicit
  initialization of 'ret' indicate error cases and were clearly intended
  to use the initial definition of 'ret' with ENXIO.  However, 'ret' was
  accidentally squashed by reuse for a subroutine call near the beginning
  of probe.
  
  Use a different variable for the subroutine status to preserve ENXIO ret
  for the 'goto out's as a minimal solution to the panic reported at attach
  for now.
  
  PR:   245757

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

Modified: head/sys/dev/acpica/acpi_ec.c
==
--- head/sys/dev/acpica/acpi_ec.c   Mon Apr 20 17:48:10 2020
(r360130)
+++ head/sys/dev/acpica/acpi_ec.c   Mon Apr 20 18:01:45 2020
(r360131)
@@ -344,7 +344,7 @@ acpi_ec_probe(device_t dev)
 device_t   peer;
 char   desc[64];
 intecdt;
-intret;
+intret, rc;
 struct acpi_ec_params *params;
 static char *ec_ids[] = { "PNP0C09", NULL };
 
@@ -368,9 +368,9 @@ acpi_ec_probe(device_t dev)
 } else
ecdt = 0;
 
-ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
-if (ret > 0)
-   return (ret);
+rc = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
+if (rc > 0)
+   return (rc);
 
 params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
 
@@ -398,7 +398,6 @@ acpi_ec_probe(device_t dev)
 peer = devclass_get_device(acpi_ec_devclass, params->uid);
 if (peer != NULL && device_is_alive(peer)) {
device_disable(dev);
-   ret = ENXIO;
goto out;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360130 - head/tests/sys/kqueue/libkqueue

2020-04-20 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 20 17:48:10 2020
New Revision: 360130
URL: https://svnweb.freebsd.org/changeset/base/360130

Log:
  Temporarily skip timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386
  
  PR:   245768
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/kqueue/libkqueue/kqueue_test.sh

Modified: head/tests/sys/kqueue/libkqueue/kqueue_test.sh
==
--- head/tests/sys/kqueue/libkqueue/kqueue_test.sh  Mon Apr 20 17:39:51 
2020(r360129)
+++ head/tests/sys/kqueue/libkqueue/kqueue_test.sh  Mon Apr 20 17:48:10 
2020(r360130)
@@ -1,9 +1,16 @@
 #!/bin/sh
 # $FreeBSD$
 
-i=1
+skip=""
 # Temporarily disable evfilt_proc tests: https://bugs.freebsd.org/233586
-"$(dirname $0)/kqtest" --no-proc | while read line; do
+skip="${skip} --no-proc"
+if [ "$(uname -p)" = "i386" ]; then
+   # Temporarily disable timer tests on i386: 
https://bugs.freebsd.org/245768
+   skip="${skip} --no-timer"
+fi
+
+i=1
+"$(dirname $0)/kqtest" ${skip} | while read line; do
echo $line | grep -q passed
if [ $? -eq 0 ]; then
echo "ok - $i $line"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360129 - head/contrib/llvm-project/clang/lib/CodeGen

2020-04-20 Thread Dimitry Andric
Author: dim
Date: Mon Apr 20 17:39:51 2020
New Revision: 360129
URL: https://svnweb.freebsd.org/changeset/base/360129

Log:
  Merge commit ce5173c0e from llvm git (by Reid Kleckner):
  
Use FinishThunk to finish musttail thunks
  
FinishThunk, and the invariant of setting and then unsetting
CurCodeDecl, was added in 7f416cc42638 (2015). The invariant didn't
exist when I added this musttail codepath in ab2090d10765 (2014).
Recently in 28328c3771, I started using this codepath on non-Windows
platforms, and users reported problems during release testing
(PR44987).
  
The issue was already present for users of EH on i686-windows-msvc,
so I added a test for that case as well.
  
Reviewed By: hans
  
Differential Revision: https://reviews.llvm.org/D76444
  
  This should fix 'Assertion failed: (!empty() && "popping exception stack
  when not empty"), function popTerminate, file
  /usr/src/contrib/llvm-project/clang/lib/CodeGen/CGCleanup.h, line 583'
  when building the net-p2p/libtorrent-rasterbar
  
  PR:   244830
  Reported by:  jbeich, yuri
  MFC after:6 weeks
  X-MFC-With:   358851

Modified:
  head/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp

Modified: head/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp
==
--- head/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp   Mon Apr 20 
16:31:05 2020(r360128)
+++ head/contrib/llvm-project/clang/lib/CodeGen/CGVTables.cpp   Mon Apr 20 
17:39:51 2020(r360129)
@@ -437,7 +437,8 @@ void CodeGenFunction::EmitMustTailThunk(GlobalDecl GD,
   // Finish the function to maintain CodeGenFunction invariants.
   // FIXME: Don't emit unreachable code.
   EmitBlock(createBasicBlock());
-  FinishFunction();
+
+  FinishThunk();
 }
 
 void CodeGenFunction::generateThunk(llvm::Function *Fn,
@@ -564,7 +565,7 @@ llvm::Constant *CodeGenVTables::maybeEmitThunk(GlobalD
   CGM.SetLLVMFunctionAttributesForDefinition(GD.getDecl(), ThunkFn);
 
   // Thunks for variadic methods are special because in general variadic
-  // arguments cannot be perferctly forwarded. In the general case, clang
+  // arguments cannot be perfectly forwarded. In the general case, clang
   // implements such thunks by cloning the original function body. However, for
   // thunks with no return adjustment on targets that support musttail, we can
   // use musttail to perfectly forward the variadic arguments.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360019 - head/tests/sys/kern

2020-04-20 Thread Enji Cooper

> On Apr 20, 2020, at 10:10 AM, Jonathan T. Looney  wrote:
> 
> On Sun, Apr 19, 2020 at 5:03 PM Enji Cooper  > wrote:
> 
> > On Apr 16, 2020, at 1:07 PM, Jonathan T. Looney  wrote:
> > 
> > Author: jtl
> > Date: Thu Apr 16 20:07:34 2020
> > New Revision: 360019
> > URL: https://svnweb.freebsd.org/changeset/base/360019 
> > 
> > 
> > Log:
> >  Add a regression test for the changes in r359922 and r359923.
> > 
> >  Note that the Python code has been tested on both Python 2.7 and 3.7.
> > 
> >  Reviewed by: olivier
> >  MFC after:   2 weeks
> >  Sponsored by:Netflix, Inc.
> 
> Ugh… I can tell by this commit that I just need to add pytest support 
> to kyua >_>…
> 
> I assume you're suggesting that we support running Python code natively, 
> instead of from a shell script. If so, I think that's a great idea.
> 
> It looks like we're growing a number of Python scripts in the test suite, and 
> supporting them more natively is probably good for more than one reason.

That was exactly my thinking. The reason why I picked pytest is that 
nose 1.x is abandoned, nose 2.x converges with pytest (and the page recommends 
pytest), and raw unittest requires a lot of complexity. Another plus of pytest 
is that it has an extensible plugin framework.
It’s really unfortunate that we don’t have better package integration 
in buildworld. It would make building and installing tests a lot easier.
Cheers,
-Enji

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


Re: svn commit: r360019 - head/tests/sys/kern

2020-04-20 Thread Jonathan T. Looney
On Sun, Apr 19, 2020 at 5:03 PM Enji Cooper  wrote:

>
> > On Apr 16, 2020, at 1:07 PM, Jonathan T. Looney  wrote:
> >
> > Author: jtl
> > Date: Thu Apr 16 20:07:34 2020
> > New Revision: 360019
> > URL: https://svnweb.freebsd.org/changeset/base/360019
> >
> > Log:
> >  Add a regression test for the changes in r359922 and r359923.
> >
> >  Note that the Python code has been tested on both Python 2.7 and 3.7.
> >
> >  Reviewed by: olivier
> >  MFC after:   2 weeks
> >  Sponsored by:Netflix, Inc.
>
> Ugh… I can tell by this commit that I just need to add pytest
> support to kyua >_>…
>

I assume you're suggesting that we support running Python code natively,
instead of from a shell script. If so, I think that's a great idea.

It looks like we're growing a number of Python scripts in the test suite,
and supporting them more natively is probably good for more than one reason.

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


Re: svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Niclas Zeising

On 2020-04-20 18:39, Justin Hibbits wrote:

On Mon, 20 Apr 2020 16:17:17 + (UTC)
Niclas Zeising  wrote:


Author: zeising (doc,ports committer)
Date: Mon Apr 20 16:17:16 2020
New Revision: 360126
URL: https://svnweb.freebsd.org/changeset/base/360126

Log:
   Change kern.evdev.rcpt_mask to 12 by default
   
   Change kern.evdev.rcpt_mask from 3 to 12 by default.  This makes us

much more evdev-friendly, and will prevent everyone using xorg and
wayland with evdev devices (the default) from needing to change this
locally.
   powerpc32 still uses the old value for the keyboard part, becaues
the adb keyboard driver used there is not evdev compatible.
   
   Reviewed by:	wulf

   Approved by: wulf
   MFC after:   2 weeks
   X-MFC-Note:  12 only
   Relnotes:yes
   Differential Revision:   https://reviews.freebsd.org/D24370

Modified:
   head/sys/dev/evdev/evdev.c

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Mon Apr 20 16:14:44 2020
(r360125) +++ head/sys/dev/evdev/evdev.cMon Apr 20 16:17:16
2020(r360126) @@ -66,7 +66,12 @@ enum evdev_sparse_result
  
  MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory");
  
-int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX;

+/* adb keyboard driver used on powerpc does not support evdev yet */
+#ifdef __powerpc__


This affects *all* powerpc, not just powerpc32.  For just powerpc32,
you should have:

#if defined(__powerpc__) && !defined(__powerpc64__)


Ok, I wasn't aware of that, I'll fix it.



But I'm curious, why not attach to sysmouse(4) and kbdmux(4)?  What
breakage does that cause?  I could maybe see not attaching to
sysmouse(4) by default, if the protocol isn't expressive enough, but
kbdmux(4) should be sufficient.


Sysmouse hides features from evdev, so it's better to let xorg or 
wayland access the device directly.


If both are enabled, you'll get double events, meaning double key 
presses when using USB devices: https://reviews.freebsd.org/D24370#538523


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


Re: svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Justin Hibbits
On Mon, 20 Apr 2020 16:17:17 + (UTC)
Niclas Zeising  wrote:

> Author: zeising (doc,ports committer)
> Date: Mon Apr 20 16:17:16 2020
> New Revision: 360126
> URL: https://svnweb.freebsd.org/changeset/base/360126
> 
> Log:
>   Change kern.evdev.rcpt_mask to 12 by default
>   
>   Change kern.evdev.rcpt_mask from 3 to 12 by default.  This makes us
> much more evdev-friendly, and will prevent everyone using xorg and
> wayland with evdev devices (the default) from needing to change this
> locally. 
>   powerpc32 still uses the old value for the keyboard part, becaues
> the adb keyboard driver used there is not evdev compatible.
>   
>   Reviewed by:wulf
>   Approved by:wulf
>   MFC after:  2 weeks
>   X-MFC-Note: 12 only
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D24370
> 
> Modified:
>   head/sys/dev/evdev/evdev.c
> 
> Modified: head/sys/dev/evdev/evdev.c
> ==
> --- head/sys/dev/evdev/evdev.cMon Apr 20 16:14:44 2020
> (r360125) +++ head/sys/dev/evdev/evdev.c  Mon Apr 20 16:17:16
> 2020  (r360126) @@ -66,7 +66,12 @@ enum evdev_sparse_result
>  
>  MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory");
>  
> -int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX;
> +/* adb keyboard driver used on powerpc does not support evdev yet */
> +#ifdef __powerpc__

This affects *all* powerpc, not just powerpc32.  For just powerpc32,
you should have:

#if defined(__powerpc__) && !defined(__powerpc64__)

But I'm curious, why not attach to sysmouse(4) and kbdmux(4)?  What
breakage does that cause?  I could maybe see not attaching to
sysmouse(4) by default, if the protocol isn't expressive enough, but
kbdmux(4) should be sufficient.


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


svn commit: r360128 - stable/12/usr.sbin/daemon

2020-04-20 Thread Alexander Motin
Author: mav
Date: Mon Apr 20 16:31:05 2020
New Revision: 360128
URL: https://svnweb.freebsd.org/changeset/base/360128

Log:
  MFC r348629 (by cem): daemon(8): Don't block SIGTERM during restart delay
  
  I believe this was introduced in the original '-r' commit, r231911 (2012).
  At the time, the scope was limited to a 1 second sleep.  r332518 (2018)
  added '-R', which increased the potential duration of the affected interval
  (from 1 to N seconds) by permitting arbitrary restart intervals.
  
  Instead, handle SIGTERM normally during restart-sleep, when the monitored
  process is not running, and shut down promptly.
  
  (I noticed this behavior when debugging a child process that exited quickly
  under the 'daemon -r -R 30' environment.  'kill ' had no
  immediate effect and the monitor process slept until the next restart
  attempt.  This was annoying.)

Modified:
  stable/12/usr.sbin/daemon/daemon.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/daemon/daemon.c
==
--- stable/12/usr.sbin/daemon/daemon.c  Mon Apr 20 16:21:37 2020
(r360127)
+++ stable/12/usr.sbin/daemon/daemon.c  Mon Apr 20 16:31:05 2020
(r360128)
@@ -359,12 +359,13 @@ restart:
}
}
}
+   if (restart && !terminate)
+   daemon_sleep(restart, 0);
if (sigprocmask(SIG_BLOCK, _term, NULL)) {
warn("sigprocmask");
goto exit;
}
if (restart && !terminate) {
-   daemon_sleep(restart, 0);
close(pfd[0]);
pfd[0] = -1;
goto restart;
@@ -384,7 +385,8 @@ static void
 daemon_sleep(time_t secs, long nsecs)
 {
struct timespec ts = { secs, nsecs };
-   while (nanosleep(, ) == -1) {
+
+   while (!terminate && nanosleep(, ) == -1) {
if (errno != EINTR)
err(1, "nanosleep");
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360127 - head/sys/compat/linuxkpi/common/include/asm

2020-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 20 16:21:37 2020
New Revision: 360127
URL: https://svnweb.freebsd.org/changeset/base/360127

Log:
  Implement the atomic fetch add unless functions for the LinuxKPI.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
  head/sys/compat/linuxkpi/common/include/asm/atomic.h
  head/sys/compat/linuxkpi/common/include/asm/atomic64.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon Apr 20 
16:17:16 2020(r360126)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Mon Apr 20 
16:21:37 2020(r360127)
@@ -111,6 +111,20 @@ atomic_long_add_unless(atomic_long_t *v, long a, long 
 }
 
 static inline long
+atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u)
+{
+   long c = atomic_long_read(v);
+
+   for (;;) {
+   if (unlikely(c == u))
+   break;
+   if (likely(atomic_fcmpset_long(>counter, , c + a)))
+   break;
+   }
+   return (c);
+}
+
+static inline long
 atomic_long_dec_and_test(atomic_long_t *v)
 {
long i = atomic_long_add(-1, v);

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic.hMon Apr 20 
16:17:16 2020(r360126)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic.hMon Apr 20 
16:21:37 2020(r360127)
@@ -119,6 +119,20 @@ atomic_add_unless(atomic_t *v, int a, int u)
return (c != u);
 }
 
+static inline int
+atomic_fetch_add_unless(atomic_t *v, int a, int u)
+{
+   int c = atomic_read(v);
+
+   for (;;) {
+   if (unlikely(c == u))
+   break;
+   if (likely(atomic_fcmpset_int(>counter, , c + a)))
+   break;
+   }
+   return (c);
+}
+
 static inline void
 atomic_clear_mask(unsigned int mask, atomic_t *v)
 {

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic64.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic64.h  Mon Apr 20 
16:17:16 2020(r360126)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic64.h  Mon Apr 20 
16:21:37 2020(r360127)
@@ -104,6 +104,20 @@ atomic64_add_unless(atomic64_t *v, int64_t a, int64_t 
 }
 
 static inline int64_t
+atomic64_fetch_add_unless(atomic64_t *v, int64_t a, int64_t u)
+{
+   int64_t c = atomic64_read(v);
+
+   for (;;) {
+   if (unlikely(c == u))
+   break;
+   if (likely(atomic_fcmpset_64(>counter, , c + a)))
+   break;
+   }
+   return (c);
+}
+
+static inline int64_t
 atomic64_xchg(atomic64_t *v, int64_t i)
 {
 #if !((defined(__mips__) && !(defined(__mips_n32) || defined(__mips_n64))) || \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360126 - head/sys/dev/evdev

2020-04-20 Thread Niclas Zeising
Author: zeising (doc,ports committer)
Date: Mon Apr 20 16:17:16 2020
New Revision: 360126
URL: https://svnweb.freebsd.org/changeset/base/360126

Log:
  Change kern.evdev.rcpt_mask to 12 by default
  
  Change kern.evdev.rcpt_mask from 3 to 12 by default.  This makes us much
  more evdev-friendly, and will prevent everyone using xorg and wayland with
  evdev devices (the default) from needing to change this locally.
  
  powerpc32 still uses the old value for the keyboard part, becaues the adb
  keyboard driver used there is not evdev compatible.
  
  Reviewed by:  wulf
  Approved by:  wulf
  MFC after:2 weeks
  X-MFC-Note:   12 only
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D24370

Modified:
  head/sys/dev/evdev/evdev.c

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Mon Apr 20 16:14:44 2020(r360125)
+++ head/sys/dev/evdev/evdev.c  Mon Apr 20 16:17:16 2020(r360126)
@@ -66,7 +66,12 @@ enum evdev_sparse_result
 
 MALLOC_DEFINE(M_EVDEV, "evdev", "evdev memory");
 
-int evdev_rcpt_mask = EVDEV_RCPT_SYSMOUSE | EVDEV_RCPT_KBDMUX;
+/* adb keyboard driver used on powerpc does not support evdev yet */
+#ifdef __powerpc__
+int evdev_rcpt_mask = EVDEV_RCPT_KBDMUX | EVDEV_RCPT_HW_MOUSE;
+#else
+int evdev_rcpt_mask = EVDEV_RCPT_HW_MOUSE | EVDEV_RCPT_HW_KBD;
+#endif
 int evdev_sysmouse_t_axis = 0;
 
 SYSCTL_NODE(_kern, OID_AUTO, evdev, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360125 - in head/usr.bin/diff: . tests

2020-04-20 Thread Kyle Evans
Author: kevans
Date: Mon Apr 20 16:14:44 2020
New Revision: 360125
URL: https://svnweb.freebsd.org/changeset/base/360125

Log:
  diff(1): reject conflicting formatting options
  
  This matches GNU diff(1) behavior and, more importantly, eliminates any
  source of confusion if multiple formatting options are specified.
  
  Note that the committed diff differs slightly from the submitted: I've
  modified it so that we initialize diff_format to something that isn't an
  accepted format option so that we can also reject --normal -c and -c
  --normal, which would've otherwise been accepted because the default was
  --normal. After option parsing we default it to D_NORMAL if it's still
  unset.
  
  PR:   243975
  Submitted by: fehmi noyan isi
  MFC after:1 week

Modified:
  head/usr.bin/diff/diff.c
  head/usr.bin/diff/diff.h
  head/usr.bin/diff/tests/diff_test.sh

Modified: head/usr.bin/diff/diff.c
==
--- head/usr.bin/diff/diff.cMon Apr 20 15:41:40 2020(r360124)
+++ head/usr.bin/diff/diff.cMon Apr 20 16:14:44 2020(r360125)
@@ -100,6 +100,7 @@ static struct option longopts[] = {
 };
 
 void usage(void) __dead2;
+void conflicting_format(void) __dead2;
 void push_excludes(char *);
 void push_ignore_pats(char *);
 void read_excludes_file(char *file);
@@ -120,7 +121,7 @@ main(int argc, char **argv)
prevoptind = 1;
newarg = 1;
diff_context = 3;
-   diff_format = 0;
+   diff_format = D_UNSET;
while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) {
switch (ch) {
case '0': case '1': case '2': case '3': case '4':
@@ -141,6 +142,8 @@ main(int argc, char **argv)
break;
case 'C':
case 'c':
+   if (diff_format != D_UNSET)
+   conflicting_format();
cflag = 1;
diff_format = D_CONTEXT;
if (optarg != NULL) {
@@ -154,13 +157,19 @@ main(int argc, char **argv)
dflags |= D_MINIMAL;
break;
case 'D':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_IFDEF;
ifdefname = optarg;
break;
case 'e':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_EDIT;
break;
case 'f':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_REVERSE;
break;
case 'H':
@@ -193,10 +202,12 @@ main(int argc, char **argv)
Nflag = 1;
break;
case 'n':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_NREVERSE;
break;
case 'p':
-   if (diff_format == 0)
+   if (diff_format == D_UNSET)
diff_format = D_CONTEXT;
dflags |= D_PROTOTYPE;
break;
@@ -207,6 +218,8 @@ main(int argc, char **argv)
rflag = 1;
break;
case 'q':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_BRIEF;
break;
case 'S':
@@ -223,6 +236,8 @@ main(int argc, char **argv)
break;
case 'U':
case 'u':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_UNIFIED;
if (optarg != NULL) {
l = strtol(optarg, , 10);
@@ -249,9 +264,13 @@ main(int argc, char **argv)
push_excludes(optarg);
break;
case 'y':
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_SIDEBYSIDE;
break;
case OPT_CHANGED_GROUP_FORMAT:
+   if (diff_format != D_UNSET)
+   conflicting_format();
diff_format = D_GFORMAT;
group_format = optarg;
break;
@@ -264,6 +283,8 @@ main(int argc, char **argv)
ignore_file_case = 0;
break;

svn commit: r360124 - head/sys/dev/sound/pci/hda

2020-04-20 Thread Ed Maste
Author: emaste
Date: Mon Apr 20 15:41:40 2020
New Revision: 360124
URL: https://svnweb.freebsd.org/changeset/base/360124

Log:
  hdac: remove unused macro

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Mon Apr 20 14:54:41 2020
(r360123)
+++ head/sys/dev/sound/pci/hda/hdac.c   Mon Apr 20 15:41:40 2020
(r360124)
@@ -232,9 +232,6 @@ static int  hdac_resume(device_t);
 static int hdac_rirb_flush(struct hdac_softc *sc);
 static int hdac_unsolq_flush(struct hdac_softc *sc);
 
-#define hdac_command(a1, a2, a3)   \
-   hdac_send_command(a1, a3, a2)
-
 /* This function surely going to make its way into upper level someday. */
 static void
 hdac_config_fetch(struct hdac_softc *sc, uint32_t *on, uint32_t *off)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360123 - head/sbin/nvmecontrol

2020-04-20 Thread Alexander Motin
Author: mav
Date: Mon Apr 20 14:54:41 2020
New Revision: 360123
URL: https://svnweb.freebsd.org/changeset/base/360123

Log:
  Allow namespace-id specification where it makes sense.
  
  It makes tool more convenient to not require user to explicitly convert
  namespace device name into controller device name.  There should be no
  changes to already existing syntaxes.
  
  MFC after:1 week

Modified:
  head/sbin/nvmecontrol/firmware.c
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/power.c
  head/sbin/nvmecontrol/reset.c

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cMon Apr 20 14:45:17 2020
(r360122)
+++ head/sbin/nvmecontrol/firmware.cMon Apr 20 14:54:41 2020
(r360123)
@@ -80,7 +80,7 @@ static const struct opts firmware_opts[] = {
 #undef OPT
 
 static const struct args firmware_args[] = {
-   { arg_string, , "controller-id" },
+   { arg_string, , "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -226,6 +226,7 @@ firmware(const struct cmd *f, int argc, char *argv[])
int activate_action, reboot_required;
charprompt[64];
void*buf = NULL;
+   char*path;
int32_t size = 0, nsid;
uint16_toacs_fw;
uint8_t fw_slot1_ro, fw_num_slots;
@@ -262,13 +263,12 @@ firmware(const struct cmd *f, int argc, char *argv[])
}
 
open_dev(opt.dev, , 1, 1);
-
-   /* Check that a controller (and not a namespace) was specified. */
-   get_nsid(fd, NULL, );
+   get_nsid(fd, , );
if (nsid != 0) {
close(fd);
-   arg_help(argc, argv, f);
+   open_dev(path, , 1, 1);
}
+   free(path);
 
read_controller_data(fd, );
 

Modified: head/sbin/nvmecontrol/ns.c
==
--- head/sbin/nvmecontrol/ns.c  Mon Apr 20 14:45:17 2020(r360122)
+++ head/sbin/nvmecontrol/ns.c  Mon Apr 20 14:54:41 2020(r360123)
@@ -79,7 +79,7 @@ static struct active_options {
 };
 
 static const struct args active_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -112,7 +112,7 @@ static struct controllers_options {
 };
 
 static const struct args controllers_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -178,7 +178,7 @@ static const struct opts create_opts[] = {
 };
 
 static const struct args create_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -208,7 +208,7 @@ static const struct opts delete_opts[] = {
 };
 
 static const struct args delete_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -242,7 +242,7 @@ static const struct opts attach_opts[] = {
 };
 
 static const struct args attach_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -272,7 +272,7 @@ static const struct opts attached_opts[] = {
 };
 
 static const struct args attached_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -306,7 +306,7 @@ static const struct opts detach_opts[] = {
 };
 
 static const struct args detach_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -344,7 +344,7 @@ static const struct opts identify_opts[] = {
 };
 
 static const struct args identify_args[] = {
-   { arg_string, _opt.dev, "controller-id" },
+   { arg_string, _opt.dev, "controller-id|namespace-id" },
{ arg_none, NULL, NULL },
 };
 
@@ -399,13 +399,28 @@ static void
 nsactive(const struct cmd *f, int argc, char *argv[])
 {
struct nvme_pt_command  pt;
+   struct nvme_controller_data cd;
int fd, i;
+   char*path;
+   uint32_t nsid;
uint32_t list[1024];
 
if (arg_parse(argc, argv, f))
return;
open_dev(active_opt.dev, , 0, 1);
+   get_nsid(fd, , );
+   if (nsid != 0) {
+   close(fd);
+   open_dev(path, , 0, 1);
+   }
+   free(path);
+   read_controller_data(fd, );
 
+   /* Check that 

svn commit: r360122 - head/sys/vm

2020-04-20 Thread Mark Johnston
Author: markj
Date: Mon Apr 20 14:45:17 2020
New Revision: 360122
URL: https://svnweb.freebsd.org/changeset/base/360122

Log:
  Handle trashed queue pointers in vm_page_acquire_unlocked().
  
  vm_page_acquire_unlocked() relies on type-stability of vm_page
  structures and assumes that the listq linkage pointers always point to a
  vm_page or are NULL.  QUEUE_MACRO_DEBUG_TRASH breaks that assumption, so
  add an explicit check for a trashed queue pointer before dereferencing.
  
  Reported and tested by:   pho
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D24472

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Mon Apr 20 14:24:13 2020(r360121)
+++ head/sys/vm/vm_page.c   Mon Apr 20 14:45:17 2020(r360122)
@@ -4438,7 +4438,7 @@ vm_page_acquire_unlocked(vm_object_t object, vm_pindex
 * without barriers.  Switch to radix to verify.
 */
if (prev == NULL || (m = TAILQ_NEXT(prev, listq)) == NULL ||
-   m->pindex != pindex ||
+   QMD_IS_TRASHED(m) || m->pindex != pindex ||
atomic_load_ptr(>object) != object) {
prev = NULL;
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360121 - head/tests/sys/netinet

2020-04-20 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 20 14:24:13 2020
New Revision: 360121
URL: https://svnweb.freebsd.org/changeset/base/360121

Log:
  Only skip sys.netinet.socket_afinet.socket_afinet_bind_zero in CI env
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/netinet/socket_afinet.c

Modified: head/tests/sys/netinet/socket_afinet.c
==
--- head/tests/sys/netinet/socket_afinet.c  Mon Apr 20 14:18:56 2020
(r360120)
+++ head/tests/sys/netinet/socket_afinet.c  Mon Apr 20 14:24:13 2020
(r360121)
@@ -51,7 +51,8 @@ ATF_TC_BODY(socket_afinet_bind_zero, tc)
int sd, rc;
struct sockaddr_in sin;
 
-   atf_tc_skip("doesn't work when mac_portacl(4) loaded (bug238781)");
+   if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false))
+   atf_tc_skip("doesn't work when mac_portacl(4) loaded 
(https://bugs.freebsd.org/238781)");
 
sd = socket(PF_INET, SOCK_DGRAM, 0);
ATF_CHECK(sd >= 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360120 - head/tests/sys/netinet

2020-04-20 Thread Li-Wen Hsu
Author: lwhsu
Date: Mon Apr 20 14:18:56 2020
New Revision: 360120
URL: https://svnweb.freebsd.org/changeset/base/360120

Log:
  Temporarily disable sys.netinet.divert.* on i386
  
  PR:   244703
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/netinet/divert.sh

Modified: head/tests/sys/netinet/divert.sh
==
--- head/tests/sys/netinet/divert.shMon Apr 20 14:03:05 2020
(r360119)
+++ head/tests/sys/netinet/divert.shMon Apr 20 14:18:56 2020
(r360120)
@@ -47,6 +47,11 @@ ipdivert_ip_output_remote_success_head() {
 
 ipdivert_ip_output_remote_success_body() {
 
+   if [ "$(atf_config_get ci false)" = "true" ] && \
+   [ "$(uname -p)" = "i386" ]; then
+   atf_skip "https://bugs.freebsd.org/245764;
+   fi
+
ids=65530
id=`printf "%x" ${ids}`
if [ $$ -gt 65535 ]; then
@@ -96,6 +101,11 @@ ipdivert_ip_input_local_success_head() {
 }
 
 ipdivert_ip_input_local_success_body() {
+
+   if [ "$(atf_config_get ci false)" = "true" ] && \
+   [ "$(uname -p)" = "i386" ]; then
+   atf_skip "https://bugs.freebsd.org/245764;
+   fi
 
ids=65529
id=`printf "%x" ${ids}`
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 20 14:03:05 2020
New Revision: 360119
URL: https://svnweb.freebsd.org/changeset/base/360119

Log:
  Implement aligned LinuxKPI types for u16, u32 and u64.
  Makes a difference for 32-bit platforms mostly.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/types.h
==
--- head/sys/compat/linuxkpi/common/include/linux/types.h   Mon Apr 20 
13:47:15 2020(r360118)
+++ head/sys/compat/linuxkpi/common/include/linux/types.h   Mon Apr 20 
14:03:05 2020(r360119)
@@ -53,6 +53,10 @@ typedef uint32_t __be32;
 typedef uint64_t __le64;
 typedef uint64_t __be64;
 
+typedef uint16_t __aligned_u16 __aligned(sizeof(uint16_t));
+typedef uint32_t __aligned_u32 __aligned(sizeof(uint32_t));
+typedef uint64_t __aligned_u64 __aligned(sizeof(uint64_t));
+
 typedef unsigned short ushort;
 typedef unsigned intuint;
 typedef unsigned long ulong;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2020-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 20 13:47:15 2020
New Revision: 360118
URL: https://svnweb.freebsd.org/changeset/base/360118

Log:
  Allow test_bit() in the LinuxKPI to accept a const pointer.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon Apr 20 
13:47:07 2020(r360117)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h  Mon Apr 20 
13:47:15 2020(r360118)
@@ -273,7 +273,7 @@ find_next_zero_bit(const unsigned long *addr, unsigned
 atomic_clear_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], 
BIT_MASK(i))
 
 #definetest_bit(i, a)  
\
-!!(READ_ONCE(((volatile unsigned long *)(a))[BIT_WORD(i)]) & BIT_MASK(i))
+!!(READ_ONCE(((volatile const unsigned long *)(a))[BIT_WORD(i)]) & 
BIT_MASK(i))
 
 static inline int
 test_and_clear_bit(long bit, volatile unsigned long *var)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360117 - head/sbin/nvmecontrol

2020-04-20 Thread Alexander Motin
Author: mav
Date: Mon Apr 20 13:47:07 2020
New Revision: 360117
URL: https://svnweb.freebsd.org/changeset/base/360117

Log:
  Open device with O_RDONLY when command is non-invasive.
  
  This allows to use some of the subcommands against mounted nvd devices.
  
  MFC after:1 week
  Sponsored by: iXystems, Inc.

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/logpage.c
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/nsid.c
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h
  head/sbin/nvmecontrol/resv.c

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cMon Apr 20 13:44:14 2020
(r360116)
+++ head/sbin/nvmecontrol/identify.cMon Apr 20 13:47:07 2020
(r360117)
@@ -241,7 +241,7 @@ identify(const struct cmd *f, int argc, char *argv[])
if (arg_parse(argc, argv, f))
return;
 
-   open_dev(opt.dev, , 1, 1);
+   open_dev(opt.dev, , 0, 1);
get_nsid(fd, , );
if (nsid != 0) {
/*
@@ -251,7 +251,7 @@ identify(const struct cmd *f, int argc, char *argv[])
 * the IDENTIFY command itself.
 */
close(fd);
-   open_dev(path, , 1, 1);
+   open_dev(path, , 0, 1);
}
free(path);
if (opt.nsid != NONE)

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Mon Apr 20 13:44:14 2020
(r360116)
+++ head/sbin/nvmecontrol/logpage.c Mon Apr 20 13:47:07 2020
(r360117)
@@ -687,13 +687,13 @@ logpage(const struct cmd *f, int argc, char *argv[])
fprintf(stderr, "Missing page_id (-p).\n");
arg_help(argc, argv, f);
}
-   open_dev(opt.dev, , 1, 1);
+   open_dev(opt.dev, , 0, 1);
get_nsid(fd, , );
if (nsid == 0) {
nsid = NVME_GLOBAL_NAMESPACE_TAG;
} else {
close(fd);
-   open_dev(path, , 1, 1);
+   open_dev(path, , 0, 1);
}
free(path);
 

Modified: head/sbin/nvmecontrol/ns.c
==
--- head/sbin/nvmecontrol/ns.c  Mon Apr 20 13:44:14 2020(r360116)
+++ head/sbin/nvmecontrol/ns.c  Mon Apr 20 13:47:07 2020(r360117)
@@ -404,7 +404,7 @@ nsactive(const struct cmd *f, int argc, char *argv[])
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(active_opt.dev, , 1, 1);
+   open_dev(active_opt.dev, , 0, 1);
 
memset(, 0, sizeof(pt));
pt.cmd.opc = NVME_OPC_IDENTIFY;
@@ -435,7 +435,7 @@ nsallocated(const struct cmd *f, int argc, char *argv[
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(active_opt.dev, , 1, 1);
+   open_dev(active_opt.dev, , 0, 1);
read_controller_data(fd, );
 
/* Check that controller can execute this command. */
@@ -472,7 +472,7 @@ nscontrollers(const struct cmd *f, int argc, char *arg
 
if (arg_parse(argc, argv, f))
return;
-   open_dev(controllers_opt.dev, , 1, 1);
+   open_dev(controllers_opt.dev, , 0, 1);
read_controller_data(fd, );
 
/* Check that controller can execute this command. */
@@ -781,7 +781,7 @@ nsattached(const struct cmd *f, int argc, char *argv[]
fprintf(stderr, "No valid NSID specified\n");
arg_help(argc, argv, f);
}
-   open_dev(attached_opt.dev, , 1, 1);
+   open_dev(attached_opt.dev, , 0, 1);
read_controller_data(fd, );
 
/* Check that controller can execute this command. */
@@ -825,7 +825,7 @@ nsidentify(const struct cmd *f, int argc, char *argv[]
fprintf(stderr, "No valid NSID specified\n");
arg_help(argc, argv, f);
}
-   open_dev(identify_opt.dev, , 1, 1);
+   open_dev(identify_opt.dev, , 0, 1);
read_controller_data(fd, );
 
/* Check that controller can execute this command. */

Modified: head/sbin/nvmecontrol/nsid.c
==
--- head/sbin/nvmecontrol/nsid.cMon Apr 20 13:44:14 2020
(r360116)
+++ head/sbin/nvmecontrol/nsid.cMon Apr 20 13:47:07 2020
(r360117)
@@ -73,7 +73,7 @@ gnsid(const struct cmd *f, int argc, char *argv[])
if (arg_parse(argc, argv, f))
return;
 
-   open_dev(nsid_opt.dev, , 1, 1);
+   open_dev(nsid_opt.dev, , 0, 1);
get_nsid(fd, , );
close(fd);
printf("%s\t%u\n", path, nsid);

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==
--- head/sbin/nvmecontrol/nvmecontrol.c Mon Apr 20 13:44:14 2020

svn commit: r360116 - in head: sys/netgraph/bluetooth/hci sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol

2020-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 20 13:44:14 2020
New Revision: 360116
URL: https://svnweb.freebsd.org/changeset/base/360116

Log:
  Substitute le_read_supported_status with le_read_supported_states.
  Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27.
  
  PR:   245763
  Submitted by: Marc Veldman 
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
  head/sys/netgraph/bluetooth/include/ng_hci.h
  head/usr.sbin/bluetooth/hccontrol/le.c

Modified: head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
==
--- head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c   Mon Apr 20 13:36:01 
2020(r360115)
+++ head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c   Mon Apr 20 13:44:14 
2020(r360116)
@@ -842,7 +842,7 @@ process_le_params(ng_hci_unit_p unit, u_int16_t ocf,
case NG_HCI_OCF_LE_RAND:
case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY:
case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY:
-   case NG_HCI_OCF_LE_READ_SUPPORTED_STATUS:
+   case NG_HCI_OCF_LE_READ_SUPPORTED_STATES:
case NG_HCI_OCF_LE_RECEIVER_TEST:
case NG_HCI_OCF_LE_TRANSMITTER_TEST:
case NG_HCI_OCF_LE_TEST_END:
@@ -913,7 +913,7 @@ process_le_status(ng_hci_unit_p unit,ng_hci_command_st
case NG_HCI_OCF_LE_RAND:
case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY:
case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY:
-   case NG_HCI_OCF_LE_READ_SUPPORTED_STATUS:
+   case NG_HCI_OCF_LE_READ_SUPPORTED_STATES:
case NG_HCI_OCF_LE_RECEIVER_TEST:
case NG_HCI_OCF_LE_TRANSMITTER_TEST:
case NG_HCI_OCF_LE_TEST_END:

Modified: head/sys/netgraph/bluetooth/include/ng_hci.h
==
--- head/sys/netgraph/bluetooth/include/ng_hci.hMon Apr 20 13:36:01 
2020(r360115)
+++ head/sys/netgraph/bluetooth/include/ng_hci.hMon Apr 20 13:44:14 
2020(r360116)
@@ -1673,12 +1673,12 @@ typedef struct {
 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp;
 
 
-#define NG_HCI_OCF_LE_READ_SUPPORTED_STATUS0x001c
+#define NG_HCI_OCF_LE_READ_SUPPORTED_STATES0x001c
 /*No command parameter*/
 typedef struct {
u_int8_t status;
-   u_int64_t le_status;
-}__attribute__ ((packed)) ng_hci_le_read_supported_status_rp;
+   u_int64_t le_states;
+}__attribute__ ((packed)) ng_hci_le_read_supported_states_rp;
 
 #define NG_HCI_OCF_LE_RECEIVER_TEST0x001d
 typedef struct{

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Mon Apr 20 13:36:01 2020
(r360115)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Mon Apr 20 13:44:14 2020
(r360116)
@@ -52,7 +52,7 @@ static int le_set_scan_param(int s, int argc, char *ar
 static int le_set_scan_enable(int s, int argc, char *argv[]);
 static int parse_param(int argc, char *argv[], char *buf, int *len);
 static int le_set_scan_response(int s, int argc, char *argv[]);
-static int le_read_supported_status(int s, int argc, char *argv[]);
+static int le_read_supported_states(int s, int argc, char *argv[]);
 static int le_read_local_supported_features(int s, int argc ,char *argv[]);
 static int set_le_event_mask(int s, uint64_t mask);
 static int set_event_mask(int s, uint64_t mask);
@@ -259,20 +259,26 @@ le_read_local_supported_features(int s, int argc ,char
 }
 
 static int
-le_read_supported_status(int s, int argc, char *argv[])
+le_read_supported_states(int s, int argc, char *argv[])
 {
-   ng_hci_le_read_supported_status_rp rp;
-   int e;
+   ng_hci_le_read_supported_states_rp rp;
int n = sizeof(rp);
 
-   e = hci_simple_request(s, NG_HCI_OPCODE(
+   if (hci_simple_request(s, NG_HCI_OPCODE(
NG_HCI_OGF_LE,
-   NG_HCI_OCF_LE_READ_SUPPORTED_STATUS),
-   (void *), );
+   NG_HCI_OCF_LE_READ_SUPPORTED_STATES),
+   (void *), ) == ERROR)
+   return (ERROR);
 
-   printf("LE_STATUS: %d %d %jx\n", e, rp.status, (uintmax_t)rp.le_status);
+   if (rp.status != 0x00) {
+   fprintf(stdout, "Status: %s [%#02x]\n", 
+   hci_status2str(rp.status), rp.status);
+   return (FAILED);
+   }
 
-   return 0;
+   fprintf(stdout, "LE States: %jx\n", rp.le_states);
+   
+   return (OK); 
 }
 
 static int
@@ -347,11 +353,11 @@ struct hci_command le_commands[] = {
  _read_local_supported_features,
   },
   {
- "le_read_supported_status",
- "le_read_supported_status\n"
+ 

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

2020-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 20 13:36:01 2020
New Revision: 360115
URL: https://svnweb.freebsd.org/changeset/base/360115

Log:
  Allow the ERR_CAST() function in the LinuxKPI to take a const void pointer.
  No functional change.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/err.h
==
--- head/sys/compat/linuxkpi/common/include/linux/err.h Mon Apr 20 13:19:23 
2020(r360114)
+++ head/sys/compat/linuxkpi/common/include/linux/err.h Mon Apr 20 13:36:01 
2020(r360115)
@@ -31,6 +31,8 @@
 #ifndef_LINUX_ERR_H_
 #define_LINUX_ERR_H_
 
+#include 
+
 #include 
 
 #define MAX_ERRNO  4095
@@ -62,9 +64,9 @@ IS_ERR_OR_NULL(const void *ptr)
 }
 
 static inline void *
-ERR_CAST(void *ptr)
+ERR_CAST(const void *ptr)
 {
-   return (void *)ptr;
+   return __DECONST(void *, ptr);
 }
 
 static inline int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360114 - stable/12/sys/dev/sound/pci/hda

2020-04-20 Thread Mark Johnston
Author: markj
Date: Mon Apr 20 13:19:23 2020
New Revision: 360114
URL: https://svnweb.freebsd.org/changeset/base/360114

Log:
  MFC r359894:
  snd_hda(4): Recognize the ALC257 codec.
  
  PR:   245524

Modified:
  stable/12/sys/dev/sound/pci/hda/hdac.h
  stable/12/sys/dev/sound/pci/hda/hdacc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pci/hda/hdac.h
==
--- stable/12/sys/dev/sound/pci/hda/hdac.h  Mon Apr 20 13:18:36 2020
(r360113)
+++ stable/12/sys/dev/sound/pci/hda/hdac.h  Mon Apr 20 13:19:23 2020
(r360114)
@@ -361,6 +361,7 @@
 #define HDA_CODEC_ALC235   HDA_CODEC_CONSTRUCT(REALTEK, 0x0235)
 #define HDA_CODEC_ALC255   HDA_CODEC_CONSTRUCT(REALTEK, 0x0255)
 #define HDA_CODEC_ALC256   HDA_CODEC_CONSTRUCT(REALTEK, 0x0256)
+#define HDA_CODEC_ALC257   HDA_CODEC_CONSTRUCT(REALTEK, 0x0257)
 #define HDA_CODEC_ALC260   HDA_CODEC_CONSTRUCT(REALTEK, 0x0260)
 #define HDA_CODEC_ALC262   HDA_CODEC_CONSTRUCT(REALTEK, 0x0262)
 #define HDA_CODEC_ALC267   HDA_CODEC_CONSTRUCT(REALTEK, 0x0267)

Modified: stable/12/sys/dev/sound/pci/hda/hdacc.c
==
--- stable/12/sys/dev/sound/pci/hda/hdacc.c Mon Apr 20 13:18:36 2020
(r360113)
+++ stable/12/sys/dev/sound/pci/hda/hdacc.c Mon Apr 20 13:19:23 2020
(r360114)
@@ -86,6 +86,7 @@ static const struct {
{ HDA_CODEC_ALC235, 0,  "Realtek ALC235" },
{ HDA_CODEC_ALC255, 0,  "Realtek ALC255" },
{ HDA_CODEC_ALC256, 0,  "Realtek ALC256" },
+   { HDA_CODEC_ALC257, 0,  "Realtek ALC257" },
{ HDA_CODEC_ALC260, 0,  "Realtek ALC260" },
{ HDA_CODEC_ALC262, 0,  "Realtek ALC262" },
{ HDA_CODEC_ALC267, 0,  "Realtek ALC267" },
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360113 - stable/12/sys/kern

2020-04-20 Thread Mark Johnston
Author: markj
Date: Mon Apr 20 13:18:36 2020
New Revision: 360113
URL: https://svnweb.freebsd.org/changeset/base/360113

Log:
  MFC r359893:
  Fix sendto() on unconnected SOCK_STREAM/SEQPACKET unix sockets.

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

Modified: stable/12/sys/kern/uipc_usrreq.c
==
--- stable/12/sys/kern/uipc_usrreq.cMon Apr 20 08:15:36 2020
(r360112)
+++ stable/12/sys/kern/uipc_usrreq.cMon Apr 20 13:18:36 2020
(r360113)
@@ -1135,25 +1135,29 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
case SOCK_STREAM:
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
-   if ((error = connect_internal(so, nam, td)))
+   error = connect_internal(so, nam, td);
+   if (error != 0)
break;
-   } else  {
+   } else {
error = ENOTCONN;
break;
}
-   } else if ((unp2 = unp->unp_conn) == NULL) {
+   } else {
+   UNP_PCB_LOCK(unp);
+   }
+
+   if ((unp2 = unp->unp_conn) == NULL) {
+   UNP_PCB_UNLOCK(unp);
error = ENOTCONN;
break;
} else if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
+   UNP_PCB_UNLOCK(unp);
error = EPIPE;
break;
-   } else {
-   UNP_PCB_LOCK(unp);
-   if ((unp2 = unp->unp_conn) == NULL) {
-   UNP_PCB_UNLOCK(unp);
-   error = ENOTCONN;
-   break;
-   }
+   } else if ((unp2 = unp->unp_conn) == NULL) {
+   UNP_PCB_UNLOCK(unp);
+   error = ENOTCONN;
+   break;
}
unp_pcb_owned_lock2(unp, unp2, freed);
UNP_PCB_UNLOCK(unp);
@@ -1195,15 +1199,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m
sbappend_locked(>so_rcv, m, flags);
break;
 
-   case SOCK_SEQPACKET: {
-   const struct sockaddr *from;
-
-   from = _noname;
+   case SOCK_SEQPACKET:
if (sbappendaddr_nospacecheck_locked(>so_rcv,
-   from, m, control))
+   _noname, m, control))
control = NULL;
break;
-   }
}
 
mbcnt = so2->so_rcv.sb_mbcnt;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360112 - stable/11/usr.sbin/jail

2020-04-20 Thread Eugene Grosbein
Author: eugen
Date: Mon Apr 20 08:15:36 2020
New Revision: 360112
URL: https://svnweb.freebsd.org/changeset/base/360112

Log:
  MFC r360040: jail(8): improve manual and usage information
  with more clear description for "jail -e" mode
  to show that it does not take additional jail name argument.
  
  Reported by:  David Marec 

Modified:
  stable/11/usr.sbin/jail/jail.8
  stable/11/usr.sbin/jail/jail.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/jail/jail.8
==
--- stable/11/usr.sbin/jail/jail.8  Mon Apr 20 08:12:40 2020
(r360111)
+++ stable/11/usr.sbin/jail/jail.8  Mon Apr 20 08:15:36 2020
(r360112)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 10, 2018
+.Dd April 17, 2020
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -49,7 +49,6 @@
 .Nm
 .Op Fl qv
 .Op Fl f Ar conf_file
-.Op Fl e Ar separator
 .Op Fl rR
 .Op Cm * | Ar jail ...
 .Nm
@@ -60,6 +59,10 @@
 .Op Fl n Ar jailname
 .Op Fl s Ar securelevel
 .Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ...
+.Nm
+.Op Fl f Ar conf_file
+.Fl e
+.Ar separator
 .Sh DESCRIPTION
 The
 .Nm

Modified: stable/11/usr.sbin/jail/jail.c
==
--- stable/11/usr.sbin/jail/jail.c  Mon Apr 20 08:12:40 2020
(r360111)
+++ stable/11/usr.sbin/jail/jail.c  Mon Apr 20 08:15:36 2020
(r360112)
@@ -1048,10 +1048,11 @@ usage(void)
(void)fprintf(stderr,
"usage: jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n"
"-[cmr] param=value ... [command=command ...]\n"
-   "   jail [-dqv] [-f file] [-e separator] -[cmr] [jail]\n"
+   "   jail [-dqv] [-f file] -[cmr] [jail]\n"
"   jail [-qv] [-f file] -[rR] ['*' | jail ...]\n"
"   jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n"
"[-n jailname] [-s securelevel]\n"
-   "path hostname [ip[,...]] command ...\n");
+   "path hostname [ip[,...]] command ...\n"
+   "   jail [-f file] -e separator\n");
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360111 - stable/12/usr.sbin/jail

2020-04-20 Thread Eugene Grosbein
Author: eugen
Date: Mon Apr 20 08:12:40 2020
New Revision: 360111
URL: https://svnweb.freebsd.org/changeset/base/360111

Log:
  MFC r360040: jail(8): improve manual and usage information
  with more clear description for "jail -e" mode
  to show that it does not take additional jail name argument.
  
  Reported by:  David Marec 

Modified:
  stable/12/usr.sbin/jail/jail.8
  stable/12/usr.sbin/jail/jail.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/jail/jail.8
==
--- stable/12/usr.sbin/jail/jail.8  Mon Apr 20 01:26:18 2020
(r360110)
+++ stable/12/usr.sbin/jail/jail.8  Mon Apr 20 08:12:40 2020
(r360111)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 6, 2019
+.Dd April 17, 2020
 .Dt JAIL 8
 .Os
 .Sh NAME
@@ -49,7 +49,6 @@
 .Nm
 .Op Fl qv
 .Op Fl f Ar conf_file
-.Op Fl e Ar separator
 .Op Fl rR
 .Op Cm * | Ar jail ...
 .Nm
@@ -60,6 +59,10 @@
 .Op Fl n Ar jailname
 .Op Fl s Ar securelevel
 .Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ...
+.Nm
+.Op Fl f Ar conf_file
+.Fl e
+.Ar separator
 .Sh DESCRIPTION
 The
 .Nm

Modified: stable/12/usr.sbin/jail/jail.c
==
--- stable/12/usr.sbin/jail/jail.c  Mon Apr 20 01:26:18 2020
(r360110)
+++ stable/12/usr.sbin/jail/jail.c  Mon Apr 20 08:12:40 2020
(r360111)
@@ -1040,10 +1040,11 @@ usage(void)
(void)fprintf(stderr,
"usage: jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n"
"-[cmr] param=value ... [command=command ...]\n"
-   "   jail [-dqv] [-f file] [-e separator] -[cmr] [jail]\n"
+   "   jail [-dqv] [-f file] -[cmr] [jail]\n"
"   jail [-qv] [-f file] -[rR] ['*' | jail ...]\n"
"   jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n"
"[-n jailname] [-s securelevel]\n"
-   "path hostname [ip[,...]] command ...\n");
+   "path hostname [ip[,...]] command ...\n"
+   "   jail [-f file] -e separator\n");
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"