svn commit: r360890 - stable/12/stand/libsa/zfs

2020-05-10 Thread Toomas Soome
Author: tsoome
Date: Mon May 11 06:59:01 2020
New Revision: 360890
URL: https://svnweb.freebsd.org/changeset/base/360890

Log:
  MFC r360836:
  
  loader: vdev_read() can corrupt memory
  
  When reading less than sector size but from sector boundary,
  the vdev_read() will read full sector into the provided buffer
  and therefore corrupting memory past buffer end.

Modified:
  stable/12/stand/libsa/zfs/zfs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/libsa/zfs/zfs.c
==
--- stable/12/stand/libsa/zfs/zfs.c Mon May 11 06:09:18 2020
(r360889)
+++ stable/12/stand/libsa/zfs/zfs.c Mon May 11 06:59:01 2020
(r360890)
@@ -417,7 +417,7 @@ vdev_read(vdev_t *vdev, void *priv, off_t offset, void
full_sec_size -= secsz;
 
/* Return of partial sector data requires a bounce buffer. */
-   if ((head > 0) || do_tail_read) {
+   if ((head > 0) || do_tail_read || bytes < secsz) {
bouncebuf = zfs_alloc(secsz);
if (bouncebuf == NULL) {
printf("vdev_read: out of memory\n");
@@ -441,14 +441,28 @@ vdev_read(vdev_t *vdev, void *priv, off_t offset, void
outbuf += min(secsz - head, bytes);
}
 
-   /* Full data return from read sectors */
+   /*
+* Full data return from read sectors.
+* Note, there is still corner case where we read
+* from sector boundary, but less than sector size, e.g. reading 512B
+* from 4k sector.
+*/
if (full_sec_size > 0) {
-   res = read(fd, outbuf, full_sec_size);
-   if (res != full_sec_size) {
-   ret = EIO;
-   goto error;
+   if (bytes < full_sec_size) {
+   res = read(fd, bouncebuf, secsz);
+   if (res != secsz) {
+   ret = EIO;
+   goto error;
+   }
+   memcpy(outbuf, bouncebuf, bytes);
+   } else {
+   res = read(fd, outbuf, full_sec_size);
+   if (res != full_sec_size) {
+   ret = EIO;
+   goto error;
+   }
+   outbuf += full_sec_size;
}
-   outbuf += full_sec_size;
}
 
/* Partial data return from last sector */
___
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: r360889 - in head/sys/net: . route

2020-05-10 Thread Alexander V. Chernikov
Author: melifaro
Date: Mon May 11 06:09:18 2020
New Revision: 360889
URL: https://svnweb.freebsd.org/changeset/base/360889

Log:
  Remove unused rnh_close callback from rtable & cleanup depends.
  
  rnh_close callbackes was used by the in[6]_clsroute() handlers,
   doing cleanup in the route cloning code. Route cloning was eliminated
   somewhere around r186119. Last callback user was eliminated in r186215,
   11 years ago.
  
  Differential Revision:https://reviews.freebsd.org/D24793

Modified:
  head/sys/net/route.c
  head/sys/net/route/route_var.h

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cMon May 11 05:53:12 2020(r360888)
+++ head/sys/net/route.cMon May 11 06:09:18 2020(r360889)
@@ -426,11 +426,8 @@ sys_setfib(struct thread *td, struct setfib_args *uap)
 void
 rtfree(struct rtentry *rt)
 {
-   struct rib_head *rnh;
 
KASSERT(rt != NULL,("%s: NULL rt", __func__));
-   rnh = rt_tables_get_rnh(rt->rt_fibnum, rt_key(rt)->sa_family);
-   KASSERT(rnh != NULL,("%s: NULL rnh", __func__));
 
RT_LOCK_ASSERT(rt);
 
@@ -445,18 +442,6 @@ rtfree(struct rtentry *rt)
}
 
/*
-* On last reference give the "close method" a chance
-* to cleanup private state.  This also permits (for
-* IPv4 and IPv6) a chance to decide if the routing table
-* entry should be purged immediately or at a later time.
-* When an immediate purge is to happen the close routine
-* typically calls rtexpunge which clears the RTF_UP flag
-* on the entry so that the code below reclaims the storage.
-*/
-   if (rt->rt_refcnt == 0 && rnh->rnh_close)
-   rnh->rnh_close((struct radix_node *)rt, &rnh->head);
-
-   /*
 * If we are no longer "up" (and ref == 0)
 * then we can free the resources associated
 * with the route.
@@ -1501,7 +1486,6 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in
return (ENOBUFS);
}
rt->rt_flags = RTF_UP | flags;
-   rt->rt_fibnum = rnh->rib_fibnum;
rt->rt_nhop = nh;
 
/* Fill in dst */

Modified: head/sys/net/route/route_var.h
==
--- head/sys/net/route/route_var.h  Mon May 11 05:53:12 2020
(r360888)
+++ head/sys/net/route/route_var.h  Mon May 11 06:09:18 2020
(r360889)
@@ -50,7 +50,6 @@ struct rib_head {
rn_lookup_f_t   *rnh_lookup;/* exact match for sockaddr */
rn_walktree_t   *rnh_walktree;  /* traverse tree */
rn_walktree_from_t  *rnh_walktree_from; /* traverse tree below a */
-   rn_close_t  *rnh_close; /*do something when the last 
ref drops*/
rnh_preadd_entry_f_t*rnh_preadd;/* hook to alter record prior 
to insertion */
rt_gen_trnh_gen;/* generation counter */
int rnh_multipath;  /* multipath capable ? */
@@ -144,7 +143,6 @@ struct rtentry {
 
int rt_flags;   /* up/down?, host/net */
int rt_refcnt;  /* # held references */
-   u_int   rt_fibnum;  /* which FIB */
u_long  rt_weight;  /* absolute weight */ 
u_long  rt_expire;  /* lifetime for route, e.g. redirect */
 #definert_endzero  rt_mtx
___
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: r360888 - head/sys/contrib/dev/ath/ath_hal/ar9300

2020-05-10 Thread Adrian Chadd
Author: adrian
Date: Mon May 11 05:53:12 2020
New Revision: 360888
URL: https://svnweb.freebsd.org/changeset/base/360888

Log:
  [ar9300] Disable unconditionally reducing transmit power in the case of FCC.
  
  Ok, yeah, the commit title is a bit misleading.
  
  This has to do with CDD (cyclic delay diversity) - how this and later
  wifi hardware transmits lower rates over more antennas.  Eg, if you're
  transmitting legacy 11abg rates on 2 or 3 antennas, you COULD just
  send them all at the same time or you could delay each by tens/hundreds
  of nanoseconds to try and get some better diversity characteristics.
  
  However, this has a fun side effect - the antenna pattern is no longer
  a bunch of interacting dipoles, but are a bunch of interacting dipoles
  plus a bunch of changing phases.  And it's frequency dependent - 50-200nS
  is not exactly the same fraction of a wavelength across all of 2GHz or 5GHz!
  
  Thus the power spectral density and maximum directional gain that you're
  effectively getting is not .. well, as flat as it once was.
  
  For more information, look up FCC/OET 13TR1003 in the FCC technical report
  database.  It has pretty graphics and everything.
  
  Anyway, the problem lies thusly - the CDD code just subtracts another 3dB
  or 5dB for the lower rates based on transmit antenna configuration.
  However, it's not done based on operating configuration and it doesn't
  take into account how far from any regulatory limits the hardware is at.
  It also doesn't let us do things like transmit legacy rates and frames
  on a single antenna without losing up to 5dB when we absolutely don't
  need to in that case (there's no CDD used when one antenna is used!)
  
  This shows up as the hardware behaving even worse for longer distance links
  at 20MHz because, well, those are the exact rates losing a bunch more
  transmit power.
  
  * For lower power NICs (ie the majority of what is out there!) it's highly
unlikely we're going to hit anywhere near the PSD limits.
  * It's doing it based on the existing limits from the CTL table (conformance
testing limits) - this isn't the regulatory max!  It's what the NIC is
allowed to put out in each frequency and rate configuration!  So things like
band edges, power amplifier behaviour and maximum current draw apply here.
Blindly subtracting 3 to 5dB from /this/ value is /very/ conservative..
  * /and/ ath9k just plainly doesn't do any of this at all.
  
  So, for now disable it and get the TX power back, thus matching what ath9k
  in Linux is doing.  If/once I get some more cycles I'll look at making it
  a bit more adaptive and really only kick in if we're a few dB away from
  hard regulatory limits.
  
  Tested:
  
  * AR9344 (2GHz + SoC, 2x2 configuration) - AP and STA modes
  * QCA9580 (5GHz 2x2 and 3x3 configurations) - AP and STA modes

Modified:
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c
  head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_phy.c

Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c
==
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Mon May 11 
02:33:37 2020(r360887)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c Mon May 11 
05:53:12 2020(r360888)
@@ -3040,6 +3040,33 @@ ar9300_eeprom_set_transmit_power(struct ath_hal *ah,
 ahp->reg_dmn = ath_hal_getctl(ah, chan);
 
 /*
+ * After reading FCC/OET 13TR1003 (Directional Gain of IEEE 802.11
+ * MIMO devices employing cyclic delay diversity) and looking at what
+ * ath9k does, let's disable the CDD check until it's clearer exactly
+ * how the maximum cap should be applied here.
+ *
+ * Right now the CDD check is simply unconditionally reducing the
+ * gain of legacy and 1/2 stream rates depending upon the chainmask.
+ * (CDD is used when transmitting rates that don't already use up the
+ * full set of streams - eg OFDM or MCS0-7 on a 2 or 3 chain TX path.)
+ *
+ * It's dropping the 2-chain TX by 3dB and 3-chain by 5dB to "meet"
+ * power spectral density requirements but it's not currently taking
+ * into account how close to the regulatory limit the hardware/antenna
+ * system is already at.  It doesn't help that the conductive testing
+ * limits have the array gain at 0dB for all AR9300/derivative
+ * configurations.
+ *
+ * It also doesn't let us do single chain transmit at the full allowed
+ * power for the regulatory/CTL limits as it subtracts it from what's
+ * programmed into the hardware.
+ *
+ * ath9k doesn't factor any of the CDD stuff into account, so I'm going
+ * to disable it here and in the TPC path until I get a better idea
+ * of what to really do here.
+ */
+#if 0
+/*
  * Always use CDD/direct per rate power table for register based approach.
  * For FCC, CDD calculations should 

svn commit: r360887 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/powerpc vm

2020-05-10 Thread Justin Hibbits
Author: jhibbits
Date: Mon May 11 02:33:37 2020
New Revision: 360887
URL: https://svnweb.freebsd.org/changeset/base/360887

Log:
  powerpc64: Implement Radix MMU for POWER9 CPUs
  
  Summary:
  POWER9 supports two MMU formats: traditional hashed page tables, and Radix
  page tables, similar to what's presesnt on most other architectures.  The
  PowerISA also specifies a process table -- a table of page table pointers--
  which on the POWER9 is only available with the Radix MMU, so we can take
  advantage of it with the Radix MMU driver.
  
  Written by Matt Macy.
  
  Differential Revision: https://reviews.freebsd.org/D19516

Added:
  head/sys/powerpc/aim/mmu_radix.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/include/cpufunc.h
  head/sys/powerpc/include/mmuvar.h
  head/sys/powerpc/include/param.h
  head/sys/powerpc/include/pmap.h
  head/sys/powerpc/include/proc.h
  head/sys/powerpc/include/pte.h
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/include/sr.h
  head/sys/powerpc/include/vmparam.h
  head/sys/powerpc/powerpc/machdep.c
  head/sys/powerpc/powerpc/mmu_if.m
  head/sys/powerpc/powerpc/pmap_dispatch.c
  head/sys/powerpc/powerpc/trap.c
  head/sys/vm/vm_fault.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Mon May 11 01:20:40 2020(r360886)
+++ head/sys/conf/files.powerpc Mon May 11 02:33:37 2020(r360887)
@@ -135,6 +135,7 @@ powerpc/aim/locore.Soptionalaim 
no-obj
 powerpc/aim/aim_machdep.c  optionalaim
 powerpc/aim/mmu_oea.c  optionalaim powerpc
 powerpc/aim/mmu_oea64.coptionalaim
+powerpc/aim/mmu_radix.coptionalaim powerpc64
 powerpc/aim/moea64_if.moptionalaim
 powerpc/aim/moea64_native.coptionalaim
 powerpc/aim/mp_cpudep.coptionalaim

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Mon May 11 01:20:40 2020
(r360886)
+++ head/sys/powerpc/aim/aim_machdep.c  Mon May 11 02:33:37 2020
(r360887)
@@ -136,6 +136,8 @@ __FBSDID("$FreeBSD$");
 struct bat battable[16];
 #endif
 
+int radix_mmu = 0;
+
 #ifndef __powerpc64__
 /* Bits for running on 64-bit systems in 32-bit mode. */
 extern void*testppc64, *testppc64size;
@@ -451,7 +453,14 @@ aim_cpu_init(vm_offset_t toc)
 * in case the platform module had a better idea of what we
 * should do.
 */
-   if (cpu_features & PPC_FEATURE_64)
+   if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) {
+   radix_mmu = 0;
+   TUNABLE_INT_FETCH("radix_mmu", &radix_mmu);
+   if (radix_mmu)
+   pmap_mmu_install(MMU_TYPE_RADIX, BUS_PROBE_GENERIC);
+   else
+   pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC);
+   } else if (cpu_features & PPC_FEATURE_64)
pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC);
else
pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC);

Modified: head/sys/powerpc/aim/mmu_oea.c
==
--- head/sys/powerpc/aim/mmu_oea.c  Mon May 11 01:20:40 2020
(r360886)
+++ head/sys/powerpc/aim/mmu_oea.c  Mon May 11 02:33:37 2020
(r360887)
@@ -322,6 +322,7 @@ void moea_dumpsys_map(mmu_t mmu, vm_paddr_t pa, size_t
 void moea_scan_init(mmu_t mmu);
 vm_offset_t moea_quick_enter_page(mmu_t mmu, vm_page_t m);
 void moea_quick_remove_page(mmu_t mmu, vm_offset_t addr);
+boolean_t moea_page_is_mapped(mmu_t mmu, vm_page_t m);
 static int moea_map_user_ptr(mmu_t mmu, pmap_t pm,
 volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen);
 static int moea_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr,
@@ -364,6 +365,7 @@ static mmu_method_t moea_methods[] = {
MMUMETHOD(mmu_page_set_memattr, moea_page_set_memattr),
MMUMETHOD(mmu_quick_enter_page, moea_quick_enter_page),
MMUMETHOD(mmu_quick_remove_page, moea_quick_remove_page),
+   MMUMETHOD(mmu_page_is_mapped,   moea_page_is_mapped),
 
/* Internal interfaces */
MMUMETHOD(mmu_bootstrap,moea_bootstrap),
@@ -1102,6 +1104,12 @@ moea_quick_enter_page(mmu_t mmu, vm_page_t m)
 void
 moea_quick_remove_page(mmu_t mmu, vm_offset_t addr)
 {
+}
+
+boolean_t
+moea_page_is_mapped(mmu_t mmu, vm_page_t m)
+{
+   return (!LIST_EMPTY(&(m)->md.mdpg_pvoh));
 }
 
 /*

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cMon May 11 01:20:40 2

svn commit: r360885 - head/sys/netinet

2020-05-10 Thread Michael Tuexen
Author: tuexen
Date: Sun May 10 22:54:30 2020
New Revision: 360885
URL: https://svnweb.freebsd.org/changeset/base/360885

Log:
  Ensure that the SCTP iterator runs with an stcb and inp, which belong to
  each other.
  
  Reported by:  syzbot+82d39d14f2f765e38...@syzkaller.appspotmail.com
  MFC after:3 days

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Sun May 10 21:37:39 2020(r360884)
+++ head/sys/netinet/sctputil.c Sun May 10 22:54:30 2020(r360885)
@@ -1489,6 +1489,7 @@ select_a_new_ep:
}
tinp = it->inp;
it->inp = LIST_NEXT(it->inp, sctp_list);
+   it->stcb = NULL;
SCTP_INP_RUNLOCK(tinp);
if (it->inp == NULL) {
goto done_with_iterator;
@@ -1558,6 +1559,9 @@ select_a_new_ep:
atomic_add_int(&it->stcb->asoc.refcnt, -1);
iteration_count = 0;
}
+   KASSERT(it->inp == it->stcb->sctp_ep,
+   ("%s: stcb %p does not belong to inp %p, but inp %p",
+__func__, it->stcb, it->inp, it->stcb->sctp_ep));
 
/* run function on this one */
(*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val);
@@ -1590,6 +1594,7 @@ no_stcb:
} else {
it->inp = LIST_NEXT(it->inp, sctp_list);
}
+   it->stcb = NULL;
if (it->inp == NULL) {
goto done_with_iterator;
}
___
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: r360882 - head

2020-05-10 Thread Kyle Evans
Author: kevans
Date: Sun May 10 20:28:38 2020
New Revision: 360882
URL: https://svnweb.freebsd.org/changeset/base/360882

Log:
  buildworld: add back in missing semicolon
  
  if foo; then blah else blah; fi has a drastically different meaning than
  if foo; then blah; else blah; fi. Fix it.
  
  Reported by:  0mp
  X-MFC-With:   r360833

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Sun May 10 19:00:57 2020(r360881)
+++ head/Makefile.inc1  Sun May 10 20:28:38 2020(r360882)
@@ -1409,7 +1409,7 @@ distributeworld installworld stageworld: _installcheck
# basis, otherwise we'll just mention that we're not doing it to raise
# awareness.
@if which certctl>/dev/null; then \
-   certctl rehash \
+   certctl rehash; \
else \
echo "No certctl on the host, not rehashing target -- /etc/ssl 
may not be populated."; \
fi
___
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: r360881 - in head/sys/powerpc: aim booke include powerpc

2020-05-10 Thread Justin Hibbits
Author: jhibbits
Date: Sun May 10 19:00:57 2020
New Revision: 360881
URL: https://svnweb.freebsd.org/changeset/base/360881

Log:
  powerpc: Add a CPU-custom machine check handler
  
  Summary:
  Some machine checks are process-recoverable, others are not.  Let a
  CPU-specific handler decide what to do.
  
  This works around a machine check error hit while building www/firefox
  and mail/thunderbird, which would otherwise cause the build to fail.
  
  More work is needed to handle all possible machine check conditions, but
  this is sufficient to unblock some ports building.
  
  Differential Revision: https://reviews.freebsd.org/D23731

Modified:
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/trap_subr64.S
  head/sys/powerpc/booke/machdep_e500.c
  head/sys/powerpc/include/cpu.h
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/powerpc/trap.c

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Sun May 10 18:17:25 2020
(r360880)
+++ head/sys/powerpc/aim/aim_machdep.c  Sun May 10 19:00:57 2020
(r360881)
@@ -515,6 +515,32 @@ memcpy(pcpu->pc_aim.slb, PCPU_GET(aim.slb), sizeof(pcp
 #endif
 }
 
+/* Return 0 on handled success, otherwise signal number. */
+int
+cpu_machine_check(struct thread *td, struct trapframe *frame, int *ucode)
+{
+#ifdef __powerpc64__
+   /*
+* This block is 64-bit CPU specific currently.  Punt running in 32-bit
+* mode on 64-bit CPUs.
+*/
+   /* Check if the important information is in DSISR */
+   if ((frame->srr1 & SRR1_MCHK_DATA) != 0) {
+   printf("Machine check, DSISR: %016lx\n", frame->cpu.aim.dsisr);
+   /* SLB multi-hit is recoverable. */
+   if ((frame->cpu.aim.dsisr & DSISR_MC_SLB_MULTIHIT) != 0)
+   return (0);
+   /* TODO: Add other machine check recovery procedures. */
+   } else {
+   if ((frame->srr1 & SRR1_MCHK_IFETCH_M) == 
SRR1_MCHK_IFETCH_SLBMH)
+   return (0);
+   }
+#endif
+   *ucode = BUS_OBJERR;
+   return (SIGBUS);
+}
+
+
 #ifndef __powerpc64__
 uint64_t
 va_to_vsid(pmap_t pm, vm_offset_t va)

Modified: head/sys/powerpc/aim/trap_subr64.S
==
--- head/sys/powerpc/aim/trap_subr64.S  Sun May 10 18:17:25 2020
(r360880)
+++ head/sys/powerpc/aim/trap_subr64.S  Sun May 10 19:00:57 2020
(r360881)
@@ -797,6 +797,8 @@ generictrap:
std %r31,(PC_TEMPSAVE+CPUSAVE_R31)(%r1)
mfdar   %r30
std %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DAR)(%r1)
+   mfdsisr %r30
+   std %r30,(PC_TEMPSAVE+CPUSAVE_AIM_DSISR)(%r1)
mfsprg1 %r1 /* restore SP, in case of branch */
mfsprg2 %r28/* save LR */
mfcr%r29/* save CR */

Modified: head/sys/powerpc/booke/machdep_e500.c
==
--- head/sys/powerpc/booke/machdep_e500.c   Sun May 10 18:17:25 2020
(r360880)
+++ head/sys/powerpc/booke/machdep_e500.c   Sun May 10 19:00:57 2020
(r360881)
@@ -119,3 +119,15 @@ void
 booke_disable_l2_cache(void)
 {
 }
+
+/* Return 0 on handled success, otherwise signal number. */
+int
+cpu_machine_check(struct thread *td, struct trapframe *frame, int *ucode)
+{
+   register_t mcsr;
+
+   mcsr = mfspr(SPR_MCSR);
+
+   *ucode = BUS_OBJERR;
+   return (SIGBUS);
+}

Modified: head/sys/powerpc/include/cpu.h
==
--- head/sys/powerpc/include/cpu.h  Sun May 10 18:17:25 2020
(r360880)
+++ head/sys/powerpc/include/cpu.h  Sun May 10 19:00:57 2020
(r360881)
@@ -134,6 +134,8 @@ get_cyclecount(void)
 extern char btext[];
 extern char etext[];
 
+struct thread;
+
 #ifdef __powerpc64__
 extern void enter_idle_powerx(void);
 extern uint64_t can_wakeup;
@@ -146,5 +148,6 @@ voidcpu_sleep(void);
 void   flush_disable_caches(void);
 void   fork_trampoline(void);
 void   swi_vm(void *);
+intcpu_machine_check(struct thread *, struct trapframe *, int *);
 
 #endif /* _MACHINE_CPU_H_ */

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sun May 10 18:17:25 2020
(r360880)
+++ head/sys/powerpc/include/spr.h  Sun May 10 19:00:57 2020
(r360881)
@@ -108,6 +108,15 @@
 #define  DSISR_DABR  0x0040 /* DABR match */
 #define  DSISR_SEGMENT   0x0020 /* XXX; not in 6xx PEM */
 #define  DSISR_EAR   0x0010 /* eciwx/ecowx && EAR[E] 
== 0 */
+#define  DSISR_MC_UE_DEFERRED0x8000 /* UE deferred error */
+#define  DSISR_MC_UE_TABLEWA

svn commit: r360880 - svnadmin/conf

2020-05-10 Thread Joseph Mingrone
Author: jrm (ports committer)
Date: Sun May 10 18:17:25 2020
New Revision: 360880
URL: https://svnweb.freebsd.org/changeset/base/360880

Log:
  Retire idle commit bits for dexuan and leitao
  
  Approved by:  core (allanjude)
  Differential Revision:https://reviews.freebsd.org/D24799

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessSun May 10 17:43:42 2020(r360879)
+++ svnadmin/conf/accessSun May 10 18:17:25 2020(r360880)
@@ -59,7 +59,6 @@ davidcs
 dchagin
 delphij
 des
-dexuan
 dfr
 dim
 dougm
@@ -123,7 +122,6 @@ kib
 kibab
 kp
 landonf
-leitao
 loos
 lstewart
 luporl

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Sun May 10 17:43:42 2020(r360879)
+++ svnadmin/conf/mentors   Sun May 10 18:17:25 2020(r360880)
@@ -24,7 +24,6 @@ johalun   imp
 jrtc27 brooks  Co-mentor: jhb
 kadesaiken Co-mentor: scottl, ambrisko
 kaktus kib Co-mentor: mjg
-leitao jhibbitsCo-mentor: nwhitehorn
 miwi   araujo
 mjoras rstone
 nick   philip  Co-mentor: kp
___
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: r360879 - head/sys/netinet

2020-05-10 Thread Michael Tuexen
Author: tuexen
Date: Sun May 10 17:43:42 2020
New Revision: 360879
URL: https://svnweb.freebsd.org/changeset/base/360879

Log:
  Remove trailing whitespace.

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Sun May 10 17:19:19 2020
(r360878)
+++ head/sys/netinet/tcp_usrreq.c   Sun May 10 17:43:42 2020
(r360879)
@@ -1373,7 +1373,7 @@ tcp_usr_close(struct socket *so)
NET_EPOCH_EXIT(et);
 }
 
-static int 
+static int
 tcp_pru_options_support(struct tcpcb *tp, int flags)
 {
/*
___
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: r360878 - head/sys/netinet

2020-05-10 Thread Michael Tuexen
Author: tuexen
Date: Sun May 10 17:19:19 2020
New Revision: 360878
URL: https://svnweb.freebsd.org/changeset/base/360878

Log:
  Ensure that we have a path when starting the T3 RXT timer.
  
  Reported by:  syzbot+f2321629047f89486...@syzkaller.appspotmail.com
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_asconf.c
==
--- head/sys/netinet/sctp_asconf.c  Sun May 10 16:11:19 2020
(r360877)
+++ head/sys/netinet/sctp_asconf.c  Sun May 10 17:19:19 2020
(r360878)
@@ -1032,9 +1032,14 @@ sctp_assoc_immediate_retrans(struct sctp_tcb *stcb, st
(stcb->asoc.sent_queue_cnt > 0)) {
struct sctp_tmit_chunk *chk;
 
-   chk = TAILQ_FIRST(&stcb->asoc.sent_queue);
-   sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep,
-   stcb, chk->whoTo);
+   TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
+   if (chk->whoTo != NULL) {
+   break;
+   }
+   }
+   if (chk != NULL) {
+   sctp_timer_start(SCTP_TIMER_TYPE_SEND, 
stcb->sctp_ep, stcb, chk->whoTo);
+   }
}
}
return;

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sun May 10 16:11:19 2020
(r360877)
+++ head/sys/netinet/sctp_indata.c  Sun May 10 17:19:19 2020
(r360878)
@@ -4439,7 +4439,12 @@ again:
}
}
}
-   if (lchk) {
+   for (; lchk != NULL; lchk = TAILQ_NEXT(lchk, sctp_next)) {
+   if (lchk->whoTo != NULL) {
+   break;
+   }
+   }
+   if (lchk != NULL) {
/* Assure a timer is up */
sctp_timer_start(SCTP_TIMER_TYPE_SEND,
stcb->sctp_ep, stcb, lchk->whoTo);
@@ -5279,7 +5284,12 @@ again:
}
}
}
-   if (lchk) {
+   for (; lchk != NULL; lchk = TAILQ_NEXT(lchk, sctp_next)) {
+   if (lchk->whoTo != NULL) {
+   break;
+   }
+   }
+   if (lchk != NULL) {
/* Assure a timer is up */
sctp_timer_start(SCTP_TIMER_TYPE_SEND,
stcb->sctp_ep, stcb, lchk->whoTo);

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Sun May 10 16:11:19 2020
(r360877)
+++ head/sys/netinet/sctp_input.c   Sun May 10 17:19:19 2020
(r360878)
@@ -2956,6 +2956,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c
 {
/* cp must not be used, others call this without a c-ack :-) */
struct sctp_association *asoc;
+   struct sctp_tmit_chunk *chk;
 
SCTPDBG(SCTP_DEBUG_INPUT2,
"sctp_handle_cookie_ack: handling COOKIE-ACK\n");
@@ -3059,11 +3060,13 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c
 closed_socket:
/* Toss the cookie if I can */
sctp_toss_old_cookies(stcb, asoc);
-   if (!TAILQ_EMPTY(&asoc->sent_queue)) {
-   /* Restart the timer if we have pending data */
-   struct sctp_tmit_chunk *chk;
-
-   chk = TAILQ_FIRST(&asoc->sent_queue);
+   /* Restart the timer if we have pending data */
+   TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
+   if (chk->whoTo != NULL) {
+   break;
+   }
+   }
+   if (chk != NULL) {
sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, 
chk->whoTo);
}
 }
@@ -5159,6 +5162,7 @@ process_control_chunks:
} else {
struct mbuf *ret_buf;
struct sctp_inpcb *linp;
+   struct sctp_tmit_chunk *chk;
 
if (stcb) {
linp = NULL;
@@ -5220,14 +5224,13 @@ process_control_chunks:
got_auth = 1;
auth_skipped = 0;
}
-   if (!TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
-   /*

svn commit: r360877 - head/tools/pkgbase

2020-05-10 Thread Ed Maste
Author: emaste
Date: Sun May 10 16:11:19 2020
New Revision: 360877
URL: https://svnweb.freebsd.org/changeset/base/360877

Log:
  Add pkgbase METALOG parse/check tool
  
  `metalog.lua` is a script that reads METALOG file created by pkgbase
  (make packages) and generates reports about the installed system
  and issues.
  
  This was developed as part of Yang's W2020 University of Waterloo co-
  operative education term with the FreeBSD Foundation.  kevans provided
  some initial review; we will iterate on it in the tree.
  
  Submitted by: Yang Wang <2...@outlook.jp>
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D24563

Added:
  head/tools/pkgbase/
  head/tools/pkgbase/README.md   (contents, props changed)
  head/tools/pkgbase/metalog_reader.lua   (contents, props changed)

Added: head/tools/pkgbase/README.md
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/pkgbase/README.mdSun May 10 16:11:19 2020
(r360877)
@@ -0,0 +1,61 @@
+`metalog.lua` is a script that reads METALOG file created by pkgbase
+(make packages) and generates reports about the installed system
+and issues
+
+the script accepts an mtree file in a format that's returned by
+`mtree -c | mtree -C`
+
+synopsis:
+```
+metalog_reader.lua [-h] [-a | -c | -p [-count] [-size] [-f...]] [-W...] [-v] 
metalog-path
+```
+
+options:
+
+* `-a` prints all scan results. this is the default option if no option is
+  provided.
+* `-c` lints the file and gives warnings/errors, including duplication and
+  conflicting metadata
+  *  `-Wcheck-notagdir` entries with dir type and no tags will be also included
+ the first time they appear (1)
+* `-p` list all package names found in the file as exactly specified by
+  `tags=package=...`
+  * `-count` display the number of files of the package
+  * `-size` display the size of the package
+  * `-fsetgid` only include packages with setgid files
+  * `-fsetuid` only include packages with setuid files
+  * `-fsetid` only include packages with setgid or setuid files
+* `-v` verbose mode
+* `-h` help page
+
+some examples:
+
+* `metalog_reader.lua -a METALOG`
+  prints all scan results described below. this is the default option
+* `metalog_reader.lua -c METALOG`
+  only prints errors and warnings found in the file
+* `metalog_reader.lua -c -Wcheck-notagdir METALOG`
+  prints errors and warnings found in the file, including directories with no
+  tags
+* `metalog_reader.lua -p METALOG`
+  only prints all the package names found in the file
+* `metalog_reader.lua -p -count -size METALOG`
+  prints all the package names, followed by number of files, followed by total
+  size
+* `metalog_reader.lua -p -size -fsetid METALOG`
+  prints packages that has either setuid/setgid files, followed by the total
+  size
+* `metalog_reader.lua -p -fsetuid -fsetgid METALOG`
+  prints packages that has both setuid and setgid files (if more than one
+  filters are specified, they are composed using logic and)
+* `metalog_reader.lua -p -count -size -fsetuid METALOG`
+  prints packages that has setuid files, followed by number of files and total
+  size
+
+(1) if we have two entries
+```
+./bin type=dir uname=root gname=wheel mode=0755
+./bin type=dir uname=root gname=wheel mode=0755 tags=...
+```
+by default, this is not warned. if the option is enabled, this will be warned
+as the second line sufficiently covers the first line.

Added: head/tools/pkgbase/metalog_reader.lua
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/pkgbase/metalog_reader.lua   Sun May 10 16:11:19 2020
(r360877)
@@ -0,0 +1,521 @@
+#!/usr/libexec/flua
+
+-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+--
+-- Copyright(c) 2020 The FreeBSD Foundation.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+--notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+--notice, this list of conditions and the following disclaimer in the
+--documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; O

svn commit: r360876 - stable/11/contrib/llvm-project/llvm/lib/Support/Unix

2020-05-10 Thread Ed Maste
Author: emaste
Date: Sun May 10 14:59:01 2020
New Revision: 360876
URL: https://svnweb.freebsd.org/changeset/base/360876

Log:
  MFC r360801: Merge commit 21e5e1724b75 from llvm git:
  
getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD
  
Once we hit AT_NULL, we need to bail out of the loop; not just the
enclosing switch.  This fixes basic usage (e.g. `cc --version`) when
AT_EXECPATH isn't present on older branches (e.g. under
emu-user-static, at the moment), where we would previously run off
the end of ::environ.
  
Patch By: kevans
  
Reviewed By: arichardson

Modified:
  stable/11/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
Directory Properties:
  stable/11/   (props changed)
  stable/11/contrib/llvm-project/llvm/   (props changed)

Modified: stable/11/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
==
--- stable/11/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc   Sun May 
10 14:56:25 2020(r360875)
+++ stable/11/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc   Sun May 
10 14:59:01 2020(r360876)
@@ -208,14 +208,9 @@ std::string getMainExecutable(const char *argv0, void 
   while (*p++ != 0)
 ;
   // Iterate through auxiliary vectors for AT_EXECPATH.
-  for (;;) {
-switch (*(uintptr_t *)p++) {
-case AT_EXECPATH:
+  for (; *(uintptr_t *)p != AT_NULL; p++) {
+if (*(uintptr_t *)p++ == AT_EXECPATH)
   return *p;
-case AT_NULL:
-  break;
-}
-p++;
   }
 #endif
   // Fall back to argv[0] if auxiliary vectors are not available.
___
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: r360875 - stable/12/contrib/llvm-project/llvm/lib/Support/Unix

2020-05-10 Thread Ed Maste
Author: emaste
Date: Sun May 10 14:56:25 2020
New Revision: 360875
URL: https://svnweb.freebsd.org/changeset/base/360875

Log:
  MFC r360801: Merge commit 21e5e1724b75 from llvm git:
  
getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD
  
Once we hit AT_NULL, we need to bail out of the loop; not just the
enclosing switch.  This fixes basic usage (e.g. `cc --version`) when
AT_EXECPATH isn't present on older branches (e.g. under
emu-user-static, at the moment), where we would previously run off
the end of ::environ.
  
Patch By: kevans
  
Reviewed By: arichardson

Modified:
  stable/12/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc
==
--- stable/12/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc   Sun May 
10 14:53:08 2020(r360874)
+++ stable/12/contrib/llvm-project/llvm/lib/Support/Unix/Path.inc   Sun May 
10 14:56:25 2020(r360875)
@@ -208,14 +208,9 @@ std::string getMainExecutable(const char *argv0, void 
   while (*p++ != 0)
 ;
   // Iterate through auxiliary vectors for AT_EXECPATH.
-  for (;;) {
-switch (*(uintptr_t *)p++) {
-case AT_EXECPATH:
+  for (; *(uintptr_t *)p != AT_NULL; p++) {
+if (*(uintptr_t *)p++ == AT_EXECPATH)
   return *p;
-case AT_NULL:
-  break;
-}
-p++;
   }
 #endif
   // Fall back to argv[0] if auxiliary vectors are not available.
___
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: r360874 - in stable/12/sys: arm64/arm64 riscv/riscv

2020-05-10 Thread John Baldwin
Author: jhb
Date: Sun May 10 14:53:08 2020
New Revision: 360874
URL: https://svnweb.freebsd.org/changeset/base/360874

Log:
  MFC 356839: Save and restore floating point registers in get/set_mcontext().
  
  arm64 and riscv were only saving and restoring floating point
  registers for sendsig() and sys_sigreturn(), but not for getcontext(),
  setcontext(), and swapcontext().
  
  While here, remove an always-false check for uap being NULL from
  sys_sigreturn().

Modified:
  stable/12/sys/arm64/arm64/machdep.c
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/machdep.c
==
--- stable/12/sys/arm64/arm64/machdep.c Sun May 10 14:46:46 2020
(r360873)
+++ stable/12/sys/arm64/arm64/machdep.c Sun May 10 14:53:08 2020
(r360874)
@@ -95,6 +95,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static void get_fpcontext(struct thread *td, mcontext_t *mcp);
+static void set_fpcontext(struct thread *td, mcontext_t *mcp);
 
 enum arm64_bus arm64_bus_method = ARM64_BUS_NONE;
 
@@ -385,6 +387,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int c
mcp->mc_gpregs.gp_sp = tf->tf_sp;
mcp->mc_gpregs.gp_lr = tf->tf_lr;
mcp->mc_gpregs.gp_elr = tf->tf_elr;
+   get_fpcontext(td, mcp);
 
return (0);
 }
@@ -406,6 +409,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf->tf_lr = mcp->mc_gpregs.gp_lr;
tf->tf_elr = mcp->mc_gpregs.gp_elr;
tf->tf_spsr = mcp->mc_gpregs.gp_spsr;
+   set_fpcontext(td, mcp);
 
return (0);
 }
@@ -577,15 +581,12 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
ucontext_t uc;
int error;
 
-   if (uap == NULL)
-   return (EFAULT);
if (copyin(uap->sigcntxp, &uc, sizeof(uc)))
return (EFAULT);
 
error = set_mcontext(td, &uc.uc_mcontext);
if (error != 0)
return (error);
-   set_fpcontext(td, &uc.uc_mcontext);
 
/* Restore signal mask. */
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
@@ -657,7 +658,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* Fill in the frame to copy out */
bzero(&frame, sizeof(frame));
get_mcontext(td, &frame.sf_uc.uc_mcontext, 0);
-   get_fpcontext(td, &frame.sf_uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ?

Modified: stable/12/sys/riscv/riscv/machdep.c
==
--- stable/12/sys/riscv/riscv/machdep.c Sun May 10 14:46:46 2020
(r360873)
+++ stable/12/sys/riscv/riscv/machdep.c Sun May 10 14:53:08 2020
(r360874)
@@ -95,6 +95,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+static void get_fpcontext(struct thread *td, mcontext_t *mcp);
+static void set_fpcontext(struct thread *td, mcontext_t *mcp);
+
 struct pcpu __pcpu[MAXCPU];
 
 static struct trapframe proc0_tf;
@@ -350,6 +353,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int c
mcp->mc_gpregs.gp_tp = tf->tf_tp;
mcp->mc_gpregs.gp_sepc = tf->tf_sepc;
mcp->mc_gpregs.gp_sstatus = tf->tf_sstatus;
+   get_fpcontext(td, mcp);
 
return (0);
 }
@@ -370,6 +374,7 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
tf->tf_gp = mcp->mc_gpregs.gp_gp;
tf->tf_sepc = mcp->mc_gpregs.gp_sepc;
tf->tf_sstatus = mcp->mc_gpregs.gp_sstatus;
+   set_fpcontext(td, mcp);
 
return (0);
 }
@@ -519,8 +524,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
ucontext_t uc;
int error;
 
-   if (uap == NULL)
-   return (EFAULT);
if (copyin(uap->sigcntxp, &uc, sizeof(uc)))
return (EFAULT);
 
@@ -537,8 +540,6 @@ sys_sigreturn(struct thread *td, struct sigreturn_args
if (error != 0)
return (error);
 
-   set_fpcontext(td, &uc.uc_mcontext);
-
/* Restore signal mask. */
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
 
@@ -606,7 +607,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
/* Fill in the frame to copy out */
bzero(&frame, sizeof(frame));
get_mcontext(td, &frame.sf_uc.uc_mcontext, 0);
-   get_fpcontext(td, &frame.sf_uc.uc_mcontext);
frame.sf_si = ksi->ksi_info;
frame.sf_uc.uc_sigmask = *mask;
frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) ?
___
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: r360873 - stable/12/contrib/bsnmp/snmpd

2020-05-10 Thread Gleb Smirnoff
Author: glebius
Date: Sun May 10 14:46:46 2020
New Revision: 360873
URL: https://svnweb.freebsd.org/changeset/base/360873

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

Modified:
  stable/12/contrib/bsnmp/snmpd/trans_inet.c
Directory Properties:
  stable/12/   (props changed)

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


svn commit: r360872 - head/sys/dev/qlnx/qlnxe

2020-05-10 Thread Emmanuel Vadot
Author: manu
Date: Sun May 10 14:09:30 2020
New Revision: 360872
URL: https://svnweb.freebsd.org/changeset/base/360872

Log:
  qnlx: Do not redifines types.
  
  r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h
  The qlnx driver is redefining some of those types so remove them and add an
  explicit linux/types.h include.
  
  Pointy hat: manu
  Reported by:  Austin Shafer 

Modified:
  head/sys/dev/qlnx/qlnxe/bcm_osal.h

Modified: head/sys/dev/qlnx/qlnxe/bcm_osal.h
==
--- head/sys/dev/qlnx/qlnxe/bcm_osal.h  Sun May 10 13:12:05 2020
(r360871)
+++ head/sys/dev/qlnx/qlnxe/bcm_osal.h  Sun May 10 14:09:30 2020
(r360872)
@@ -34,6 +34,8 @@
 #include "ecore_status.h"
 #include 
 
+#include 
+
 #if __FreeBSD_version >= 1200032
 #include 
 #else
@@ -112,11 +114,6 @@ extern void qlnx_vf_flr_update(void *p_hwfn);
 #define s32 uint32_t
 
 #ifndef QLNX_RDMA
-
-typedef uint16_t __le16;
-typedef uint32_t __le32;
-typedef uint16_t __be16;
-typedef uint32_t __be32;
 
 static __inline unsigned long
 roundup_pow_of_two(unsigned long x)
___
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: r360871 - head/sys/compat/linuxkpi/common/include/linux

2020-05-10 Thread Emmanuel Vadot
Author: manu
Date: Sun May 10 13:12:05 2020
New Revision: 360871
URL: https://svnweb.freebsd.org/changeset/base/360871

Log:
  linuxkpi: Really add bitmap_alloc and bitmap_zalloc
  
  This was missing in r360870
  
  Sponsored-by: The FreeBSD Foundation

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

Modified: head/sys/compat/linuxkpi/common/include/linux/bitmap.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Sun May 10 
13:07:00 2020(r360870)
+++ head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Sun May 10 
13:12:05 2020(r360871)
@@ -310,6 +310,19 @@ bitmap_xor(unsigned long *dst, const unsigned long *sr
dst[i] = src1[i] ^ src2[i];
 }
 
+static inline unsigned long *
+bitmap_alloc(unsigned int size, gfp_t flags)
+{
+   return (kmalloc_array(BITS_TO_LONGS(size),
+   sizeof(unsigned long), flags));
+}
+
+static inline unsigned long *
+bitmap_zalloc(unsigned int size, gfp_t flags)
+{
+   return (bitmap_alloc(size, flags | __GFP_ZERO));
+}
+
 static inline void
 bitmap_free(const unsigned long *bitmap)
 {
___
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: r360870 - head/sys/compat/linuxkpi/common/include/linux

2020-05-10 Thread Emmanuel Vadot
Author: manu
Date: Sun May 10 13:07:00 2020
New Revision: 360870
URL: https://svnweb.freebsd.org/changeset/base/360870

Log:
  linuxkpi: Add bitmap_alloc and bitmap_free
  
  This is a simple call to kmallock_array/kfree, therefore include linux/slab.h 
as
  this is where the kmalloc_array/kfree definition is.
  
  Sponsored-by: The FreeBSD Foundation
  Reviewed by:  hselsasky
  Differential Revision:https://reviews.freebsd.org/D24794

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

Modified: head/sys/compat/linuxkpi/common/include/linux/bitmap.h
==
--- head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Sun May 10 
10:03:10 2020(r360869)
+++ head/sys/compat/linuxkpi/common/include/linux/bitmap.h  Sun May 10 
13:07:00 2020(r360870)
@@ -30,6 +30,7 @@
 #define_LINUX_BITMAP_H_
 
 #include 
+#include 
 
 static inline void
 bitmap_zero(unsigned long *addr, const unsigned int size)
@@ -307,6 +308,12 @@ bitmap_xor(unsigned long *dst, const unsigned long *sr
 
for (i = 0; i != end; i++)
dst[i] = src1[i] ^ src2[i];
+}
+
+static inline void
+bitmap_free(const unsigned long *bitmap)
+{
+   kfree(bitmap);
 }
 
 #endif /* _LINUX_BITMAP_H_ */
___
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: r360869 - head/sys/netinet

2020-05-10 Thread Michael Tuexen
Author: tuexen
Date: Sun May 10 10:03:10 2020
New Revision: 360869
URL: https://svnweb.freebsd.org/changeset/base/360869

Log:
  Only drop DATA chunk with lower priorities as specified in RFC 7496.
  This issue was found by looking at a reproducer generated by syzkaller.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sun May 10 09:50:44 2020
(r360868)
+++ head/sys/netinet/sctp_output.c  Sun May 10 10:03:10 2020
(r360869)
@@ -6199,11 +6199,11 @@ sctp_prune_prsctp(struct sctp_tcb *stcb,
 * This one is PR-SCTP AND buffer space
 * limited type
 */
-   if (chk->rec.data.timetodrop.tv_sec >= 
(long)srcv->sinfo_timetolive) {
+   if (chk->rec.data.timetodrop.tv_sec > 
(long)srcv->sinfo_timetolive) {
/*
 * Lower numbers equates to higher
 * priority so if the one we are
-* looking at has a larger or equal
+* looking at has a larger
 * priority we want to drop the data
 * and NOT retransmit it.
 */
@@ -6234,7 +6234,7 @@ sctp_prune_prsctp(struct sctp_tcb *stcb,
TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
/* Here we must move to the sent queue and mark */
if (PR_SCTP_BUF_ENABLED(chk->flags)) {
-   if (chk->rec.data.timetodrop.tv_sec >= 
(long)srcv->sinfo_timetolive) {
+   if (chk->rec.data.timetodrop.tv_sec > 
(long)srcv->sinfo_timetolive) {
if (chk->data) {
/*
 * We release the book_size
@@ -12617,7 +12617,7 @@ sctp_lower_sosend(struct socket *so,
top = SCTP_HEADER_TO_CHAIN(i_pak);
sndlen = SCTP_HEADER_LEN(i_pak);
}
-   SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zu\n",
+   SCTPDBG(SCTP_DEBUG_OUTPUT1, "Send called addr:%p send length %zd\n",
(void *)addr,
sndlen);
if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
___
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: r360867 - stable/11/sys/netpfil/pf

2020-05-10 Thread Kristof Provost
Author: kp
Date: Sun May 10 09:50:43 2020
New Revision: 360867
URL: https://svnweb.freebsd.org/changeset/base/360867

Log:
  MFC r360609:
  
  pf: Improve DIOCADDRULE validation
  
  We expect the addrwrap.p.dyn value to be set to NULL (and assert such),
  but do not verify it on input.
  
  Reported-by:  syzbot+936a89182e7d8f927...@syzkaller.appspotmail.com

Modified:
  stable/11/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/pf/pf_ioctl.c
==
--- stable/11/sys/netpfil/pf/pf_ioctl.c Sun May 10 09:34:48 2020
(r360866)
+++ stable/11/sys/netpfil/pf/pf_ioctl.c Sun May 10 09:50:43 2020
(r360867)
@@ -1152,6 +1152,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, in
error = EINVAL;
break;
}
+   if (pr->rule.src.addr.p.dyn != NULL ||
+   pr->rule.dst.addr.p.dyn != NULL) {
+   error = EINVAL;
+   break;
+   }
 #ifndef INET
if (pr->rule.af == AF_INET) {
error = EAFNOSUPPORT;
___
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: r360868 - stable/12/sys/netpfil/pf

2020-05-10 Thread Kristof Provost
Author: kp
Date: Sun May 10 09:50:44 2020
New Revision: 360868
URL: https://svnweb.freebsd.org/changeset/base/360868

Log:
  MFC r360609:
  
  pf: Improve DIOCADDRULE validation
  
  We expect the addrwrap.p.dyn value to be set to NULL (and assert such),
  but do not verify it on input.
  
  Reported-by:  syzbot+936a89182e7d8f927...@syzkaller.appspotmail.com

Modified:
  stable/12/sys/netpfil/pf/pf_ioctl.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netpfil/pf/pf_ioctl.c
==
--- stable/12/sys/netpfil/pf/pf_ioctl.c Sun May 10 09:50:43 2020
(r360867)
+++ stable/12/sys/netpfil/pf/pf_ioctl.c Sun May 10 09:50:44 2020
(r360868)
@@ -1556,6 +1556,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, in
error = EINVAL;
break;
}
+   if (pr->rule.src.addr.p.dyn != NULL ||
+   pr->rule.dst.addr.p.dyn != NULL) {
+   error = EINVAL;
+   break;
+   }
 #ifndef INET
if (pr->rule.af == AF_INET) {
error = EAFNOSUPPORT;
___
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: r360866 - head/sys/net

2020-05-10 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun May 10 09:34:48 2020
New Revision: 360866
URL: https://svnweb.freebsd.org/changeset/base/360866

Log:
  Remove rtalloc1(_fib) KPI.
  
  Last user of rtalloc1() KPI has been eliminated in rS360631.
  As kernel is now fully switched to use new routing KPI defined in
  rS359823, remove old lookup functions.
  
  Differential Revision:https://reviews.freebsd.org/D24776

Modified:
  head/sys/net/route.c
  head/sys/net/route.h

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cSun May 10 03:36:11 2020(r360865)
+++ head/sys/net/route.cSun May 10 09:34:48 2020(r360866)
@@ -420,76 +420,6 @@ sys_setfib(struct thread *td, struct setfib_args *uap)
 }
 
 /*
- * Look up the route that matches the address given
- * Or, at least try.. Create a cloned route if needed.
- *
- * The returned route, if any, is locked.
- */
-struct rtentry *
-rtalloc1(struct sockaddr *dst, int report, u_long ignflags)
-{
-
-   return (rtalloc1_fib(dst, report, ignflags, RT_DEFAULT_FIB));
-}
-
-struct rtentry *
-rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags,
-   u_int fibnum)
-{
-   RIB_RLOCK_TRACKER;
-   struct rib_head *rh;
-   struct radix_node *rn;
-   struct rtentry *newrt;
-   struct rt_addrinfo info;
-   int err = 0, msgtype = RTM_MISS;
-
-   KASSERT((fibnum < rt_numfibs), ("rtalloc1_fib: bad fibnum"));
-   rh = rt_tables_get_rnh(fibnum, dst->sa_family);
-   newrt = NULL;
-   if (rh == NULL)
-   goto miss;
-
-   /*
-* Look up the address in the table for that Address Family
-*/
-   if ((ignflags & RTF_RNH_LOCKED) == 0)
-   RIB_RLOCK(rh);
-#ifdef INVARIANTS
-   else
-   RIB_LOCK_ASSERT(rh);
-#endif
-   rn = rh->rnh_matchaddr(dst, &rh->head);
-   if (rn && ((rn->rn_flags & RNF_ROOT) == 0)) {
-   newrt = RNTORT(rn);
-   RT_LOCK(newrt);
-   RT_ADDREF(newrt);
-   if ((ignflags & RTF_RNH_LOCKED) == 0)
-   RIB_RUNLOCK(rh);
-   return (newrt);
-
-   } else if ((ignflags & RTF_RNH_LOCKED) == 0)
-   RIB_RUNLOCK(rh);
-   /*
-* Either we hit the root or could not find any match,
-* which basically means: "cannot get there from here".
-*/
-miss:
-   RTSTAT_INC(rts_unreach);
-
-   if (report) {
-   /*
-* If required, report the failure to the supervising
-* Authorities.
-* For a delete, this is not an error. (report == 0)
-*/
-   bzero(&info, sizeof(info));
-   info.rti_info[RTAX_DST] = dst;
-   rt_missmsg_fib(msgtype, &info, 0, err, fibnum);
-   }
-   return (newrt);
-}
-
-/*
  * Remove a reference count from an rtentry.
  * If the count gets low enough, take it out of the routing table
  */

Modified: head/sys/net/route.h
==
--- head/sys/net/route.hSun May 10 03:36:11 2020(r360865)
+++ head/sys/net/route.hSun May 10 09:34:48 2020(r360866)
@@ -392,8 +392,6 @@ struct sockaddr *rtsock_fix_netmask(const struct socka
 /*
  * Note the following locking behavior:
  *
- *rtalloc1() returns a locked rtentry
- *
  *rtfree() and RTFREE_LOCKED() require a locked rtentry
  *
  *RTFREE() uses an unlocked entry.
@@ -414,14 +412,12 @@ void  rt_flushifroutes(struct ifnet *ifp);
 
 /* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */
 /* Thes are used by old code not yet converted to use multiple FIBS */
-struct rtentry *rtalloc1(struct sockaddr *, int, u_long);
 int rtinit(struct ifaddr *, int, int);
 
 /* XXX MRT NEW VERSIONS THAT USE FIBs
  * For now the protocol indepedent versions are the same as the AF_INET ones
  * but this will change.. 
  */
-struct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int);
 int rtioctl_fib(u_long, caddr_t, u_int);
 int rtrequest_fib(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int, struct rtentry **, 
u_int);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"