svn commit: r349639 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:06:39 2019
New Revision: 349639
URL: https://svnweb.freebsd.org/changeset/base/349639

Log:
  Also remove lib32 version of libprivateifconfig after r344530.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 03:42:51 2019(r349638)
+++ head/ObsoleteFiles.inc  Wed Jul  3 09:06:39 2019(r349639)
@@ -388,6 +388,8 @@ OLD_FILES+=usr/include/sys/seq.h
 # 20190222: libifconfig made INTERNALLIB
 OLD_FILES+=usr/lib/libprivateifconfig.a
 OLD_FILES+=usr/lib/libprivateifconfig_p.a
+OLD_FILES+=usr/lib32/libprivateifconfig.a
+OLD_FILES+=usr/lib32/libprivateifconfig_p.a
 # 20190131: pfil(9) changed
 OLD_FILES+=usr/share/man/man9/pfil_hook_get.9.gz
 OLD_FILES+=usr/share/man/man9/pfil_rlock.9.gz
___
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: r349640 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:08:17 2019
New Revision: 349640
URL: https://svnweb.freebsd.org/changeset/base/349640

Log:
  Also remove lib32 version of libcasper.so.0.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 09:06:39 2019(r349639)
+++ head/ObsoleteFiles.inc  Wed Jul  3 09:08:17 2019(r349640)
@@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
 OLD_FILES+=usr/bin/send-pr
 # 20180725: Cleanup old libcasper.so.0
 OLD_LIBS+=lib/libcasper.so.0
+OLD_LIBS+=lib32/libcasper.so.0
 # 20180722: indent(1) option renamed, test files follow
 OLD_FILES+=usr/bin/indent/tests/nsac.0
 OLD_FILES+=usr/bin/indent/tests/nsac.0.pro
___
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: r349641 - head/tools/build/mk

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:14:39 2019
New Revision: 349641
URL: https://svnweb.freebsd.org/changeset/base/349641

Log:
  Also remove lib32 versions of libradius.
  
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul  3 09:08:17 
2019(r349640)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul  3 09:14:39 
2019(r349641)
@@ -8321,6 +8321,12 @@ OLD_LIBS+=usr/lib/libradius.so.4
 OLD_FILES+=usr/lib/libradius_p.a
 OLD_FILES+=usr/lib/pam_radius.so
 OLD_LIBS+=usr/lib/pam_radius.so.6
+OLD_FILES+=usr/lib32/libradius.a
+OLD_FILES+=usr/lib32/libradius.so
+OLD_LIBS+=usr/lib32/libradius.so.4
+OLD_FILES+=usr/lib32/libradius_p.a
+OLD_FILES+=usr/lib32/pam_radius.so
+OLD_LIBS+=usr/lib32/pam_radius.so.6
 OLD_FILES+=usr/include/radlib.h
 OLD_FILES+=usr/include/radlib_vs.h
 OLD_FILES+=usr/share/man/man3/libradius.3.gz
___
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: r349642 - stable/12/sbin/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:43:26 2019
New Revision: 349642
URL: https://svnweb.freebsd.org/changeset/base/349642

Log:
  MFC r349364:
Restore ipfw(8)'s compact output support broken after r331668.
  
Also modify it a bit. Now -c option omits only 'from any to any' part
and works for different protocols (not just for ip).
  
Reported by:Dmitry Selivanov 

Modified:
  stable/12/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ipfw/ipfw2.c
==
--- stable/12/sbin/ipfw/ipfw2.c Wed Jul  3 09:14:39 2019(r349641)
+++ stable/12/sbin/ipfw/ipfw2.c Wed Jul  3 09:43:26 2019(r349642)
@@ -2223,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct forma
}
 
print_proto(bp, fo, &state);
+   if (co->do_compact != 0 && (rule->flags & IPFW_RULE_NOOPT))
+   goto justopts;
 
/* Print source */
bprintf(bp, " from");
@@ -4395,6 +4397,8 @@ chkarg:
}
 OR_BLOCK(get_proto);
 
+   first_cmd = cmd; /* update pointer to use in compact form */
+
/*
 * "from", mandatory
 */
@@ -4466,6 +4470,8 @@ chkarg:
cmd = next_cmd(cmd, &cblen);
}
}
+   if (first_cmd == cmd)
+   rule->flags |= IPFW_RULE_NOOPT;
 
 read_options:
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: r349643 - stable/12/sys/netpfil/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:45:02 2019
New Revision: 349643
URL: https://svnweb.freebsd.org/changeset/base/349643

Log:
  MFC r349365:
Mark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
compact form.

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

Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:43:26 2019
(r349642)
+++ stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:45:02 2019
(r349643)
@@ -3327,6 +3327,7 @@ vnet_ipfw_init(const void *unused)
 
/* fill and insert the default rule */
rule = ipfw_alloc_rule(chain, sizeof(struct ip_fw));
+   rule->flags |= IPFW_RULE_NOOPT;
rule->cmd_len = 1;
rule->cmd[0].len = 1;
rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
___
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: r349644 - stable/12/sys/netpfil/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:46:30 2019
New Revision: 349644
URL: https://svnweb.freebsd.org/changeset/base/349644

Log:
  MFC r349366:
Follow the RFC 3128 and drop short TCP fragments with offset = 1.

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

Modified: stable/12/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:45:02 2019
(r349643)
+++ stable/12/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:46:30 2019
(r349644)
@@ -1688,6 +1688,11 @@ do { 
\
default:
break;
}
+   } else {
+   if (offset == 1 && proto == IPPROTO_TCP) {
+   /* RFC 3128 */
+   goto pullup_failed;
+   }
}
 
ip = mtod(m, struct ip *);
___
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: r349645 - in head/sys/compat/linuxkpi/common: include/linux src

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 09:48:20 2019
New Revision: 349645
URL: https://svnweb.freebsd.org/changeset/base/349645

Log:
  Remove dead code added after r348743 in the LinuxKPI. The
  LINUXKPI_VERSION macro is not defined for any compiled LinuxKPI code
  which basically means __GFP_NOTWIRED is never checked when allocating
  pages. This should work fine with the existing external DRM code as
  long as the page wiring and unwiring is balanced.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/gfp.h
  head/sys/compat/linuxkpi/common/src/linux_page.c

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Wed Jul  3 09:46:30 
2019(r349644)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Wed Jul  3 09:48:20 
2019(r349645)
@@ -58,9 +58,6 @@
 #define__GFP_NO_KSWAPD 0
 #define__GFP_WAIT  M_WAITOK
 #define__GFP_DMA32 (1U << 24) /* LinuxKPI only */
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION == 5
-#define__GFP_NOTWIRED  (1U << 25)
-#endif
 #define__GFP_BITS_SHIFT 25
 #define__GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
 #define__GFP_NOFAILM_WAITOK
@@ -101,9 +98,6 @@ static inline struct page *
 alloc_page(gfp_t flags)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, 0));
 }
 
@@ -111,9 +105,6 @@ static inline struct page *
 alloc_pages(gfp_t flags, unsigned int order)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, order));
 }
 
@@ -121,9 +112,6 @@ static inline struct page *
 alloc_pages_node(int node_id, gfp_t flags, unsigned int order)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, order));
 }
 

Modified: head/sys/compat/linuxkpi/common/src/linux_page.c
==
--- head/sys/compat/linuxkpi/common/src/linux_page.cWed Jul  3 09:46:30 
2019(r349644)
+++ head/sys/compat/linuxkpi/common/src/linux_page.cWed Jul  3 09:48:20 
2019(r349645)
@@ -93,10 +93,6 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
unsigned long npages = 1UL << order;
int req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_NORMAL;
 
-#ifdef __GFP_NOTWIRED
-   if ((flags & __GFP_NOTWIRED) != 0)
-   req &= ~VM_ALLOC_WIRED;
-#endif
if ((flags & M_ZERO) != 0)
req |= VM_ALLOC_ZERO;
if (order == 0 && (flags & GFP_DMA32) == 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: r349646 - stable/11/sbin/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:48:22 2019
New Revision: 349646
URL: https://svnweb.freebsd.org/changeset/base/349646

Log:
  MFC r349364:
Restore ipfw(8)'s compact output support broken after r331668.
  
Also modify it a bit. Now -c option omits only 'from any to any' part
and works for different protocols (not just for ip).
  
Reported by:  Dmitry Selivanov 

Modified:
  stable/11/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/ipfw/ipfw2.c
==
--- stable/11/sbin/ipfw/ipfw2.c Wed Jul  3 09:48:20 2019(r349645)
+++ stable/11/sbin/ipfw/ipfw2.c Wed Jul  3 09:48:22 2019(r349646)
@@ -2223,6 +2223,8 @@ show_static_rule(struct cmdline_opts *co, struct forma
}
 
print_proto(bp, fo, &state);
+   if (co->do_compact != 0 && (rule->flags & IPFW_RULE_NOOPT))
+   goto justopts;
 
/* Print source */
bprintf(bp, " from");
@@ -4395,6 +4397,8 @@ chkarg:
}
 OR_BLOCK(get_proto);
 
+   first_cmd = cmd; /* update pointer to use in compact form */
+
/*
 * "from", mandatory
 */
@@ -4466,6 +4470,8 @@ chkarg:
cmd = next_cmd(cmd, &cblen);
}
}
+   if (first_cmd == cmd)
+   rule->flags |= IPFW_RULE_NOOPT;
 
 read_options:
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: r349647 - stable/11/sys/netpfil/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:49:47 2019
New Revision: 349647
URL: https://svnweb.freebsd.org/changeset/base/349647

Log:
  MFC r349365:
Mark default rule with IPFW_RULE_NOOPT flag, so it can be showed in
compact form.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:48:22 2019
(r349646)
+++ stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:49:47 2019
(r349647)
@@ -3325,6 +3325,7 @@ vnet_ipfw_init(const void *unused)
 
/* fill and insert the default rule */
rule = ipfw_alloc_rule(chain, sizeof(struct ip_fw));
+   rule->flags |= IPFW_RULE_NOOPT;
rule->cmd_len = 1;
rule->cmd[0].len = 1;
rule->cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
___
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: r349648 - stable/11/sys/netpfil/ipfw

2019-07-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Jul  3 09:51:59 2019
New Revision: 349648
URL: https://svnweb.freebsd.org/changeset/base/349648

Log:
  MFC r349366:
Follow the RFC 3128 and drop short TCP fragments with offset = 1.

Modified:
  stable/11/sys/netpfil/ipfw/ip_fw2.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:49:47 2019
(r349647)
+++ stable/11/sys/netpfil/ipfw/ip_fw2.c Wed Jul  3 09:51:59 2019
(r349648)
@@ -1686,6 +1686,11 @@ do { 
\
default:
break;
}
+   } else {
+   if (offset == 1 && proto == IPPROTO_TCP) {
+   /* RFC 3128 */
+   goto pullup_failed;
+   }
}
 
ip = mtod(m, struct ip *);
___
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: r349649 - head/sys/dev/cxgbe/tom

2019-07-03 Thread John Baldwin
Author: jhb
Date: Wed Jul  3 16:06:11 2019
New Revision: 349649
URL: https://svnweb.freebsd.org/changeset/base/349649

Log:
  Use unmapped (M_NOMAP) mbufs for zero-copy AIO writes via TOE.
  
  Previously the TOE code used its own custom unmapped mbufs via
  EXT_FLAG_VENDOR1.  The old version always wired the entire AIO request
  buffer first for the duration of the AIO operation and constructed
  multiple mbufs which used the wired buffer as an external buffer.
  
  The new version determines how much room is available in the socket
  buffer and only wires the pages needed for the available room building
  chains of M_NOMAP mbufs.  This means that a large AIO write will now
  limit the amount of wired memory it uses to the size of the socket
  buffer.
  
  Reviewed by:  gallatin, np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20839

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Jul  3 09:51:59 2019
(r349648)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Jul  3 16:06:11 2019
(r349649)
@@ -76,28 +76,6 @@ __FBSDID("$FreeBSD$");
 static voidt4_aiotx_cancel(struct kaiocb *job);
 static voidt4_aiotx_queue_toep(struct socket *so, struct toepcb *toep);
 
-static size_t
-aiotx_mbuf_pgoff(struct mbuf *m)
-{
-   struct aiotx_buffer *ab;
-
-   MPASS(IS_AIOTX_MBUF(m));
-   ab = m->m_ext.ext_arg1;
-   return ((ab->ps.offset + (uintptr_t)m->m_ext.ext_arg2) % PAGE_SIZE);
-}
-
-static vm_page_t *
-aiotx_mbuf_pages(struct mbuf *m)
-{
-   struct aiotx_buffer *ab;
-   int npages;
-
-   MPASS(IS_AIOTX_MBUF(m));
-   ab = m->m_ext.ext_arg1;
-   npages = (ab->ps.offset + (uintptr_t)m->m_ext.ext_arg2) / PAGE_SIZE;
-   return (ab->ps.pages + npages);
-}
-
 void
 send_flowc_wr(struct toepcb *toep, struct flowc_tx_params *ftxp)
 {
@@ -647,10 +625,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu
 
i = -1;
for (m = start; m != stop; m = m->m_next) {
-   if (IS_AIOTX_MBUF(m))
-   rc = sglist_append_vmpages(&sg, aiotx_mbuf_pages(m),
-   aiotx_mbuf_pgoff(m), m->m_len);
-   else if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_NOMAP)
rc = sglist_append_mb_ext_pgs(&sg, m);
else
rc = sglist_append(&sg, mtod(m, void *), m->m_len);
@@ -713,7 +688,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
struct sockbuf *sb = &so->so_snd;
int tx_credits, shove, compl, sowwakeup;
struct ofld_tx_sdesc *txsd;
-   bool aiotx_mbuf_seen;
+   bool nomap_mbuf_seen;
 
INP_WLOCK_ASSERT(inp);
KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
@@ -766,14 +741,11 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
plen = 0;
nsegs = 0;
max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */
-   aiotx_mbuf_seen = false;
+   nomap_mbuf_seen = false;
for (m = sndptr; m != NULL; m = m->m_next) {
int n;
 
-   if (IS_AIOTX_MBUF(m))
-   n = sglist_count_vmpages(aiotx_mbuf_pages(m),
-   aiotx_mbuf_pgoff(m), m->m_len);
-   else if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_NOMAP)
n = sglist_count_mb_ext_pgs(m);
else
n = sglist_count(mtod(m, void *), m->m_len);
@@ -802,8 +774,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
break;
}
 
-   if (IS_AIOTX_MBUF(m))
-   aiotx_mbuf_seen = true;
+   if (m->m_flags & M_NOMAP)
+   nomap_mbuf_seen = true;
if (max_nsegs_1mbuf < n)
max_nsegs_1mbuf = n;
sb_sndptr = m;  /* new sb->sb_sndptr if all goes well */
@@ -852,7 +824,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
panic("%s: excess tx.", __func__);
 
shove = m == NULL && !(tp->t_flags & TF_MORETOCOME);
-   if (plen <= max_imm && !aiotx_mbuf_seen) {
+   if (plen <= max_imm && !nomap_mbuf_seen) {
 
/* Immediate data tx */
 
@@ -1910,71 +1882,94 @@ t4_uninit_cpl_io_handlers(void)
 }
 
 /*
- * Use the 'backend3' field in AIO jobs to store the amount of data
- * sent by the AIO job so far and the 'backend4' field to hold an
- * error that should be reporte

Re: svn commit: r349640 - head

2019-07-03 Thread John Baldwin
On 7/3/19 2:08 AM, Tijl Coosemans wrote:
> Author: tijl
> Date: Wed Jul  3 09:08:17 2019
> New Revision: 349640
> URL: https://svnweb.freebsd.org/changeset/base/349640
> 
> Log:
>   Also remove lib32 version of libcasper.so.0.
> 
> Modified:
>   head/ObsoleteFiles.inc
> 
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.incWed Jul  3 09:06:39 2019(r349639)
> +++ head/ObsoleteFiles.incWed Jul  3 09:08:17 2019(r349640)
> @@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
>  OLD_FILES+=usr/bin/send-pr
>  # 20180725: Cleanup old libcasper.so.0
>  OLD_LIBS+=lib/libcasper.so.0
> +OLD_LIBS+=lib32/libcasper.so.0

Should this be usr/lib32 instead of lib32?

-- 
John Baldwin
___
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: r349641 - head/tools/build/mk

2019-07-03 Thread John Baldwin
On 7/3/19 2:14 AM, Tijl Coosemans wrote:
> Author: tijl
> Date: Wed Jul  3 09:14:39 2019
> New Revision: 349641
> URL: https://svnweb.freebsd.org/changeset/base/349641
> 
> Log:
>   Also remove lib32 versions of libradius.
>   
>   MFC after:  1 week

I do wonder if we shouldn't try to make OLD_LIBS a bit
smarter by having it expand to also include the lib32
(and libsoft) variants.  Having some kind of helper
to deal with the non-dynamic libs would also be nice
(it would remove libfoo.a, libfoo_p.a, and libfoo.so
which always live in /usr/lib, /usr/lib32, and /usr/libsoft).

-- 
John Baldwin
___
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: r349650 - in stable: 11/lib/libsqlite3 12/lib/libsqlite3

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:23:06 2019
New Revision: 349650
URL: https://svnweb.freebsd.org/changeset/base/349650

Log:
  MFC r342972:
  
  Disable FTS3, FTS4, and RTREE in bundled and private sqlite3.
  
  Suggested by: delphij@
  Reviewed by:  delphij@ (for secteam@)
  Differential Revision:https://reviews.freebsd.org/D18786

Modified:
  stable/11/lib/libsqlite3/Makefile
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/lib/libsqlite3/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/lib/libsqlite3/Makefile
==
--- stable/11/lib/libsqlite3/Makefile   Wed Jul  3 16:06:11 2019
(r349649)
+++ stable/11/lib/libsqlite3/Makefile   Wed Jul  3 16:23:06 2019
(r349650)
@@ -32,9 +32,6 @@ CFLAGS+=  -I${SQLITE} \
-DHAVE_STRERROR_R=1 \
-DHAVE_POSIX_FALLOCATE=1 \
-D_REENTRANT=1 \
-   -DSQLITE_THREADSAFE=1 \
-   -DSQLITE_ENABLE_FTS3 \
-   -DSQLITE_ENABLE_FTS4 \
-   -DSQLITE_ENABLE_RTREE
+   -DSQLITE_THREADSAFE=1
 
 .include 
___
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: r349650 - in stable: 11/lib/libsqlite3 12/lib/libsqlite3

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:23:06 2019
New Revision: 349650
URL: https://svnweb.freebsd.org/changeset/base/349650

Log:
  MFC r342972:
  
  Disable FTS3, FTS4, and RTREE in bundled and private sqlite3.
  
  Suggested by: delphij@
  Reviewed by:  delphij@ (for secteam@)
  Differential Revision:https://reviews.freebsd.org/D18786

Modified:
  stable/12/lib/libsqlite3/Makefile
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/lib/libsqlite3/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/lib/libsqlite3/Makefile
==
--- stable/12/lib/libsqlite3/Makefile   Wed Jul  3 16:06:11 2019
(r349649)
+++ stable/12/lib/libsqlite3/Makefile   Wed Jul  3 16:23:06 2019
(r349650)
@@ -33,9 +33,6 @@ CFLAGS+=  -I${SQLITE} \
-DHAVE_STRERROR_R=1 \
-DHAVE_POSIX_FALLOCATE=1 \
-D_REENTRANT=1 \
-   -DSQLITE_THREADSAFE=1 \
-   -DSQLITE_ENABLE_FTS3 \
-   -DSQLITE_ENABLE_FTS4 \
-   -DSQLITE_ENABLE_RTREE
+   -DSQLITE_THREADSAFE=1
 
 .include 
___
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: r349651 - in stable/12/libexec/rc: . rc.d

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:43:40 2019
New Revision: 349651
URL: https://svnweb.freebsd.org/changeset/base/349651

Log:
  MFC r349153:
  
  Allow the hostapd program to be specified. This allows users to use
  hostapd from ports instead of the one in base. The default is the hostapd
  in base.
  
  PR:   238571

Modified:
  stable/12/libexec/rc/rc.conf
  stable/12/libexec/rc/rc.d/hostapd
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rc/rc.conf
==
--- stable/12/libexec/rc/rc.confWed Jul  3 16:23:06 2019
(r349650)
+++ stable/12/libexec/rc/rc.confWed Jul  3 16:43:40 2019
(r349651)
@@ -275,6 +275,7 @@ ppp_user="root" # Which user to run ppp as
 # profile3 uses default ppp_mode and ppp_nat
 
 ### Network daemon (miscellaneous) ###
+hostapd_program="/usr/sbin/hostapd"
 hostapd_enable="NO"# Run hostap daemon.
 syslogd_enable="YES"   # Run syslog daemon (or NO).
 syslogd_program="/usr/sbin/syslogd" # path to syslogd, if you want a different 
one.

Modified: stable/12/libexec/rc/rc.d/hostapd
==
--- stable/12/libexec/rc/rc.d/hostapd   Wed Jul  3 16:23:06 2019
(r349650)
+++ stable/12/libexec/rc/rc.d/hostapd   Wed Jul  3 16:43:40 2019
(r349651)
@@ -11,7 +11,7 @@
 
 name="hostapd"
 desc="Authenticator for IEEE 802.11 networks"
-command="/usr/sbin/${name}"
+command=${hostapd_program}
 
 ifn="$2"
 if [ -z "$ifn" ]; then
___
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: r349652 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:48:46 2019
New Revision: 349652
URL: https://svnweb.freebsd.org/changeset/base/349652

Log:
  MFC r349331:
  
  Clean out duplicate definitions of TCP macros also found in netinet/tcp.h.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:43:40 
2019(r349651)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:48:46 
2019(r349652)
@@ -828,37 +828,6 @@ typedefstruct  tcpiphdrtcpiphdr_t;
 #undef IPOPT_AH
 #defineIPOPT_AH256+IPPROTO_AH
 
-#ifndef TCPOPT_EOL
-# define TCPOPT_EOL0
-#endif
-#ifndef TCPOPT_NOP
-# define TCPOPT_NOP1
-#endif
-#ifndef TCPOPT_MAXSEG
-# define TCPOPT_MAXSEG 2
-#endif
-#ifndef TCPOLEN_MAXSEG
-# define TCPOLEN_MAXSEG4
-#endif
-#ifndef TCPOPT_WINDOW
-# define TCPOPT_WINDOW 3
-#endif
-#ifndef TCPOLEN_WINDOW
-# define TCPOLEN_WINDOW3
-#endif
-#ifndef TCPOPT_SACK_PERMITTED
-# define TCPOPT_SACK_PERMITTED 4
-#endif
-#ifndef TCPOLEN_SACK_PERMITTED
-# define TCPOLEN_SACK_PERMITTED2
-#endif
-#ifndef TCPOPT_SACK
-# define TCPOPT_SACK   5
-#endif
-#ifndef TCPOPT_TIMESTAMP
-# define TCPOPT_TIMESTAMP  8
-#endif
-
 #ifndefICMP_MINLEN
 # define   ICMP_MINLEN 8
 #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: r349652 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:48:46 2019
New Revision: 349652
URL: https://svnweb.freebsd.org/changeset/base/349652

Log:
  MFC r349331:
  
  Clean out duplicate definitions of TCP macros also found in netinet/tcp.h.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:43:40 
2019(r349651)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:48:46 
2019(r349652)
@@ -829,37 +829,6 @@ typedefstruct  tcpiphdrtcpiphdr_t;
 #undef IPOPT_AH
 #defineIPOPT_AH256+IPPROTO_AH
 
-#ifndef TCPOPT_EOL
-# define TCPOPT_EOL0
-#endif
-#ifndef TCPOPT_NOP
-# define TCPOPT_NOP1
-#endif
-#ifndef TCPOPT_MAXSEG
-# define TCPOPT_MAXSEG 2
-#endif
-#ifndef TCPOLEN_MAXSEG
-# define TCPOLEN_MAXSEG4
-#endif
-#ifndef TCPOPT_WINDOW
-# define TCPOPT_WINDOW 3
-#endif
-#ifndef TCPOLEN_WINDOW
-# define TCPOLEN_WINDOW3
-#endif
-#ifndef TCPOPT_SACK_PERMITTED
-# define TCPOPT_SACK_PERMITTED 4
-#endif
-#ifndef TCPOLEN_SACK_PERMITTED
-# define TCPOLEN_SACK_PERMITTED2
-#endif
-#ifndef TCPOPT_SACK
-# define TCPOPT_SACK   5
-#endif
-#ifndef TCPOPT_TIMESTAMP
-# define TCPOPT_TIMESTAMP  8
-#endif
-
 #ifndefICMP_MINLEN
 # define   ICMP_MINLEN 8
 #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: r349653 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:53:59 2019
New Revision: 349653
URL: https://svnweb.freebsd.org/changeset/base/349653

Log:
  MFC r349362:
  
  The definition of icmptypes in ip_compt.h is dead code as it already
  use the icmptypes in ip_icmp.h.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:48:46 
2019(r349652)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:53:59 
2019(r349653)
@@ -829,159 +829,9 @@ typedef   struct  tcpiphdrtcpiphdr_t;
 #undef IPOPT_AH
 #defineIPOPT_AH256+IPPROTO_AH
 
-#ifndefICMP_MINLEN
-# define   ICMP_MINLEN 8
-#endif
-#ifndefICMP_ECHOREPLY
-# define   ICMP_ECHOREPLY  0
-#endif
-#ifndefICMP_UNREACH
-# define   ICMP_UNREACH3
-#endif
-#ifndefICMP_UNREACH_NET
-# define   ICMP_UNREACH_NET0
-#endif
-#ifndefICMP_UNREACH_HOST
-# define   ICMP_UNREACH_HOST   1
-#endif
-#ifndefICMP_UNREACH_PROTOCOL
-# define   ICMP_UNREACH_PROTOCOL   2
-#endif
-#ifndefICMP_UNREACH_PORT
-# define   ICMP_UNREACH_PORT   3
-#endif
-#ifndefICMP_UNREACH_NEEDFRAG
-# define   ICMP_UNREACH_NEEDFRAG   4
-#endif
-#ifndefICMP_UNREACH_SRCFAIL
-# define   ICMP_UNREACH_SRCFAIL5
-#endif
-#ifndefICMP_UNREACH_NET_UNKNOWN
-# define   ICMP_UNREACH_NET_UNKNOWN6
-#endif
-#ifndefICMP_UNREACH_HOST_UNKNOWN
-# define   ICMP_UNREACH_HOST_UNKNOWN   7
-#endif
-#ifndefICMP_UNREACH_ISOLATED
-# define   ICMP_UNREACH_ISOLATED   8
-#endif
-#ifndefICMP_UNREACH_NET_PROHIB
-# define   ICMP_UNREACH_NET_PROHIB 9
-#endif
-#ifndefICMP_UNREACH_HOST_PROHIB
-# define   ICMP_UNREACH_HOST_PROHIB10
-#endif
-#ifndefICMP_UNREACH_TOSNET
-# define   ICMP_UNREACH_TOSNET 11
-#endif
-#ifndefICMP_UNREACH_TOSHOST
-# define   ICMP_UNREACH_TOSHOST12
-#endif
-#ifndefICMP_UNREACH_ADMIN_PROHIBIT
-# define   ICMP_UNREACH_ADMIN_PROHIBIT 13
-#endif
-#ifndefICMP_UNREACH_FILTER
-# define   ICMP_UNREACH_FILTER 13
-#endif
-#ifndefICMP_UNREACH_HOST_PRECEDENCE
-# define   ICMP_UNREACH_HOST_PRECEDENCE14
-#endif
-#ifndefICMP_UNREACH_PRECEDENCE_CUTOFF
-# define   ICMP_UNREACH_PRECEDENCE_CUTOFF  15
-#endif
-#ifndefICMP_SOURCEQUENCH
-# define   ICMP_SOURCEQUENCH   4
-#endif
-#ifndefICMP_REDIRECT_NET
-# define   ICMP_REDIRECT_NET   0
-#endif
-#ifndefICMP_REDIRECT_HOST
-# define   ICMP_REDIRECT_HOST  1
-#endif
-#ifndefICMP_REDIRECT_TOSNET
-# define   ICMP_REDIRECT_TOSNET2
-#endif
-#ifndefICMP_REDIRECT_TOSHOST
-# define   ICMP_REDIRECT_TOSHOST   3
-#endif
-#ifndefICMP_ALTHOSTADDR
-# define   ICMP_ALTHOSTADDR6
-#endif
-#ifndefICMP_TIMXCEED
-# define   ICMP_TIMXCEED   11
-#endif
-#ifndefICMP_TIMXCEED_INTRANS
-# define   ICMP_TIMXCEED_INTRANS   0
-#endif
-#ifndefICMP_TIMXCEED_REASS
-# define   ICMP_TIMXCEED_REASS 1
-#endif
-#ifndefICMP_PARAMPROB
-# define   ICMP_PARAMPROB  12
-#endif
-#ifndefICMP_PARAMPROB_ERRATPTR
-# define   ICMP_PARAMPROB_ERRATPTR 0
-#endif
-#ifndefICMP_PARAMPROB_OPTABSENT
-# define   ICMP_PARAMPROB_OPTABSENT1
-#endif
-#ifndefICMP_PARAMPROB_LENGTH
-# define   ICMP_PARAMPROB_LENGTH   2
-#endif
-#ifndef ICMP_TSTAMP
-# define   ICMP_TSTAMP 13
-#endif
-#ifndef ICMP_TSTAMPREPLY
-# define   ICMP_TSTAMPREPLY14
-#endif
-#ifndef ICMP_IREQ
-# define   ICMP_IREQ   15
-#endif
-#ifndef ICMP_IREQREPLY
-# define   ICMP_IREQREPLY  16
-#endif
-#ifndefICMP_MASKREQ
-# define   ICMP_MASKREQ17
-#endif
-#ifndef ICMP_MASKREPLY
-# define   ICMP_MASKREPLY  18
-#endif
-#ifndefICMP_TRACEROUTE
-# define   ICMP_TRACEROUTE 30
-#endif
-#ifndefICMP_DATACONVERR
-# define   ICMP_DATACONVERR31
-#endif
-#ifndefICMP_MOBILE_REDIRECT
-# define   ICMP_MOBILE_REDIRECT32
-#endif
-#ifndefICMP_IPV6_WHEREAREYOU
-# define   ICMP_IPV6_WHEREAREYOU   33
-#endif
-#ifndefICMP_IPV6_IAMHERE
-# define   ICMP_IPV6_IAMHERE   34
-#endif
-#ifndefICMP_MOBILE_REGREQUEST
-# define   ICMP_MOBILE_REGREQUEST  35
-#endif
-#ifndefICMP_MOBILE_REGREPLY
-# define   ICMP_MOBILE_REGREPLY36
-#endif
-#ifndefICMP_SKIP
-# define   ICMP_SKIP   39
-#endif
-#ifndefICMP_PHOTU

svn commit: r349653 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 16:53:59 2019
New Revision: 349653
URL: https://svnweb.freebsd.org/changeset/base/349653

Log:
  MFC r349362:
  
  The definition of icmptypes in ip_compt.h is dead code as it already
  use the icmptypes in ip_icmp.h.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/ip_compat.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_compat.h
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:48:46 
2019(r349652)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_compat.h  Wed Jul  3 16:53:59 
2019(r349653)
@@ -828,159 +828,9 @@ typedef   struct  tcpiphdrtcpiphdr_t;
 #undef IPOPT_AH
 #defineIPOPT_AH256+IPPROTO_AH
 
-#ifndefICMP_MINLEN
-# define   ICMP_MINLEN 8
-#endif
-#ifndefICMP_ECHOREPLY
-# define   ICMP_ECHOREPLY  0
-#endif
-#ifndefICMP_UNREACH
-# define   ICMP_UNREACH3
-#endif
-#ifndefICMP_UNREACH_NET
-# define   ICMP_UNREACH_NET0
-#endif
-#ifndefICMP_UNREACH_HOST
-# define   ICMP_UNREACH_HOST   1
-#endif
-#ifndefICMP_UNREACH_PROTOCOL
-# define   ICMP_UNREACH_PROTOCOL   2
-#endif
-#ifndefICMP_UNREACH_PORT
-# define   ICMP_UNREACH_PORT   3
-#endif
-#ifndefICMP_UNREACH_NEEDFRAG
-# define   ICMP_UNREACH_NEEDFRAG   4
-#endif
-#ifndefICMP_UNREACH_SRCFAIL
-# define   ICMP_UNREACH_SRCFAIL5
-#endif
-#ifndefICMP_UNREACH_NET_UNKNOWN
-# define   ICMP_UNREACH_NET_UNKNOWN6
-#endif
-#ifndefICMP_UNREACH_HOST_UNKNOWN
-# define   ICMP_UNREACH_HOST_UNKNOWN   7
-#endif
-#ifndefICMP_UNREACH_ISOLATED
-# define   ICMP_UNREACH_ISOLATED   8
-#endif
-#ifndefICMP_UNREACH_NET_PROHIB
-# define   ICMP_UNREACH_NET_PROHIB 9
-#endif
-#ifndefICMP_UNREACH_HOST_PROHIB
-# define   ICMP_UNREACH_HOST_PROHIB10
-#endif
-#ifndefICMP_UNREACH_TOSNET
-# define   ICMP_UNREACH_TOSNET 11
-#endif
-#ifndefICMP_UNREACH_TOSHOST
-# define   ICMP_UNREACH_TOSHOST12
-#endif
-#ifndefICMP_UNREACH_ADMIN_PROHIBIT
-# define   ICMP_UNREACH_ADMIN_PROHIBIT 13
-#endif
-#ifndefICMP_UNREACH_FILTER
-# define   ICMP_UNREACH_FILTER 13
-#endif
-#ifndefICMP_UNREACH_HOST_PRECEDENCE
-# define   ICMP_UNREACH_HOST_PRECEDENCE14
-#endif
-#ifndefICMP_UNREACH_PRECEDENCE_CUTOFF
-# define   ICMP_UNREACH_PRECEDENCE_CUTOFF  15
-#endif
-#ifndefICMP_SOURCEQUENCH
-# define   ICMP_SOURCEQUENCH   4
-#endif
-#ifndefICMP_REDIRECT_NET
-# define   ICMP_REDIRECT_NET   0
-#endif
-#ifndefICMP_REDIRECT_HOST
-# define   ICMP_REDIRECT_HOST  1
-#endif
-#ifndefICMP_REDIRECT_TOSNET
-# define   ICMP_REDIRECT_TOSNET2
-#endif
-#ifndefICMP_REDIRECT_TOSHOST
-# define   ICMP_REDIRECT_TOSHOST   3
-#endif
-#ifndefICMP_ALTHOSTADDR
-# define   ICMP_ALTHOSTADDR6
-#endif
-#ifndefICMP_TIMXCEED
-# define   ICMP_TIMXCEED   11
-#endif
-#ifndefICMP_TIMXCEED_INTRANS
-# define   ICMP_TIMXCEED_INTRANS   0
-#endif
-#ifndefICMP_TIMXCEED_REASS
-# define   ICMP_TIMXCEED_REASS 1
-#endif
-#ifndefICMP_PARAMPROB
-# define   ICMP_PARAMPROB  12
-#endif
-#ifndefICMP_PARAMPROB_ERRATPTR
-# define   ICMP_PARAMPROB_ERRATPTR 0
-#endif
-#ifndefICMP_PARAMPROB_OPTABSENT
-# define   ICMP_PARAMPROB_OPTABSENT1
-#endif
-#ifndefICMP_PARAMPROB_LENGTH
-# define   ICMP_PARAMPROB_LENGTH   2
-#endif
-#ifndef ICMP_TSTAMP
-# define   ICMP_TSTAMP 13
-#endif
-#ifndef ICMP_TSTAMPREPLY
-# define   ICMP_TSTAMPREPLY14
-#endif
-#ifndef ICMP_IREQ
-# define   ICMP_IREQ   15
-#endif
-#ifndef ICMP_IREQREPLY
-# define   ICMP_IREQREPLY  16
-#endif
-#ifndefICMP_MASKREQ
-# define   ICMP_MASKREQ17
-#endif
-#ifndef ICMP_MASKREPLY
-# define   ICMP_MASKREPLY  18
-#endif
-#ifndefICMP_TRACEROUTE
-# define   ICMP_TRACEROUTE 30
-#endif
-#ifndefICMP_DATACONVERR
-# define   ICMP_DATACONVERR31
-#endif
-#ifndefICMP_MOBILE_REDIRECT
-# define   ICMP_MOBILE_REDIRECT32
-#endif
-#ifndefICMP_IPV6_WHEREAREYOU
-# define   ICMP_IPV6_WHEREAREYOU   33
-#endif
-#ifndefICMP_IPV6_IAMHERE
-# define   ICMP_IPV6_IAMHERE   34
-#endif
-#ifndefICMP_MOBILE_REGREQUEST
-# define   ICMP_MOBILE_REGREQUEST  35
-#endif
-#ifndefICMP_MOBILE_REGREPLY
-# define   ICMP_MOBILE_REGREPLY36
-#endif
-#ifndefICMP_SKIP
-# define   ICMP_SKIP   39
-#endif
-#ifndefICMP_PHOTU

svn commit: r349654 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 17:04:44 2019
New Revision: 349654
URL: https://svnweb.freebsd.org/changeset/base/349654

Log:
  MFC r349399-349400,349567-349568:
  
  Prompted by r349366, ipfilter is also does not conform to RFC 3128
  by dropping TCP fragments with offset = 1.
  
  In addition to dropping these fragments, add a DTrace probe to allow
  for more detailed monitoring and diagnosis if required.

Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/11/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 16:53:59 
2019(r349653)
+++ stable/11/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:04:44 
2019(r349654)
@@ -1728,6 +1728,10 @@ ipf_pr_ipv4hdr(fin)
 
fi->fi_flx |= FI_FRAG;
off &= IP_OFFMASK;
+   if (off == 1 && p == IPPROTO_TCP) {
+   fin->fin_flx |= FI_SHORT;   /* RFC 3128 */
+   DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin);
+   }
if (off != 0) {
fin->fin_flx |= FI_FRAGBODY;
off <<= 3;
___
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: r349654 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 17:04:44 2019
New Revision: 349654
URL: https://svnweb.freebsd.org/changeset/base/349654

Log:
  MFC r349399-349400,349567-349568:
  
  Prompted by r349366, ipfilter is also does not conform to RFC 3128
  by dropping TCP fragments with offset = 1.
  
  In addition to dropping these fragments, add a DTrace probe to allow
  for more detailed monitoring and diagnosis if required.

Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/12/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 16:53:59 
2019(r349653)
+++ stable/12/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:04:44 
2019(r349654)
@@ -1728,6 +1728,10 @@ ipf_pr_ipv4hdr(fin)
 
fi->fi_flx |= FI_FRAG;
off &= IP_OFFMASK;
+   if (off == 1 && p == IPPROTO_TCP) {
+   fin->fin_flx |= FI_SHORT;   /* RFC 3128 */
+   DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin);
+   }
if (off != 0) {
fin->fin_flx |= FI_FRAGBODY;
off <<= 3;
___
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: r349655 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 17:09:41 2019
New Revision: 349655
URL: https://svnweb.freebsd.org/changeset/base/349655

Log:
  MFC r349401:
  
  While working on PR/238796 I discovered an unused variable in frdest,
  the next hop structure. It is likely this contributes to PR/238796
  though other factors remain to be investigated.
  
  PR:   238796

Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
  stable/11/sys/contrib/ipfilter/netinet/ip_fil.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
  stable/12/sys/contrib/ipfilter/netinet/ip_fil.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/11/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:04:44 
2019(r349654)
+++ stable/11/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:09:41 
2019(r349655)
@@ -7480,10 +7480,6 @@ ipf_resolvedest(softc, base, fdp, v)
}
fdp->fd_ptr = ifp;
 
-   if ((ifp != NULL) && (ifp != (void *)-1)) {
-   fdp->fd_local = ipf_deliverlocal(softc, v, ifp, &fdp->fd_ip6);
-   }
-
return errval;
 }
 

Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h
==
--- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jul  3 17:04:44 
2019(r349654)
+++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jul  3 17:09:41 
2019(r349655)
@@ -560,7 +560,6 @@ typedef struct  frdest  {
addrfamily_tfd_addr;
fr_dtypes_t fd_type;
int fd_name;
-   int fd_local;
 } frdest_t;
 
 #definefd_ip6  fd_addr.adf_addr
___
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: r349655 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 17:09:41 2019
New Revision: 349655
URL: https://svnweb.freebsd.org/changeset/base/349655

Log:
  MFC r349401:
  
  While working on PR/238796 I discovered an unused variable in frdest,
  the next hop structure. It is likely this contributes to PR/238796
  though other factors remain to be investigated.
  
  PR:   238796

Modified:
  stable/12/sys/contrib/ipfilter/netinet/fil.c
  stable/12/sys/contrib/ipfilter/netinet/ip_fil.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/contrib/ipfilter/netinet/fil.c
  stable/11/sys/contrib/ipfilter/netinet/ip_fil.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c
==
--- stable/12/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:04:44 
2019(r349654)
+++ stable/12/sys/contrib/ipfilter/netinet/fil.cWed Jul  3 17:09:41 
2019(r349655)
@@ -7480,10 +7480,6 @@ ipf_resolvedest(softc, base, fdp, v)
}
fdp->fd_ptr = ifp;
 
-   if ((ifp != NULL) && (ifp != (void *)-1)) {
-   fdp->fd_local = ipf_deliverlocal(softc, v, ifp, &fdp->fd_ip6);
-   }
-
return errval;
 }
 

Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h
==
--- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jul  3 17:04:44 
2019(r349654)
+++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Wed Jul  3 17:09:41 
2019(r349655)
@@ -560,7 +560,6 @@ typedef struct  frdest  {
addrfamily_tfd_addr;
fr_dtypes_t fd_type;
int fd_name;
-   int fd_local;
 } frdest_t;
 
 #definefd_ip6  fd_addr.adf_addr
___
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: r349656 - head/usr.sbin/bhyve

2019-07-03 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Wed Jul  3 17:24:24 2019
New Revision: 349656
URL: https://svnweb.freebsd.org/changeset/base/349656

Log:
  bhyve/audio: don't leak resources on failed initialization.
  
  Coverity CID: 1402793
  Approved by:  markj, jhb, bhyve
  Differential Revision:https://reviews.freebsd.org/D20841

Modified:
  head/usr.sbin/bhyve/audio.c

Modified: head/usr.sbin/bhyve/audio.c
==
--- head/usr.sbin/bhyve/audio.c Wed Jul  3 17:09:41 2019(r349655)
+++ head/usr.sbin/bhyve/audio.c Wed Jul  3 17:24:24 2019(r349656)
@@ -103,6 +103,7 @@ audio_init(const char *dev_name, uint8_t dir)
if (aud->fd == -1) {
DPRINTF("Failed to open dev: %s, errno: %d\n",
aud->dev_name, errno);
+   free(aud);
return (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: r349657 - stable/12/sys/dev/nand

2019-07-03 Thread Ed Maste
Author: emaste
Date: Wed Jul  3 17:34:26 2019
New Revision: 349657
URL: https://svnweb.freebsd.org/changeset/base/349657

Log:
  MFC r349268: nandsim: correct test to avoid out-of-bounds access
  
  Previously nandsim_chip_status returned EINVAL iff both of user-provided
  chip->ctrl_num and chip->num were out of bounds.  If only one failed the
  bounds check arbitrary memory would be read and returned.
  
  The NAND framework is not built by default, nandsim is not intended for
  production use (it is a simulator), and the nandsim device has root-only
  permissions.
  
  admbugs:  827
  Reported by:  Daniel Hodson of elttam
  Security: kernel information leak or DoS
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/dev/nand/nandsim.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nand/nandsim.c
==
--- stable/12/sys/dev/nand/nandsim.cWed Jul  3 17:24:24 2019
(r349656)
+++ stable/12/sys/dev/nand/nandsim.cWed Jul  3 17:34:26 2019
(r349657)
@@ -295,7 +295,7 @@ nandsim_chip_status(struct sim_chip *chip)
nand_debug(NDBG_SIM,"status for chip num:%d at ctrl:%d", chip->num,
chip->ctrl_num);
 
-   if (chip->ctrl_num >= MAX_SIM_DEV &&
+   if (chip->ctrl_num >= MAX_SIM_DEV ||
chip->num >= MAX_CTRL_CS)
return (EINVAL);
 
___
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: r349658 - stable/11/sys/dev/nand

2019-07-03 Thread Ed Maste
Author: emaste
Date: Wed Jul  3 17:35:23 2019
New Revision: 349658
URL: https://svnweb.freebsd.org/changeset/base/349658

Log:
  MFC r349268: nandsim: correct test to avoid out-of-bounds access
  
  Previously nandsim_chip_status returned EINVAL iff both of user-provided
  chip->ctrl_num and chip->num were out of bounds.  If only one failed the
  bounds check arbitrary memory would be read and returned.
  
  The NAND framework is not built by default, nandsim is not intended for
  production use (it is a simulator), and the nandsim device has root-only
  permissions.
  
  admbugs:  827
  Reported by:  Daniel Hodson of elttam
  Security: kernel information leak or DoS
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/sys/dev/nand/nandsim.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/nand/nandsim.c
==
--- stable/11/sys/dev/nand/nandsim.cWed Jul  3 17:34:26 2019
(r349657)
+++ stable/11/sys/dev/nand/nandsim.cWed Jul  3 17:35:23 2019
(r349658)
@@ -293,7 +293,7 @@ nandsim_chip_status(struct sim_chip *chip)
nand_debug(NDBG_SIM,"status for chip num:%d at ctrl:%d", chip->num,
chip->ctrl_num);
 
-   if (chip->ctrl_num >= MAX_SIM_DEV &&
+   if (chip->ctrl_num >= MAX_SIM_DEV ||
chip->num >= MAX_CTRL_CS)
return (EINVAL);
 
___
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: r349659 - in stable: 10/contrib/ipfilter/man 11/contrib/ipfilter/man 12/contrib/ipfilter/man

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 18:11:22 2019
New Revision: 349659
URL: https://svnweb.freebsd.org/changeset/base/349659

Log:
  MFC r349448:
  
  Fix a typo.
  
  PR/238816 initially addressed updates to usage() however it has now
  become a shopping list of fixes to ipmon man pages and usage().
  
  PR:   238816

Modified:
  stable/10/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/man/ipmon.8
  stable/12/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/contrib/ipfilter/man/ipmon.8
==
--- stable/10/contrib/ipfilter/man/ipmon.8  Wed Jul  3 17:35:23 2019
(r349658)
+++ stable/10/contrib/ipfilter/man/ipmon.8  Wed Jul  3 18:11:22 2019
(r349659)
@@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets
 .LP
 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
 the packet filter.  The binary data read from the device is reprinted in
-human readable for, however, IP#'s are not mapped back to hostnames, nor are
+human readable form, however, IP#'s are not mapped back to hostnames, nor are
 ports mapped back to service names.  The output goes to standard output by
 default or a filename, if given on the command line.  Should the \fB\-s\fP
 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
___
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: r349659 - in stable: 10/contrib/ipfilter/man 11/contrib/ipfilter/man 12/contrib/ipfilter/man

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 18:11:22 2019
New Revision: 349659
URL: https://svnweb.freebsd.org/changeset/base/349659

Log:
  MFC r349448:
  
  Fix a typo.
  
  PR/238816 initially addressed updates to usage() however it has now
  become a shopping list of fixes to ipmon man pages and usage().
  
  PR:   238816

Modified:
  stable/12/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/man/ipmon.8
  stable/11/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/man/ipmon.8
==
--- stable/12/contrib/ipfilter/man/ipmon.8  Wed Jul  3 17:35:23 2019
(r349658)
+++ stable/12/contrib/ipfilter/man/ipmon.8  Wed Jul  3 18:11:22 2019
(r349659)
@@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets
 .LP
 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
 the packet filter.  The binary data read from the device is reprinted in
-human readable for, however, IP#'s are not mapped back to hostnames, nor are
+human readable form, however, IP#'s are not mapped back to hostnames, nor are
 ports mapped back to service names.  The output goes to standard output by
 default or a filename, if given on the command line.  Should the \fB\-s\fP
 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
___
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: r349659 - in stable: 10/contrib/ipfilter/man 11/contrib/ipfilter/man 12/contrib/ipfilter/man

2019-07-03 Thread Cy Schubert
Author: cy
Date: Wed Jul  3 18:11:22 2019
New Revision: 349659
URL: https://svnweb.freebsd.org/changeset/base/349659

Log:
  MFC r349448:
  
  Fix a typo.
  
  PR/238816 initially addressed updates to usage() however it has now
  become a shopping list of fixes to ipmon man pages and usage().
  
  PR:   238816

Modified:
  stable/11/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/man/ipmon.8
  stable/12/contrib/ipfilter/man/ipmon.8
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/man/ipmon.8
==
--- stable/11/contrib/ipfilter/man/ipmon.8  Wed Jul  3 17:35:23 2019
(r349658)
+++ stable/11/contrib/ipfilter/man/ipmon.8  Wed Jul  3 18:11:22 2019
(r349659)
@@ -27,7 +27,7 @@ ipmon \- monitors /dev/ipl for logged packets
 .LP
 \fBipmon\fP opens \fB/dev/ipl\fP for reading and awaits data to be saved from
 the packet filter.  The binary data read from the device is reprinted in
-human readable for, however, IP#'s are not mapped back to hostnames, nor are
+human readable form, however, IP#'s are not mapped back to hostnames, nor are
 ports mapped back to service names.  The output goes to standard output by
 default or a filename, if given on the command line.  Should the \fB\-s\fP
 option be used, output is instead sent to \fBsyslogd(8)\fP.  Messages sent
___
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: r349660 - stable/12/sys/fs/cuse

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:14:00 2019
New Revision: 349660
URL: https://svnweb.freebsd.org/changeset/base/349660

Log:
  MFC r349367:
  Fix for deadlock situation in cuse(3)
  
  The final server unref should be done by the server thread to prevent
  deadlock in the client cdevpriv destructor, which cannot destroy
  itself.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/fs/cuse/cuse.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/cuse/cuse.c
==
--- stable/12/sys/fs/cuse/cuse.cWed Jul  3 18:11:22 2019
(r349659)
+++ stable/12/sys/fs/cuse/cuse.cWed Jul  3 18:14:00 2019
(r349660)
@@ -699,12 +699,38 @@ cuse_server_unref(struct cuse_server *pcs)
free(pcs, M_CUSE);
 }
 
+static int
+cuse_server_do_close(struct cuse_server *pcs)
+{
+   int retval;
+
+   cuse_lock();
+   cuse_server_is_closing(pcs);
+   /* final client wakeup, if any */
+   cuse_server_wakeup_all_client_locked(pcs);
+
+   knlist_clear(&pcs->selinfo.si_note, 1);
+
+   retval = pcs->refs;
+   cuse_unlock();
+
+   return (retval);
+}
+
 static void
 cuse_server_free(void *arg)
 {
struct cuse_server *pcs = arg;
 
-   /* drop refcount */
+   /*
+* The final server unref should be done by the server thread
+* to prevent deadlock in the client cdevpriv destructor,
+* which cannot destroy itself.
+*/
+   while (cuse_server_do_close(pcs) != 1)
+   pause("W", hz);
+
+   /* drop final refcount */
cuse_server_unref(pcs);
 }
 
@@ -746,21 +772,10 @@ static int
 cuse_server_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
 {
struct cuse_server *pcs;
-   int error;
 
-   error = cuse_server_get(&pcs);
-   if (error != 0)
-   goto done;
+   if (cuse_server_get(&pcs) == 0)
+   cuse_server_do_close(pcs);
 
-   cuse_lock();
-   cuse_server_is_closing(pcs);
-   /* final client wakeup, if any */
-   cuse_server_wakeup_all_client_locked(pcs);
-
-   knlist_clear(&pcs->selinfo.si_note, 1);
-   cuse_unlock();
-
-done:
return (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: r349661 - stable/11/sys/fs/cuse

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:15:00 2019
New Revision: 349661
URL: https://svnweb.freebsd.org/changeset/base/349661

Log:
  MFC r349367:
  Fix for deadlock situation in cuse(3)
  
  The final server unref should be done by the server thread to prevent
  deadlock in the client cdevpriv destructor, which cannot destroy
  itself.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/fs/cuse/cuse.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/cuse/cuse.c
==
--- stable/11/sys/fs/cuse/cuse.cWed Jul  3 18:14:00 2019
(r349660)
+++ stable/11/sys/fs/cuse/cuse.cWed Jul  3 18:15:00 2019
(r349661)
@@ -701,12 +701,38 @@ cuse_server_unref(struct cuse_server *pcs)
free(pcs, M_CUSE);
 }
 
+static int
+cuse_server_do_close(struct cuse_server *pcs)
+{
+   int retval;
+
+   cuse_lock();
+   cuse_server_is_closing(pcs);
+   /* final client wakeup, if any */
+   cuse_server_wakeup_all_client_locked(pcs);
+
+   knlist_clear(&pcs->selinfo.si_note, 1);
+
+   retval = pcs->refs;
+   cuse_unlock();
+
+   return (retval);
+}
+
 static void
 cuse_server_free(void *arg)
 {
struct cuse_server *pcs = arg;
 
-   /* drop refcount */
+   /*
+* The final server unref should be done by the server thread
+* to prevent deadlock in the client cdevpriv destructor,
+* which cannot destroy itself.
+*/
+   while (cuse_server_do_close(pcs) != 1)
+   pause("W", hz);
+
+   /* drop final refcount */
cuse_server_unref(pcs);
 }
 
@@ -748,21 +774,10 @@ static int
 cuse_server_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
 {
struct cuse_server *pcs;
-   int error;
 
-   error = cuse_server_get(&pcs);
-   if (error != 0)
-   goto done;
+   if (cuse_server_get(&pcs) == 0)
+   cuse_server_do_close(pcs);
 
-   cuse_lock();
-   cuse_server_is_closing(pcs);
-   /* final client wakeup, if any */
-   cuse_server_wakeup_all_client_locked(pcs);
-
-   knlist_clear(&pcs->selinfo.si_note, 1);
-   cuse_unlock();
-
-done:
return (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: r349662 - stable/12/sys/fs/cuse

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:16:10 2019
New Revision: 349662
URL: https://svnweb.freebsd.org/changeset/base/349662

Log:
  MFC r349368:
  Free all allocated unit IDs in cuse(3) after the client character
  devices have been destroyed to avoid creating character devices with
  identical name.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/fs/cuse/cuse.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/cuse/cuse.c
==
--- stable/12/sys/fs/cuse/cuse.cWed Jul  3 18:15:00 2019
(r349661)
+++ stable/12/sys/fs/cuse/cuse.cWed Jul  3 18:16:10 2019
(r349662)
@@ -671,14 +671,14 @@ cuse_server_unref(struct cuse_server *pcs)
 
TAILQ_REMOVE(&cuse_server_head, pcs, entry);
 
-   cuse_free_unit_by_id_locked(pcs, -1);
-
while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) {
TAILQ_REMOVE(&pcs->hdev, pcsd, entry);
cuse_unlock();
cuse_server_free_dev(pcsd);
cuse_lock();
}
+
+   cuse_free_unit_by_id_locked(pcs, -1);
 
while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) {
TAILQ_REMOVE(&pcs->hmem, mem, entry);
___
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: r349663 - stable/11/sys/fs/cuse

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:16:52 2019
New Revision: 349663
URL: https://svnweb.freebsd.org/changeset/base/349663

Log:
  MFC r349368:
  Free all allocated unit IDs in cuse(3) after the client character
  devices have been destroyed to avoid creating character devices with
  identical name.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/fs/cuse/cuse.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/cuse/cuse.c
==
--- stable/11/sys/fs/cuse/cuse.cWed Jul  3 18:16:10 2019
(r349662)
+++ stable/11/sys/fs/cuse/cuse.cWed Jul  3 18:16:52 2019
(r349663)
@@ -673,14 +673,14 @@ cuse_server_unref(struct cuse_server *pcs)
 
TAILQ_REMOVE(&cuse_server_head, pcs, entry);
 
-   cuse_free_unit_by_id_locked(pcs, -1);
-
while ((pcsd = TAILQ_FIRST(&pcs->hdev)) != NULL) {
TAILQ_REMOVE(&pcs->hdev, pcsd, entry);
cuse_unlock();
cuse_server_free_dev(pcsd);
cuse_lock();
}
+
+   cuse_free_unit_by_id_locked(pcs, -1);
 
while ((mem = TAILQ_FIRST(&pcs->hmem)) != NULL) {
TAILQ_REMOVE(&pcs->hmem, mem, entry);
___
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: r349664 - stable/12/usr.sbin/usbdump

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:18:05 2019
New Revision: 349664
URL: https://svnweb.freebsd.org/changeset/base/349664

Log:
  MFC r349370:
  Fix parsing of corrupt data in usbdump(8). Check that the transfer
  type array lookup is within bounds to avoid segfault.
  
  PR:   238801
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/usr.sbin/usbdump/usbdump.c
==
--- stable/12/usr.sbin/usbdump/usbdump.cWed Jul  3 18:16:52 2019
(r349663)
+++ stable/12/usr.sbin/usbdump/usbdump.cWed Jul  3 18:18:05 2019
(r349664)
@@ -149,7 +149,9 @@ static const char *errstr_table[USB_ERR_MAX] = {
[USB_ERR_NOT_LOCKED]= "NOT_LOCKED",
 };
 
-static const char *xfertype_table[4] = {
+#defineUSB_XFERTYPE_MAX 4
+
+static const char *xfertype_table[USB_XFERTYPE_MAX] = {
[UE_CONTROL]= "CTRL",
[UE_ISOCHRONOUS]= "ISOC",
[UE_BULK]   = "BULK",
@@ -320,6 +322,15 @@ usb_speedstr(uint8_t speed)
return (speed_table[speed]);
 }
 
+static const char *
+usb_xferstr(uint8_t type)
+{
+   if (type >= USB_XFERTYPE_MAX  || xfertype_table[type] == NULL)
+   return ("UNKN");
+   else
+   return (xfertype_table[type]);
+}
+
 static void
 print_flags(uint32_t flags)
 {
@@ -496,7 +507,7 @@ print_apacket(const struct header_32 *hdr, const uint8
(int)len, buf, tv.tv_usec,
(int)up->up_busunit, (int)up->up_address,
(up->up_type == USBPF_XFERTAP_SUBMIT) ? "SUBM" : "DONE",
-   xfertype_table[up->up_xfertype],
+   usb_xferstr(up->up_xfertype),
(unsigned int)up->up_endpoint,
usb_speedstr(up->up_speed),
(int)up->up_frames,
___
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: r349665 - stable/11/usr.sbin/usbdump

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:18:42 2019
New Revision: 349665
URL: https://svnweb.freebsd.org/changeset/base/349665

Log:
  MFC r349370:
  Fix parsing of corrupt data in usbdump(8). Check that the transfer
  type array lookup is within bounds to avoid segfault.
  
  PR:   238801
  Sponsored by: Mellanox Technologies

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

Modified: stable/11/usr.sbin/usbdump/usbdump.c
==
--- stable/11/usr.sbin/usbdump/usbdump.cWed Jul  3 18:18:05 2019
(r349664)
+++ stable/11/usr.sbin/usbdump/usbdump.cWed Jul  3 18:18:42 2019
(r349665)
@@ -149,7 +149,9 @@ static const char *errstr_table[USB_ERR_MAX] = {
[USB_ERR_NOT_LOCKED]= "NOT_LOCKED",
 };
 
-static const char *xfertype_table[4] = {
+#defineUSB_XFERTYPE_MAX 4
+
+static const char *xfertype_table[USB_XFERTYPE_MAX] = {
[UE_CONTROL]= "CTRL",
[UE_ISOCHRONOUS]= "ISOC",
[UE_BULK]   = "BULK",
@@ -320,6 +322,15 @@ usb_speedstr(uint8_t speed)
return (speed_table[speed]);
 }
 
+static const char *
+usb_xferstr(uint8_t type)
+{
+   if (type >= USB_XFERTYPE_MAX  || xfertype_table[type] == NULL)
+   return ("UNKN");
+   else
+   return (xfertype_table[type]);
+}
+
 static void
 print_flags(uint32_t flags)
 {
@@ -496,7 +507,7 @@ print_apacket(const struct header_32 *hdr, const uint8
(int)len, buf, tv.tv_usec,
(int)up->up_busunit, (int)up->up_address,
(up->up_type == USBPF_XFERTAP_SUBMIT) ? "SUBM" : "DONE",
-   xfertype_table[up->up_xfertype],
+   usb_xferstr(up->up_xfertype),
(unsigned int)up->up_endpoint,
usb_speedstr(up->up_speed),
(int)up->up_frames,
___
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: r349666 - stable/10/usr.sbin/usbdump

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:19:29 2019
New Revision: 349666
URL: https://svnweb.freebsd.org/changeset/base/349666

Log:
  MFC r349370:
  Fix parsing of corrupt data in usbdump(8). Check that the transfer
  type array lookup is within bounds to avoid segfault.
  
  PR:   238801
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/usr.sbin/usbdump/usbdump.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/usbdump/usbdump.c
==
--- stable/10/usr.sbin/usbdump/usbdump.cWed Jul  3 18:18:42 2019
(r349665)
+++ stable/10/usr.sbin/usbdump/usbdump.cWed Jul  3 18:19:29 2019
(r349666)
@@ -148,7 +148,9 @@ static const char *errstr_table[USB_ERR_MAX] = {
[USB_ERR_NOT_LOCKED]= "NOT_LOCKED",
 };
 
-static const char *xfertype_table[4] = {
+#defineUSB_XFERTYPE_MAX 4
+
+static const char *xfertype_table[USB_XFERTYPE_MAX] = {
[UE_CONTROL]= "CTRL",
[UE_ISOCHRONOUS]= "ISOC",
[UE_BULK]   = "BULK",
@@ -319,6 +321,15 @@ usb_speedstr(uint8_t speed)
return (speed_table[speed]);
 }
 
+static const char *
+usb_xferstr(uint8_t type)
+{
+   if (type >= USB_XFERTYPE_MAX  || xfertype_table[type] == NULL)
+   return ("UNKN");
+   else
+   return (xfertype_table[type]);
+}
+
 static void
 print_flags(uint32_t flags)
 {
@@ -495,7 +506,7 @@ print_apacket(const struct header_32 *hdr, const uint8
(int)len, buf, tv.tv_usec,
(int)up->up_busunit, (int)up->up_address,
(up->up_type == USBPF_XFERTAP_SUBMIT) ? "SUBM" : "DONE",
-   xfertype_table[up->up_xfertype],
+   usb_xferstr(up->up_xfertype),
(unsigned int)up->up_endpoint,
usb_speedstr(up->up_speed),
(int)up->up_frames,
___
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: r349667 - stable/12/lib/libusb

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:23:36 2019
New Revision: 349667
URL: https://svnweb.freebsd.org/changeset/base/349667

Log:
  MFC r349409 and r349410:
  Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
  devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
  flag. Make sure when the flag is not specified no arrival events are
  generated for currently enumerated devices.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/lib/libusb/libusb10.h
  stable/12/lib/libusb/libusb10_hotplug.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libusb/libusb10.h
==
--- stable/12/lib/libusb/libusb10.h Wed Jul  3 18:19:29 2019
(r349666)
+++ stable/12/lib/libusb/libusb10.h Wed Jul  3 18:23:36 2019
(r349667)
@@ -89,6 +89,8 @@ struct libusb_hotplug_callback_handle_struct {
void *user_data;
 };
 
+TAILQ_HEAD(libusb_device_head, libusb_device);
+
 struct libusb_context {
int debug;
int debug_fixed;
@@ -106,7 +108,7 @@ struct libusb_context {
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
TAILQ_HEAD(, libusb_super_transfer) tr_done;
TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh;
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
 
struct libusb_super_pollfd ctx_poll;
 

Modified: stable/12/lib/libusb/libusb10_hotplug.c
==
--- stable/12/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:19:29 2019
(r349666)
+++ stable/12/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:23:36 2019
(r349667)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotp
return (pcbh->fn(ctx, dev, event, pcbh->user_data));
 }
 
+static int
+libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead)
+{
+   libusb_device **ppdev;
+   ssize_t count;
+   ssize_t x;
+
+   count = libusb_get_device_list(ctx, &ppdev);
+   if (count < 0)
+   return (-1);
+
+   for (x = 0; x != count; x++)
+   TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry);
+
+   libusb_free_device_list(ppdev, 0);
+   return (0);
+}
+
 static void *
 libusb_hotplug_scan(void *arg)
 {
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
libusb_hotplug_callback_handle acbh;
libusb_hotplug_callback_handle bcbh;
libusb_context *ctx = arg;
-   libusb_device **ppdev;
libusb_device *temp;
libusb_device *adev;
libusb_device *bdev;
unsigned do_loop = 1;
-   ssize_t count;
-   ssize_t x;
 
while (do_loop) {
usleep(400);
@@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg)
TAILQ_INIT(&hotplug_devs);
 
if (ctx->hotplug_handler != NO_THREAD) {
-   count = libusb_get_device_list(ctx, &ppdev);
-   if (count < 0)
+   if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
continue;
-   for (x = 0; x != count; x++) {
-   TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x],
-   hotplug_entry);
-   }
-   libusb_free_device_list(ppdev, 0);
} else {
do_loop = 0;
}
@@ -191,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *c
 
HOTPLUG_LOCK(ctx);
if (ctx->hotplug_handler == NO_THREAD) {
+   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
+
if (pthread_create(&ctx->hotplug_handler, NULL,
&libusb_hotplug_scan, ctx) != 0)
ctx->hotplug_handler = NO_THREAD;
___
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: r349668 - stable/11/lib/libusb

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:25:05 2019
New Revision: 349668
URL: https://svnweb.freebsd.org/changeset/base/349668

Log:
  MFC r349409 and r349410:
  Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
  devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
  flag. Make sure when the flag is not specified no arrival events are
  generated for currently enumerated devices.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/lib/libusb/libusb10.h
  stable/11/lib/libusb/libusb10_hotplug.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libusb/libusb10.h
==
--- stable/11/lib/libusb/libusb10.h Wed Jul  3 18:23:36 2019
(r349667)
+++ stable/11/lib/libusb/libusb10.h Wed Jul  3 18:25:05 2019
(r349668)
@@ -87,6 +87,8 @@ struct libusb_hotplug_callback_handle_struct {
void *user_data;
 };
 
+TAILQ_HEAD(libusb_device_head, libusb_device);
+
 struct libusb_context {
int debug;
int debug_fixed;
@@ -104,7 +106,7 @@ struct libusb_context {
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
TAILQ_HEAD(, libusb_super_transfer) tr_done;
TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh;
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
 
struct libusb_super_pollfd ctx_poll;
 

Modified: stable/11/lib/libusb/libusb10_hotplug.c
==
--- stable/11/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:23:36 2019
(r349667)
+++ stable/11/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:25:05 2019
(r349668)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotp
return (pcbh->fn(ctx, dev, event, pcbh->user_data));
 }
 
+static int
+libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead)
+{
+   libusb_device **ppdev;
+   ssize_t count;
+   ssize_t x;
+
+   count = libusb_get_device_list(ctx, &ppdev);
+   if (count < 0)
+   return (-1);
+
+   for (x = 0; x != count; x++)
+   TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry);
+
+   libusb_free_device_list(ppdev, 0);
+   return (0);
+}
+
 static void *
 libusb_hotplug_scan(void *arg)
 {
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
libusb_hotplug_callback_handle acbh;
libusb_hotplug_callback_handle bcbh;
libusb_context *ctx = arg;
-   libusb_device **ppdev;
libusb_device *temp;
libusb_device *adev;
libusb_device *bdev;
unsigned do_loop = 1;
-   ssize_t count;
-   ssize_t x;
 
while (do_loop) {
usleep(400);
@@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg)
TAILQ_INIT(&hotplug_devs);
 
if (ctx->hotplug_handler != NO_THREAD) {
-   count = libusb_get_device_list(ctx, &ppdev);
-   if (count < 0)
+   if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
continue;
-   for (x = 0; x != count; x++) {
-   TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x],
-   hotplug_entry);
-   }
-   libusb_free_device_list(ppdev, 0);
} else {
do_loop = 0;
}
@@ -191,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *c
 
HOTPLUG_LOCK(ctx);
if (ctx->hotplug_handler == NO_THREAD) {
+   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
+
if (pthread_create(&ctx->hotplug_handler, NULL,
&libusb_hotplug_scan, ctx) != 0)
ctx->hotplug_handler = NO_THREAD;
___
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: r349669 - stable/10/lib/libusb

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:26:07 2019
New Revision: 349669
URL: https://svnweb.freebsd.org/changeset/base/349669

Log:
  MFC r349409 and r349410:
  Fix support for LIBUSB_HOTPLUG_ENUMERATE in libusb. Currently all
  devices are enumerated regardless of of the LIBUSB_HOTPLUG_ENUMERATE
  flag. Make sure when the flag is not specified no arrival events are
  generated for currently enumerated devices.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/lib/libusb/libusb10.h
  stable/10/lib/libusb/libusb10_hotplug.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libusb/libusb10.h
==
--- stable/10/lib/libusb/libusb10.h Wed Jul  3 18:25:05 2019
(r349668)
+++ stable/10/lib/libusb/libusb10.h Wed Jul  3 18:26:07 2019
(r349669)
@@ -87,6 +87,8 @@ struct libusb_hotplug_callback_handle_struct {
void *user_data;
 };
 
+TAILQ_HEAD(libusb_device_head, libusb_device);
+
 struct libusb_context {
int debug;
int debug_fixed;
@@ -104,7 +106,7 @@ struct libusb_context {
TAILQ_HEAD(, libusb_super_pollfd) pollfds;
TAILQ_HEAD(, libusb_super_transfer) tr_done;
TAILQ_HEAD(, libusb_hotplug_callback_handle_struct) hotplug_cbh;
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
 
struct libusb_super_pollfd ctx_poll;
 

Modified: stable/10/lib/libusb/libusb10_hotplug.c
==
--- stable/10/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:25:05 2019
(r349668)
+++ stable/10/lib/libusb/libusb10_hotplug.c Wed Jul  3 18:26:07 2019
(r349669)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2016 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2016-2019 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -85,20 +85,35 @@ libusb_hotplug_filter(libusb_context *ctx, libusb_hotp
return (pcbh->fn(ctx, dev, event, pcbh->user_data));
 }
 
+static int
+libusb_hotplug_enumerate(libusb_context *ctx, struct libusb_device_head *phead)
+{
+   libusb_device **ppdev;
+   ssize_t count;
+   ssize_t x;
+
+   count = libusb_get_device_list(ctx, &ppdev);
+   if (count < 0)
+   return (-1);
+
+   for (x = 0; x != count; x++)
+   TAILQ_INSERT_TAIL(phead, ppdev[x], hotplug_entry);
+
+   libusb_free_device_list(ppdev, 0);
+   return (0);
+}
+
 static void *
 libusb_hotplug_scan(void *arg)
 {
-   TAILQ_HEAD(, libusb_device) hotplug_devs;
+   struct libusb_device_head hotplug_devs;
libusb_hotplug_callback_handle acbh;
libusb_hotplug_callback_handle bcbh;
libusb_context *ctx = arg;
-   libusb_device **ppdev;
libusb_device *temp;
libusb_device *adev;
libusb_device *bdev;
unsigned do_loop = 1;
-   ssize_t count;
-   ssize_t x;
 
while (do_loop) {
usleep(400);
@@ -108,14 +123,8 @@ libusb_hotplug_scan(void *arg)
TAILQ_INIT(&hotplug_devs);
 
if (ctx->hotplug_handler != NO_THREAD) {
-   count = libusb_get_device_list(ctx, &ppdev);
-   if (count < 0)
+   if (libusb_hotplug_enumerate(ctx, &hotplug_devs) < 0)
continue;
-   for (x = 0; x != count; x++) {
-   TAILQ_INSERT_TAIL(&hotplug_devs, ppdev[x],
-   hotplug_entry);
-   }
-   libusb_free_device_list(ppdev, 0);
} else {
do_loop = 0;
}
@@ -191,6 +200,8 @@ int libusb_hotplug_register_callback(libusb_context *c
 
HOTPLUG_LOCK(ctx);
if (ctx->hotplug_handler == NO_THREAD) {
+   libusb_hotplug_enumerate(ctx, &ctx->hotplug_devs);
+
if (pthread_create(&ctx->hotplug_handler, NULL,
&libusb_hotplug_scan, ctx) != 0)
ctx->hotplug_handler = NO_THREAD;
___
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: r349670 - stable/12/sys/dev/pci

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 18:29:18 2019
New Revision: 349670
URL: https://svnweb.freebsd.org/changeset/base/349670

Log:
  MFC r349522:
  Need to apply the PCIM_BAR_MEM_BASE mask to the physical memory
  address before returning it to the user. Some of the least significant
  bits have special meaning and should be masked away.
  
  Discussed with:   kib@
  Sponsored by: Mellanox Technologies

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

Modified: stable/12/sys/dev/pci/pci_user.c
==
--- stable/12/sys/dev/pci/pci_user.cWed Jul  3 18:26:07 2019
(r349669)
+++ stable/12/sys/dev/pci/pci_user.cWed Jul  3 18:29:18 2019
(r349670)
@@ -855,6 +855,7 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm
struct thread *td;
struct sglist *sg;
struct pci_map *pm;
+   vm_paddr_t membase;
vm_paddr_t pbase;
vm_size_t plen;
vm_offset_t addr;
@@ -877,8 +878,9 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm
return (EBUSY); /* XXXKIB enable if _ACTIVATE */
if (!PCI_BAR_MEM(pm->pm_value))
return (EIO);
-   pbase = trunc_page(pm->pm_value);
-   plen = round_page(pm->pm_value + ((pci_addr_t)1 << pm->pm_size)) -
+   membase = pm->pm_value & PCIM_BAR_MEM_BASE;
+   pbase = trunc_page(membase);
+   plen = round_page(membase + ((pci_addr_t)1 << pm->pm_size)) -
pbase;
prot = VM_PROT_READ | (((pbm->pbm_flags & PCIIO_BAR_MMAP_RW) != 0) ?
VM_PROT_WRITE : 0);
@@ -910,7 +912,7 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm
}
pbm->pbm_map_base = (void *)addr;
pbm->pbm_map_length = plen;
-   pbm->pbm_bar_off = pm->pm_value - pbase;
+   pbm->pbm_bar_off = membase - pbase;
pbm->pbm_bar_length = (pci_addr_t)1 << pm->pm_size;
 
 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: r349671 - head/sys/vm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 18:46:39 2019
New Revision: 349671
URL: https://svnweb.freebsd.org/changeset/base/349671

Log:
  Cache the next queue element when traversing a page queue.
  
  When QUEUE_MACRO_DEBUG_TRASH is configured, removing a queue element
  invalidates its queue linkage pointers.  vm_pageout_collect_batch()
  was relying on these pointers remaining valid after a removal, so
  modify it to fetch the next queued page before dequeuing the current
  page.
  
  Submitted by: Don Morris 
  Reviewed by:  cem, vangyzen
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20842

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cWed Jul  3 18:29:18 2019(r349670)
+++ head/sys/vm/vm_pageout.cWed Jul  3 18:46:39 2019(r349671)
@@ -266,7 +266,7 @@ static __always_inline void
 vm_pageout_collect_batch(struct scan_state *ss, const bool dequeue)
 {
struct vm_pagequeue *pq;
-   vm_page_t m, marker;
+   vm_page_t m, marker, n;
 
marker = ss->marker;
pq = ss->pq;
@@ -277,7 +277,8 @@ vm_pageout_collect_batch(struct scan_state *ss, const 
vm_pagequeue_lock(pq);
for (m = TAILQ_NEXT(marker, plinks.q); m != NULL &&
ss->scanned < ss->maxscan && ss->bq.bq_cnt < VM_BATCHQUEUE_SIZE;
-   m = TAILQ_NEXT(m, plinks.q), ss->scanned++) {
+   m = n, ss->scanned++) {
+   n = TAILQ_NEXT(m, plinks.q);
if ((m->flags & PG_MARKER) == 0) {
KASSERT((m->aflags & PGA_ENQUEUED) != 0,
("page %p not enqueued", m));
___
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: r349672 - stable/12/sys/powerpc/powerpc

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 18:53:04 2019
New Revision: 349672
URL: https://svnweb.freebsd.org/changeset/base/349672

Log:
  MFC r344958,r344960,r344961
  
  r344958: powerpc: Print data address register on alignment exceptions
  r344960: powerpc: Print trap frame address for fatal traps
  r344961: powerpc: Print trap frame address in ddb backtraces

Modified:
  stable/12/sys/powerpc/powerpc/db_trace.c
  stable/12/sys/powerpc/powerpc/trap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/powerpc/db_trace.c
==
--- stable/12/sys/powerpc/powerpc/db_trace.cWed Jul  3 18:46:39 2019
(r349671)
+++ stable/12/sys/powerpc/powerpc/db_trace.cWed Jul  3 18:53:04 2019
(r349672)
@@ -276,7 +276,7 @@ db_backtrace(struct thread *td, db_addr_t fp, int coun
if (tf->exc == EXC_DSI)
db_printf(" sr=%#x",
(uint32_t)tf->cpu.aim.dsisr);
-   db_printf("\n");
+   db_printf(" frame=%p\n", tf);
stackframe = (db_addr_t) tf->fixreg[1];
if (kernel_only && (tf->srr1 & PSL_PR))
break;

Modified: stable/12/sys/powerpc/powerpc/trap.c
==
--- stable/12/sys/powerpc/powerpc/trap.cWed Jul  3 18:46:39 2019
(r349671)
+++ stable/12/sys/powerpc/powerpc/trap.cWed Jul  3 18:53:04 2019
(r349672)
@@ -515,6 +515,7 @@ printtrap(u_int vector, struct trapframe *frame, int i
case EXC_DSE:
case EXC_DSI:
case EXC_DTMISS:
+   case EXC_ALI:
printf("   virtual address = 0x%" PRIxPTR "\n", frame->dar);
break;
case EXC_ISE:
@@ -532,6 +533,7 @@ printtrap(u_int vector, struct trapframe *frame, int i
printf("   current msr = 0x%" PRIxPTR "\n", mfmsr());
printf("   lr  = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n",
frame->lr, frame->lr - (register_t)(__startkernel - KERNBASE));
+   printf("   frame   = %p\n", frame);
printf("   curthread   = %p\n", curthread);
if (curthread != NULL)
printf("  pid = %d, comm = %s\n",
___
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: r349673 - in stable/12/sys/powerpc: include powerpc

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 19:01:41 2019
New Revision: 349673
URL: https://svnweb.freebsd.org/changeset/base/349673

Log:
  MFC r345829,345831,349402
  
  r345829: powerpc: Apply r178139 from sparc64 to powerpc's fpu_sqrt
  r345831: powerpc: Allow emulating optional FPU instructions on CPUs with an 
FPU
  r349402: powerpc/booke: Handle misaligned floating point loads/stores as on 
AIM

Modified:
  stable/12/sys/powerpc/include/trap.h
  stable/12/sys/powerpc/powerpc/trap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/include/trap.h
==
--- stable/12/sys/powerpc/include/trap.hWed Jul  3 18:53:04 2019
(r349672)
+++ stable/12/sys/powerpc/include/trap.hWed Jul  3 19:01:41 2019
(r349673)
@@ -127,7 +127,7 @@
 /* Macros to extract register information */
 #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f)   /* source or target */
 #define EXC_ALI_RA(dsisr) (dsisr & 0x1f)
-#defineEXC_ALI_SPE_REG(instr)  ((instr >> 21) & 0x1f)
+#defineEXC_ALI_INST_RST(instr) ((instr >> 21) & 0x1f)
 
 /*
  * SRR1 bits for program exception traps. These identify what caused

Modified: stable/12/sys/powerpc/powerpc/trap.c
==
--- stable/12/sys/powerpc/powerpc/trap.cWed Jul  3 18:53:04 2019
(r349672)
+++ stable/12/sys/powerpc/powerpc/trap.cWed Jul  3 19:01:41 2019
(r349673)
@@ -832,7 +832,7 @@ static int
 fix_unaligned(struct thread *td, struct trapframe *frame)
 {
struct thread   *fputhread;
-#ifdef __SPE__
+#ifdef BOOKE
uint32_tinst;
 #endif
int indicator, reg;
@@ -843,7 +843,7 @@ fix_unaligned(struct thread *td, struct trapframe *fra
if (indicator & ESR_SPE) {
if (copyin((void *)frame->srr0, &inst, sizeof(inst)) != 0)
return (-1);
-   reg = EXC_ALI_SPE_REG(inst);
+   reg = EXC_ALI_INST_RST(inst);
fpr = (double *)td->td_pcb->pcb_vec.vr[reg];
fputhread = PCPU_GET(vecthread);
 
@@ -873,12 +873,22 @@ fix_unaligned(struct thread *td, struct trapframe *fra
return (0);
}
 #else
+#ifdef BOOKE
+   indicator = (frame->cpu.booke.esr & ESR_ST) ? EXC_ALI_STFD : 
EXC_ALI_LFD;
+#else
indicator = EXC_ALI_OPCODE_INDICATOR(frame->cpu.aim.dsisr);
+#endif
 
switch (indicator) {
case EXC_ALI_LFD:
case EXC_ALI_STFD:
+#ifdef BOOKE
+   if (copyin((void *)frame->srr0, &inst, sizeof(inst)) != 0)
+   return (-1);
+   reg = EXC_ALI_INST_RST(inst);
+#else
reg = EXC_ALI_RST(frame->cpu.aim.dsisr);
+#endif
fpr = &td->td_pcb->pcb_fpu.fpr[reg].fpr;
fputhread = PCPU_GET(fputhread);
 
___
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: r349674 - stable/12/sys/powerpc/cpufreq

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 19:07:42 2019
New Revision: 349674
URL: https://svnweb.freebsd.org/changeset/base/349674

Log:
  MFC r344915:
  
  powerpc: Fix cpufreq statement scoping
  
  The second statements on the lines are not guarded by the `if' condition.
  This triggers a warning with newer gcc.  It's relatively harmless given the
  usage, but incorrect.  Instead, wrap the statements so they're properly
  guarded.

Modified:
  stable/12/sys/powerpc/cpufreq/dfs.c
  stable/12/sys/powerpc/cpufreq/pcr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/cpufreq/dfs.c
==
--- stable/12/sys/powerpc/cpufreq/dfs.c Wed Jul  3 19:01:41 2019
(r349673)
+++ stable/12/sys/powerpc/cpufreq/dfs.c Wed Jul  3 19:07:42 2019
(r349674)
@@ -157,8 +157,10 @@ dfs_settings(device_t dev, struct cf_setting *sets, in
 
sets[0].freq = 1; sets[0].dev = dev;
sets[1].freq = 5000; sets[1].dev = dev;
-   if (sc->dfs4)
-   sets[2].freq = 2500; sets[2].dev = dev;
+   if (sc->dfs4) {
+   sets[2].freq = 2500;
+   sets[2].dev = dev;
+   }
*count = states;
 
return (0);

Modified: stable/12/sys/powerpc/cpufreq/pcr.c
==
--- stable/12/sys/powerpc/cpufreq/pcr.c Wed Jul  3 19:01:41 2019
(r349673)
+++ stable/12/sys/powerpc/cpufreq/pcr.c Wed Jul  3 19:07:42 2019
(r349674)
@@ -251,8 +251,10 @@ pcr_settings(device_t dev, struct cf_setting *sets, in
 
sets[0].freq = 1; sets[0].dev = dev;
sets[1].freq = 5000; sets[1].dev = dev;
-   if (sc->nmodes > 2)
-   sets[2].freq = 2500; sets[2].dev = dev;
+   if (sc->nmodes > 2) {
+   sets[2].freq = 2500;
+   sets[2].dev = dev;
+   }
*count = sc->nmodes;
 
return (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: r349675 - stable/12/sys/cddl/dev/dtrace/powerpc

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 19:21:03 2019
New Revision: 349675
URL: https://svnweb.freebsd.org/changeset/base/349675

Log:
  MFC r346173,r347943
  
  r346173: powerpc/dtrace: Fix dtrace powerpc asm, and simplify stack walking
  r347943: powerpc/dtrace: Actually fix stack traces

Modified:
  stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S
  stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S
==
--- stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S  Wed Jul  3 19:07:42 
2019(r349674)
+++ stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S  Wed Jul  3 19:21:03 
2019(r349675)
@@ -148,14 +148,19 @@ dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_
 volatile uint16_t *flags)
 */
 ASENTRY_NOPROF(dtrace_copystr)
-   addme   %r7,%r3
-   addme   %r8,%r4
+   subi%r7,%r3,1
+   subi%r8,%r4,1
 1:
lbzu%r3,1(%r7)
stbu%r3,1(%r8)
-   addme   %r5,%r5
+   subi%r5,%r5,1
+#ifdef __powerpc64__
+   cmpldi  %r5,0
+#else
+   cmplwi  %r5,0
+#endif
beq 2f
-   or  %r3,%r3,%r3
+   cmplwi  %r3,0
beq 2f
andi.   %r0,%r5,0x0fff
beq 2f
@@ -174,3 +179,13 @@ ASENTRY_NOPROF(dtrace_caller)
li  %r3, -1
blr
 END(dtrace_caller)
+
+/*
+greg_t
+dtrace_getfp(void)
+*/
+ASENTRY_NOPROF(dtrace_getfp)
+   mr  %r3,%r31
+   blr
+END(dtrace_getfp)
+

Modified: stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
==
--- stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c  Wed Jul  3 19:07:42 
2019(r349674)
+++ stable/12/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c  Wed Jul  3 19:21:03 
2019(r349675)
@@ -61,8 +61,10 @@
 #defineFRAME_OFFSET8
 #endif
 
-#define INKERNEL(x)((x) <= VM_MAX_KERNEL_ADDRESS && \
-   (x) >= VM_MIN_KERNEL_ADDRESS)
+#define INKERNEL(x)(((x) <= VM_MAX_KERNEL_ADDRESS && \
+   (x) >= VM_MIN_KERNEL_ADDRESS) || \
+   (PMAP_HAS_DMAP && (x) >= DMAP_BASE_ADDRESS && \
+(x) <= DMAP_MAX_ADDRESS))
 
 static __inline int
 dtrace_sp_inkernel(uintptr_t sp)
@@ -70,6 +72,9 @@ dtrace_sp_inkernel(uintptr_t sp)
struct trapframe *frame;
vm_offset_t callpc;
 
+   /* Not within the kernel, or not aligned. */
+   if (!INKERNEL(sp) || (sp & 0xf) != 0)
+   return (0);
 #ifdef __powerpc64__
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
 #else
@@ -84,8 +89,6 @@ dtrace_sp_inkernel(uintptr_t sp)
 */
if (callpc + OFFSET == (vm_offset_t) &trapexit ||
callpc + OFFSET == (vm_offset_t) &asttrapexit) {
-   if (sp == 0)
-   return (0);
frame = (struct trapframe *)(sp + FRAME_OFFSET);
 
return ((frame->srr1 & PSL_PR) == 0);
@@ -94,11 +97,10 @@ dtrace_sp_inkernel(uintptr_t sp)
return (1);
 }
 
-static __inline uintptr_t
-dtrace_next_sp(uintptr_t sp)
+static __inline void
+dtrace_next_sp_pc(uintptr_t sp, uintptr_t *nsp, uintptr_t *pc)
 {
vm_offset_t callpc;
-   uintptr_t *r1;
struct trapframe *frame;
 
 #ifdef __powerpc64__
@@ -115,47 +117,20 @@ dtrace_next_sp(uintptr_t sp)
callpc + OFFSET == (vm_offset_t) &asttrapexit)) {
/* Access the trap frame */
frame = (struct trapframe *)(sp + FRAME_OFFSET);
-   r1 = (uintptr_t *)frame->fixreg[1];
-   if (r1 == NULL)
-   return (0);
-   return (*r1);
-   }
 
-   return (*(uintptr_t*)sp);
-}
-
-static __inline uintptr_t
-dtrace_get_pc(uintptr_t sp)
-{
-   struct trapframe *frame;
-   vm_offset_t callpc;
-
-#ifdef __powerpc64__
-   callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
-#else
-   callpc = *(vm_offset_t *)(sp + RETURN_OFFSET);
-#endif
-
-   /*
-* trapexit() and asttrapexit() are sentinels
-* for kernel stack tracing.
-*/
-   if ((callpc + OFFSET == (vm_offset_t) &trapexit ||
-   callpc + OFFSET == (vm_offset_t) &asttrapexit)) {
-   /* Access the trap frame */
-   frame = (struct trapframe *)(sp + FRAME_OFFSET);
-   return (frame->srr0);
+   if (nsp != NULL)
+   *nsp = frame->fixreg[1];
+   if (pc != NULL)
+   *pc = frame->srr0;
+   return;
}
 
-   return (callpc);
+   if (nsp != NULL)
+   *nsp = *(uintptr_t *)sp;
+   if (pc != NULL)
+   *pc = callpc;
 }
 
-greg_t
-dtrace_getfp(void)
-{
-   return (greg_t)__builtin_frame_address(0);
-}
-
 void
 dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
 uint32_

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

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:22:25 2019
New Revision: 349676
URL: https://svnweb.freebsd.org/changeset/base/349676

Log:
  MFC r349297:
  Remove redundand 'else' and 'return'.

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

Modified: stable/12/lib/libc/gen/libc_dlopen.c
==
--- stable/12/lib/libc/gen/libc_dlopen.cWed Jul  3 19:21:03 2019
(r349675)
+++ stable/12/lib/libc/gen/libc_dlopen.cWed Jul  3 19:22:25 2019
(r349676)
@@ -48,8 +48,8 @@ libc_dlopen(const char *path, int mode)
if (__libc_restricted_mode) {
_rtld_error("Service unavailable -- libc in restricted mode");
return (NULL);
-   } else
-   return (dlopen(path, mode));
+   }
+   return (dlopen(path, mode));
 }
 
 void
@@ -57,6 +57,5 @@ __FreeBSD_libc_enter_restricted_mode(void)
 {
 
__libc_restricted_mode = 1;
-   return;
 }
 
___
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: r349677 - in head: sys/kern tools/test/callout_free

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:22:44 2019
New Revision: 349677
URL: https://svnweb.freebsd.org/changeset/base/349677

Log:
  Save the last callout function executed on each CPU
  
  Save the last callout function pointer (and its argument) executed
  on each CPU for inspection by a debugger.  Add a ddb `show callout_last`
  command to show these pointers.  Add a kernel module that I used
  for testing that command.
  
  Relocate `ce_migration_cpu` to reduce padding and therefore preserve
  the size of `struct callout_cpu` (320 bytes on amd64) despite the
  added members.
  
  This should help diagnose reference-after-free bugs where the
  callout's mutex has already been freed when `softclock_call_cc`
  tries to unlock it.
  
  You might hope that the pointer would still be available, but it
  isn't.  The argument to that function is on the stack (because
  `softclock_call_cc` uses it later), and that might be enough in
  some cases, but even then, it's very laborious.  A pointer to the
  callout is saved right before these newly added fields, but that
  callout might have been freed.  We still have the pointer to its
  associated mutex, and the name within might be enough, but it might
  also have been freed.
  
  Reviewed by:  markj jhb
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20794

Added:
  head/tools/test/callout_free/
  head/tools/test/callout_free/Makefile   (contents, props changed)
  head/tools/test/callout_free/callout_free.c   (contents, props changed)
Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cWed Jul  3 19:22:25 2019
(r349676)
+++ head/sys/kern/kern_timeout.cWed Jul  3 19:22:44 2019
(r349677)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DDB
 #include 
+#include 
 #include 
 #endif
 
@@ -143,12 +144,14 @@ u_int callwheelsize, callwheelmask;
 struct cc_exec {
struct callout  *cc_curr;
void(*cc_drain)(void *);
+   void*cc_last_func;
+   void*cc_last_arg;
 #ifdef SMP
void(*ce_migration_func)(void *);
void*ce_migration_arg;
-   int ce_migration_cpu;
sbintime_t  ce_migration_time;
sbintime_t  ce_migration_prec;
+   int ce_migration_cpu;
 #endif
boolcc_cancel;
boolcc_waiting;
@@ -177,6 +180,8 @@ struct callout_cpu {
 #definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION)
 
 #definecc_exec_curr(cc, dir)   cc->cc_exec_entity[dir].cc_curr
+#definecc_exec_last_func(cc, dir)  
cc->cc_exec_entity[dir].cc_last_func
+#definecc_exec_last_arg(cc, dir)   
cc->cc_exec_entity[dir].cc_last_arg
 #definecc_exec_drain(cc, dir)  cc->cc_exec_entity[dir].cc_drain
 #definecc_exec_next(cc)cc->cc_next
 #definecc_exec_cancel(cc, dir) 
cc->cc_exec_entity[dir].cc_cancel
@@ -686,6 +691,8 @@ softclock_call_cc(struct callout *c, struct callout_cp
c->c_iflags &= ~CALLOUT_PENDING;

cc_exec_curr(cc, direct) = c;
+   cc_exec_last_func(cc, direct) = c_func;
+   cc_exec_last_arg(cc, direct) = c_arg;
cc_exec_cancel(cc, direct) = false;
cc_exec_drain(cc, direct) = NULL;
CC_UNLOCK(cc);
@@ -1669,5 +1676,43 @@ DB_SHOW_COMMAND(callout, db_show_callout)
}
 
_show_callout((struct callout *)addr);
+}
+
+static void
+_show_last_callout(int cpu, int direct, const char *dirstr)
+{
+   struct callout_cpu *cc;
+   void *func, *arg;
+
+   cc = CC_CPU(cpu);
+   func = cc_exec_last_func(cc, direct);
+   arg = cc_exec_last_arg(cc, direct);
+   db_printf("cpu %d last%s callout function: %p ", cpu, dirstr, func);
+   db_printsym((db_expr_t)func, DB_STGY_ANY);
+   db_printf("\ncpu %d last%s callout argument: %p\n", cpu, dirstr, arg);
+}
+
+DB_SHOW_COMMAND(callout_last, db_show_callout_last)
+{
+   int cpu, last;
+
+   if (have_addr) {
+   if (addr < 0 || addr > mp_maxid || CPU_ABSENT(addr)) {
+   db_printf("no such cpu: %d\n", (int)addr);
+   return;
+   }
+   cpu = last = addr;
+   } else {
+   cpu = 0;
+   last = mp_maxid;
+   }
+
+   while (cpu <= last) {
+   if (!CPU_ABSENT(cpu)) {
+   _show_last_callout(cpu, 0, "");
+   _show_last_callout(cpu, 1, " direct");
+   }
+   cpu++;
+   }
 }
 #endif /* DDB */

Added: head/tools/test/callout_free/Makefile
===

svn commit: r349678 - stable/11/lib/libc/gen

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:23:20 2019
New Revision: 349678
URL: https://svnweb.freebsd.org/changeset/base/349678

Log:
  MFC r349297:
  Remove redundand 'else' and 'return'.

Modified:
  stable/11/lib/libc/gen/libc_dlopen.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/libc_dlopen.c
==
--- stable/11/lib/libc/gen/libc_dlopen.cWed Jul  3 19:22:44 2019
(r349677)
+++ stable/11/lib/libc/gen/libc_dlopen.cWed Jul  3 19:23:20 2019
(r349678)
@@ -47,8 +47,8 @@ libc_dlopen(const char *path, int mode)
if (__libc_restricted_mode) {
_rtld_error("Service unavailable -- libc in restricted mode");
return (NULL);
-   } else
-   return (dlopen(path, mode));
+   }
+   return (dlopen(path, mode));
 }
 
 void
@@ -56,6 +56,5 @@ __FreeBSD_libc_enter_restricted_mode(void)
 {
 
__libc_restricted_mode = 1;
-   return;
 }
 
___
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: r349679 - in stable/12/lib: libc/gen libc/include libthr/thread

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:24:50 2019
New Revision: 349679
URL: https://svnweb.freebsd.org/changeset/base/349679

Log:
  MFC r349299:
  Add libc stub for pthread_getthreadid_np(3).
  
  PR:   238650

Modified:
  stable/12/lib/libc/gen/Symbol.map
  stable/12/lib/libc/gen/_pthread_stubs.c
  stable/12/lib/libc/include/libc_private.h
  stable/12/lib/libthr/thread/thr_init.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/Symbol.map
==
--- stable/12/lib/libc/gen/Symbol.map   Wed Jul  3 19:23:20 2019
(r349678)
+++ stable/12/lib/libc/gen/Symbol.map   Wed Jul  3 19:24:50 2019
(r349679)
@@ -338,6 +338,7 @@ FBSD_1.2 {
getutxid;
getutxline;
getutxuser;
+   pthread_getthreadid_np;
pututxline;
sem_close;
sem_destroy;

Modified: stable/12/lib/libc/gen/_pthread_stubs.c
==
--- stable/12/lib/libc/gen/_pthread_stubs.c Wed Jul  3 19:23:20 2019
(r349678)
+++ stable/12/lib/libc/gen/_pthread_stubs.c Wed Jul  3 19:24:50 2019
(r349679)
@@ -130,6 +130,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_CONSISTENT */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEXATTR_GETROBUST */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEXATTR_SETROBUST */
+   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_GETTHREADID_NP */
 };
 
 /*
@@ -248,6 +249,7 @@ STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRL
 STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *)
 STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *)
 STUB_FUNC(pthread_self,PJT_SELF, pthread_t)
+STUB_FUNC(pthread_getthreadid_np, PJT_GETTHREADID_NP, int)
 STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *)
 STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *)
 STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*)

Modified: stable/12/lib/libc/include/libc_private.h
==
--- stable/12/lib/libc/include/libc_private.h   Wed Jul  3 19:23:20 2019
(r349678)
+++ stable/12/lib/libc/include/libc_private.h   Wed Jul  3 19:24:50 2019
(r349679)
@@ -176,6 +176,7 @@ typedef enum {
PJT_MUTEX_CONSISTENT,
PJT_MUTEXATTR_GETROBUST,
PJT_MUTEXATTR_SETROBUST,
+   PJT_GETTHREADID_NP,
PJT_MAX
 } pjt_index_t;
 

Modified: stable/12/lib/libthr/thread/thr_init.c
==
--- stable/12/lib/libthr/thread/thr_init.c  Wed Jul  3 19:23:20 2019
(r349678)
+++ stable/12/lib/libthr/thread/thr_init.c  Wed Jul  3 19:24:50 2019
(r349679)
@@ -272,6 +272,7 @@ static pthread_func_t jmp_table[][2] = {
{DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */
{DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */
{DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */
+   {DUAL_ENTRY(_pthread_getthreadid_np)},  /* PJT_GETTHREADID_NP */
 };
 
 static int init_once = 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: r349680 - stable/12/sys/powerpc/booke

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 19:25:57 2019
New Revision: 349680
URL: https://svnweb.freebsd.org/changeset/base/349680

Log:
  MFC r347167,r348079
  
  Book-E pmap
  
  r347167: powerpc/booke: Use #ifdef __powerpc64__ instead of hw_direct_map in
  places
  r348079: powerpc/booke: Use wrtee instead of msr to restore EE bit

Modified:
  stable/12/sys/powerpc/booke/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/booke/pmap.c
==
--- stable/12/sys/powerpc/booke/pmap.c  Wed Jul  3 19:24:50 2019
(r349679)
+++ stable/12/sys/powerpc/booke/pmap.c  Wed Jul  3 19:25:57 2019
(r349680)
@@ -2973,19 +2973,19 @@ mmu_booke_zero_page_area(mmu_t mmu, vm_page_t m, int o
 
/* XXX KASSERT off and size are within a single page? */
 
-   if (hw_direct_map) {
-   va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
-   bzero((caddr_t)va + off, size);
-   } else {
-   mtx_lock(&zero_page_mutex);
-   va = zero_page_va;
+#ifdef __powerpc64__
+   va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
+   bzero((caddr_t)va + off, size);
+#else
+   mtx_lock(&zero_page_mutex);
+   va = zero_page_va;
 
-   mmu_booke_kenter(mmu, va, VM_PAGE_TO_PHYS(m));
-   bzero((caddr_t)va + off, size);
-   mmu_booke_kremove(mmu, va);
+   mmu_booke_kenter(mmu, va, VM_PAGE_TO_PHYS(m));
+   bzero((caddr_t)va + off, size);
+   mmu_booke_kremove(mmu, va);
 
-   mtx_unlock(&zero_page_mutex);
-   }
+   mtx_unlock(&zero_page_mutex);
+#endif
 }
 
 /*
@@ -2996,23 +2996,24 @@ mmu_booke_zero_page(mmu_t mmu, vm_page_t m)
 {
vm_offset_t off, va;
 
-   if (hw_direct_map) {
-   va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
-   } else {
-   va = zero_page_va;
-   mtx_lock(&zero_page_mutex);
+#ifdef __powerpc64__
+   va = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
 
-   mmu_booke_kenter(mmu, va, VM_PAGE_TO_PHYS(m));
-   }
+   for (off = 0; off < PAGE_SIZE; off += cacheline_size)
+   __asm __volatile("dcbz 0,%0" :: "r"(va + off));
+#else
+   va = zero_page_va;
+   mtx_lock(&zero_page_mutex);
 
+   mmu_booke_kenter(mmu, va, VM_PAGE_TO_PHYS(m));
+
for (off = 0; off < PAGE_SIZE; off += cacheline_size)
__asm __volatile("dcbz 0,%0" :: "r"(va + off));
 
-   if (!hw_direct_map) {
-   mmu_booke_kremove(mmu, va);
+   mmu_booke_kremove(mmu, va);
 
-   mtx_unlock(&zero_page_mutex);
-   }
+   mtx_unlock(&zero_page_mutex);
+#endif
 }
 
 /*
@@ -3025,23 +3026,23 @@ mmu_booke_copy_page(mmu_t mmu, vm_page_t sm, vm_page_t
 {
vm_offset_t sva, dva;
 
+#ifdef __powerpc64__
+   sva = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(sm));
+   dva = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dm));
+   memcpy((caddr_t)dva, (caddr_t)sva, PAGE_SIZE);
+#else
+   mtx_lock(©_page_mutex);
+   mmu_booke_kenter(mmu, sva, VM_PAGE_TO_PHYS(sm));
+   mmu_booke_kenter(mmu, dva, VM_PAGE_TO_PHYS(dm));
sva = copy_page_src_va;
dva = copy_page_dst_va;
 
-   if (hw_direct_map) {
-   sva = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(sm));
-   dva = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dm));
-   } else {
-   mtx_lock(©_page_mutex);
-   mmu_booke_kenter(mmu, sva, VM_PAGE_TO_PHYS(sm));
-   mmu_booke_kenter(mmu, dva, VM_PAGE_TO_PHYS(dm));
-   }
memcpy((caddr_t)dva, (caddr_t)sva, PAGE_SIZE);
-   if (!hw_direct_map) {
-   mmu_booke_kremove(mmu, dva);
-   mmu_booke_kremove(mmu, sva);
-   mtx_unlock(©_page_mutex);
-   }
+
+   mmu_booke_kremove(mmu, dva);
+   mmu_booke_kremove(mmu, sva);
+   mtx_unlock(©_page_mutex);
+#endif
 }
 
 static inline void
@@ -3052,39 +3053,55 @@ mmu_booke_copy_pages(mmu_t mmu, vm_page_t *ma, vm_offs
vm_offset_t a_pg_offset, b_pg_offset;
int cnt;
 
-   if (hw_direct_map) {
-   a_cp = (caddr_t)((uintptr_t)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*ma)) +
-   a_offset);
-   b_cp = (caddr_t)((uintptr_t)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*mb)) +
-   b_offset);
-   bcopy(a_cp, b_cp, xfersize);
-   } else {
-   mtx_lock(©_page_mutex);
-   while (xfersize > 0) {
-   a_pg_offset = a_offset & PAGE_MASK;
-   cnt = min(xfersize, PAGE_SIZE - a_pg_offset);
-   mmu_booke_kenter(mmu, copy_page_src_va,
-   VM_PAGE_TO_PHYS(ma[a_offset >> PAGE_SHIFT]));
-   a_cp = (char *)copy_page_src_va + a_pg_offset;
-   b_pg_offset = b_offset & PAGE_MASK;
-   cnt = min(cnt, PAGE_SIZE - b_pg_offset);
-   mmu_booke_kenter(mmu, copy_page_dst_va,
-  

svn commit: r349681 - stable/12/sys/amd64/amd64

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:27:34 2019
New Revision: 349681
URL: https://svnweb.freebsd.org/changeset/base/349681

Log:
  MFC r349427:
  amd64 pmap: Fix pkru handling in pmap_remove().

Modified:
  stable/12/sys/amd64/amd64/pmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/pmap.c
==
--- stable/12/sys/amd64/amd64/pmap.cWed Jul  3 19:25:57 2019
(r349680)
+++ stable/12/sys/amd64/amd64/pmap.cWed Jul  3 19:27:34 2019
(r349681)
@@ -4533,6 +4533,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 
pmap_delayed_invl_started();
PMAP_LOCK(pmap);
+   pmap_pkru_on_remove(pmap, sva, eva);
 
/*
 * special handling of removing one page.  a very
@@ -4626,7 +4627,6 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t 
 out:
if (anyvalid)
pmap_invalidate_all(pmap);
-   pmap_pkru_on_remove(pmap, sva, eva);
PMAP_UNLOCK(pmap);
pmap_delayed_invl_finished();
vm_page_free_pages_toq(&free, true);
___
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: r349682 - stable/12/lib/libc/sys

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:28:47 2019
New Revision: 349682
URL: https://svnweb.freebsd.org/changeset/base/349682

Log:
  MFC r349511:
  Typo.

Modified:
  stable/12/lib/libc/sys/procctl.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/procctl.2
==
--- stable/12/lib/libc/sys/procctl.2Wed Jul  3 19:27:34 2019
(r349681)
+++ stable/12/lib/libc/sys/procctl.2Wed Jul  3 19:28:47 2019
(r349682)
@@ -91,7 +91,7 @@ The image flag and set-uid might prevent ASLR enableme
 .It Dv PROC_ASLR_FORCE_DISABLE
 Request that ASLR is disabled after execution.
 Same notes as for
-.Dv PROC_ASKR_FORCE_ENABLE
+.Dv PROC_ASLR_FORCE_ENABLE
 apply.
 .It Dv PROC_ASLR_NOFORCE
 Use system-wide configured policy for ASLR.
___
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: r349683 - stable/12/usr.bin/proccontrol

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:29:53 2019
New Revision: 349683
URL: https://svnweb.freebsd.org/changeset/base/349683

Log:
  MFC r349512:
  Mention proccontrol(1) -m kpti.

Modified:
  stable/12/usr.bin/proccontrol/proccontrol.1
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/proccontrol/proccontrol.1
==
--- stable/12/usr.bin/proccontrol/proccontrol.1 Wed Jul  3 19:28:47 2019
(r349682)
+++ stable/12/usr.bin/proccontrol/proccontrol.1 Wed Jul  3 19:29:53 2019
(r349683)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 13, 2019
+.Dd June 28, 2019
 .Dt PROCCONTROL 1
 .Os
 .Sh NAME
@@ -66,6 +66,8 @@ Note that process is only allowed to enable tracing fo
 not for any other process.
 .It Ar trapcap
 Controls the signalling of capability mode access violations.
+.It Ar kpti
+Controls the KPTI enable, AMD64 only.
 .El
 .Pp
 The
___
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: r349684 - stable/12/sys/kern

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:31:11 2019
New Revision: 349684
URL: https://svnweb.freebsd.org/changeset/base/349684

Log:
  MFC r349519:
  Style.

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

Modified: stable/12/sys/kern/kern_umtx.c
==
--- stable/12/sys/kern/kern_umtx.c  Wed Jul  3 19:29:53 2019
(r349683)
+++ stable/12/sys/kern/kern_umtx.c  Wed Jul  3 19:31:11 2019
(r349684)
@@ -2624,7 +2624,8 @@ do_cv_broadcast(struct thread *td, struct ucond *cv)
 }
 
 static int
-do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct 
_umtx_time *timeout)
+do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag,
+struct _umtx_time *timeout)
 {
struct abs_timeout timo;
struct umtx_q *uq;
___
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: r349685 - stable/11/sys/kern

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:31:47 2019
New Revision: 349685
URL: https://svnweb.freebsd.org/changeset/base/349685

Log:
  MFC r349519:
  Style.

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

Modified: stable/11/sys/kern/kern_umtx.c
==
--- stable/11/sys/kern/kern_umtx.c  Wed Jul  3 19:31:11 2019
(r349684)
+++ stable/11/sys/kern/kern_umtx.c  Wed Jul  3 19:31:47 2019
(r349685)
@@ -2631,7 +2631,8 @@ do_cv_broadcast(struct thread *td, struct ucond *cv)
 }
 
 static int
-do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct 
_umtx_time *timeout)
+do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag,
+struct _umtx_time *timeout)
 {
struct abs_timeout timo;
struct umtx_q *uq;
___
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: r349686 - in stable/12/sys/powerpc: aim include powerpc

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 19:32:25 2019
New Revision: 349686
URL: https://svnweb.freebsd.org/changeset/base/349686

Log:
  MFC r346777:
  
  powerpc: Add POWER8NVL definition
  
  The POWER8NVL (POWER8 NVLink) architecturally behaves identically to the
  POWER8, with a different PVR identifier.  Mark it as such, so it shows up
  appropriately to the user.
  
  Reported by:  Alexey Kardashevskiy

Modified:
  stable/12/sys/powerpc/aim/aim_machdep.c
  stable/12/sys/powerpc/aim/mp_cpudep.c
  stable/12/sys/powerpc/include/spr.h
  stable/12/sys/powerpc/powerpc/cpu.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/powerpc/aim/aim_machdep.c
==
--- stable/12/sys/powerpc/aim/aim_machdep.c Wed Jul  3 19:31:47 2019
(r349685)
+++ stable/12/sys/powerpc/aim/aim_machdep.c Wed Jul  3 19:32:25 2019
(r349686)
@@ -213,6 +213,7 @@ aim_early_init(vm_offset_t fdt, vm_offset_t toc, vm_of
case IBMPOWER7PLUS:
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
/* XXX: get from ibm,slb-size in device tree */
n_slbs = 32;

Modified: stable/12/sys/powerpc/aim/mp_cpudep.c
==
--- stable/12/sys/powerpc/aim/mp_cpudep.c   Wed Jul  3 19:31:47 2019
(r349685)
+++ stable/12/sys/powerpc/aim/mp_cpudep.c   Wed Jul  3 19:32:25 2019
(r349686)
@@ -89,6 +89,7 @@ cpudep_ap_early_bootstrap(void)
break;
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
 #ifdef __powerpc64__
if (mfmsr() & PSL_HV) {
@@ -398,6 +399,7 @@ cpudep_ap_setup()
case IBMPOWER7PLUS:
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
case IBMPOWER9:
 #ifdef __powerpc64__
if (mfmsr() & PSL_HV) {

Modified: stable/12/sys/powerpc/include/spr.h
==
--- stable/12/sys/powerpc/include/spr.h Wed Jul  3 19:31:47 2019
(r349685)
+++ stable/12/sys/powerpc/include/spr.h Wed Jul  3 19:32:25 2019
(r349686)
@@ -188,6 +188,7 @@
 #define  IBMPOWERPCA20x0049
 #define  IBMPOWER7PLUS   0x004a
 #define  IBMPOWER8E  0x004b
+#define  IBMPOWER8NVL0x004c
 #define  IBMPOWER8   0x004d
 #define  IBMPOWER9   0x004e
 #define  MPC860  0x0050

Modified: stable/12/sys/powerpc/powerpc/cpu.c
==
--- stable/12/sys/powerpc/powerpc/cpu.c Wed Jul  3 19:31:47 2019
(r349685)
+++ stable/12/sys/powerpc/powerpc/cpu.c Wed Jul  3 19:32:25 2019
(r349686)
@@ -171,6 +171,13 @@ static const struct cputab models[] = {
   PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
   PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
   PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
+{ "IBM POWER8NVL", IBMPOWER8NVL,   REVFMT_MAJMIN,
+  PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
+  PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
+  PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
+  PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR | 
+  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
+  PPC_FEATURE2_HTM_NOSC, cpu_powerx_setup },
 { "IBM POWER8",IBMPOWER8,  REVFMT_MAJMIN,
   PPC_FEATURE_64 | PPC_FEATURE_HAS_ALTIVEC | PPC_FEATURE_HAS_FPU |
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
@@ -666,6 +673,7 @@ cpu_powerx_setup(int cpuid, uint16_t vers)
switch (vers) {
case IBMPOWER8:
case IBMPOWER8E:
+   case IBMPOWER8NVL:
cpu_idle_hook = cpu_idle_powerx;
mtspr(SPR_LPCR, mfspr(SPR_LPCR) | LPCR_PECE_WAKESET);
isync();
___
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: r349687 - stable/12/sys/kern

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:34:17 2019
New Revision: 349687
URL: https://svnweb.freebsd.org/changeset/base/349687

Log:
  MFC r349320, r349324:
  coredump: avoid writing to core files not owned by the effective user.
  
  PR:   68905
  admbugs:  358

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

Modified: stable/12/sys/kern/kern_sig.c
==
--- stable/12/sys/kern/kern_sig.c   Wed Jul  3 19:32:25 2019
(r349686)
+++ stable/12/sys/kern/kern_sig.c   Wed Jul  3 19:34:17 2019
(r349687)
@@ -3400,10 +3400,16 @@ corefile_open_last(struct thread *td, char *name, int 
}
 
if (oldvp != NULL) {
-   if (nextvp == NULL)
-   nextvp = oldvp;
-   else
+   if (nextvp == NULL) {
+   if ((td->td_proc->p_flag & P_SUGID) != 0) {
+   error = EFAULT;
+   vnode_close_locked(td, oldvp);
+   } else {
+   nextvp = oldvp;
+   }
+   } else {
vnode_close_locked(td, oldvp);
+   }
}
if (error != 0) {
if (nextvp != NULL)
@@ -3523,6 +3529,8 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, 
oflags = VN_OPEN_NOAUDIT | VN_OPEN_NAMECACHE |
(capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
flags = O_CREAT | FWRITE | O_NOFOLLOW;
+   if ((td->td_proc->p_flag & P_SUGID) != 0)
+   flags |= O_EXCL;
 
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td);
error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred,
@@ -3599,10 +3607,11 @@ coredump(struct thread *td)
 
/*
 * Don't dump to non-regular files or files with links.
-* Do not dump into system files.
+* Do not dump into system files. Effective user must own the corefile.
 */
if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 ||
-   vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0) {
+   vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0 ||
+   vattr.va_uid != cred->cr_uid) {
VOP_UNLOCK(vp, 0);
error = EFAULT;
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: r349688 - in stable/11/lib: libc/gen libc/include libthr/thread

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:42:36 2019
New Revision: 349688
URL: https://svnweb.freebsd.org/changeset/base/349688

Log:
  MFC r349299:
  Add libc stub for pthread_getthreadid_np(3).
  
  PR:   238650

Modified:
  stable/11/lib/libc/gen/Symbol.map
  stable/11/lib/libc/gen/_pthread_stubs.c
  stable/11/lib/libc/include/libc_private.h
  stable/11/lib/libthr/thread/thr_init.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/Symbol.map
==
--- stable/11/lib/libc/gen/Symbol.map   Wed Jul  3 19:34:17 2019
(r349687)
+++ stable/11/lib/libc/gen/Symbol.map   Wed Jul  3 19:42:36 2019
(r349688)
@@ -365,6 +365,7 @@ FBSD_1.2 {
getutxid;
getutxline;
getutxuser;
+   pthread_getthreadid_np;
pututxline;
sem_close;
sem_destroy;

Modified: stable/11/lib/libc/gen/_pthread_stubs.c
==
--- stable/11/lib/libc/gen/_pthread_stubs.c Wed Jul  3 19:34:17 2019
(r349687)
+++ stable/11/lib/libc/gen/_pthread_stubs.c Wed Jul  3 19:42:36 2019
(r349688)
@@ -128,6 +128,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEX_CONSISTENT */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEXATTR_GETROBUST */
{PJT_DUAL_ENTRY(stub_zero)},/* PJT_MUTEXATTR_SETROBUST */
+   {PJT_DUAL_ENTRY(stub_zero)},/* PJT_GETTHREADID_NP */
 };
 
 /*
@@ -246,6 +247,7 @@ STUB_FUNC1(pthread_rwlock_trywrlock, PJT_RWLOCK_TRYWRL
 STUB_FUNC1(pthread_rwlock_unlock, PJT_RWLOCK_UNLOCK, int, void *)
 STUB_FUNC1(pthread_rwlock_wrlock, PJT_RWLOCK_WRLOCK, int, void *)
 STUB_FUNC(pthread_self,PJT_SELF, pthread_t)
+STUB_FUNC(pthread_getthreadid_np, PJT_GETTHREADID_NP, int)
 STUB_FUNC2(pthread_setspecific, PJT_SETSPECIFIC, int, pthread_key_t, void *)
 STUB_FUNC3(pthread_sigmask, PJT_SIGMASK, int, int, void *, void *)
 STUB_FUNC3(pthread_atfork, PJT_ATFORK, int, void *, void *, void*)

Modified: stable/11/lib/libc/include/libc_private.h
==
--- stable/11/lib/libc/include/libc_private.h   Wed Jul  3 19:34:17 2019
(r349687)
+++ stable/11/lib/libc/include/libc_private.h   Wed Jul  3 19:42:36 2019
(r349688)
@@ -174,6 +174,7 @@ typedef enum {
PJT_MUTEX_CONSISTENT,
PJT_MUTEXATTR_GETROBUST,
PJT_MUTEXATTR_SETROBUST,
+   PJT_GETTHREADID_NP,
PJT_MAX
 } pjt_index_t;
 

Modified: stable/11/lib/libthr/thread/thr_init.c
==
--- stable/11/lib/libthr/thread/thr_init.c  Wed Jul  3 19:34:17 2019
(r349687)
+++ stable/11/lib/libthr/thread/thr_init.c  Wed Jul  3 19:42:36 2019
(r349688)
@@ -270,6 +270,7 @@ static pthread_func_t jmp_table[][2] = {
{DUAL_ENTRY(_pthread_mutex_consistent)},/* PJT_MUTEX_CONSISTENT */
{DUAL_ENTRY(_pthread_mutexattr_getrobust)},/* PJT_MUTEXATTR_GETROBUST */
{DUAL_ENTRY(_pthread_mutexattr_setrobust)},/* PJT_MUTEXATTR_SETROBUST */
+   {DUAL_ENTRY(_pthread_getthreadid_np)},  /* PJT_GETTHREADID_NP */
 };
 
 static int init_once = 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: r349689 - stable/11/sys/kern

2019-07-03 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  3 19:46:05 2019
New Revision: 349689
URL: https://svnweb.freebsd.org/changeset/base/349689

Log:
  MFC r349320, r349324:
  coredump: avoid writing to core files not owned by the effective user.
  
  PR:   68905
  admbugs:  358

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

Modified: stable/11/sys/kern/kern_sig.c
==
--- stable/11/sys/kern/kern_sig.c   Wed Jul  3 19:42:36 2019
(r349688)
+++ stable/11/sys/kern/kern_sig.c   Wed Jul  3 19:46:05 2019
(r349689)
@@ -3380,10 +3380,16 @@ corefile_open_last(struct thread *td, char *name, int 
}
 
if (oldvp != NULL) {
-   if (nextvp == NULL)
-   nextvp = oldvp;
-   else
+   if (nextvp == NULL) {
+   if ((td->td_proc->p_flag & P_SUGID) != 0) {
+   error = EFAULT;
+   vnode_close_locked(td, oldvp);
+   } else {
+   nextvp = oldvp;
+   }
+   } else {
vnode_close_locked(td, oldvp);
+   }
}
if (error != 0) {
if (nextvp != NULL)
@@ -3492,6 +3498,8 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, 
oflags = VN_OPEN_NOAUDIT | VN_OPEN_NAMECACHE |
(capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
flags = O_CREAT | FWRITE | O_NOFOLLOW;
+   if ((td->td_proc->p_flag & P_SUGID) != 0)
+   flags |= O_EXCL;
 
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td);
error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred,
@@ -3589,10 +3597,11 @@ coredump(struct thread *td)
 
/*
 * Don't dump to non-regular files or files with links.
-* Do not dump into system files.
+* Do not dump into system files. Effective user must own the corefile.
 */
if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 ||
-   vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0) {
+   vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0 ||
+   vattr.va_uid != cred->cr_uid) {
VOP_UNLOCK(vp, 0);
error = EFAULT;
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: r349690 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:50:22 2019
New Revision: 349690
URL: https://svnweb.freebsd.org/changeset/base/349690

Log:
  MFC r349278
  
  bhyve: Fix vtscsi maximum segment config
  
  The seg_max value reported to the guest should be two less than the
  host's maximum, in order to leave room for the request and the
  response.  This is analogous to r347033 for virtio_block.
  
  We hit the "too many segments to enqueue" assertion on OneFS because
  we increase MAXPHYS to 256 KB.
  
  Reviewed by:  bryanv
  Discussed with:   cem jhb rgrimes
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20529

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

Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:46:05 2019
(r349689)
+++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:50:22 2019
(r349690)
@@ -309,7 +309,8 @@ pci_vtscsi_reset(void *vsc)
/* initialize config structure */
sc->vss_config = (struct pci_vtscsi_config){
.num_queues = VTSCSI_REQUESTQ,
-   .seg_max = VTSCSI_MAXSEG,
+   /* Leave room for the request and the response. */
+   .seg_max = VTSCSI_MAXSEG - 2,
.max_sectors = 2,
.cmd_per_lun = 1,
.event_info_size = sizeof(struct pci_vtscsi_event),
___
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: r349691 - stable/12/sys/dev/virtio/scsi

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:52:24 2019
New Revision: 349691
URL: https://svnweb.freebsd.org/changeset/base/349691

Log:
  MFC r349285
  
  VirtIO SCSI:  validate seg_max on attach
  
  Until head r349278 (stable/12 r349690), bhyve presented a seg_max
  to the guest that was too large.  Detect this case and clamp it to
  the virtqueue size.  Otherwise, we would fail the "too many segments
  to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  stable/12/sys/dev/virtio/scsi/virtio_scsi.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/virtio/scsi/virtio_scsi.c
==
--- stable/12/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:50:22 2019
(r349690)
+++ stable/12/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:52:24 2019
(r349691)
@@ -81,6 +81,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -314,6 +315,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -478,6 +481,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 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: r349692 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 19:54:37 2019
New Revision: 349692
URL: https://svnweb.freebsd.org/changeset/base/349692

Log:
  MFC r348834
  
  bhyve: vtnet: simplify thread synchronization
  
  On vtnet device reset it is necessary to wait for threads to stop TX and
  RX processing. However, the rx_in_progress variable (used for to wait for
  RX processing to stop) is actually useless, and can be removed. Acquiring
  and releasing the RX lock is enough to synchronize correctly. Moreover,
  it is possible to reset the device while holding both TX and RX locks, so
  that the "resetting" variable becomes unnecessary for the RX thread, and
  can be protected by the TX lock (instead of being volatile).
  
  Reviewed by:jhb, markj
  Differential Revision:  https://reviews.freebsd.org/D20543

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

Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:52:24 2019
(r349691)
+++ stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:54:37 2019
(r349692)
@@ -147,14 +147,13 @@ struct pci_vtnet_softc {
struct nm_desc  *vsc_nmd;
 
int vsc_rx_ready;
-   volatile intresetting;  /* set and checked outside lock */
+   int resetting;  /* protected by tx_mtx */
 
uint64_tvsc_features;   /* negotiated features */

struct virtio_net_config vsc_config;
 
pthread_mutex_t rx_mtx;
-   int rx_in_progress;
int rx_vhdrlen;
int rx_merge;   /* merged rx bufs in use */
 
@@ -186,62 +185,39 @@ static struct virtio_consts vtnet_vi_consts = {
VTNET_S_HOSTCAPS,   /* our capabilities */
 };
 
-/*
- * If the transmit thread is active then stall until it is done.
- */
 static void
-pci_vtnet_txwait(struct pci_vtnet_softc *sc)
+pci_vtnet_reset(void *vsc)
 {
+   struct pci_vtnet_softc *sc = vsc;
 
+   DPRINTF(("vtnet: device reset requested !\n"));
+
+   /* Acquire the RX lock to block RX processing. */
+   pthread_mutex_lock(&sc->rx_mtx);
+
+   /* Set sc->resetting and give a chance to the TX thread to stop. */
pthread_mutex_lock(&sc->tx_mtx);
+   sc->resetting = 1;
while (sc->tx_in_progress) {
pthread_mutex_unlock(&sc->tx_mtx);
usleep(1);
pthread_mutex_lock(&sc->tx_mtx);
}
-   pthread_mutex_unlock(&sc->tx_mtx);
-}
 
-/*
- * If the receive thread is active then stall until it is done.
- */
-static void
-pci_vtnet_rxwait(struct pci_vtnet_softc *sc)
-{
-
-   pthread_mutex_lock(&sc->rx_mtx);
-   while (sc->rx_in_progress) {
-   pthread_mutex_unlock(&sc->rx_mtx);
-   usleep(1);
-   pthread_mutex_lock(&sc->rx_mtx);
-   }
-   pthread_mutex_unlock(&sc->rx_mtx);
-}
-
-static void
-pci_vtnet_reset(void *vsc)
-{
-   struct pci_vtnet_softc *sc = vsc;
-
-   DPRINTF(("vtnet: device reset requested !\n"));
-
-   sc->resetting = 1;
-
-   /*
-* Wait for the transmit and receive threads to finish their
-* processing.
-*/
-   pci_vtnet_txwait(sc);
-   pci_vtnet_rxwait(sc);
-
sc->vsc_rx_ready = 0;
sc->rx_merge = 1;
sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr);
 
-   /* now reset rings, MSI-X vectors, and negotiated capabilities */
+   /*
+* Now reset rings, MSI-X vectors, and negotiated capabilities.
+* Do that with the TX lock held, since we need to reset
+* sc->resetting.
+*/
vi_reset_dev(&sc->vsc_vs);
 
sc->resetting = 0;
+   pthread_mutex_unlock(&sc->tx_mtx);
+   pthread_mutex_unlock(&sc->rx_mtx);
 }
 
 /*
@@ -315,9 +291,9 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc *sc)
 
/*
 * But, will be called when the rx ring hasn't yet
-* been set up or the guest is resetting the device.
+* been set up.
 */
-   if (!sc->vsc_rx_ready || sc->resetting) {
+   if (!sc->vsc_rx_ready) {
/*
 * Drop the packet and try later.
 */
@@ -512,9 +488,9 @@ pci_vtnet_netmap_rx(struct pci_vtnet_softc *sc)
 
/*
 * But, will be called when the rx ring hasn't yet
-* been set up or the guest is resetting the device.
+* been set up.
 */
-   if (!sc->vsc_rx_ready || sc->resetting) {
+   if (!sc->vsc_rx_ready) {
/*
 * Drop the packet and try later.
 */
@@ -591,9 +567,7 @@ pci_vtnet_rx_callback(int fd, enum ev_type type, void 
struct pci_vtnet_softc *sc = param;
 
pthread_mutex_lock(&sc->rx_mtx);
-   sc->rx_in_progress = 1;
sc->pci_vtnet_rx(sc);
-  

svn commit: r349693 - stable/11/sys/dev/virtio/scsi

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:54:56 2019
New Revision: 349693
URL: https://svnweb.freebsd.org/changeset/base/349693

Log:
  MFC r349285
  
  VirtIO SCSI:  validate seg_max on attach
  
  Until head r349278 (stable/12 r349690), bhyve presented a seg_max
  to the guest that was too large.  Detect this case and clamp it to
  the virtqueue size.  Otherwise, we would fail the "too many segments
  to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  stable/11/sys/dev/virtio/scsi/virtio_scsi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/virtio/scsi/virtio_scsi.c
==
--- stable/11/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:54:37 2019
(r349692)
+++ stable/11/sys/dev/virtio/scsi/virtio_scsi.c Wed Jul  3 19:54:56 2019
(r349693)
@@ -79,6 +79,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -312,6 +313,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -476,6 +479,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 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: r349694 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 19:56:05 2019
New Revision: 349694
URL: https://svnweb.freebsd.org/changeset/base/349694

Log:
  MFC r348929
  
  bhyve: virtio: introduce vq_kick_enable() and vq_kick_disable()
  
  The VirtIO standard supports two schemes for notification suppression:
  a notification enable bit and a more sophisticated one (event_idx) that
  also supports delayed notifications. Currently bhyve fully supports
  only the first scheme. This patch hides the notification suppression
  internals by means of two inline routines, vq_kick_enable() and
  vq_kick_disable(), and makes the code more readable.
  Moreover, further improve readability by replacing the call to mb()
  with a call to atomic_thread_fence_seq_cst(), which is already used
  in virtio.c
  
  Reviewed by:pmooney_pfmooney.com, bryanv
  Differential Revision:  https://reviews.freebsd.org/D20581

Modified:
  stable/12/usr.sbin/bhyve/pci_virtio_console.c
  stable/12/usr.sbin/bhyve/pci_virtio_net.c
  stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
  stable/12/usr.sbin/bhyve/virtio.c
  stable/12/usr.sbin/bhyve/virtio.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_virtio_console.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_console.c   Wed Jul  3 19:54:56 
2019(r349693)
+++ stable/12/usr.sbin/bhyve/pci_virtio_console.c   Wed Jul  3 19:56:05 
2019(r349694)
@@ -604,7 +604,7 @@ pci_vtcon_notify_rx(void *vsc, struct vqueue_info *vq)
 
if (!port->vsp_rx_ready) {
port->vsp_rx_ready = 1;
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
}
 }
 

Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:54:56 2019
(r349693)
+++ stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:56:05 2019
(r349694)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #ifndef NETMAP_WITH_LIBS
 #define NETMAP_WITH_LIBS
@@ -582,7 +581,7 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq)
 */
if (sc->vsc_rx_ready == 0) {
sc->vsc_rx_ready = 1;
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
}
 }
 
@@ -628,7 +627,7 @@ pci_vtnet_ping_txq(void *vsc, struct vqueue_info *vq)
 
/* Signal the tx thread for processing */
pthread_mutex_lock(&sc->tx_mtx);
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
if (sc->tx_in_progress == 0)
pthread_cond_signal(&sc->tx_cond);
pthread_mutex_unlock(&sc->tx_mtx);
@@ -657,8 +656,7 @@ pci_vtnet_tx_thread(void *param)
for (;;) {
/* note - tx mutex is locked here */
while (sc->resetting || !vq_has_descs(vq)) {
-   vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY;
-   mb();
+   vq_kick_enable(vq);
if (!sc->resetting && vq_has_descs(vq))
break;
 
@@ -666,7 +664,7 @@ pci_vtnet_tx_thread(void *param)
error = pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx);
assert(error == 0);
}
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
sc->tx_in_progress = 1;
pthread_mutex_unlock(&sc->tx_mtx);
 

Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:54:56 2019
(r349693)
+++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Wed Jul  3 19:56:05 2019
(r349694)
@@ -582,7 +582,7 @@ static void
 pci_vtscsi_eventq_notify(void *vsc, struct vqueue_info *vq)
 {
 
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
 }
 
 static void

Modified: stable/12/usr.sbin/bhyve/virtio.c
==
--- stable/12/usr.sbin/bhyve/virtio.c   Wed Jul  3 19:54:56 2019
(r349693)
+++ stable/12/usr.sbin/bhyve/virtio.c   Wed Jul  3 19:56:05 2019
(r349694)
@@ -428,7 +428,8 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint
 
/*
 * Ensure the used descriptor is visible before updating the index.
-* This is necessary on ISAs with memory ordering less strict than x86.
+* This is necessary on ISAs with memory ordering less strict than x86
+* (and even on x86 to act as a compiler barrier).
 */
atomic_thread_fence_rel();
vuh->vu_idx = uidx;

Modified: stable/

svn commit: r349695 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 19:57:23 2019
New Revision: 349695
URL: https://svnweb.freebsd.org/changeset/base/349695

Log:
  MFC r349019
  
  bhyve: move common code to net_utils.c
  
  Both virtio_net and e82545 network frontends have code to validate and
  generate MAC addresses. These functionalities are replicated in the two
  files, so we move them in a separate compilation unit.
  
  Reviewed by:rgrimes, bryanv, imp, kevans
  Differential Revision:  https://reviews.freebsd.org/D20626

Added:
  stable/12/usr.sbin/bhyve/net_utils.c
 - copied unchanged from r349019, head/usr.sbin/bhyve/net_utils.c
  stable/12/usr.sbin/bhyve/net_utils.h
 - copied unchanged from r349019, head/usr.sbin/bhyve/net_utils.h
Modified:
  stable/12/usr.sbin/bhyve/Makefile
  stable/12/usr.sbin/bhyve/pci_e82545.c
  stable/12/usr.sbin/bhyve/pci_virtio_net.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/Makefile
==
--- stable/12/usr.sbin/bhyve/Makefile   Wed Jul  3 19:56:05 2019
(r349694)
+++ stable/12/usr.sbin/bhyve/Makefile   Wed Jul  3 19:57:23 2019
(r349695)
@@ -32,6 +32,7 @@ SRCS= \
mem.c   \
mevent.c\
mptbl.c \
+   net_utils.c \
pci_ahci.c  \
pci_e82545.c\
pci_emul.c  \

Copied: stable/12/usr.sbin/bhyve/net_utils.c (from r349019, 
head/usr.sbin/bhyve/net_utils.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/usr.sbin/bhyve/net_utils.cWed Jul  3 19:57:23 2019
(r349695, copy of r349019, head/usr.sbin/bhyve/net_utils.c)
@@ -0,0 +1,83 @@
+/*-
+ * Copyright (c) 2011 NetApp, Inc.
+ *
+ * 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$
+ */
+
+#include "net_utils.h"
+#include "bhyverun.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int
+net_parsemac(char *mac_str, uint8_t *mac_addr)
+{
+struct ether_addr *ea;
+char *tmpstr;
+char zero_addr[ETHER_ADDR_LEN] = { 0, 0, 0, 0, 0, 0 };
+
+tmpstr = strsep(&mac_str,"=");
+
+if ((mac_str != NULL) && (!strcmp(tmpstr,"mac"))) {
+ea = ether_aton(mac_str);
+
+if (ea == NULL || ETHER_IS_MULTICAST(ea->octet) ||
+memcmp(ea->octet, zero_addr, ETHER_ADDR_LEN) == 0) {
+   fprintf(stderr, "Invalid MAC %s\n", mac_str);
+return (EINVAL);
+} else
+memcpy(mac_addr, ea->octet, ETHER_ADDR_LEN);
+}
+
+return (0);
+}
+
+void
+net_genmac(struct pci_devinst *pi, uint8_t *macaddr)
+{
+   /*
+* The default MAC address is the standard NetApp OUI of 00-a0-98,
+* followed by an MD5 of the PCI slot/func number and dev name
+*/
+   MD5_CTX mdctx;
+   unsigned char digest[16];
+   char nstr[80];
+
+   snprintf(nstr, sizeof(nstr), "%d-%d-%s", pi->pi_slot,
+   pi->pi_func, vmname);
+
+   MD5Init(&mdctx);
+   MD5Update(&mdctx, nstr, (unsigned int)strlen(nstr));
+   MD5Final(digest, &mdctx);
+
+   macaddr[0] = 0x00;
+   macaddr[1] = 0xa0;
+   macaddr[2] = 0x98;
+   macaddr[3] = digest[0];
+   macaddr[4] = digest[1];
+   macaddr[5] = digest[2];
+}

Copied: stable/12/usr.sbin/bhyve/net_utils.h (from r349019, 
head/usr.sbin/bhyve/net_utils.h)
==
--- /dev/null   00:00:00 1970   (empty, because file 

svn commit: r349696 - stable/12/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 19:59:48 2019
New Revision: 349696
URL: https://svnweb.freebsd.org/changeset/base/349696

Log:
  MFC r349175
  
  bhyve: vtnet: fix locking on receive
  
  The vsc_rx_ready and the RX virtqueue is protected by the rx_mtx lock.
  However, pci_vtnet_ping_rxq() (currently called only once after each
  device reset) accesses those without acquiring the lock.
  
  Reviewed by:markj
  Differential Revision:  https://reviews.freebsd.org/D20609

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

Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:57:23 2019
(r349695)
+++ stable/12/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:59:48 2019
(r349696)
@@ -580,10 +580,12 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq)
/*
 * A qnotify means that the rx process can now begin
 */
+   pthread_mutex_lock(&sc->rx_mtx);
if (sc->vsc_rx_ready == 0) {
sc->vsc_rx_ready = 1;
vq_kick_disable(vq);
}
+   pthread_mutex_unlock(&sc->rx_mtx);
 }
 
 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: r349697 - head/sys/vm

2019-07-03 Thread Ed Maste
Author: emaste
Date: Wed Jul  3 19:59:56 2019
New Revision: 349697
URL: https://svnweb.freebsd.org/changeset/base/349697

Log:
  correct pmap_ts_referenced return type
  
  pmap_ts_referenced returns a count, not a boolean, and is supposed to
  have int as the return type not boolean_t.
  
  This worked previously because boolean_t is an int typedef.
  
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/pmap.h

Modified: head/sys/vm/pmap.h
==
--- head/sys/vm/pmap.h  Wed Jul  3 19:59:48 2019(r349696)
+++ head/sys/vm/pmap.h  Wed Jul  3 19:59:56 2019(r349697)
@@ -164,7 +164,7 @@ void pmap_remove_all(vm_page_t m);
 voidpmap_remove_pages(pmap_t);
 voidpmap_remove_write(vm_page_t m);
 voidpmap_sync_icache(pmap_t, vm_offset_t, vm_size_t);
-boolean_t   pmap_ts_referenced(vm_page_t m);
+int pmap_ts_referenced(vm_page_t m);
 voidpmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end);
 voidpmap_zero_page(vm_page_t);
 voidpmap_zero_page_area(vm_page_t, int off, int size);
___
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: r349698 - stable/11/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 20:05:25 2019
New Revision: 349698
URL: https://svnweb.freebsd.org/changeset/base/349698

Log:
  MFC r348834
  
  bhyve: vtnet: simplify thread synchronization
  
  On vtnet device reset it is necessary to wait for threads to stop TX and
  RX processing. However, the rx_in_progress variable (used for to wait for
  RX processing to stop) is actually useless, and can be removed. Acquiring
  and releasing the RX lock is enough to synchronize correctly. Moreover,
  it is possible to reset the device while holding both TX and RX locks, so
  that the "resetting" variable becomes unnecessary for the RX thread, and
  can be protected by the TX lock (instead of being volatile).
  
  Reviewed by:jhb, markj
  Differential Revision:  https://reviews.freebsd.org/D20543

Modified:
  stable/11/usr.sbin/bhyve/pci_virtio_net.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/pci_virtio_net.c
==
--- stable/11/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 19:59:56 2019
(r349697)
+++ stable/11/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 20:05:25 2019
(r349698)
@@ -147,14 +147,13 @@ struct pci_vtnet_softc {
struct nm_desc  *vsc_nmd;
 
int vsc_rx_ready;
-   volatile intresetting;  /* set and checked outside lock */
+   int resetting;  /* protected by tx_mtx */
 
uint64_tvsc_features;   /* negotiated features */

struct virtio_net_config vsc_config;
 
pthread_mutex_t rx_mtx;
-   int rx_in_progress;
int rx_vhdrlen;
int rx_merge;   /* merged rx bufs in use */
 
@@ -186,62 +185,39 @@ static struct virtio_consts vtnet_vi_consts = {
VTNET_S_HOSTCAPS,   /* our capabilities */
 };
 
-/*
- * If the transmit thread is active then stall until it is done.
- */
 static void
-pci_vtnet_txwait(struct pci_vtnet_softc *sc)
+pci_vtnet_reset(void *vsc)
 {
+   struct pci_vtnet_softc *sc = vsc;
 
+   DPRINTF(("vtnet: device reset requested !\n"));
+
+   /* Acquire the RX lock to block RX processing. */
+   pthread_mutex_lock(&sc->rx_mtx);
+
+   /* Set sc->resetting and give a chance to the TX thread to stop. */
pthread_mutex_lock(&sc->tx_mtx);
+   sc->resetting = 1;
while (sc->tx_in_progress) {
pthread_mutex_unlock(&sc->tx_mtx);
usleep(1);
pthread_mutex_lock(&sc->tx_mtx);
}
-   pthread_mutex_unlock(&sc->tx_mtx);
-}
 
-/*
- * If the receive thread is active then stall until it is done.
- */
-static void
-pci_vtnet_rxwait(struct pci_vtnet_softc *sc)
-{
-
-   pthread_mutex_lock(&sc->rx_mtx);
-   while (sc->rx_in_progress) {
-   pthread_mutex_unlock(&sc->rx_mtx);
-   usleep(1);
-   pthread_mutex_lock(&sc->rx_mtx);
-   }
-   pthread_mutex_unlock(&sc->rx_mtx);
-}
-
-static void
-pci_vtnet_reset(void *vsc)
-{
-   struct pci_vtnet_softc *sc = vsc;
-
-   DPRINTF(("vtnet: device reset requested !\n"));
-
-   sc->resetting = 1;
-
-   /*
-* Wait for the transmit and receive threads to finish their
-* processing.
-*/
-   pci_vtnet_txwait(sc);
-   pci_vtnet_rxwait(sc);
-
sc->vsc_rx_ready = 0;
sc->rx_merge = 1;
sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr);
 
-   /* now reset rings, MSI-X vectors, and negotiated capabilities */
+   /*
+* Now reset rings, MSI-X vectors, and negotiated capabilities.
+* Do that with the TX lock held, since we need to reset
+* sc->resetting.
+*/
vi_reset_dev(&sc->vsc_vs);
 
sc->resetting = 0;
+   pthread_mutex_unlock(&sc->tx_mtx);
+   pthread_mutex_unlock(&sc->rx_mtx);
 }
 
 /*
@@ -315,9 +291,9 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc *sc)
 
/*
 * But, will be called when the rx ring hasn't yet
-* been set up or the guest is resetting the device.
+* been set up.
 */
-   if (!sc->vsc_rx_ready || sc->resetting) {
+   if (!sc->vsc_rx_ready) {
/*
 * Drop the packet and try later.
 */
@@ -512,9 +488,9 @@ pci_vtnet_netmap_rx(struct pci_vtnet_softc *sc)
 
/*
 * But, will be called when the rx ring hasn't yet
-* been set up or the guest is resetting the device.
+* been set up.
 */
-   if (!sc->vsc_rx_ready || sc->resetting) {
+   if (!sc->vsc_rx_ready) {
/*
 * Drop the packet and try later.
 */
@@ -591,9 +567,7 @@ pci_vtnet_rx_callback(int fd, enum ev_type type, void 
struct pci_vtnet_softc *sc = param;
 
pthread_mutex_lock(&sc->rx_mtx);
-   sc->rx_in_progress = 1;
sc->pci_vtnet_rx(sc);
-  

svn commit: r349699 - stable/12/sys/fs/smbfs

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:14:43 2019
New Revision: 349699
URL: https://svnweb.freebsd.org/changeset/base/349699

Log:
  MFC r349334:
  Remove a lingering use of splbio().

Modified:
  stable/12/sys/fs/smbfs/smbfs_io.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/smbfs/smbfs_io.c
==
--- stable/12/sys/fs/smbfs/smbfs_io.c   Wed Jul  3 20:05:25 2019
(r349698)
+++ stable/12/sys/fs/smbfs/smbfs_io.c   Wed Jul  3 20:14:43 2019
(r349699)
@@ -375,9 +375,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc
 */
if (error == EINTR
|| (!error && (bp->b_flags & B_NEEDCOMMIT))) {
-   int s;
-
-   s = splbio();
bp->b_flags &= ~(B_INVAL|B_NOCACHE);
if ((bp->b_flags & B_ASYNC) == 0)
bp->b_flags |= B_EINTR;
@@ -387,7 +384,6 @@ smbfs_doio(struct vnode *vp, struct buf *bp, struct uc
}
if ((bp->b_flags & B_ASYNC) == 0)
bp->b_flags |= B_EINTR;
-   splx(s);
} else {
if (error) {
bp->b_ioflags |= BIO_ERROR;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349700 - stable/12/sys/ufs/ffs

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:15:09 2019
New Revision: 349700
URL: https://svnweb.freebsd.org/changeset/base/349700

Log:
  MFC r349419:
  Remove references to splbio in ffs_softdep.c.

Modified:
  stable/12/sys/ufs/ffs/ffs_softdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/ufs/ffs/ffs_softdep.c
==
--- stable/12/sys/ufs/ffs/ffs_softdep.c Wed Jul  3 20:14:43 2019
(r349699)
+++ stable/12/sys/ufs/ffs/ffs_softdep.c Wed Jul  3 20:15:09 2019
(r349700)
@@ -2098,7 +2098,6 @@ pagedep_find(pagedephd, ino, lbn, pagedeppp)
  * Look up a pagedep. Return 1 if found, 0 otherwise.
  * If not found, allocate if DEPALLOC flag is passed.
  * Found or allocated entry is returned in pagedeppp.
- * This routine must be called with splbio interrupts blocked.
  */
 static int
 pagedep_lookup(mp, bp, ino, lbn, flags, pagedeppp)
@@ -2190,7 +2189,6 @@ inodedep_find(inodedephd, inum, inodedeppp)
  * Look up an inodedep. Return 1 if found, 0 if not found.
  * If not found, allocate if DEPALLOC flag is passed.
  * Found or allocated entry is returned in inodedeppp.
- * This routine must be called with splbio interrupts blocked.
  */
 static int
 inodedep_lookup(mp, inum, flags, inodedeppp)
@@ -5466,7 +5464,6 @@ jnewblk_merge(new, old, wkhd)
 
 /*
  * Replace an old allocdirect dependency with a newer one.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 allocdirect_merge(adphead, newadp, oldadp)
@@ -7519,7 +7516,6 @@ free_newblk(newblk)
 
 /*
  * Free a newdirblk. Clear the NEWBLOCK flag on its associated pagedep.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 free_newdirblk(newdirblk)
@@ -7650,7 +7646,6 @@ softdep_freefile(pvp, ino, mode)
 /*
  * Check to see if an inode has never been written to disk. If
  * so free the inodedep and return success, otherwise return failure.
- * This routine must be called with splbio interrupts blocked.
  *
  * If we still have a bitmap dependency, then the inode has never
  * been written to disk. Drop the dependency as it is no longer
@@ -8882,8 +8877,7 @@ cancel_diradd(dap, dirrem, jremref, dotremref, dotdotr
 }
 
 /*
- * Free a diradd dependency structure. This routine must be called
- * with splbio interrupts blocked.
+ * Free a diradd dependency structure.
  */
 static void
 free_diradd(dap, wkhd)
@@ -11168,9 +11162,7 @@ softdep_disk_write_complete(bp)
 }
 
 /*
- * Called from within softdep_disk_write_complete above. Note that
- * this routine is always called from interrupt level with further
- * splbio interrupts blocked.
+ * Called from within softdep_disk_write_complete above.
  */
 static void 
 handle_allocdirect_partdone(adp, wkhd)
@@ -11182,6 +11174,7 @@ handle_allocdirect_partdone(adp, wkhd)
struct inodedep *inodedep;
long bsize;
 
+   LOCK_OWNED(VFSTOUFS(adp->ad_block.nb_list.wk_mp));
if ((adp->ad_state & ALLCOMPLETE) != ALLCOMPLETE)
return;
/*
@@ -11788,7 +11781,6 @@ handle_written_indirdep(indirdep, bp, bpp, flags)
 
 /*
  * Process a diradd entry after its dependent inode has been written.
- * This routine must be called with splbio interrupts blocked.
  */
 static void
 diradd_inode_written(dap, inodedep)
@@ -11796,6 +11788,7 @@ diradd_inode_written(dap, inodedep)
struct inodedep *inodedep;
 {
 
+   LOCK_OWNED(VFSTOUFS(dap->da_list.wk_mp));
dap->da_state |= COMPLETE;
complete_diradd(dap);
WORKLIST_INSERT(&inodedep->id_pendinghd, &dap->da_list);
@@ -12356,8 +12349,7 @@ retry:
 
 /*
  * Merge the a new inode dependency list (such as id_newinoupdt) into an
- * old inode dependency list (such as id_inoupdt). This routine must be
- * called with splbio interrupts blocked.
+ * old inode dependency list (such as id_inoupdt).
  */
 static void
 merge_inode_lists(newlisthead, oldlisthead)
@@ -12367,6 +12359,8 @@ merge_inode_lists(newlisthead, oldlisthead)
struct allocdirect *listadp, *newadp;
 
newadp = TAILQ_FIRST(newlisthead);
+   if (newadp != NULL)
+   LOCK_OWNED(VFSTOUFS(newadp->ad_block.nb_list.wk_mp));
for (listadp = TAILQ_FIRST(oldlisthead); listadp && newadp;) {
if (listadp->ad_offset < newadp->ad_offset) {
listadp = TAILQ_NEXT(listadp, ad_next);
@@ -12861,7 +12855,6 @@ out:
 
 /*
  * Flush the dependencies associated with an inodedep.
- * Called with splbio blocked.
  */
 static int
 flush_inodedep_deps(vp, mp, ino)
@@ -12926,7 +12919,6 @@ restart:
 
 /*
  * Flush an inode dependency list.
- * Called with splbio blocked.
  */
 static int
 flush_deplist(listhead, waitfor, errorp)
@@ -13068,7 +13060,6 @@ flush_newblk_dep(vp, mp, lbn)
 
 /*
  * Eliminate a pagedep dependency by flushing out all its diradd dependencies.
- * Called with splbio blocked.
  */
 static int
 flush_pagedep_deps(pvp, mp, diraddhdp)
___

svn commit: r349701 - in stable/12/sys: amd64/sgx dev/drm2/ttm vm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:17:26 2019
New Revision: 349701
URL: https://svnweb.freebsd.org/changeset/base/349701

Log:
  MFC r349432:
  Add a return value to vm_page_remove().

Modified:
  stable/12/sys/amd64/sgx/sgx.c
  stable/12/sys/dev/drm2/ttm/ttm_bo_vm.c
  stable/12/sys/vm/device_pager.c
  stable/12/sys/vm/vm_fault.c
  stable/12/sys/vm/vm_object.c
  stable/12/sys/vm/vm_page.c
  stable/12/sys/vm/vm_page.h

Modified: stable/12/sys/amd64/sgx/sgx.c
==
--- stable/12/sys/amd64/sgx/sgx.c   Wed Jul  3 20:15:09 2019
(r349700)
+++ stable/12/sys/amd64/sgx/sgx.c   Wed Jul  3 20:17:26 2019
(r349701)
@@ -358,7 +358,7 @@ sgx_page_remove(struct sgx_softc *sc, vm_page_t p)
uint64_t offs;
 
vm_page_lock(p);
-   vm_page_remove(p);
+   (void)vm_page_remove(p);
vm_page_unlock(p);
 
dprintf("%s: p->pidx %ld\n", __func__, p->pindex);

Modified: stable/12/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- stable/12/sys/dev/drm2/ttm/ttm_bo_vm.c  Wed Jul  3 20:15:09 2019
(r349700)
+++ stable/12/sys/dev/drm2/ttm/ttm_bo_vm.c  Wed Jul  3 20:17:26 2019
(r349701)
@@ -115,7 +115,7 @@ ttm_bo_vm_fault(vm_object_t vm_obj, vm_ooffset_t offse
vm_object_pip_add(vm_obj, 1);
if (*mres != NULL) {
vm_page_lock(*mres);
-   vm_page_remove(*mres);
+   (void)vm_page_remove(*mres);
vm_page_unlock(*mres);
}
 retry:

Modified: stable/12/sys/vm/device_pager.c
==
--- stable/12/sys/vm/device_pager.c Wed Jul  3 20:15:09 2019
(r349700)
+++ stable/12/sys/vm/device_pager.c Wed Jul  3 20:17:26 2019
(r349701)
@@ -236,7 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m)
KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m));
pmap_remove_all(m);
vm_page_lock(m);
-   vm_page_remove(m);
+   (void)vm_page_remove(m);
vm_page_unlock(m);
} else if (object->type == OBJT_DEVICE)
dev_pager_free_page(object, m);

Modified: stable/12/sys/vm/vm_fault.c
==
--- stable/12/sys/vm/vm_fault.c Wed Jul  3 20:15:09 2019(r349700)
+++ stable/12/sys/vm/vm_fault.c Wed Jul  3 20:17:26 2019(r349701)
@@ -1144,7 +1144,7 @@ readrest:
fs.object == fs.first_object->backing_object) {
vm_page_lock(fs.m);
vm_page_dequeue(fs.m);
-   vm_page_remove(fs.m);
+   (void)vm_page_remove(fs.m);
vm_page_unlock(fs.m);
vm_page_lock(fs.first_m);
vm_page_replace_checked(fs.m, fs.first_object,

Modified: stable/12/sys/vm/vm_object.c
==
--- stable/12/sys/vm/vm_object.cWed Jul  3 20:15:09 2019
(r349700)
+++ stable/12/sys/vm/vm_object.cWed Jul  3 20:17:26 2019
(r349701)
@@ -1595,10 +1595,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
vm_page_lock(p);
KASSERT(!pmap_page_is_mapped(p),
("freeing mapped page %p", p));
-   if (!vm_page_wired(p))
+   if (vm_page_remove(p))
vm_page_free(p);
-   else
-   vm_page_remove(p);
vm_page_unlock(p);
continue;
}
@@ -1639,10 +1637,8 @@ vm_object_collapse_scan(vm_object_t object, int op)
vm_page_lock(p);
KASSERT(!pmap_page_is_mapped(p),
("freeing mapped page %p", p));
-   if (!vm_page_wired(p))
+   if (vm_page_remove(p))
vm_page_free(p);
-   else
-   vm_page_remove(p);
vm_page_unlock(p);
continue;
}

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Wed Jul  3 20:15:09 2019(r349700)
+++ stable/12/sys/vm/vm_page.c  Wed Jul  3 20:17:26 2019(r349701)
@@ -1454,20 +1454,21 @@ vm_page_insert_radixdone(vm_page_t m, vm_object_t obje
  * vm_page_remove:
  *
  * Removes the specified page from its containing object, but does not
- * invalidate any backing storage.
+ * invali

svn commit: r349703 - stable/12/sys/vm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:18:49 2019
New Revision: 349703
URL: https://svnweb.freebsd.org/changeset/base/349703

Log:
  MFC r349218:
  Group vm_page_activate()'s definition with other related functions.

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

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Wed Jul  3 20:18:05 2019(r349702)
+++ stable/12/sys/vm/vm_page.c  Wed Jul  3 20:18:49 2019(r349703)
@@ -3372,35 +3372,6 @@ vm_page_requeue(vm_page_t m)
 }
 
 /*
- * vm_page_activate:
- *
- * Put the specified page on the active list (if appropriate).
- * Ensure that act_count is at least ACT_INIT but do not otherwise
- * mess with it.
- *
- * The page must be locked.
- */
-void
-vm_page_activate(vm_page_t m)
-{
-
-   vm_page_assert_locked(m);
-
-   if (vm_page_wired(m) || (m->oflags & VPO_UNMANAGED) != 0)
-   return;
-   if (vm_page_queue(m) == PQ_ACTIVE) {
-   if (m->act_count < ACT_INIT)
-   m->act_count = ACT_INIT;
-   return;
-   }
-
-   vm_page_dequeue(m);
-   if (m->act_count < ACT_INIT)
-   m->act_count = ACT_INIT;
-   vm_page_enqueue(m, PQ_ACTIVE);
-}
-
-/*
  * vm_page_free_prep:
  *
  * Prepares the given page to be put on the free list,
@@ -3649,6 +3620,35 @@ vm_page_unwire_noq(vm_page_t m)
return (true);
} else
return (false);
+}
+
+/*
+ * vm_page_activate:
+ *
+ * Put the specified page on the active list (if appropriate).
+ * Ensure that act_count is at least ACT_INIT but do not otherwise
+ * mess with it.
+ *
+ * The page must be locked.
+ */
+void
+vm_page_activate(vm_page_t m)
+{
+
+   vm_page_assert_locked(m);
+
+   if (vm_page_wired(m) || (m->oflags & VPO_UNMANAGED) != 0)
+   return;
+   if (vm_page_queue(m) == PQ_ACTIVE) {
+   if (m->act_count < ACT_INIT)
+   m->act_count = ACT_INIT;
+   return;
+   }
+
+   vm_page_dequeue(m);
+   if (m->act_count < ACT_INIT)
+   m->act_count = ACT_INIT;
+   vm_page_enqueue(m, PQ_ACTIVE);
 }
 
 /*
___
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: r349702 - stable/12

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:18:05 2019
New Revision: 349702
URL: https://svnweb.freebsd.org/changeset/base/349702

Log:
  Add mergeinfo missed in r349701.

Modified:
Directory Properties:
  stable/12/   (props changed)
___
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: r349704 - stable/11/usr.sbin/bhyve

2019-07-03 Thread Vincenzo Maffione
Author: vmaffione
Date: Wed Jul  3 20:22:36 2019
New Revision: 349704
URL: https://svnweb.freebsd.org/changeset/base/349704

Log:
  MFC r348929
  
  bhyve: virtio: introduce vq_kick_enable() and vq_kick_disable()
  
  The VirtIO standard supports two schemes for notification suppression:
  a notification enable bit and a more sophisticated one (event_idx) that
  also supports delayed notifications. Currently bhyve fully supports
  only the first scheme. This patch hides the notification suppression
  internals by means of two inline routines, vq_kick_enable() and
  vq_kick_disable(), and makes the code more readable.
  Moreover, further improve readability by replacing the call to mb()
  with a call to atomic_thread_fence_seq_cst(), which is already used
  in virtio.c
  
  Reviewed by:pmooney_pfmooney.com, bryanv
  Differential Revision:  https://reviews.freebsd.org/D20581

Modified:
  stable/11/usr.sbin/bhyve/pci_virtio_console.c
  stable/11/usr.sbin/bhyve/pci_virtio_net.c
  stable/11/usr.sbin/bhyve/virtio.c
  stable/11/usr.sbin/bhyve/virtio.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/pci_virtio_console.c
==
--- stable/11/usr.sbin/bhyve/pci_virtio_console.c   Wed Jul  3 20:18:49 
2019(r349703)
+++ stable/11/usr.sbin/bhyve/pci_virtio_console.c   Wed Jul  3 20:22:36 
2019(r349704)
@@ -581,7 +581,7 @@ pci_vtcon_notify_rx(void *vsc, struct vqueue_info *vq)
 
if (!port->vsp_rx_ready) {
port->vsp_rx_ready = 1;
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
}
 }
 

Modified: stable/11/usr.sbin/bhyve/pci_virtio_net.c
==
--- stable/11/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 20:18:49 2019
(r349703)
+++ stable/11/usr.sbin/bhyve/pci_virtio_net.c   Wed Jul  3 20:22:36 2019
(r349704)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #ifndef NETMAP_WITH_LIBS
 #define NETMAP_WITH_LIBS
@@ -582,7 +581,7 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq)
 */
if (sc->vsc_rx_ready == 0) {
sc->vsc_rx_ready = 1;
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
}
 }
 
@@ -628,7 +627,7 @@ pci_vtnet_ping_txq(void *vsc, struct vqueue_info *vq)
 
/* Signal the tx thread for processing */
pthread_mutex_lock(&sc->tx_mtx);
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
if (sc->tx_in_progress == 0)
pthread_cond_signal(&sc->tx_cond);
pthread_mutex_unlock(&sc->tx_mtx);
@@ -657,8 +656,7 @@ pci_vtnet_tx_thread(void *param)
for (;;) {
/* note - tx mutex is locked here */
while (sc->resetting || !vq_has_descs(vq)) {
-   vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY;
-   mb();
+   vq_kick_enable(vq);
if (!sc->resetting && vq_has_descs(vq))
break;
 
@@ -666,7 +664,7 @@ pci_vtnet_tx_thread(void *param)
error = pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx);
assert(error == 0);
}
-   vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY;
+   vq_kick_disable(vq);
sc->tx_in_progress = 1;
pthread_mutex_unlock(&sc->tx_mtx);
 

Modified: stable/11/usr.sbin/bhyve/virtio.c
==
--- stable/11/usr.sbin/bhyve/virtio.c   Wed Jul  3 20:18:49 2019
(r349703)
+++ stable/11/usr.sbin/bhyve/virtio.c   Wed Jul  3 20:22:36 2019
(r349704)
@@ -428,7 +428,8 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint
 
/*
 * Ensure the used descriptor is visible before updating the index.
-* This is necessary on ISAs with memory ordering less strict than x86.
+* This is necessary on ISAs with memory ordering less strict than x86
+* (and even on x86 to act as a compiler barrier).
 */
atomic_thread_fence_rel();
vuh->vu_idx = uidx;

Modified: stable/11/usr.sbin/bhyve/virtio.h
==
--- stable/11/usr.sbin/bhyve/virtio.h   Wed Jul  3 20:18:49 2019
(r349703)
+++ stable/11/usr.sbin/bhyve/virtio.h   Wed Jul  3 20:22:36 2019
(r349704)
@@ -31,6 +31,8 @@
 #ifndef_VIRTIO_H_
 #define_VIRTIO_H_
 
+#include 
+
 /*
  * These are derived from several virtio specifications.
  *
@@ -444,6 +446,26 @@ vq_interrupt(struct virtio_softc *vs, struct vqueue_in
pci_lintr_assert(vs->vs_pi);

svn commit: r349705 - stable/12/contrib/elftoolchain/elfcopy

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:52:07 2019
New Revision: 349705
URL: https://svnweb.freebsd.org/changeset/base/349705

Log:
  MFC r349423
  elfcopy: Provide a size hint when creating the section string table.

Modified:
  stable/12/contrib/elftoolchain/elfcopy/sections.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/elfcopy/sections.c
==
--- stable/12/contrib/elftoolchain/elfcopy/sections.c   Wed Jul  3 20:22:36 
2019(r349704)
+++ stable/12/contrib/elftoolchain/elfcopy/sections.c   Wed Jul  3 20:52:07 
2019(r349705)
@@ -1398,8 +1398,24 @@ update_shdr(struct elfcopy *ecp, int update_link)
 void
 init_shstrtab(struct elfcopy *ecp)
 {
+   Elf_Scn *shstrtab;
+   GElf_Shdr shdr;
struct section *s;
+   size_t indx, sizehint;
 
+   if (elf_getshstrndx(ecp->ein, &indx) != 0) {
+   shstrtab = elf_getscn(ecp->ein, indx);
+   if (shstrtab == NULL)
+   errx(EXIT_FAILURE, "elf_getscn failed: %s",
+   elf_errmsg(-1));
+   if (gelf_getshdr(shstrtab, &shdr) != &shdr)
+   errx(EXIT_FAILURE, "gelf_getshdr failed: %s",
+   elf_errmsg(-1));
+   sizehint = shdr.sh_size;
+   } else {
+   sizehint = 0;
+   }
+
if ((ecp->shstrtab = calloc(1, sizeof(*ecp->shstrtab))) == NULL)
err(EXIT_FAILURE, "calloc failed");
s = ecp->shstrtab;
@@ -1410,7 +1426,7 @@ init_shstrtab(struct elfcopy *ecp)
s->loadable = 0;
s->type = SHT_STRTAB;
s->vma = 0;
-   s->strtab = elftc_string_table_create(0);
+   s->strtab = elftc_string_table_create(sizehint);
 
add_to_shstrtab(ecp, "");
add_to_shstrtab(ecp, ".symtab");
___
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: r349706 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 20:52:10 2019
New Revision: 349706
URL: https://svnweb.freebsd.org/changeset/base/349706

Log:
  Fix path of lib32 libcasper.
  
  Reported by:  jhb
  MFC after:1 week

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 20:52:07 2019(r349705)
+++ head/ObsoleteFiles.inc  Wed Jul  3 20:52:10 2019(r349706)
@@ -825,7 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
 OLD_FILES+=usr/bin/send-pr
 # 20180725: Cleanup old libcasper.so.0
 OLD_LIBS+=lib/libcasper.so.0
-OLD_LIBS+=lib32/libcasper.so.0
+OLD_LIBS+=usr/lib32/libcasper.so.0
 # 20180722: indent(1) option renamed, test files follow
 OLD_FILES+=usr/bin/indent/tests/nsac.0
 OLD_FILES+=usr/bin/indent/tests/nsac.0.pro
___
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: r349640 - head

2019-07-03 Thread Tijl Coosemans
On Wed, 3 Jul 2019 09:11:53 -0700 John Baldwin  wrote:
> On 7/3/19 2:08 AM, Tijl Coosemans wrote:
>> Author: tijl
>> Date: Wed Jul  3 09:08:17 2019
>> New Revision: 349640
>> URL: https://svnweb.freebsd.org/changeset/base/349640
>> 
>> Log:
>>   Also remove lib32 version of libcasper.so.0.
>> 
>> Modified:
>>   head/ObsoleteFiles.inc
>> 
>> Modified: head/ObsoleteFiles.inc
>> ==
>> --- head/ObsoleteFiles.inc   Wed Jul  3 09:06:39 2019(r349639)
>> +++ head/ObsoleteFiles.inc   Wed Jul  3 09:08:17 2019(r349640)
>> @@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
>>  OLD_FILES+=usr/bin/send-pr
>>  # 20180725: Cleanup old libcasper.so.0
>>  OLD_LIBS+=lib/libcasper.so.0
>> +OLD_LIBS+=lib32/libcasper.so.0  
> 
> Should this be usr/lib32 instead of lib32?

Yes, fixed in r349706.
___
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: r349707 - stable/12/contrib/elftoolchain/libelftc

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:53:05 2019
New Revision: 349707
URL: https://svnweb.freebsd.org/changeset/base/349707

Log:
  MFC r349420
  libelftc: Micro-optimize string table insertion.

Modified:
  stable/12/contrib/elftoolchain/libelftc/elftc_string_table.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/libelftc/elftc_string_table.c
==
--- stable/12/contrib/elftoolchain/libelftc/elftc_string_table.cWed Jul 
 3 20:52:10 2019(r349706)
+++ stable/12/contrib/elftoolchain/libelftc/elftc_string_table.cWed Jul 
 3 20:53:05 2019(r349707)
@@ -119,7 +119,7 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
st->st_string_pool_size = newsize;
}
 
-   strcpy(st->st_string_pool + stlen, string);
+   memcpy(st->st_string_pool + stlen, string, len);
ELFTC_STRING_TABLE_UPDATE_LENGTH(st, stlen + len);
 
return (stlen);
___
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: r349708 - stable/12/contrib/elftoolchain/libelftc

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:54:36 2019
New Revision: 349708
URL: https://svnweb.freebsd.org/changeset/base/349708

Log:
  MFC r349421:
  libelftc: Consistently use size_t for string table offsets and sizes.

Modified:
  stable/12/contrib/elftoolchain/libelftc/elftc_string_table.c
  stable/12/contrib/elftoolchain/libelftc/elftc_string_table_create.3
  stable/12/contrib/elftoolchain/libelftc/libelftc.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/libelftc/elftc_string_table.c
==
--- stable/12/contrib/elftoolchain/libelftc/elftc_string_table.cWed Jul 
 3 20:53:05 2019(r349707)
+++ stable/12/contrib/elftoolchain/libelftc/elftc_string_table.cWed Jul 
 3 20:54:36 2019(r349708)
@@ -44,7 +44,7 @@ ELFTC_VCSID("$Id: elftc_string_table.c 2869 2013-01-06
 #defineELFTC_STRING_TABLE_POOL_SIZE_INCREMENT  (4*1024)
 
 struct _Elftc_String_Table_Entry {
-   int ste_idx;
+   ssize_t ste_idx;
SLIST_ENTRY(_Elftc_String_Table_Entry) ste_next;
 };
 
@@ -64,9 +64,9 @@ struct _Elftc_String_Table_Entry {
} while (0)
 
 struct _Elftc_String_Table {
-   unsigned intst_len; /* length and flags */
+   size_t  st_len; /* length and flags */
int st_nbuckets;
-   int st_string_pool_size;
+   size_t  st_string_pool_size;
char*st_string_pool;
SLIST_HEAD(_Elftc_String_Table_Bucket,
_Elftc_String_Table_Entry) st_buckets[];
@@ -86,7 +86,7 @@ elftc_string_table_find_hash_entry(Elftc_String_Table 
*rhashindex = hashindex;
 
SLIST_FOREACH(ste, &st->st_buckets[hashindex], ste_next) {
-   s = st->st_string_pool + abs(ste->ste_idx);
+   s = st->st_string_pool + labs(ste->ste_idx);
 
assert(s > st->st_string_pool &&
s < st->st_string_pool + st->st_string_pool_size);
@@ -102,7 +102,7 @@ static int
 elftc_string_table_add_to_pool(Elftc_String_Table *st, const char *string)
 {
char *newpool;
-   int len, newsize, stlen;
+   size_t len, newsize, stlen;
 
len = strlen(string) + 1; /* length, including the trailing NUL */
stlen = ELFTC_STRING_TABLE_LENGTH(st);
@@ -126,10 +126,10 @@ elftc_string_table_add_to_pool(Elftc_String_Table *st,
 }
 
 Elftc_String_Table *
-elftc_string_table_create(int sizehint)
+elftc_string_table_create(size_t sizehint)
 {
-   int n, nbuckets, tablesize;
struct _Elftc_String_Table *st;
+   int n, nbuckets, tablesize;
 
if (sizehint < ELFTC_STRING_TABLE_DEFAULT_SIZE)
sizehint = ELFTC_STRING_TABLE_DEFAULT_SIZE;
@@ -173,13 +173,13 @@ elftc_string_table_destroy(Elftc_String_Table *st)
 }
 
 Elftc_String_Table *
-elftc_string_table_from_section(Elf_Scn *scn, int sizehint)
+elftc_string_table_from_section(Elf_Scn *scn, size_t sizehint)
 {
-   int len;
Elf_Data *d;
GElf_Shdr sh;
const char *s, *end;
Elftc_String_Table *st;
+   size_t len;
 
/* Verify the type of the section passed in. */
if (gelf_getshdr(scn, &sh) == NULL ||
@@ -235,7 +235,8 @@ elftc_string_table_image(Elftc_String_Table *st, size_
char *r, *s, *end;
struct _Elftc_String_Table_Entry *ste;
struct _Elftc_String_Table_Bucket *head;
-   int copied, hashindex, offset, length, newsize;
+   size_t copied, offset, length, newsize;
+   int hashindex;
 
/*
 * For the common case of a string table has not seen
@@ -303,8 +304,9 @@ elftc_string_table_image(Elftc_String_Table *st, size_
 size_t
 elftc_string_table_insert(Elftc_String_Table *st, const char *string)
 {
-   int hashindex, idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
+   int hashindex;
 
hashindex = 0;
 
@@ -326,7 +328,7 @@ elftc_string_table_insert(Elftc_String_Table *st, cons
 
idx = ste->ste_idx;
if (idx < 0)/* Undelete. */
-   ste->ste_idx = idx = (- idx);
+   ste->ste_idx = idx = -idx;
 
return (idx);
 }
@@ -334,8 +336,9 @@ elftc_string_table_insert(Elftc_String_Table *st, cons
 size_t
 elftc_string_table_lookup(Elftc_String_Table *st, const char *string)
 {
-   int hashindex, idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
+   int hashindex;
 
ste = elftc_string_table_find_hash_entry(st, string, &hashindex);
 
@@ -350,17 +353,17 @@ elftc_string_table_lookup(Elftc_String_Table *st, cons
 int
 elftc_string_table_remove(Elftc_String_Table *st, const char *string)
 {
-   int idx;
struct _Elftc_String_Table_Entry *ste;
+   ssize_t idx;
 
ste = elftc_string_table_find_hash_entry(st, string, NULL);
 
if (ste == NULL || (idx = ste->ste_idx) < 0)

svn commit: r349709 - stable/12/contrib/elftoolchain/libelftc

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:54:52 2019
New Revision: 349709
URL: https://svnweb.freebsd.org/changeset/base/349709

Log:
  MFC r349422:
  libelftc: Fix the documented prototype for elftc_string_table_destroy().

Modified:
  stable/12/contrib/elftoolchain/libelftc/elftc_string_table_create.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/libelftc/elftc_string_table_create.3
==
--- stable/12/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jul 
 3 20:54:36 2019(r349708)
+++ stable/12/contrib/elftoolchain/libelftc/elftc_string_table_create.3 Wed Jul 
 3 20:54:52 2019(r349709)
@@ -41,7 +41,7 @@
 .In libelftc.h
 .Ft "Elftc_String_Table *"
 .Fn elftc_string_table_create "size_t sizehint"
-.Ft int
+.Ft void
 .Fn elftc_string_table_destroy "Elftc_String_Table *table"
 .Ft "Elftc_String_Table *"
 .Fn elftc_string_table_from_section "Elf_Scn *scn" "size_t sizehint"
___
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: r349710 - stable/12/contrib/elftoolchain/libdwarf

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 20:55:08 2019
New Revision: 349710
URL: https://svnweb.freebsd.org/changeset/base/349710

Log:
  MFC r349424:
  libdwarf: Use the cached strtab pointer when reading string attributes.

Modified:
  stable/12/contrib/elftoolchain/libdwarf/libdwarf_attr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/libdwarf/libdwarf_attr.c
==
--- stable/12/contrib/elftoolchain/libdwarf/libdwarf_attr.c Wed Jul  3 
20:54:52 2019(r349709)
+++ stable/12/contrib/elftoolchain/libdwarf/libdwarf_attr.c Wed Jul  3 
20:55:08 2019(r349710)
@@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
 uint64_t form, int indirect, Dwarf_Error *error)
 {
struct _Dwarf_Attribute atref;
-   Dwarf_Section *str;
int ret;
 
ret = DW_DLE_NONE;
@@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
break;
case DW_FORM_strp:
atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size);
-   str = _dwarf_find_section(dbg, ".debug_str");
-   assert(str != NULL);
-   atref.u[1].s = (char *) str->ds_data + atref.u[0].u64;
+   atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64;
break;
case DW_FORM_ref_sig8:
atref.u[0].u64 = 8;
___
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: r349641 - head/tools/build/mk

2019-07-03 Thread Tijl Coosemans
On Wed, 3 Jul 2019 09:14:48 -0700 John Baldwin  wrote:
> On 7/3/19 2:14 AM, Tijl Coosemans wrote:
>> Author: tijl
>> Date: Wed Jul  3 09:14:39 2019
>> New Revision: 349641
>> URL: https://svnweb.freebsd.org/changeset/base/349641
>> 
>> Log:
>>   Also remove lib32 versions of libradius.
>>   
>>   MFC after: 1 week  
> 
> I do wonder if we shouldn't try to make OLD_LIBS a bit
> smarter by having it expand to also include the lib32
> (and libsoft) variants.  Having some kind of helper
> to deal with the non-dynamic libs would also be nice
> (it would remove libfoo.a, libfoo_p.a, and libfoo.so
> which always live in /usr/lib, /usr/lib32, and /usr/libsoft).

I hope this file just goes away with base packages.
___
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: r349711 - head/sys/dev/iwm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 21:05:40 2019
New Revision: 349711
URL: https://svnweb.freebsd.org/changeset/base/349711

Log:
  iwm: Drain callouts after stopping the device during detach.
  
  Otherwise there is a window where they may be rescheduled.  This
  typically manifested as a page fault shortly after unloading if_iwm.ko.
  Close the race by draining callouts after calling iwm_stop_device(),
  which is also what Dragonfly does.
  
  Change whitespace to reduce gratuitous diffs with Dragonfly.
  
  Reported and tested by:   seanc
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Jul  3 20:55:08 2019(r349710)
+++ head/sys/dev/iwm/if_iwm.c   Wed Jul  3 21:05:40 2019(r349711)
@@ -6330,12 +6330,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
if (!sc->sc_attached)
return 0;
sc->sc_attached = 0;
-
-   if (do_net80211)
+   if (do_net80211) {
ieee80211_draintask(&sc->sc_ic, &sc->sc_es_task);
-
-   callout_drain(&sc->sc_led_blink_to);
-   callout_drain(&sc->sc_watchdog_to);
+   }
iwm_stop_device(sc);
if (do_net80211) {
IWM_LOCK(sc);
@@ -6343,6 +6340,8 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
IWM_UNLOCK(sc);
ieee80211_ifdetach(&sc->sc_ic);
}
+   callout_drain(&sc->sc_led_blink_to);
+   callout_drain(&sc->sc_watchdog_to);
 
iwm_phy_db_free(sc->sc_phy_db);
sc->sc_phy_db = 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: r349712 - stable/12/sys/kern

2019-07-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jul  3 21:30:18 2019
New Revision: 349712
URL: https://svnweb.freebsd.org/changeset/base/349712

Log:
  MFC r348299
  
  kern/CTF: link_elf_ctf_get() on big endian platforms
  
  Check the CTF magic number in big endian platforms.  This lets DTrace FBT
  handle types correctly on these platforms.

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

Modified: stable/12/sys/kern/kern_ctf.c
==
--- stable/12/sys/kern/kern_ctf.c   Wed Jul  3 21:05:40 2019
(r349711)
+++ stable/12/sys/kern/kern_ctf.c   Wed Jul  3 21:30:18 2019
(r349712)
@@ -193,8 +193,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
NOCRED, NULL, td)) != 0)
goto out;
 
-   /* Check the CTF magic number. (XXX check for big endian!) */
+   /* Check the CTF magic number. */
+#ifdef __LITTLE_ENDIAN__
if (ctf_hdr[0] != 0xf1 || ctf_hdr[1] != 0xcf) {
+#else
+   if (ctf_hdr[0] != 0xcf || ctf_hdr[1] != 0xf1) {
+#endif
printf("%s(%d): module %s has invalid format\n",
__func__, __LINE__, lf->pathname);
error = EFTYPE;
___
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: r349713 - head/sys/vm

2019-07-03 Thread Doug Moore
Author: dougm
Date: Wed Jul  3 22:41:54 2019
New Revision: 349713
URL: https://svnweb.freebsd.org/changeset/base/349713

Log:
  Eliminate a goto and a label in vm_map_wire_locked by inserting an 'else'.
  
  Reviewed by: alc
  Approved by: kib, markj (mentors, implicit)
  Differential Revision: https://reviews.freebsd.org/D20845

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Jul  3 21:30:18 2019(r349712)
+++ head/sys/vm/vm_map.cWed Jul  3 22:41:54 2019(r349713)
@@ -3170,9 +3170,7 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm
rv = KERN_INVALID_ADDRESS;
goto done;
}
-   goto next_entry;
-   }
-   if (entry->wired_count == 0) {
+   } else if (entry->wired_count == 0) {
entry->wired_count++;
 
npages = atop(entry->end - entry->start);
@@ -3250,7 +3248,6 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm
 * Check the map for holes in the specified region.
 * If VM_MAP_WIRE_HOLESOK was specified, skip this check.
 */
-   next_entry:
if ((flags & VM_MAP_WIRE_HOLESOK) == 0 &&
entry->end < end && entry->next->start > entry->end) {
end = entry->end;
___
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: r349714 - head/sys/dev/proto

2019-07-03 Thread Marcel Moolenaar
Author: marcel
Date: Thu Jul  4 02:51:34 2019
New Revision: 349714
URL: https://svnweb.freebsd.org/changeset/base/349714

Log:
  Lock busdma operations and serialize detach against open/close
  
  Use sx to allow M_WAITOK allocations (suggested by markj).
  
  admbugs: 782
  Reviewed by:  markj

Modified:
  head/sys/dev/proto/proto.h
  head/sys/dev/proto/proto_busdma.c
  head/sys/dev/proto/proto_busdma.h
  head/sys/dev/proto/proto_core.c

Modified: head/sys/dev/proto/proto.h
==
--- head/sys/dev/proto/proto.h  Wed Jul  3 22:41:54 2019(r349713)
+++ head/sys/dev/proto/proto.h  Thu Jul  4 02:51:34 2019(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014, 2015 Marcel Moolenaar
+ * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@
 #definePROTO_RES_BUSDMA11
 
 struct proto_res {
-   int r_type;
+   u_int   r_type:8;
+   u_int   r_opened:1;
int r_rid;
union {
struct resource *res;
@@ -47,13 +48,14 @@ struct proto_res {
void*cookie;
struct cdev *cdev;
} r_u;
-   uintptr_t   r_opened;
 };
 
 struct proto_softc {
device_tsc_dev;
struct proto_res sc_res[PROTO_RES_MAX];
int sc_rescnt;
+   int sc_opencnt;
+   struct mtx  sc_mtx;
 };
 
 extern devclass_t proto_devclass;

Modified: head/sys/dev/proto/proto_busdma.c
==
--- head/sys/dev/proto/proto_busdma.c   Wed Jul  3 22:41:54 2019
(r349713)
+++ head/sys/dev/proto/proto_busdma.c   Thu Jul  4 02:51:34 2019
(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Marcel Moolenaar
+ * Copyright (c) 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,6 +356,7 @@ proto_busdma_attach(struct proto_softc *sc)
struct proto_busdma *busdma;
 
busdma = malloc(sizeof(*busdma), M_PROTO_BUSDMA, M_WAITOK | M_ZERO);
+   sx_init(&busdma->sxlck, "proto-busdma");
return (busdma);
 }
 
@@ -363,6 +365,7 @@ proto_busdma_detach(struct proto_softc *sc, struct pro
 {
 
proto_busdma_cleanup(sc, busdma);
+   sx_destroy(&busdma->sxlck);
free(busdma, M_PROTO_BUSDMA);
return (0);
 }
@@ -373,10 +376,12 @@ proto_busdma_cleanup(struct proto_softc *sc, struct pr
struct proto_md *md, *md1;
struct proto_tag *tag, *tag1;
 
+   sx_xlock(&busdma->sxlck);
LIST_FOREACH_SAFE(md, &busdma->mds, mds, md1)
proto_busdma_md_destroy_internal(busdma, md);
LIST_FOREACH_SAFE(tag, &busdma->tags, tags, tag1)
proto_busdma_tag_destroy(busdma, tag);
+   sx_xunlock(&busdma->sxlck);
return (0);
 }
 
@@ -388,6 +393,8 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot
struct proto_md *md;
int error;
 
+   sx_xlock(&busdma->sxlck);
+
error = 0;
switch (ioc->request) {
case PROTO_IOC_BUSDMA_TAG_CREATE:
@@ -470,6 +477,9 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot
error = EINVAL;
break;
}
+
+   sx_xunlock(&busdma->sxlck);
+
return (error);
 }
 
@@ -477,11 +487,20 @@ int
 proto_busdma_mmap_allowed(struct proto_busdma *busdma, vm_paddr_t physaddr)
 {
struct proto_md *md;
+   int result;
 
+   sx_xlock(&busdma->sxlck);
+
+   result = 0;
LIST_FOREACH(md, &busdma->mds, mds) {
if (physaddr >= trunc_page(md->physaddr) &&
-   physaddr <= trunc_page(md->physaddr + md->tag->maxsz))
-   return (1);
+   physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) {
+   result = 1;
+   break;
+   }
}
-   return (0);
+
+   sx_xunlock(&busdma->sxlck);
+
+   return (result);
 }

Modified: head/sys/dev/proto/proto_busdma.h
==
--- head/sys/dev/proto/proto_busdma.h   Wed Jul  3 22:41:54 2019
(r349713)
+++ head/sys/dev/proto/proto_busdma.h   Thu Jul  4 02:51:34 2019
(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Marcel Moolenaar
+ * Copyright (c) 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -60,6 +60,7 @@ struct proto_busdma {
LIST_HEAD(,proto_tag)   tags;
LIST_HEAD(,proto_md)mds;
bus_dma_tag_t   bd_roottag;
+

svn commit: r349715 - in stable: 11/sbin/ipf/ipmon 11/tools/build/mk 12/sbin/ipf/ipmon 12/tools/build/mk

2019-07-03 Thread Cy Schubert
Author: cy
Date: Thu Jul  4 03:04:41 2019
New Revision: 349715
URL: https://svnweb.freebsd.org/changeset/base/349715

Log:
  MFC r349449, r349452:
  
  Add the ipmon.5 man page and link ipmon.conf.5 to it.
  
  PR/238816 initially addressed updates to usage() however the PR has
  morphed into a shopping list of updates to usage() and man pages.
  
  PR:   238816

Modified:
  stable/12/sbin/ipf/ipmon/Makefile
  stable/12/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sbin/ipf/ipmon/Makefile
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sbin/ipf/ipmon/Makefile
==
--- stable/12/sbin/ipf/ipmon/Makefile   Thu Jul  4 02:51:34 2019
(r349714)
+++ stable/12/sbin/ipf/ipmon/Makefile   Thu Jul  4 03:04:41 2019
(r349715)
@@ -3,7 +3,8 @@
 PACKAGE=   ipf
 PROG=  ipmon
 SRCS=  ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c
-MAN=   ipmon.8
+MAN=   ipmon.5 ipmon.8
+MLINKS=ipmon.5 ipmon.conf.5
 
 CFLAGS+=   -DLOGFAC=LOG_LOCAL0 -I.
 

Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jul  4 02:51:34 
2019(r349714)
+++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jul  4 03:04:41 
2019(r349715)
@@ -3338,6 +3338,8 @@ OLD_FILES+=usr/share/man/man5/ipf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipfilter.5.gz
+OLD_FILES+=usr/share/man/man8/ipmon.5.gz
+OLD_FILES+=usr/share/man/man5/ipmon.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ippool.5.gz
___
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: r349715 - in stable: 11/sbin/ipf/ipmon 11/tools/build/mk 12/sbin/ipf/ipmon 12/tools/build/mk

2019-07-03 Thread Cy Schubert
Author: cy
Date: Thu Jul  4 03:04:41 2019
New Revision: 349715
URL: https://svnweb.freebsd.org/changeset/base/349715

Log:
  MFC r349449, r349452:
  
  Add the ipmon.5 man page and link ipmon.conf.5 to it.
  
  PR/238816 initially addressed updates to usage() however the PR has
  morphed into a shopping list of updates to usage() and man pages.
  
  PR:   238816

Modified:
  stable/11/sbin/ipf/ipmon/Makefile
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sbin/ipf/ipmon/Makefile
  stable/12/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sbin/ipf/ipmon/Makefile
==
--- stable/11/sbin/ipf/ipmon/Makefile   Thu Jul  4 02:51:34 2019
(r349714)
+++ stable/11/sbin/ipf/ipmon/Makefile   Thu Jul  4 03:04:41 2019
(r349715)
@@ -3,7 +3,8 @@
 PACKAGE=   ipf
 PROG=  ipmon
 SRCS=  ${GENHDRS} ipmon.c ipmon_y.c ipmon_l.c
-MAN=   ipmon.8
+MAN=   ipmon.5 ipmon.8
+MLINKS=ipmon.5 ipmon.conf.5
 
 CFLAGS+=   -DLOGFAC=LOG_LOCAL0 -I.
 

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jul  4 02:51:34 
2019(r349714)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Thu Jul  4 03:04:41 
2019(r349715)
@@ -3415,6 +3415,8 @@ OLD_FILES+=usr/share/man/man5/ipf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipfilter.5.gz
+OLD_FILES+=usr/share/man/man8/ipmon.5.gz
+OLD_FILES+=usr/share/man/man5/ipmon.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ippool.5.gz
___
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: r349716 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools

2019-07-03 Thread Cy Schubert
Author: cy
Date: Thu Jul  4 03:08:14 2019
New Revision: 349716
URL: https://svnweb.freebsd.org/changeset/base/349716

Log:
  MFC r349450-349451:
  
  Update usage() to refect the current state of ipmon.
  
  PR:   238816

Modified:
  stable/11/contrib/ipfilter/tools/ipmon.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/contrib/ipfilter/tools/ipmon.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/contrib/ipfilter/tools/ipmon.c
==
--- stable/11/contrib/ipfilter/tools/ipmon.cThu Jul  4 03:04:41 2019
(r349715)
+++ stable/11/contrib/ipfilter/tools/ipmon.cThu Jul  4 03:08:14 2019
(r349716)
@@ -1438,7 +1438,10 @@ printipflog:
 static void usage(prog)
char *prog;
 {
-   fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog);
+   fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B  ] [ 
-C  ]\n"
+   "\t[ -f  ] [ -L  ] [ -N  ]\n"
+   "\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n"
+   "\t[  ]\n", prog);
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: r349716 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools

2019-07-03 Thread Cy Schubert
Author: cy
Date: Thu Jul  4 03:08:14 2019
New Revision: 349716
URL: https://svnweb.freebsd.org/changeset/base/349716

Log:
  MFC r349450-349451:
  
  Update usage() to refect the current state of ipmon.
  
  PR:   238816

Modified:
  stable/12/contrib/ipfilter/tools/ipmon.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/tools/ipmon.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/contrib/ipfilter/tools/ipmon.c
==
--- stable/12/contrib/ipfilter/tools/ipmon.cThu Jul  4 03:04:41 2019
(r349715)
+++ stable/12/contrib/ipfilter/tools/ipmon.cThu Jul  4 03:08:14 2019
(r349716)
@@ -1438,7 +1438,10 @@ printipflog:
 static void usage(prog)
char *prog;
 {
-   fprintf(stderr, "%s: [-NFhstvxX] [-f ]\n", prog);
+   fprintf(stderr, "Usage: %s [ -abDFhnpstvxX ] [ -B  ] [ 
-C  ]\n"
+   "\t[ -f  ] [ -L  ] [ -N  ]\n"
+   "\t[ -o [NSI] ] [ -O [NSI] ] [ -P  ] [ -S  ]\n"
+   "\t[  ]\n", prog);
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"