svn commit: r363443 - stable/12/sys/net

2020-07-22 Thread Kyle Evans
Author: kevans
Date: Thu Jul 23 03:25:31 2020
New Revision: 363443
URL: https://svnweb.freebsd.org/changeset/base/363443

Log:
  tuntap: drop redundant if_mtu assignment in tuncreate
  
  ether_ifattach will immediately clobber if_mtu with ETHERMTU anyways, just
  let it happen.

Modified:
  stable/12/sys/net/if_tuntap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_tuntap.c
==
--- stable/12/sys/net/if_tuntap.c   Thu Jul 23 03:24:35 2020
(r363442)
+++ stable/12/sys/net/if_tuntap.c   Thu Jul 23 03:25:31 2020
(r363443)
@@ -939,7 +939,6 @@ tuncreate(struct cdev *dev)
ifp->if_capenable |= IFCAP_LINKSTATE;
 
if ((tp->tun_flags & TUN_L2) != 0) {
-   ifp->if_mtu = ETHERMTU;
ifp->if_init = tunifinit;
ifp->if_start = tunstart_l2;
 
___
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: r363442 - stable/12/sys/net

2020-07-22 Thread Kyle Evans
Author: kevans
Date: Thu Jul 23 03:24:35 2020
New Revision: 363442
URL: https://svnweb.freebsd.org/changeset/base/363442

Log:
  MFC r363244: ether_ifattach: set mtu before calling if_attach()
  
  if_attach() -> if_attach_internal() will call if_attachdomain1(ifp) any time
  an ethernet interface is setup *after*
  SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_FIRST.  This eventually leads to
  nd6_ifattach() -> nd6_setmtu0() stashing off ifp->if_mtu in ndi->maxmtu
  *before* ifp->if_mtu has been properly set in some scenarios, e.g., USB
  ethernet adapter plugged in later on.
  
  For interfaces that are created in early boot, we don't have this issue as
  domains aren't constructed enough for them to attach and thus it gets
  deferred to domainifattach at SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_SECOND
  *after* the mtu has been set earlier in ether_ifattach().
  
  PR:   248005

Modified:
  stable/12/sys/net/if_ethersubr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_ethersubr.c
==
--- stable/12/sys/net/if_ethersubr.cThu Jul 23 03:08:17 2020
(r363441)
+++ stable/12/sys/net/if_ethersubr.cThu Jul 23 03:24:35 2020
(r363442)
@@ -927,8 +927,8 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
 
ifp->if_addrlen = ETHER_ADDR_LEN;
ifp->if_hdrlen = ETHER_HDR_LEN;
-   if_attach(ifp);
ifp->if_mtu = ETHERMTU;
+   if_attach(ifp);
ifp->if_output = ether_output;
ifp->if_input = ether_input;
ifp->if_resolvemulti = ether_resolvemulti;
___
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: r363441 - in stable: 11/usr.sbin/wpa/hostapd 11/usr.sbin/wpa/wpa_supplicant 12/usr.sbin/wpa/hostapd 12/usr.sbin/wpa/wpa_supplicant

2020-07-22 Thread Cy Schubert
Author: cy
Date: Thu Jul 23 03:08:17 2020
New Revision: 363441
URL: https://svnweb.freebsd.org/changeset/base/363441

Log:
  MFC r363061:
  
  Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
  hostapd and wpa_supplicant.
  
  Submitted by: bz
  Relnotes: yes
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  stable/12/usr.sbin/wpa/hostapd/Makefile
  stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/wpa/hostapd/Makefile
  stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.sbin/wpa/hostapd/Makefile
==
--- stable/12/usr.sbin/wpa/hostapd/Makefile Thu Jul 23 01:35:24 2020
(r363440)
+++ stable/12/usr.sbin/wpa/hostapd/Makefile Thu Jul 23 03:08:17 2020
(r363441)
@@ -44,11 +44,15 @@ SRCS=   accounting.c \
ieee802_11.c \
ieee802_11_auth.c \
ieee802_11_common.c \
+   ieee802_11_he.c \
+   ieee802_11_ht.c \
ieee802_11_shared.c \
+   ieee802_11_vht.c \
ieee802_1x.c \
ip_addr.c \
l2_packet_freebsd.c \
main.c \
+   mbo_ap.c \
ms_funcs.c \
neighbor_db.c \
os_unix.c \
@@ -102,6 +106,11 @@ CFLAGS+=-I${.CURDIR:H}/wpa_supplicant \
-DCONFIG_DRIVER_BSD \
-DCONFIG_DRIVER_RADIUS_ACL \
-DCONFIG_HS20 \
+   -DCONFIG_MBO \
+   -DCONFIG_IEEE80211N \
+   -DCONFIG_IEEE80211W \
+   -DCONFIG_IEEE80211AC \
+   -DCONFIG_IEEE80211AX \
-DCONFIG_INTERWORKING \
-DCONFIG_PEERKEY \
-DCONFIG_RSN_PREAUTH \

Modified: stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
==
--- stable/12/usr.sbin/wpa/wpa_supplicant/Makefile  Thu Jul 23 01:35:24 
2020(r363440)
+++ stable/12/usr.sbin/wpa/wpa_supplicant/Makefile  Thu Jul 23 03:08:17 
2020(r363441)
@@ -41,6 +41,10 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \
-DCONFIG_DRIVER_WIRED \
-DCONFIG_GAS \
-DCONFIG_IEEE80211R \
+   -DCONFIG_IEEE80211N \
+   -DCONFIG_IEEE80211W \
+   -DCONFIG_IEEE80211AC \
+   -DCONFIG_IEEE80211AX \
-DCONFIG_PEERKEY \
-DCONFIG_PRIVSEP \
-DCONFIG_SMARTCARD \
___
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: r363441 - in stable: 11/usr.sbin/wpa/hostapd 11/usr.sbin/wpa/wpa_supplicant 12/usr.sbin/wpa/hostapd 12/usr.sbin/wpa/wpa_supplicant

2020-07-22 Thread Cy Schubert
Author: cy
Date: Thu Jul 23 03:08:17 2020
New Revision: 363441
URL: https://svnweb.freebsd.org/changeset/base/363441

Log:
  MFC r363061:
  
  Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
  hostapd and wpa_supplicant.
  
  Submitted by: bz
  Relnotes: yes
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  stable/11/usr.sbin/wpa/hostapd/Makefile
  stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/wpa/hostapd/Makefile
  stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/wpa/hostapd/Makefile
==
--- stable/11/usr.sbin/wpa/hostapd/Makefile Thu Jul 23 01:35:24 2020
(r363440)
+++ stable/11/usr.sbin/wpa/hostapd/Makefile Thu Jul 23 03:08:17 2020
(r363441)
@@ -44,11 +44,15 @@ SRCS=   accounting.c \
ieee802_11.c \
ieee802_11_auth.c \
ieee802_11_common.c \
+   ieee802_11_he.c \
+   ieee802_11_ht.c \
ieee802_11_shared.c \
+   ieee802_11_vht.c \
ieee802_1x.c \
ip_addr.c \
l2_packet_freebsd.c \
main.c \
+   mbo_ap.c \
ms_funcs.c \
neighbor_db.c \
os_unix.c \
@@ -102,6 +106,11 @@ CFLAGS+=-I${.CURDIR:H}/wpa_supplicant \
-DCONFIG_DRIVER_BSD \
-DCONFIG_DRIVER_RADIUS_ACL \
-DCONFIG_HS20 \
+   -DCONFIG_MBO \
+   -DCONFIG_IEEE80211N \
+   -DCONFIG_IEEE80211W \
+   -DCONFIG_IEEE80211AC \
+   -DCONFIG_IEEE80211AX \
-DCONFIG_INTERWORKING \
-DCONFIG_PEERKEY \
-DCONFIG_RSN_PREAUTH \

Modified: stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
==
--- stable/11/usr.sbin/wpa/wpa_supplicant/Makefile  Thu Jul 23 01:35:24 
2020(r363440)
+++ stable/11/usr.sbin/wpa/wpa_supplicant/Makefile  Thu Jul 23 03:08:17 
2020(r363441)
@@ -41,6 +41,10 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \
-DCONFIG_DRIVER_WIRED \
-DCONFIG_GAS \
-DCONFIG_IEEE80211R \
+   -DCONFIG_IEEE80211N \
+   -DCONFIG_IEEE80211W \
+   -DCONFIG_IEEE80211AC \
+   -DCONFIG_IEEE80211AX \
-DCONFIG_PEERKEY \
-DCONFIG_PRIVSEP \
-DCONFIG_SMARTCARD \
___
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: r363440 - head/sys/netinet

2020-07-22 Thread Michael Tuexen
Author: tuexen
Date: Thu Jul 23 01:35:24 2020
New Revision: 363440
URL: https://svnweb.freebsd.org/changeset/base/363440

Log:
  Detect and handle an invalid reassembly constellation, which results in
  a memory leak.
  
  Thanks to Felix Weinrank for finding this issue using fuzz testing the
  userland stack.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Wed Jul 22 23:39:58 2020
(r363439)
+++ head/sys/netinet/sctp_constants.h   Thu Jul 23 01:35:24 2020
(r363440)
@@ -795,6 +795,7 @@ __FBSDID("$FreeBSD$");
 #define SCTP_LOC_34 0x0022
 #define SCTP_LOC_35 0x0023
 #define SCTP_LOC_36 0x0024
+#define SCTP_LOC_37 0x0025
 
 /* Free assoc codes */
 #define SCTP_NORMAL_PROC  0

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Wed Jul 22 23:39:58 2020
(r363439)
+++ head/sys/netinet/sctp_indata.c  Thu Jul 23 01:35:24 2020
(r363440)
@@ -1567,6 +1567,15 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc
chk->rec.data.fsn);
TAILQ_FOREACH(at, >reasm, sctp_next) {
if (SCTP_TSN_GT(at->rec.data.fsn, chk->rec.data.fsn)) {
+   if (chk->rec.data.rcv_flags & 
SCTP_DATA_LAST_FRAG) {
+   /* Last not at the end? huh? */
+   SCTPDBG(SCTP_DEBUG_XXX,
+   "Last fragment not last in list: -- 
abort\n");
+   sctp_abort_in_reasm(stcb, control,
+   chk, abort_flag,
+   SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_14);
+   return;
+   }
/*
 * This one in queue is bigger than the new
 * one, insert the new one before at.
@@ -1597,7 +1606,7 @@ sctp_queue_data_for_reasm(struct sctp_tcb *stcb, struc
at->rec.data.fsn);
sctp_abort_in_reasm(stcb, control,
chk, abort_flag,
-   SCTP_FROM_SCTP_INDATA + SCTP_LOC_14);
+   SCTP_FROM_SCTP_INDATA + SCTP_LOC_15);
return;
}
}
@@ -1751,7 +1760,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc
 * Need to send an abort since we had a empty data chunk.
 */
op_err = sctp_generate_no_user_data_cause(tsn);
-   stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_15;
+   stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_16;
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, 
SCTP_SO_NOT_LOCKED);
*abort_flag = 1;
return (0);
@@ -1888,7 +1897,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc
SCTP_SNPRINTF(msg, sizeof(msg), "Reassembly 
problem (MID=%8.8x)", mid);
err_out:
op_err = 
sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg);
-   stcb->sctp_ep->last_abort_code = 
SCTP_FROM_SCTP_INDATA + SCTP_LOC_16;
+   stcb->sctp_ep->last_abort_code = 
SCTP_FROM_SCTP_INDATA + SCTP_LOC_17;
sctp_abort_an_association(stcb->sctp_ep, stcb, 
op_err, SCTP_SO_NOT_LOCKED);
*abort_flag = 1;
return (0);
@@ -2023,7 +2032,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc
(uint16_t)mid);
}
op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, 
msg);
-   stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_17;
+   stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + 
SCTP_LOC_18;
sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, 
SCTP_SO_NOT_LOCKED);
*abort_flag = 1;
return (0);
@@ -2597,7 +2606,7 @@ sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap)
if (SCTP_OS_TIMER_PENDING(>asoc.dack_timer.timer)) {
sctp_timer_stop(SCTP_TIMER_TYPE_RECV,
stcb->sctp_ep, stcb, NULL,
-   SCTP_FROM_SCTP_INDATA + SCTP_LOC_18);
+   SCTP_FROM_SCTP_INDATA + SCTP_LOC_19);

svn commit: r363439 - head/usr.sbin/mountd

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 23:39:58 2020
New Revision: 363439
URL: https://svnweb.freebsd.org/changeset/base/363439

Log:
  Correct a type-mismatch between xdr_long and the variable "bad".
  
  Way back in r28911 (August 1997, CVS rev 1.22) we imported a NetBSD
  information leak fix via OpenBSD.  Unfortunatly we failed to track the
  followup commit that fixed the type of the error code.  Apply the change
  from int to long now.
  
  Reviewed by:  emaste
  Found by: CHERI
  Obtained from:CheriBSD
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25779

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Jul 22 23:35:41 2020
(r363438)
+++ head/usr.sbin/mountd/mountd.c   Wed Jul 22 23:39:58 2020
(r363439)
@@ -1091,7 +1091,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
struct sockaddr *saddr;
u_short sport;
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
-   int bad = 0, defset, hostset;
+   int defset, hostset;
+   long bad = 0;
sigset_t sighup_mask;
int numsecflavors, *secflavorsp;
 
___
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: r363438 - head/sys/kern

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 23:35:41 2020
New Revision: 363438
URL: https://svnweb.freebsd.org/changeset/base/363438

Log:
  Use SI_ORDER_(FOURTH|FIFTH) rather than bespoke versions.
  
  No functional change.
  
  When these SYSINITs were added these macros didn't exist.
  
  Reviewed by:  imp
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25758

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Wed Jul 22 23:33:37 2020(r363437)
+++ head/sys/kern/init_main.c   Wed Jul 22 23:35:41 2020(r363438)
@@ -372,18 +372,18 @@ SYSINIT(version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, pri
 #ifdef WITNESS
 static char wit_warn[] =
  "WARNING: WITNESS option enabled, expect reduced performance.\n";
-SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
-SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1,
+SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_FOURTH,
print_caddr_t, wit_warn);
 #endif
 
 #ifdef DIAGNOSTIC
 static char diag_warn[] =
  "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n";
-SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
-SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 2,
+SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH,
 print_caddr_t, diag_warn);
 #endif
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363437 - head/sys/fs/nfsclient

2020-07-22 Thread Rick Macklem
Author: rmacklem
Date: Wed Jul 22 23:33:37 2020
New Revision: 363437
URL: https://svnweb.freebsd.org/changeset/base/363437

Log:
  Modify writing to mirrored pNFS DSs to prepare for use of ext_pgs mbufs.
  
  This patch modifies writing to mirrored pNFS DSs slightly so that there is
  only one m_copym() call for a mirrored pair instead of two of them.
  This call replaces the custom nfsm_copym() call, which is no longer needed
  and deleted by this patch. The patch does introduce a new nfsm_split()
  function that only calls m_split() for the non-ext_pgs case.
  The semantics of nfsm_uiombuflist() is changed to include code that nul
  pads the generated mbuf list. This was done by nfsm_copym() prior to this 
patch.
  
  The main reason for this change is that it allows the data to be a list
  of ext_pgs mbufs, since the m_copym() is for the entire mbuf list.
  This support will be added in a future commit.
  
  This patch only affects writing to mirrored flexible file layout pNFS servers.

Modified:
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==
--- head/sys/fs/nfsclient/nfs_clcomsubs.c   Wed Jul 22 22:51:14 2020
(r363436)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c   Wed Jul 22 23:33:37 2020
(r363437)
@@ -164,9 +164,9 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
 {
char *uiocp;
struct mbuf *mp, *mp2, *firstmp;
-   int xfer, left, mlen;
+   int i, left, mlen, rem, xfer;
int uiosiz, clflg;
-   char *tcp;
+   char *mcp, *tcp;
 
KASSERT(uiop->uio_iovcnt == 1, ("nfsm_uiotombuf: iovcnt != 1"));
 
@@ -179,7 +179,9 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
else
NFSMGET(mp);
mp->m_len = 0;
+   mcp = mtod(mp, char *);
firstmp = mp2 = mp;
+   rem = NFSM_RNDUP(siz) - siz;
while (siz > 0) {
left = uiop->uio_iov->iov_len;
uiocp = uiop->uio_iov->iov_base;
@@ -194,18 +196,18 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
else
NFSMGET(mp);
mp->m_len = 0;
+   mcp = mtod(mp, char *);
mp2->m_next = mp;
mp2 = mp;
mlen = M_TRAILINGSPACE(mp);
}
xfer = (left > mlen) ? mlen : left;
if (uiop->uio_segflg == UIO_SYSSPACE)
-   NFSBCOPY(uiocp, mtod(mp, caddr_t) +
-   mp->m_len, xfer);
+   NFSBCOPY(uiocp, mcp, xfer);
else
-   copyin(uiocp, mtod(mp, caddr_t) +
-   mp->m_len, xfer);
+   copyin(uiocp, mcp, xfer);
mp->m_len += xfer;
+   mcp += xfer;
left -= xfer;
uiocp += xfer;
uiop->uio_offset += xfer;
@@ -216,6 +218,13 @@ nfsm_uiombuflist(struct uio *uiop, int siz, struct mbu
uiop->uio_iov->iov_base = (void *)tcp;
uiop->uio_iov->iov_len -= uiosiz;
siz -= uiosiz;
+   }
+   if (rem > 0) {
+   KASSERT(rem <= M_TRAILINGSPACE(mp),
+   ("nfsm_uiombuflist: no space for padding"));
+   for (i = 0; i < rem; i++)
+   *mcp++ = '\0';
+   mp->m_len += rem;
}
if (cpp != NULL)
*cpp = mtod(mp, caddr_t) + mp->m_len;

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cWed Jul 22 22:51:14 2020
(r363436)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cWed Jul 22 23:33:37 2020
(r363437)
@@ -158,7 +158,6 @@ static int nfscl_dofflayoutio(vnode_t, struct uio *, i
 nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *,
 struct nfsclflayout *, uint64_t, uint64_t, int, int, struct mbuf *,
 struct nfsclwritedsdorpc *, struct ucred *, NFSPROC_T *);
-static struct mbuf *nfsm_copym(struct mbuf *, int, int);
 static int nfsrpc_readds(vnode_t, struct uio *, nfsv4stateid_t *, int *,
 struct nfsclds *, uint64_t, int, struct nfsfh *, int, int, int,
 struct ucred *, NFSPROC_T *);
@@ -220,6 +219,7 @@ static int nfsrpc_copyrpc(vnode_t, off_t, vnode_t, off
 struct nfsvattr *, int *, bool, int *, struct ucred *, NFSPROC_T *);
 static int nfsrpc_seekrpc(vnode_t, off_t *, nfsv4stateid_t *, bool *,
 int, struct nfsvattr *, int *, struct ucred *);
+static struct mbuf *nfsm_split(struct mbuf 

svn commit: r363436 - in head/sys: arm64/arm64 riscv/riscv

2020-07-22 Thread John Baldwin
Author: jhb
Date: Wed Jul 22 22:51:14 2020
New Revision: 363436
URL: https://svnweb.freebsd.org/changeset/base/363436

Log:
  Add missing space after switch.
  
  Reviewed by:  br, emaste
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25778

Modified:
  head/sys/arm64/arm64/trap.c
  head/sys/riscv/riscv/trap.c

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Wed Jul 22 21:44:51 2020(r363435)
+++ head/sys/arm64/arm64/trap.c Wed Jul 22 22:51:14 2020(r363436)
@@ -341,7 +341,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
break;
}
 
-   switch(exception) {
+   switch (exception) {
case EXCP_FP_SIMD:
case EXCP_TRAP_FP:
 #ifdef VFP
@@ -452,7 +452,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame
"do_el0_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr,
frame->tf_elr, frame);
 
-   switch(exception) {
+   switch (exception) {
case EXCP_FP_SIMD:
case EXCP_TRAP_FP:
 #ifdef VFP

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Wed Jul 22 21:44:51 2020(r363435)
+++ head/sys/riscv/riscv/trap.c Wed Jul 22 22:51:14 2020(r363436)
@@ -269,7 +269,7 @@ do_trap_supervisor(struct trapframe *frame)
CTR3(KTR_TRAP, "do_trap_supervisor: curthread: %p, sepc: %lx, frame: 
%p",
curthread, frame->tf_sepc, frame);
 
-   switch(exception) {
+   switch (exception) {
case EXCP_FAULT_LOAD:
case EXCP_FAULT_STORE:
case EXCP_FAULT_FETCH:
@@ -326,7 +326,7 @@ do_trap_user(struct trapframe *frame)
CTR3(KTR_TRAP, "do_trap_user: curthread: %p, sepc: %lx, frame: %p",
curthread, frame->tf_sepc, frame);
 
-   switch(exception) {
+   switch (exception) {
case EXCP_FAULT_LOAD:
case EXCP_FAULT_STORE:
case EXCP_FAULT_FETCH:
___
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: r363435 - head/usr.sbin/mountd

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:44:51 2020
New Revision: 363435
URL: https://svnweb.freebsd.org/changeset/base/363435

Log:
  Avoid reading one byte before the path buffer.
  
  This happens when there's only one component (e.g. "/foo"). This
  (mostly-harmless) bug has been present since June 1990 when it was
  commited to mountd.c SCCS version 5.9.
  
  Note: the bug is on the second changed line, the first line is changed
  for visual consistency.
  
  Reviewed by:  cem, emaste, mckusick, rmacklem
  Found with:   CHERI
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25759

Modified:
  head/usr.sbin/mountd/mountd.c

Modified: head/usr.sbin/mountd/mountd.c
==
--- head/usr.sbin/mountd/mountd.c   Wed Jul 22 21:30:18 2020
(r363434)
+++ head/usr.sbin/mountd/mountd.c   Wed Jul 22 21:44:51 2020
(r363435)
@@ -3155,9 +3155,9 @@ do_mount(struct exportlist *ep, struct grouplist *grp,
goto error_exit;
}
/* back up over the last component */
-   while (*cp == '/' && cp > dirp)
+   while (cp > dirp && *cp == '/')
cp--;
-   while (*(cp - 1) != '/' && cp > dirp)
+   while (cp > dirp && *(cp - 1) != '/')
cp--;
if (cp == dirp) {
if (debug)
___
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: r363434 - stable/11/lib/libc/gen

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:30:18 2020
New Revision: 363434
URL: https://svnweb.freebsd.org/changeset/base/363434

Log:
  MFC r363228:
  
  Don't imply that all action values can be OR'd.
  
  This is neither POSIX compliant nor what the implementation does.
  This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
  but that doesn't seem worthwhile after 25+ years.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25659

Modified:
  stable/11/lib/libc/gen/tcsetattr.3
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/tcsetattr.3
==
--- stable/11/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:17:02 2020
(r363433)
+++ stable/11/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:30:18 2020
(r363434)
@@ -28,7 +28,7 @@
 .\"@(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
 .\" $FreeBSD$
 .\"
-.Dd January 2, 1994
+.Dd July 15, 2020
 .Dt TCSETATTR 3
 .Os
 .Sh NAME
@@ -221,8 +221,7 @@ termios structure referenced by
 .Fa tp .
 The
 .Fa action
-argument is created by
-.Em or Ns 'ing
+argument is one of
 the following values, as specified in the include file
 .In termios.h .
 .Bl -tag -width "TCSADRAIN"
@@ -240,18 +239,20 @@ The change occurs after all output written to
 .Fa fd
 has been transmitted to the terminal.
 Additionally, any input that has been received but not read is discarded.
-.It Fa TCSASOFT
-If this value is
-.Em or Ns 'ed
-into the
+.El
+.Pp
+The
 .Fa action
-value, the values of the
+may be modified by
+.Em or Ns 'ing
+in
+.Fa TCSASOFT
+which causes the values of the
 .Va c_cflag ,
 .Va c_ispeed ,
 and
 .Va c_ospeed
-fields are ignored.
-.El
+fields to be ignored.
 .Pp
 The 0 baud rate is used to terminate the connection.
 If 0 is specified as the output speed to the function
___
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: r363433 - in stable: 11/sys/x86/x86 12/sys/x86/x86

2020-07-22 Thread Jung-uk Kim
Author: jkim
Date: Wed Jul 22 21:17:02 2020
New Revision: 363433
URL: https://svnweb.freebsd.org/changeset/base/363433

Log:
  MFC:  r362509
  
  Assume all TSCs are synchronized for AMD Family 17h processors and later
  when it has passed the synchronization test.

Modified:
  stable/11/sys/x86/x86/tsc.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/x86/x86/tsc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/x86/x86/tsc.c
==
--- stable/11/sys/x86/x86/tsc.c Wed Jul 22 21:06:32 2020(r363432)
+++ stable/11/sys/x86/x86/tsc.c Wed Jul 22 21:17:02 2020(r363433)
@@ -495,6 +495,13 @@ retry:
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
/*
+* Processor Programming Reference (PPR) for AMD
+* Family 17h states that the TSC uses a common
+* reference for all sockets, cores and threads.
+*/
+   if (CPUID_TO_FAMILY(cpu_id) >= 0x17)
+   return (1000);
+   /*
 * Starting with Family 15h processors, TSC clock
 * source is in the north bridge.  Check whether
 * we have a single-socket/multi-core platform.
___
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: r363433 - in stable: 11/sys/x86/x86 12/sys/x86/x86

2020-07-22 Thread Jung-uk Kim
Author: jkim
Date: Wed Jul 22 21:17:02 2020
New Revision: 363433
URL: https://svnweb.freebsd.org/changeset/base/363433

Log:
  MFC:  r362509
  
  Assume all TSCs are synchronized for AMD Family 17h processors and later
  when it has passed the synchronization test.

Modified:
  stable/12/sys/x86/x86/tsc.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/x86/x86/tsc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/x86/x86/tsc.c
==
--- stable/12/sys/x86/x86/tsc.c Wed Jul 22 21:06:32 2020(r363432)
+++ stable/12/sys/x86/x86/tsc.c Wed Jul 22 21:17:02 2020(r363433)
@@ -530,6 +530,13 @@ retry:
case CPU_VENDOR_AMD:
case CPU_VENDOR_HYGON:
/*
+* Processor Programming Reference (PPR) for AMD
+* Family 17h states that the TSC uses a common
+* reference for all sockets, cores and threads.
+*/
+   if (CPUID_TO_FAMILY(cpu_id) >= 0x17)
+   return (1000);
+   /*
 * Starting with Family 15h processors, TSC clock
 * source is in the north bridge.  Check whether
 * we have a single-socket/multi-core platform.
___
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: r363432 - stable/12/lib/libc/gen

2020-07-22 Thread Brooks Davis
Author: brooks
Date: Wed Jul 22 21:06:32 2020
New Revision: 363432
URL: https://svnweb.freebsd.org/changeset/base/363432

Log:
  MFC r363228:
  
  Don't imply that all action values can be OR'd.
  
  This is neither POSIX compliant nor what the implementation does.
  This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
  but that doesn't seem worthwhile after 25+ years.
  
  Reviewed by:  imp
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D25659

Modified:
  stable/12/lib/libc/gen/tcsetattr.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/tcsetattr.3
==
--- stable/12/lib/libc/gen/tcsetattr.3  Wed Jul 22 20:15:21 2020
(r363431)
+++ stable/12/lib/libc/gen/tcsetattr.3  Wed Jul 22 21:06:32 2020
(r363432)
@@ -28,7 +28,7 @@
 .\"@(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
 .\" $FreeBSD$
 .\"
-.Dd January 2, 1994
+.Dd July 15, 2020
 .Dt TCSETATTR 3
 .Os
 .Sh NAME
@@ -221,8 +221,7 @@ termios structure referenced by
 .Fa tp .
 The
 .Fa action
-argument is created by
-.Em or Ns 'ing
+argument is one of
 the following values, as specified in the include file
 .In termios.h .
 .Bl -tag -width "TCSADRAIN"
@@ -240,18 +239,20 @@ The change occurs after all output written to
 .Fa fd
 has been transmitted to the terminal.
 Additionally, any input that has been received but not read is discarded.
-.It Fa TCSASOFT
-If this value is
-.Em or Ns 'ed
-into the
+.El
+.Pp
+The
 .Fa action
-value, the values of the
+may be modified by
+.Em or Ns 'ing
+in
+.Fa TCSASOFT
+which causes the values of the
 .Va c_cflag ,
 .Va c_ispeed ,
 and
 .Va c_ospeed
-fields are ignored.
-.El
+fields to be ignored.
 .Pp
 The 0 baud rate is used to terminate the connection.
 If 0 is specified as the output speed to the function
___
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: r363431 - in head/sys: amd64/amd64 i386/i386

2020-07-22 Thread Alexander Motin
Author: mav
Date: Wed Jul 22 20:15:21 2020
New Revision: 363431
URL: https://svnweb.freebsd.org/changeset/base/363431

Log:
  Untie nmi_handle_intr() from DEV_ISA.
  
  The only part of nmi_handle_intr() depending on ISA is isa_nmi(), which is
  already wrapped.  Entering debugger on NMI does not really depend on ISA.
  
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/trap.c
  head/sys/i386/i386/trap.c

Modified: head/sys/amd64/amd64/trap.c
==
--- head/sys/amd64/amd64/trap.c Wed Jul 22 20:13:12 2020(r363430)
+++ head/sys/amd64/amd64/trap.c Wed Jul 22 20:15:21 2020(r363431)
@@ -350,11 +350,9 @@ trap(struct trapframe *frame)
signo = SIGFPE;
break;
 
-#ifdef DEV_ISA
case T_NMI:
nmi_handle_intr(type, frame);
return;
-#endif
 
case T_OFLOW:   /* integer overflow fault */
ucode = FPE_INTOVF;
@@ -580,11 +578,9 @@ trap(struct trapframe *frame)
 #endif
break;
 
-#ifdef DEV_ISA
case T_NMI:
nmi_handle_intr(type, frame);
return;
-#endif
}
 
trap_fatal(frame, 0);

Modified: head/sys/i386/i386/trap.c
==
--- head/sys/i386/i386/trap.c   Wed Jul 22 20:13:12 2020(r363430)
+++ head/sys/i386/i386/trap.c   Wed Jul 22 20:15:21 2020(r363431)
@@ -407,7 +407,6 @@ user_trctrap_out:
signo = SIGFPE;
break;
 
-#ifdef DEV_ISA
case T_NMI:
 #ifdef POWERFAIL_NMI
 #ifndef TIMER_FREQ
@@ -423,7 +422,6 @@ user_trctrap_out:
nmi_handle_intr(type, frame);
return;
 #endif /* POWERFAIL_NMI */
-#endif /* DEV_ISA */
 
case T_OFLOW:   /* integer overflow fault */
ucode = FPE_INTOVF;
@@ -669,7 +667,6 @@ kernel_trctrap:
 #endif
break;
 
-#ifdef DEV_ISA
case T_NMI:
 #ifdef POWERFAIL_NMI
if (time_second - lastalert > 10) {
@@ -682,7 +679,6 @@ kernel_trctrap:
nmi_handle_intr(type, frame);
return;
 #endif /* POWERFAIL_NMI */
-#endif /* DEV_ISA */
}
 
trap_fatal(frame, eva);
___
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: r363430 - stable/12/sys/net

2020-07-22 Thread Kristof Provost
Author: kp
Date: Wed Jul 22 20:13:12 2020
New Revision: 363430
URL: https://svnweb.freebsd.org/changeset/base/363430

Log:
  bridge: Enter epoch for bridge_input()/bridge_output()
  
  In stable/12 epoch is not as wide as it is in head. The network stack isn't 
yet
  in epoch when bridge_input()/bridge_output() get called, so rather than assert
  this we must enter it ourselves.
  
  This is a direct commit to stable/12.
  
  PR:   248046
  Differential Revision:https://reviews.freebsd.org/D25715

Modified:
  stable/12/sys/net/if_bridge.c

Modified: stable/12/sys/net/if_bridge.c
==
--- stable/12/sys/net/if_bridge.c   Wed Jul 22 19:43:55 2020
(r363429)
+++ stable/12/sys/net/if_bridge.c   Wed Jul 22 20:13:12 2020
(r363430)
@@ -605,7 +605,7 @@ vnet_bridge_uninit(const void *unused __unused)
 
/* Before we can destroy the uma zone, because there are callbacks that
 * use it. */
-   NET_EPOCH_WAIT();
+   epoch_drain_callbacks(net_epoch_preempt);
 
uma_zdestroy(V_bridge_rtnode_zone);
 }
@@ -2114,17 +2114,20 @@ static int
 bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
 struct rtentry *rt)
 {
+   struct epoch_tracker et;
struct ether_header *eh;
struct ifnet *dst_if;
struct bridge_softc *sc;
uint16_t vlan;
 
-   MPASS(in_epoch(net_epoch_preempt));
+   NET_EPOCH_ENTER_ET(et);
 
if (m->m_len < ETHER_HDR_LEN) {
m = m_pullup(m, ETHER_HDR_LEN);
-   if (m == NULL)
+   if (m == NULL) {
+   NET_EPOCH_EXIT_ET(et);
return (0);
+   }
}
 
eh = mtod(m, struct ether_header *);
@@ -2189,6 +2192,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struc
}
if (used == 0)
m_freem(m);
+   NET_EPOCH_EXIT_ET(et);
return (0);
}
 
@@ -2200,10 +2204,12 @@ sendunicast:
bridge_span(sc, m);
if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0) {
m_freem(m);
+   NET_EPOCH_EXIT_ET(et);
return (0);
}
 
bridge_enqueue(sc, dst_if, m);
+   NET_EPOCH_EXIT_ET(et);
return (0);
 }
 
@@ -2400,6 +2406,7 @@ drop:
 static struct mbuf *
 bridge_input(struct ifnet *ifp, struct mbuf *m)
 {
+   struct epoch_tracker et;
struct bridge_softc *sc = ifp->if_bridge;
struct bridge_iflist *bif, *bif2;
struct ifnet *bifp;
@@ -2408,10 +2415,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
uint16_t vlan;
int error;
 
-   MPASS(in_epoch(net_epoch_preempt));
+   NET_EPOCH_ENTER_ET(et);
 
-   if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
+   NET_EPOCH_EXIT_ET(et);
return (m);
+   }
 
bifp = sc->sc_ifp;
vlan = VLANTAGOF(m);
@@ -2428,10 +2437,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
if_inc_counter(bifp, IFCOUNTER_IPACKETS, 1);
if_inc_counter(bifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
m_freem(m);
+   NET_EPOCH_EXIT_ET(et);
return (NULL);
}
bif = bridge_lookup_member_if(sc, ifp);
if (bif == NULL) {
+   NET_EPOCH_EXIT_ET(et);
return (m);
}
 
@@ -2444,11 +2455,13 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
if (memcmp(eh->ether_dhost, bstp_etheraddr,
ETHER_ADDR_LEN) == 0) {
bstp_input(>bif_stp, ifp, m); /* consumes mbuf */
+   NET_EPOCH_EXIT_ET(et);
return (NULL);
}
 
if ((bif->bif_flags & IFBIF_STP) &&
bif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) {
+   NET_EPOCH_EXIT_ET(et);
return (m);
}
 
@@ -2459,6 +2472,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
 */
mc = m_dup(m, M_NOWAIT);
if (mc == NULL) {
+   NET_EPOCH_EXIT_ET(et);
return (m);
}
 
@@ -2485,11 +2499,13 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
}
 
/* Return the original packet for local processing. */
+   NET_EPOCH_EXIT_ET(et);
return (m);
}
 
if ((bif->bif_flags & IFBIF_STP) &&
bif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) {
+   NET_EPOCH_EXIT_ET(et);
return (m);
}
 
@@ -2539,10 +2555,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
vlan, bif, 0, IFBAF_DYNAMIC);   \

svn commit: r363429 - stable/12/sys/net

2020-07-22 Thread Kristof Provost
Author: kp
Date: Wed Jul 22 19:43:55 2020
New Revision: 363429
URL: https://svnweb.freebsd.org/changeset/base/363429

Log:
  MFC r363308:
  
  bridge: Don't sleep during epoch
  
  While it doesn't trigger INVARIANTS or WITNESS on head it does in stable/12.
  There's also no reason for it, as we can easily report the out of memory error
  to the caller (i.e. userspace). All of these can already fail.
  
  PR:   248046

Modified:
  stable/12/sys/net/if_bridge.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/if_bridge.c
==
--- stable/12/sys/net/if_bridge.c   Wed Jul 22 19:08:05 2020
(r363428)
+++ stable/12/sys/net/if_bridge.c   Wed Jul 22 19:43:55 2020
(r363429)
@@ -1467,9 +1467,9 @@ bridge_ioctl_gifs(struct bridge_softc *sc, void *arg)
bifc->ifbic_len = buflen;
return (0);
}
-   BRIDGE_UNLOCK(sc);
-   outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-   BRIDGE_LOCK(sc);
+   outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+   if (outbuf == NULL)
+   return (ENOMEM);
 
count = 0;
buf = outbuf;
@@ -1529,9 +1529,9 @@ bridge_ioctl_rts(struct bridge_softc *sc, void *arg)
count++;
buflen = sizeof(bareq) * count;
 
-   BRIDGE_UNLOCK(sc);
-   outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-   BRIDGE_LOCK(sc);
+   outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+   if (outbuf == NULL)
+   return (ENOMEM);
 
count = 0;
buf = outbuf;
@@ -1857,9 +1857,9 @@ bridge_ioctl_gifsstp(struct bridge_softc *sc, void *ar
return (0);
}
 
-   BRIDGE_UNLOCK(sc);
-   outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO);
-   BRIDGE_LOCK(sc);
+   outbuf = malloc(buflen, M_TEMP, M_NOWAIT | M_ZERO);
+   if (outbuf == NULL)
+   return (ENOMEM);
 
count = 0;
buf = outbuf;
___
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: r363428 - head/sys/cam/mmc

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 19:08:05 2020
New Revision: 363428
URL: https://svnweb.freebsd.org/changeset/base/363428

Log:
  mmccam: Add support for 1.2V and 1.8V eMMC
  
  If the card reports that it support 1.2V or 1.8V signaling switch to this 
voltage.
  
  Submitted by: kibab

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Wed Jul 22 19:04:45 2020(r363427)
+++ head/sys/cam/mmc/mmc_da.c   Wed Jul 22 19:08:05 2020(r363428)
@@ -136,6 +136,9 @@ struct sdda_softc {
 
/* Generic switch timeout */
uint32_t cmd6_time;
+   uint32_t timings;   /* Mask of bus timings supported */
+   uint32_t vccq_120;  /* Mask of bus timings at VCCQ of 1.2 V */
+   uint32_t vccq_180;  /* Mask of bus timings at VCCQ of 1.8 V */
/* MMC partitions support */
struct sdda_part *part[MMC_PART_MAX];
uint8_t part_curr;  /* Partition currently switched to */
@@ -1242,6 +1245,7 @@ sdda_start_init(void *context, union ccb *start_ccb)
uint32_t sec_count;
int err;
int host_f_max;
+   uint8_t card_type;
 
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("sdda_start_init\n"));
/* periph was held for us when this task was enqueued */
@@ -1370,12 +1374,35 @@ sdda_start_init(void *context, union ccb *start_ccb)
}
 
if (mmcp->card_features & CARD_FEATURE_MMC && 
mmc_get_spec_vers(periph) >= 4) {
-   if (softc->raw_ext_csd[EXT_CSD_CARD_TYPE]
-   & EXT_CSD_CARD_TYPE_HS_52)
+   card_type = softc->raw_ext_csd[EXT_CSD_CARD_TYPE];
+   if (card_type & EXT_CSD_CARD_TYPE_HS_52)
softc->card_f_max = MMC_TYPE_HS_52_MAX;
-   else if (softc->raw_ext_csd[EXT_CSD_CARD_TYPE]
-& EXT_CSD_CARD_TYPE_HS_26)
+   else if (card_type & EXT_CSD_CARD_TYPE_HS_26)
softc->card_f_max = MMC_TYPE_HS_26_MAX;
+   if ((card_type & EXT_CSD_CARD_TYPE_DDR_52_1_2V) != 0 &&
+   (host_caps & MMC_CAP_SIGNALING_120) != 0) {
+   setbit(>timings, bus_timing_mmc_ddr52);
+   setbit(>vccq_120, bus_timing_mmc_ddr52);
+   CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, 
("Card supports DDR52 at 1.2V\n"));
+   }
+   if ((card_type & EXT_CSD_CARD_TYPE_DDR_52_1_8V) != 0 &&
+   (host_caps & MMC_CAP_SIGNALING_180) != 0) {
+   setbit(>timings, bus_timing_mmc_ddr52);
+   setbit(>vccq_180, bus_timing_mmc_ddr52);
+   CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, 
("Card supports DDR52 at 1.8V\n"));
+   }
+   if ((card_type & EXT_CSD_CARD_TYPE_HS200_1_2V) != 0 &&
+   (host_caps & MMC_CAP_SIGNALING_120) != 0) {
+   setbit(>timings, bus_timing_mmc_hs200);
+   setbit(>vccq_120, bus_timing_mmc_hs200);
+   CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, 
("Card supports HS200 at 1.2V\n"));
+   }
+   if ((card_type & EXT_CSD_CARD_TYPE_HS200_1_8V) != 0 &&
+   (host_caps & MMC_CAP_SIGNALING_180) != 0) {
+   setbit(>timings, bus_timing_mmc_hs200);
+   setbit(>vccq_180, bus_timing_mmc_hs200);
+   CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, 
("Card supports HS200 at 1.8V\n"));
+   }
}
}
int f_max;
@@ -1391,6 +1418,46 @@ finish_hs_tests:
f_max = 2500;
}
}
+   /* If possible, set lower-level signaling */
+   enum mmc_bus_timing timing;
+   /* FIXME: MMCCAM supports max. bus_timing_mmc_ddr52 at the moment. */
+   for (timing = bus_timing_mmc_ddr52; timing > bus_timing_normal; 
timing--) {
+   if (isset(>vccq_120, timing)) {
+   /* Set VCCQ = 1.2V */
+   start_ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
+   start_ccb->ccb_h.flags = CAM_DIR_NONE;
+   start_ccb->ccb_h.retry_count = 0;
+   start_ccb->ccb_h.timeout = 100;
+   start_ccb->ccb_h.cbfcnp = NULL;
+   cts->ios.vccq = vccq_120;
+   cts->ios_valid = MMC_VCCQ;
+   xpt_action(start_ccb);
+   break;
+   } else if (isset(>vccq_180, timing)) {
+   /* Set VCCQ = 1.8V 

svn commit: r363427 - in head/sys/cam: . mmc

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 19:04:45 2020
New Revision: 363427
URL: https://svnweb.freebsd.org/changeset/base/363427

Log:
  mmccam: Add support for 1.8V sdcard
  
  If the card reports that it support 1.8V signaling switch to this voltage.
  While here update the list of mode for mmccam.
  
  Submitted by: kibab

Modified:
  head/sys/cam/cam_ccb.h
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Wed Jul 22 18:33:36 2020(r363426)
+++ head/sys/cam/cam_ccb.h  Wed Jul 22 19:04:45 2020(r363427)
@@ -1046,14 +1046,41 @@ struct ccb_trans_settings_mmc {
 #define MMC_PM (1 << 5)
 #define MMC_BT (1 << 6)
 #define MMC_BM (1 << 7)
+#define MMC_VCCQ(1 << 8)
uint32_t ios_valid;
 /* The folowing is used only for GET_TRAN_SETTINGS */
uint32_thost_ocr;
int host_f_min;
int host_f_max;
-#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */
-#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */
-#define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed transfers */
+/* Copied from sys/dev/mmc/bridge.h */
+#defineMMC_CAP_4_BIT_DATA  (1 <<  0) /* Can do 4-bit data 
transfers */
+#defineMMC_CAP_8_BIT_DATA  (1 <<  1) /* Can do 8-bit data 
transfers */
+#defineMMC_CAP_HSPEED  (1 <<  2) /* Can do High Speed 
transfers */
+#defineMMC_CAP_BOOT_NOACC  (1 <<  4) /* Cannot access boot 
partitions */
+#defineMMC_CAP_WAIT_WHILE_BUSY (1 <<  5) /* Host waits for busy 
responses */
+#defineMMC_CAP_UHS_SDR12   (1 <<  6) /* Can do UHS SDR12 */
+#defineMMC_CAP_UHS_SDR25   (1 <<  7) /* Can do UHS SDR25 */
+#defineMMC_CAP_UHS_SDR50   (1 <<  8) /* Can do UHS SDR50 */
+#defineMMC_CAP_UHS_SDR104  (1 <<  9) /* Can do UHS SDR104 */
+#defineMMC_CAP_UHS_DDR50   (1 << 10) /* Can do UHS DDR50 */
+#defineMMC_CAP_MMC_DDR52_120   (1 << 11) /* Can do eMMC DDR52 at 1.2 V 
*/
+#defineMMC_CAP_MMC_DDR52_180   (1 << 12) /* Can do eMMC DDR52 at 1.8 V 
*/
+#defineMMC_CAP_MMC_DDR52   (MMC_CAP_MMC_DDR52_120 | 
MMC_CAP_MMC_DDR52_180)
+#defineMMC_CAP_MMC_HS200_120   (1 << 13) /* Can do eMMC HS200 at 1.2 V 
*/
+#defineMMC_CAP_MMC_HS200_180   (1 << 14) /* Can do eMMC HS200 at 1.8 V 
*/
+#defineMMC_CAP_MMC_HS200   (MMC_CAP_MMC_HS200_120| 
MMC_CAP_MMC_HS200_180)
+#defineMMC_CAP_MMC_HS400_120   (1 << 15) /* Can do eMMC HS400 at 1.2 V 
*/
+#defineMMC_CAP_MMC_HS400_180   (1 << 16) /* Can do eMMC HS400 at 1.8 V 
*/
+#defineMMC_CAP_MMC_HS400   (MMC_CAP_MMC_HS400_120 | 
MMC_CAP_MMC_HS400_180)
+#defineMMC_CAP_MMC_HSX00_120   (MMC_CAP_MMC_HS200_120 | 
MMC_CAP_MMC_HS400_120)
+#defineMMC_CAP_MMC_ENH_STROBE  (1 << 17) /* Can do eMMC Enhanced 
Strobe */
+#defineMMC_CAP_SIGNALING_120   (1 << 18) /* Can do signaling at 1.2 V 
*/
+#defineMMC_CAP_SIGNALING_180   (1 << 19) /* Can do signaling at 1.8 V 
*/
+#defineMMC_CAP_SIGNALING_330   (1 << 20) /* Can do signaling at 3.3 V 
*/
+#defineMMC_CAP_DRIVER_TYPE_A   (1 << 21) /* Can do Driver Type A */
+#defineMMC_CAP_DRIVER_TYPE_C   (1 << 22) /* Can do Driver Type C */
+#defineMMC_CAP_DRIVER_TYPE_D   (1 << 23) /* Can do Driver Type D */
+
uint32_t host_caps;
uint32_t host_max_data;
 };

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 18:33:36 2020(r363426)
+++ head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 19:04:45 2020(r363427)
@@ -167,6 +167,7 @@ typedef struct {
union ccb   saved_ccb;
uint32_tflags;
 #define PROBE_FLAG_ACMD_SENT   0x1 /* CMD55 is sent, card expects ACMD */
+#define PROBE_FLAG_HOST_CAN_DO_18V   0x2 /* Host can do 1.8V signaling */
uint8_t acmd41_count; /* how many times ACMD41 has been issued 
*/
struct cam_periph *periph;
 } mmcprobe_softc;
@@ -457,6 +458,9 @@ mmc_print_ident(struct mmc_params *ident_data)
sbuf_printf(sb, "%sSDIO", space ? " " : "");
space = true;
}
+   if (ident_data->card_features & CARD_FEATURE_18V) {
+   sbuf_printf(sb, "%s1.8-Signaling", space ? " " : "");
+   }
sbuf_printf(sb, ">\n");
 
if (ident_data->card_features & CARD_FEATURE_MEMORY)
@@ -636,6 +640,9 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s
init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS);
xpt_action(start_ccb);
 
+   uint32_t host_caps = cts->host_caps;
+   if (host_caps & MMC_CAP_SIGNALING_180)
+   softc->flags |= PROBE_FLAG_HOST_CAN_DO_18V;
uint32_t hv = 

svn commit: r363426 - head/sys/arm/allwinner

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 18:33:36 2020
New Revision: 363426
URL: https://svnweb.freebsd.org/changeset/base/363426

Log:
  aw_mmc: Start a mmccam discovery when the CD handler is called.
  
  Submitted by: kibab

Modified:
  head/sys/arm/allwinner/aw_mmc.c

Modified: head/sys/arm/allwinner/aw_mmc.c
==
--- head/sys/arm/allwinner/aw_mmc.c Wed Jul 22 18:30:17 2020
(r363425)
+++ head/sys/arm/allwinner/aw_mmc.c Wed Jul 22 18:33:36 2020
(r363426)
@@ -371,6 +371,9 @@ aw_mmc_helper_cd_handler(device_t dev, bool present)
struct aw_mmc_softc *sc;
 
sc = device_get_softc(dev);
+#ifdef MMCCAM
+   mmccam_start_discovery(sc->sim);
+#else
AW_MMC_LOCK(sc);
if (present) {
if (sc->child == NULL) {
@@ -397,6 +400,7 @@ aw_mmc_helper_cd_handler(device_t dev, bool present)
} else
AW_MMC_UNLOCK(sc);
}
+#endif /* MMCCAM */
 }
 
 static 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: r363425 - in head/sys: cam/mmc dev/sdhci

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 18:30:17 2020
New Revision: 363425
URL: https://svnweb.freebsd.org/changeset/base/363425

Log:
  mmccam: Add a generic mmccam_start_discovery function
  
  This is a generic function start a scan request for the given
  cam_sim.
  Other driver can now just use this function to request a new rescan.
  
  Submitted by: kibab

Modified:
  head/sys/cam/mmc/mmc_all.h
  head/sys/cam/mmc/mmc_xpt.c
  head/sys/dev/sdhci/sdhci.c

Modified: head/sys/cam/mmc/mmc_all.h
==
--- head/sys/cam/mmc/mmc_all.h  Wed Jul 22 18:21:37 2020(r363424)
+++ head/sys/cam/mmc/mmc_all.h  Wed Jul 22 18:30:17 2020(r363425)
@@ -64,6 +64,7 @@
 #ifndef CAM_MMC_ALL_H
 #define CAM_MMC_ALL_H
 
+#include 
 #include 
 #include 
 
@@ -72,5 +73,6 @@ struct ccb_pathinq;
 struct cam_sim;
 void   mmc_path_inq(struct ccb_pathinq *cpi, const char *hba,
 const struct cam_sim *sim, size_t maxio);
+voidmmccam_start_discovery(struct cam_sim *sim);
 
 #endif

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 18:21:37 2020(r363424)
+++ head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 18:30:17 2020(r363425)
@@ -404,6 +404,29 @@ mmc_announce_periph(struct cam_periph *periph)
printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock);
 }
 
+void
+mmccam_start_discovery(struct cam_sim *sim) {
+   union ccb *ccb;
+   uint32_t pathid;
+
+   pathid = cam_sim_path(sim);
+   ccb = xpt_alloc_ccb_nowait();
+   if (ccb == NULL) {
+   return;
+   }
+
+   /*
+* We create a rescan request for BUS:0:0, since the card
+* will be at lun 0.
+*/
+   if (xpt_create_path(>ccb_h.path, NULL, pathid,
+   /* target */ 0, /* lun */ 0) != CAM_REQ_CMP) {
+   xpt_free_ccb(ccb);
+   return;
+   }
+   xpt_rescan(ccb);
+}
+
 /* This func is called per attached device :-( */
 void
 mmc_print_ident(struct mmc_params *ident_data)

Modified: head/sys/dev/sdhci/sdhci.c
==
--- head/sys/dev/sdhci/sdhci.c  Wed Jul 22 18:21:37 2020(r363424)
+++ head/sys/dev/sdhci/sdhci.c  Wed Jul 22 18:30:17 2020(r363425)
@@ -626,29 +626,8 @@ sdhci_card_task(void *arg, int pending __unused)
slot_printf(slot, "Card inserted\n");
 #ifdef MMCCAM
slot->card_present = 1;
-   union ccb *ccb;
-   uint32_t pathid;
-   pathid = cam_sim_path(slot->sim);
-   ccb = xpt_alloc_ccb_nowait();
-   if (ccb == NULL) {
-   slot_printf(slot, "Unable to alloc CCB for 
rescan\n");
-   SDHCI_UNLOCK(slot);
-   return;
-   }
-
-   /*
-* We create a rescan request for BUS:0:0, since the 
card
-* will be at lun 0.
-*/
-   if (xpt_create_path(>ccb_h.path, NULL, pathid,
-   /* target */ 0, /* lun */ 0) != 
CAM_REQ_CMP) {
-   slot_printf(slot, "Unable to create path for 
rescan\n");
-   SDHCI_UNLOCK(slot);
-   xpt_free_ccb(ccb);
-   return;
-   }
+   mmccam_start_discovery(slot->sim);
SDHCI_UNLOCK(slot);
-   xpt_rescan(ccb);
 #else
d = slot->dev = device_add_child(slot->bus, "mmc", -1);
SDHCI_UNLOCK(slot);
@@ -672,29 +651,8 @@ sdhci_card_task(void *arg, int pending __unused)
slot->dev = NULL;
 #ifdef MMCCAM
slot->card_present = 0;
-   union ccb *ccb;
-   uint32_t pathid;
-   pathid = cam_sim_path(slot->sim);
-   ccb = xpt_alloc_ccb_nowait();
-   if (ccb == NULL) {
-   slot_printf(slot, "Unable to alloc CCB for 
rescan\n");
-   SDHCI_UNLOCK(slot);
-   return;
-   }
-
-   /*
-* We create a rescan request for BUS:0:0, since the 
card
-* will be at lun 0.
-*/
-   if (xpt_create_path(>ccb_h.path, NULL, pathid,
-   /* target */ 0, /* lun */ 0) != 
CAM_REQ_CMP) {
-   slot_printf(slot, "Unable to create path for 
rescan\n");
- 

svn commit: r363424 - head/sys/cam/mmc

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 18:21:37 2020
New Revision: 363424
URL: https://svnweb.freebsd.org/changeset/base/363424

Log:
  mmccam: Use a sbuf for the mmc ident function
  
  While here fix a typo.

Modified:
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 17:37:11 2020(r363423)
+++ head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 18:21:37 2020(r363424)
@@ -408,27 +408,47 @@ mmc_announce_periph(struct cam_periph *periph)
 void
 mmc_print_ident(struct mmc_params *ident_data)
 {
-printf("Relative addr: %08x\n", ident_data->card_rca);
-printf("Card features: <");
-if (ident_data->card_features & CARD_FEATURE_MMC)
-printf("MMC ");
-if (ident_data->card_features & CARD_FEATURE_MEMORY)
-printf("Memory ");
-if (ident_data->card_features & CARD_FEATURE_SDHC)
-printf("High-Capacity ");
-if (ident_data->card_features & CARD_FEATURE_SD20)
-printf("SD2.0-Conditions ");
-if (ident_data->card_features & CARD_FEATURE_SDIO)
-printf("SDIO ");
-printf(">\n");
+   struct sbuf *sb;
+   bool space = false;
 
-if (ident_data->card_features & CARD_FEATURE_MEMORY)
-printf("Card memory OCR: %08x\n", ident_data->card_ocr);
+   sb = sbuf_new_auto();
+   sbuf_printf(sb, "Relative addr: %08x\n", ident_data->card_rca);
+   sbuf_printf(sb, "Card features: <");
+   if (ident_data->card_features & CARD_FEATURE_MMC) {
+   sbuf_printf(sb, "MMC");
+   space = true;
+   }
+   if (ident_data->card_features & CARD_FEATURE_MEMORY) {
+   sbuf_printf(sb, "%sMemory", space ? " " : "");
+   space = true;
+   }
+   if (ident_data->card_features & CARD_FEATURE_SDHC) {
+   sbuf_printf(sb, "%sHigh-Capacity", space ? " " : "");
+   space = true;
+   }
+   if (ident_data->card_features & CARD_FEATURE_SD20) {
+   sbuf_printf(sb, "%sSD2.0-Conditions", space ? " " : "");
+   space = true;
+   }
+   if (ident_data->card_features & CARD_FEATURE_SDIO) {
+   sbuf_printf(sb, "%sSDIO", space ? " " : "");
+   space = true;
+   }
+   sbuf_printf(sb, ">\n");
 
-if (ident_data->card_features & CARD_FEATURE_SDIO) {
-printf("Card IO OCR: %08x\n", ident_data->io_ocr);
-printf("Number of funcitions: %u\n", 
ident_data->sdio_func_count);
-}
+   if (ident_data->card_features & CARD_FEATURE_MEMORY)
+   sbuf_printf(sb, "Card memory OCR: %08x\n",
+   ident_data->card_ocr);
+
+   if (ident_data->card_features & CARD_FEATURE_SDIO) {
+   sbuf_printf(sb, "Card IO OCR: %08x\n", ident_data->io_ocr);
+   sbuf_printf(sb, "Number of functions: %u\n",
+   ident_data->sdio_func_count);
+   }
+
+   sbuf_finish(sb);
+   printf("%s", sbuf_data(sb));
+   sbuf_clear(sb);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363422 - head/sys/cam/mmc

2020-07-22 Thread Emmanuel Vadot
Author: manu
Date: Wed Jul 22 17:36:28 2020
New Revision: 363422
URL: https://svnweb.freebsd.org/changeset/base/363422

Log:
  mmc_xpt: Fix debug messages
  
  PROBE_RESET was printed for PROBE_IDENTIFY, fix this.
  While here add one for the PROBE_RESET.
  
  Submitted by: kibab

Modified:
  head/sys/cam/mmc/mmc_xpt.c

Modified: head/sys/cam/mmc/mmc_xpt.c
==
--- head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 17:33:35 2020(r363421)
+++ head/sys/cam/mmc/mmc_xpt.c  Wed Jul 22 17:36:28 2020(r363422)
@@ -574,10 +574,11 @@ mmcprobe_start(struct cam_periph *periph, union ccb *s
/* Here is the place where the identify fun begins */
switch (softc->action) {
case PROBE_RESET:
+   CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with 
PROBE_RESET\n"));
/* FALLTHROUGH */
case PROBE_IDENTIFY:
xpt_path_inq(_ccb->cpi, periph->path);
-   CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with 
PROBE_RESET\n"));
+   CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_PROBE, ("Start with 
PROBE_IDENTIFY\n"));
init_standard_ccb(start_ccb, XPT_GET_TRAN_SETTINGS);
xpt_action(start_ccb);
if (cts->ios.power_mode != power_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: r363423 - head/tests/sys/geom/class/eli

2020-07-22 Thread Li-Wen Hsu
Author: lwhsu
Date: Wed Jul 22 17:37:11 2020
New Revision: 363423
URL: https://svnweb.freebsd.org/changeset/base/363423

Log:
  Fix sys.geom.class.eli.onetime_test.onetime after r363402
  
  PR:   247954
  X-MFC with:   r363402
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tests/sys/geom/class/eli/onetime_test.sh

Modified: head/tests/sys/geom/class/eli/onetime_test.sh
==
--- head/tests/sys/geom/class/eli/onetime_test.sh   Wed Jul 22 17:36:28 
2020(r363422)
+++ head/tests/sys/geom/class/eli/onetime_test.sh   Wed Jul 22 17:37:11 
2020(r363423)
@@ -130,7 +130,7 @@ onetime_d_cleanup()
geli_test_cleanup
 }
 
-atf_test_case onetime cleanup
+atf_test_case onetime_null cleanup
 onetime_null_head()
 {
atf_set "descr" "geli onetime can use the null cipher"
___
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: r363421 - head/usr.sbin/pkg

2020-07-22 Thread Kyle Evans
Author: kevans
Date: Wed Jul 22 17:33:35 2020
New Revision: 363421
URL: https://svnweb.freebsd.org/changeset/base/363421

Log:
  pkg-bootstrap: complain on improper `pkg bootstrap` usage
  
  Right now, the bootstrap will gloss over things like pkg bootstrap -x or
  pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
  at the correct formatting.
  
  Reported by:  jhb (IIRC via IRC)
  Approved by:  bapt, jhb, manu
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24750

Modified:
  head/usr.sbin/pkg/pkg.c

Modified: head/usr.sbin/pkg/pkg.c
==
--- head/usr.sbin/pkg/pkg.c Wed Jul 22 14:32:47 2020(r363420)
+++ head/usr.sbin/pkg/pkg.c Wed Jul 22 17:33:35 2020(r363421)
@@ -1050,8 +1050,16 @@ main(int argc, char *argv[])
 
if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) {
bootstrap_only = true;
-   if (argc == 3 && strcmp(argv[2], "-f") == 0)
+   if (argc > 3) {
+   fprintf(stderr, "Too many arguments\nUsage: pkg 
bootstrap [-f]\n");
+   exit(EXIT_FAILURE);
+   }
+   if (argc == 3 && strcmp(argv[2], "-f") == 0) {
force = true;
+   } else if (argc == 3) {
+   fprintf(stderr, "Invalid argument specified\nUsage: pkg 
bootstrap [-f]\n");
+   exit(EXIT_FAILURE);
+   }
}
 
if ((bootstrap_only && force) || access(pkgpath, X_OK) == -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: r363420 - in head/sys: compat/linuxkpi/common/src dev/sound/usb dev/usb dev/usb/input dev/usb/storage

2020-07-22 Thread Mark Johnston
Author: markj
Date: Wed Jul 22 14:32:47 2020
New Revision: 363420
URL: https://svnweb.freebsd.org/changeset/base/363420

Log:
  usb(4): Stop checking for failures from malloc(M_WAITOK).
  
  Handle the fact that parts of usb(4) can be compiled into the boot
  loader, where M_WAITOK does not guarantee a successful allocation.
  
  PR:   240545
  Submitted by: Andrew Reiter  (original version)
  Reviewed by:  hselasky
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25706

Modified:
  head/sys/compat/linuxkpi/common/src/linux_usb.c
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/uhid_snes.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_freebsd.h
  head/sys/dev/usb/usb_freebsd_loader.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_mbuf.c
  head/sys/dev/usb/usb_transfer.c

Modified: head/sys/compat/linuxkpi/common/src/linux_usb.c
==
--- head/sys/compat/linuxkpi/common/src/linux_usb.c Wed Jul 22 14:24:41 
2020(r363419)
+++ head/sys/compat/linuxkpi/common/src/linux_usb.c Wed Jul 22 14:32:47 
2020(r363420)
@@ -707,8 +707,6 @@ usb_control_msg(struct usb_device *dev, struct usb_hos
 * 0x is a FreeBSD specific magic value.
 */
urb = usb_alloc_urb(0x, size);
-   if (urb == NULL)
-   return (-ENOMEM);
 
urb->dev = dev;
urb->endpoint = uhe;
@@ -1008,16 +1006,14 @@ usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags
}
 
urb = malloc(size, M_USBDEV, M_WAITOK | M_ZERO);
-   if (urb) {
 
-   cv_init(>cv_wait, "URBWAIT");
-   if (iso_packets == 0x) {
-   urb->setup_packet = (void *)(urb + 1);
-   urb->transfer_buffer = (void *)(urb->setup_packet +
-   sizeof(struct usb_device_request));
-   } else {
-   urb->number_of_packets = iso_packets;
-   }
+   cv_init(>cv_wait, "URBWAIT");
+   if (iso_packets == 0x) {
+   urb->setup_packet = (void *)(urb + 1);
+   urb->transfer_buffer = (void *)(urb->setup_packet +
+   sizeof(struct usb_device_request));
+   } else {
+   urb->number_of_packets = iso_packets;
}
return (urb);
 }
@@ -1722,8 +1718,6 @@ usb_bulk_msg(struct usb_device *udev, struct usb_host_
return (err);
 
urb = usb_alloc_urb(0, 0);
-   if (urb == NULL)
-   return (-ENOMEM);
 
usb_fill_bulk_urb(urb, udev, uhe, data, len,
usb_linux_wait_complete, NULL);

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Wed Jul 22 14:24:41 2020
(r363419)
+++ head/sys/dev/sound/usb/uaudio.c Wed Jul 22 14:32:47 2020
(r363420)
@@ -4968,10 +4968,6 @@ uaudio_mixer_fill_info(struct uaudio_softc *sc,
iot = malloc(sizeof(struct uaudio_terminal_node) * 256, M_TEMP,
M_WAITOK | M_ZERO);
 
-   if (iot == NULL) {
-   DPRINTF("no memory!\n");
-   goto done;
-   }
while ((desc = usb_desc_foreach(cd, desc))) {
 
dp = desc;

Modified: head/sys/dev/usb/input/uhid.c
==
--- head/sys/dev/usb/input/uhid.c   Wed Jul 22 14:24:41 2020
(r363419)
+++ head/sys/dev/usb/input/uhid.c   Wed Jul 22 14:32:47 2020
(r363420)
@@ -451,10 +451,6 @@ uhid_get_report(struct uhid_softc *sc, uint8_t type,
 
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
-   if (kern_data == NULL) {
-   err = ENOMEM;
-   goto done;
-   }
free_data = 1;
}
err = usbd_req_get_report(sc->sc_udev, NULL, kern_data,
@@ -487,10 +483,6 @@ uhid_set_report(struct uhid_softc *sc, uint8_t type,
 
if (kern_data == NULL) {
kern_data = malloc(len, M_USBDEV, M_WAITOK);
-   if (kern_data == NULL) {
-   err = ENOMEM;
-   goto done;
-   }
free_data = 1;
err = copyin(user_data, kern_data, len);
if (err) {

Modified: head/sys/dev/usb/input/uhid_snes.c
==
--- head/sys/dev/usb/input/uhid_snes.c  Wed Jul 22 14:24:41 2020
(r363419)
+++ head/sys/dev/usb/input/uhid_snes.c  Wed Jul 22 14:32:47 2020
(r363420)
@@ -168,10 +168,6 @@ uhid_get_report(struct uhid_snes_softc *sc, uint8_t ty
 
if (kern_data == NULL) {

svn commit: r363419 - stable/12/tests/sys/opencrypto

2020-07-22 Thread Mark Johnston
Author: markj
Date: Wed Jul 22 14:24:41 2020
New Revision: 363419
URL: https://svnweb.freebsd.org/changeset/base/363419

Log:
  MFC r363181:
  Add safexcel(4) to cryptotest.

Modified:
  stable/12/tests/sys/opencrypto/cryptotest.py
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/opencrypto/cryptotest.py
==
--- stable/12/tests/sys/opencrypto/cryptotest.pyWed Jul 22 14:22:35 
2020(r363418)
+++ stable/12/tests/sys/opencrypto/cryptotest.pyWed Jul 22 14:24:41 
2020(r363419)
@@ -47,9 +47,9 @@ def katg(base, glob):
raise unittest.SkipTest("Missing %s test vectors" % (base))
return iglob(os.path.join(katdir, base, glob))
 
-aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ]
+aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0' ]
 desmodules = [ 'cryptosoft0', ]
-shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ]
+shamodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0', 'safexcel0' ]
 
 def GenTestCase(cname):
try:
@@ -468,6 +468,7 @@ cryptosoft = GenTestCase('cryptosoft0')
 aesni = GenTestCase('aesni0')
 ccr = GenTestCase('ccr0')
 ccp = GenTestCase('ccp0')
+safexcel = GenTestCase('safexcel0')
 
 if __name__ == '__main__':
unittest.main()
___
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: r363418 - in stable/12: share/man/man4 sys/arm64/conf sys/conf sys/dev/safexcel sys/modules sys/modules/safexcel

2020-07-22 Thread Mark Johnston
Author: markj
Date: Wed Jul 22 14:22:35 2020
New Revision: 363418
URL: https://svnweb.freebsd.org/changeset/base/363418

Log:
  MFC r363180, r363182, r363251:
  Add a driver for the SafeXcel EIP-97.

Added:
  stable/12/share/man/man4/safexcel.4
 - copied unchanged from r363180, head/share/man/man4/safexcel.4
  stable/12/sys/dev/safexcel/
 - copied from r363180, head/sys/dev/safexcel/
  stable/12/sys/modules/safexcel/
 - copied from r363180, head/sys/modules/safexcel/
Modified:
  stable/12/share/man/man4/Makefile
  stable/12/sys/arm64/conf/GENERIC
  stable/12/sys/conf/files.arm64
  stable/12/sys/dev/safexcel/safexcel.c
  stable/12/sys/dev/safexcel/safexcel_var.h
  stable/12/sys/modules/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/Makefile
==
--- stable/12/share/man/man4/Makefile   Wed Jul 22 13:49:54 2020
(r363417)
+++ stable/12/share/man/man4/Makefile   Wed Jul 22 14:22:35 2020
(r363418)
@@ -461,6 +461,7 @@ MAN=aac.4 \
rue.4 \
sa.4 \
safe.4 \
+   safexcel.4 \
sbp.4 \
sbp_targ.4 \
scc.4 \

Copied: stable/12/share/man/man4/safexcel.4 (from r363180, 
head/share/man/man4/safexcel.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man4/safexcel.4 Wed Jul 22 14:22:35 2020
(r363418, copy of r363180, head/share/man/man4/safexcel.4)
@@ -0,0 +1,84 @@
+.\"-
+.\" Copyright (c) 2020 Rubicon Communications, LLC (Netgate)
+.\"
+.\" 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 June 23, 2020
+.Dt SAFEXCEL 4
+.Os
+.Sh NAME
+.Nm safexcel
+.Nd Inside Secure SafeXcel-IP-97 security packet engine
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device crypto"
+.Cd "device cryptodev"
+.Cd "device safexcel"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+safexcel_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver implements
+.Xr crypto 4
+support for the cryptographic acceleration functions of the EIP-97 device
+found on some Marvell systems-on-chip.
+The driver can accelerate the following AES modes:
+.Pp
+.Bl -bullet -compact
+.It
+AES-CBC
+.It
+AES-CTR
+.It
+AES-XTS
+.It
+AES-GCM
+.It
+AES-CCM
+.El
+.Pp
+.Nm
+also implements SHA1 and SHA2 transforms, and can combine AES-CBC and AES-CTR
+with SHA1-HMAC and SHA2-HMAC for encrypt-then-authenticate operations.
+.Sh SEE ALSO
+.Xr crypto 4 ,
+.Xr ipsec 4 ,
+.Xr random 4 ,
+.Xr geli 8 ,
+.Xr crypto 9
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 13.0 .

Modified: stable/12/sys/arm64/conf/GENERIC
==
--- stable/12/sys/arm64/conf/GENERICWed Jul 22 13:49:54 2020
(r363417)
+++ stable/12/sys/arm64/conf/GENERICWed Jul 22 14:22:35 2020
(r363418)
@@ -238,6 +238,9 @@ device  mv_ap806_gicp   # Marvell AP806 GICP
 device aw_rtc  # Allwinner Real-time Clock
 device mv_rtc  # Marvell Real-time Clock
 
+# Crypto accelerators
+device safexcel# Inside Secure EIP-97
+
 # Watchdog controllers
 device aw_wdog # Allwinner Watchdog
 

Modified: stable/12/sys/conf/files.arm64
==
--- stable/12/sys/conf/files.arm64  Wed Jul 

svn commit: r363417 - in head: etc/mtree sbin/route sbin/route/tests

2020-07-22 Thread Tom Jones
Author: thj
Date: Wed Jul 22 13:49:54 2020
New Revision: 363417
URL: https://svnweb.freebsd.org/changeset/base/363417

Log:
  Add tests for "add", "change" and "delete" functionality of /sbin/route.
  
  Add tests to cover "add", "change" and "delete" functionality of /sbin/route
  for ipv4 and ipv6. These tests for the existing route tool are the first step
  towards creating libroute.
  
  Submitted by:   Ahsan Barkati
  Sponsored by:   Google, Inc. (GSoC 2020)
  Reviewed by:kp, thj
  Approved by:bz (mentor)
  MFC after:  1 month
  Differential Revision:  https://reviews.freebsd.org/D25220

Added:
  head/sbin/route/tests/
  head/sbin/route/tests/Makefile   (contents, props changed)
  head/sbin/route/tests/basic.sh   (contents, props changed)
  head/sbin/route/tests/utils.subr   (contents, props changed)
Modified:
  head/etc/mtree/BSD.tests.dist
  head/sbin/route/Makefile

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Wed Jul 22 13:00:56 2020
(r363416)
+++ head/etc/mtree/BSD.tests.dist   Wed Jul 22 13:49:54 2020
(r363417)
@@ -448,6 +448,8 @@
 ..
 ping6
 ..
+route
+..
 ..
 secure
 lib

Modified: head/sbin/route/Makefile
==
--- head/sbin/route/MakefileWed Jul 22 13:00:56 2020(r363416)
+++ head/sbin/route/MakefileWed Jul 22 13:49:54 2020(r363417)
@@ -19,6 +19,9 @@ CFLAGS+= -DINET6
 .endif
 CFLAGS+= -I.
 
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
 keywords.h: keywords
LC_ALL=C awk '!/^#|^$$/ { \
printf "#define\tK_%s\t%d\n\t{\"%s\", K_%s},\n", \

Added: head/sbin/route/tests/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/route/tests/Makefile  Wed Jul 22 13:49:54 2020
(r363417)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+ATF_TESTS_SH+= \
+basic
+
+${PACKAGE}FILES+=  \
+   utils.subr
+
+.include 

Added: head/sbin/route/tests/basic.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sbin/route/tests/basic.sh  Wed Jul 22 13:49:54 2020
(r363417)
@@ -0,0 +1,125 @@
+#-
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright (c) 2020 Ahsan Barkati
+#
+# 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$
+#
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "basic_v4" "cleanup"
+basic_v4_head()
+{
+   atf_set descr 'add/change/delete route test for v4'
+   atf_set require.user root
+   atf_set require.progs jq
+}
+
+basic_v4_body()
+{
+   epair=$(vnet_mkepair)
+   ifconfig ${epair}a 192.0.2.2/24 up
+   vnet_mkjail alcatraz ${epair}b
+   jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up
+
+   # add a new route in the jail
+   jexec alcatraz route add 192.0.2.3 192.0.2.2
+   gateway=$(check_route "alcatraz" "192.0.2.3")
+
+   if [ "${gateway}" != "192.0.2.2" ]; then
+   atf_fail "Failed to add new route."
+   fi
+
+   # change the added route
+   jexec alcatraz route change 192.0.2.3 192.0.2.4
+   gateway=$(check_route "alcatraz" "192.0.2.3")
+
+   if [ "${gateway}" != "192.0.2.4" ]; then
+   atf_fail "Failed to change route."
+   fi
+
+   # delete the route
+   jexec alcatraz route delete 192.0.2.3
+   gateway=$(check_route "alcatraz" "192.0.2.3")
+
+   if [ "${gateway}" != 

svn commit: r363416 - head/lib/geom/eli

2020-07-22 Thread Gordon Bergling
Author: gbe (doc committer)
Date: Wed Jul 22 13:00:56 2020
New Revision: 363416
URL: https://svnweb.freebsd.org/changeset/base/363416

Log:
  geli(8): Add missing commands in the EXAMPLES section
  
  - Add a missing 'geli attach' command
  - Fix the passphrase prompt for a 'geli attach' command
  
  Reported by:  Fabian Keil 
  Reviewed by:  bcr (mentor)
  Approved by:  bcr (mentor)
  Differential Revision:https://reviews.freebsd.org/D25761

Modified:
  head/lib/geom/eli/geli.8

Modified: head/lib/geom/eli/geli.8
==
--- head/lib/geom/eli/geli.8Wed Jul 22 12:30:31 2020(r363415)
+++ head/lib/geom/eli/geli.8Wed Jul 22 13:00:56 2020(r363416)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 20, 2020
+.Dd July 22, 2020
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -1130,6 +1130,8 @@ is requested when geli init is called.
 # geli init -K /root/private0.key -s 4096 /dev/md0
 Enter new passphrase:
 Reenter new passphrase:
+# geli attach -k /root/private0.key /dev/md0
+Enter passphrase:
 # dd if=/dev/random of=/dev/md0.eli bs=1m
 .Ed
 .Pp
@@ -1150,7 +1152,7 @@ It is recommended to do this procedure after the boot,
 the boot process would be waiting for the passphrase input.
 .Bd -literal -offset indent
 # geli attach -k /root/private0.key /dev/md0
-Enter new passphrase:
+Enter passphrase:
 # mount /dev/md0.eli /private
 .Ed
 .Sh ENCRYPTION MODES
___
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: r363415 - in head/sys: kern sys ufs/ffs

2020-07-22 Thread Mateusz Guzik
Author: mjg
Date: Wed Jul 22 12:30:31 2020
New Revision: 363415
URL: https://svnweb.freebsd.org/changeset/base/363415

Log:
  lockmgr: add adaptive spinning
  
  It is very conservative. Only spinning when LK_ADAPTIVE is passed, only on
  exclusive lock and never when any waiters are present. buffer cache is remains
  not spinning.
  
  This reduces total sleep times during buildworld etc., but it does not shorten
  total real time (culprits are contention in the vm subsystem along with slock 
+
  upgrade which is not covered).
  
  For microbenchmarks: open3_processes -t 52 (open/close of the same file for
  writing) ops/s:
  before: 258845
  after: 801638
  
  Reviewed by:  kib
  Tested by:pho
  Differential Revision:https://reviews.freebsd.org/D25753

Modified:
  head/sys/kern/kern_lock.c
  head/sys/sys/lockmgr.h
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Wed Jul 22 10:00:13 2020(r363414)
+++ head/sys/kern/kern_lock.c   Wed Jul 22 12:30:31 2020(r363415)
@@ -167,6 +167,12 @@ struct lock_class lock_class_lockmgr = {
 #endif
 };
 
+static __read_mostly bool lk_adaptive = true;
+static SYSCTL_NODE(_debug, OID_AUTO, lockmgr, CTLFLAG_RD, NULL, "lockmgr 
debugging");
+SYSCTL_BOOL(_debug_lockmgr, OID_AUTO, adaptive_spinning, CTLFLAG_RW, 
_adaptive,
+0, "");
+#define lockmgr_delay  locks_delay
+
 struct lockmgr_wait {
const char *iwmesg;
int ipri;
@@ -515,7 +521,6 @@ lockmgr_slock_try(struct lock *lk, uintptr_t *xp, int 
 * waiters, if we fail to acquire the shared lock
 * loop back and retry.
 */
-   *xp = lockmgr_read_value(lk);
while (LK_CAN_SHARE(*xp, flags, fp)) {
if (atomic_fcmpset_acq_ptr(>lk_lock, xp,
*xp + LK_ONE_SHARER)) {
@@ -541,6 +546,38 @@ lockmgr_sunlock_try(struct lock *lk, uintptr_t *xp)
return (false);
 }
 
+static bool
+lockmgr_slock_adaptive(struct lock_delay_arg *lda, struct lock *lk, uintptr_t 
*xp,
+int flags)
+{
+   struct thread *owner;
+   uintptr_t x;
+
+   x = *xp;
+   MPASS(x != LK_UNLOCKED);
+   owner = (struct thread *)LK_HOLDER(x);
+   for (;;) {
+   MPASS(owner != curthread);
+   if (owner == (struct thread *)LK_KERNPROC)
+   return (false);
+   if ((x & LK_SHARE) && LK_SHARERS(x) > 0)
+   return (false);
+   if (owner == NULL)
+   return (false);
+   if (!TD_IS_RUNNING(owner))
+   return (false);
+   if ((x & LK_ALL_WAITERS) != 0)
+   return (false);
+   lock_delay(lda);
+   x = lockmgr_read_value(lk);
+   if (LK_CAN_SHARE(x, flags, false)) {
+   *xp = x;
+   return (true);
+   }
+   owner = (struct thread *)LK_HOLDER(x);
+   }
+}
+
 static __noinline int
 lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk,
 const char *file, int line, struct lockmgr_wait *lwa)
@@ -557,6 +594,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
uint64_t waittime = 0;
int contested = 0;
 #endif
+   struct lock_delay_arg lda;
 
if (KERNEL_PANICKED())
goto out;
@@ -566,9 +604,31 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
if (LK_CAN_WITNESS(flags))
WITNESS_CHECKORDER(>lock_object, LOP_NEWORDER,
file, line, flags & LK_INTERLOCK ? ilk : NULL);
+   lock_delay_arg_init(, _delay);
+   if (!lk_adaptive)
+   flags &= ~LK_ADAPTIVE;
+   x = lockmgr_read_value(lk);
+   /*
+* The lock may already be locked exclusive by curthread,
+* avoid deadlock.
+*/
+   if (LK_HOLDER(x) == tid) {
+   LOCK_LOG2(lk,
+   "%s: %p already held in exclusive mode",
+   __func__, lk);
+   error = EDEADLK;
+   goto out;
+   }
+
for (;;) {
if (lockmgr_slock_try(lk, , flags, false))
break;
+
+   if ((flags & (LK_ADAPTIVE | LK_INTERLOCK)) == LK_ADAPTIVE) {
+   if (lockmgr_slock_adaptive(, lk, , flags))
+   continue;
+   }
+
 #ifdef HWPMC_HOOKS
PMC_SOFT_CALL( , , lock, failed);
 #endif
@@ -576,18 +636,6 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struc
, );
 
/*
-* If the lock is already held by curthread in
-* exclusive way avoid a deadlock.
-*/
-   if (LK_HOLDER(x) == tid) {
-   LOCK_LOG2(lk,
-   "%s: %p already held in exclusive mode",
-  

svn commit: r363414 - stable/12/sys/netpfil/ipfw

2020-07-22 Thread Tom Jones
Author: thj
Date: Wed Jul 22 10:00:13 2020
New Revision: 363414
URL: https://svnweb.freebsd.org/changeset/base/363414

Log:
  MFC r363141:
  
  Don't print VNET pointer when initializing dummynet
  
  When dummynet initializes it prints a debug message with the current VNET
  pointer unnecessarily revealing kernel memory layout. This appears to be left
  over from when the first pieces of vimage support were added.
  
  PR:   238658
  Submitted by: huangfq.dax...@gmail.com
  Reviewed by:  markj, bz, gnn, kp, melifaro
  Approved by:  jtl (co-mentor), bz (co-mentor)
  Event:July 2020 Bugathon
  Differential Revision:https://reviews.freebsd.org/D25619

Modified:
  stable/12/sys/netpfil/ipfw/ip_dummynet.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/ipfw/ip_dummynet.c
==
--- stable/12/sys/netpfil/ipfw/ip_dummynet.cWed Jul 22 06:47:38 2020
(r363413)
+++ stable/12/sys/netpfil/ipfw/ip_dummynet.cWed Jul 22 10:00:13 2020
(r363414)
@@ -2511,7 +2511,6 @@ ip_dn_init(void)
 {
if (dn_cfg.init_done)
return;
-   printf("DUMMYNET %p with IPv6 initialized (100409)\n", curvnet);
dn_cfg.init_done = 1;
/* Set defaults here. MSVC does not accept initializers,
 * and this is also useful for vimages
___
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: r363363 - head/lib/geom/eli

2020-07-22 Thread Gordon Bergling
On Tue, Jul 21, 2020 at 03:54:19PM +0200, Fabian Keil wrote:
> Gordon Bergling  wrote:
> 
> > Author: gbe (doc committer)
> > Date: Mon Jul 20 13:24:50 2020
> > New Revision: 363363
> > URL: https://svnweb.freebsd.org/changeset/base/363363
> > 
> > Log:
> >   geli(8): Add an example on how to use geli(8) with a file as encrypted 
> > storage
> >   
> >   Reviewed by:  bcr (mentor)
> >   Approved by:  bcr (mentor)
> >   MFC after:1 week
> >   Differential Revision:https://reviews.freebsd.org/D25741
> > 
> > Modified:
> >   head/lib/geom/eli/geli.8
> > 
> > Modified: head/lib/geom/eli/geli.8
> > ==
> > --- head/lib/geom/eli/geli.8Mon Jul 20 13:01:19 2020
> > (r363362)
> > +++ head/lib/geom/eli/geli.8Mon Jul 20 13:24:50 2020
> > (r363363)
> [...]
> > +This key should be protected by a passphrase, which
> > +is requested when geli init is called.
> > +.Bd -literal -offset indent
> > +# dd if=/dev/random of=/root/private0.key bs=64 count=1
> > +# geli init -K /root/private0.key -s 4096 /dev/md0
> > +Enter new passphrase:
> > +Reenter new passphrase:
> > +# dd if=/dev/random of=/dev/md0.eli bs=1m
> 
> There seems to be a "geli attach ..." missing after
> the "geli init ...".
> 
> > +The call of geli attach will ask for the passphrase.
> > +It is recommended to do this procedure after the boot, because otherwise
> > +the boot process would be waiting for the passphrase input.
> > +.Bd -literal -offset indent
> > +# geli attach -k /root/private0.key /dev/md0
> > +Enter new passphrase:
> 
> The expected prompt is just "Enter passphrase:".
> 
> Fabian

Hi Fabian,

your right. I created a differential with the fixes for the example and commit
your corrections once the differential is approved.

--Gordon


signature.asc
Description: PGP signature


svn commit: r363413 - stable/12/sys/netinet

2020-07-22 Thread Tom Jones
Author: thj
Date: Wed Jul 22 06:47:38 2020
New Revision: 363413
URL: https://svnweb.freebsd.org/changeset/base/363413

Log:
  MFC r350749, r362275
  
  r350749:
  Rename IPPROTO 33 from SEP to DCCP
  
  IPPROTO 33 is DCCP in the IANA Registry:
  https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
  
  IPPROTO_SEP was added about 20 years ago in r33804. The entries were added
  straight from RFC1700, without regard to whether they were used.
  
  The reference in RFC1700 for SEP is '[JC120] ', this is an
  indication that the protocol number was probably in use in a private network.
  
  As RFC1700 is no longer the authoritative list of internet numbers and that
  IANA assinged 33 to DCCP in RFC4340, change the header to the actual
  authoritative source.
  
  Reviewed by:  Richard Scheffenegger, bz
  Approved by:  bz (mentor)
  Differential Revision:https://reviews.freebsd.org/D21178
  
  r362275:
  Add header definition for RFC4340, Datagram Congestion Control Protocol
  
  Add a header definition for DCCP as defined in RFC4340. This header definition
  is required to perform validation when receiving and forwarding DCCP packets.
  We do not currently support DCCP.
  
  Reviewed by:  gallatin, bz
  Approved by:  bz (co-mentor)
  MFC with: 350749
  Differential Revision:https://reviews.freebsd.org/D21179

Added:
  stable/12/sys/netinet/dccp.h
 - copied unchanged from r362275, head/sys/netinet/dccp.h
Modified:
  stable/12/sys/netinet/in.h
Directory Properties:
  stable/12/   (props changed)

Copied: stable/12/sys/netinet/dccp.h (from r362275, head/sys/netinet/dccp.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/sys/netinet/dccp.hWed Jul 22 06:47:38 2020
(r363413, copy of r362275, head/sys/netinet/dccp.h)
@@ -0,0 +1,78 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Tom Jones 
+ *
+ * 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$
+ */
+
+#ifndef _NETINET_DCCP_H_
+#define _NETINET_DCCP_H_
+
+/* DCCP protocol header as per RFC4340 */
+struct dccphdr {
+   uint16_td_sport;
+   uint16_td_dport;
+   uint8_t d_doff;
+#if BYTE_ORDER == LITTLE_ENDIAN
+   uint8_t d_cscov:4,
+   d_ccval:4;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+   uint8_t d_ccval:4,
+   d_cscov:4;
+#endif
+   uint8_t d_cksum[2];
+#if BYTE_ORDER == LITTLE_ENDIAN
+   uint8_t d_res:3,
+   d_type:4,
+   d_x:1;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+   uint8_t d_x:1,
+   d_type:4,
+   d_res:3;
+#endif
+   /*
+* Provide enough space for both the short (24 bit) sequence number and
+* the long (48 bit) sequene number and a leading reserved byte in
+* front of the long sequence number.
+*/
+   union dccp_seqno {
+   uint8_t shortseq[3];
+   struct dccp_long_seqno {
+   uint8_t res;
+   uint8_t seq[6];
+   } longseq;
+   } d_seqno;
+};
+
+#define d_seqno_short d_seqno.shortseq;
+#define d_seqno_long d_seqno.longseq.seq;
+
+#define DCCP_SHORTHDR  12
+#define DCCP_LONGHDR   16
+#define DCCP_EXTHDR0x80
+
+#endif /* _NETINET_DCCP_H */

Modified: stable/12/sys/netinet/in.h
==
--- stable/12/sys/netinet/in.h  Wed Jul 22 06:45:24 2020(r363412)
+++ stable/12/sys/netinet/in.h  Wed Jul 22 06:47:38 

svn commit: r363412 - stable/12/usr.sbin/pkg

2020-07-22 Thread Tom Jones
Author: thj
Date: Wed Jul 22 06:45:24 2020
New Revision: 363412
URL: https://svnweb.freebsd.org/changeset/base/363412

Log:
  MFC r362541:
  
  pkg: Provide a friendlier message when bootstrap fails due to address 
resolution
  
  The current message when bootstapping pkg fails for any reason implies that 
pkg
  is not available. We have the error code from fetch so if bootstrap failed due
  to address resolution say so.
  
  Reviewed by:bapt, bz
  Approved by:bz (co-mentor)
  Differential Revision:  https://reviews.freebsd.org/D25323

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

Modified: stable/12/usr.sbin/pkg/pkg.c
==
--- stable/12/usr.sbin/pkg/pkg.cWed Jul 22 02:15:21 2020
(r363411)
+++ stable/12/usr.sbin/pkg/pkg.cWed Jul 22 06:45:24 2020
(r363412)
@@ -915,10 +915,15 @@ bootstrap_pkg(bool force)
 
 fetchfail:
warnx("Error fetching %s: %s", url, fetchLastErrString);
-   fprintf(stderr, "A pre-built version of pkg could not be found for "
-   "your system.\n");
-   fprintf(stderr, "Consider changing PACKAGESITE or installing it from "
-   "ports: 'ports-mgmt/pkg'.\n");
+   if (fetchLastErrCode == FETCH_RESOLV) {
+   fprintf(stderr, "Address resolution failed for %s.\n", 
packagesite);
+   fprintf(stderr, "Consider changing PACKAGESITE.\n");
+   } else {
+   fprintf(stderr, "A pre-built version of pkg could not be found 
for "
+   "your system.\n");
+   fprintf(stderr, "Consider changing PACKAGESITE or installing it 
from "
+   "ports: 'ports-mgmt/pkg'.\n");
+   }
 
 cleanup:
if (fd_sig != -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"