svn commit: r357609 - in head/contrib/xz/src: common xz

2020-02-05 Thread Xin LI
Author: delphij
Date: Thu Feb  6 07:47:28 2020
New Revision: 357609
URL: https://svnweb.freebsd.org/changeset/base/357609

Log:
  MFV r357608: Limit memory usage in xz(1) instead of in tuklib.
  
  Apply upstream 353970510895f6a80adfe60cf71b70a95adfa8bc to limit memory
  usage on 32-bit binary to 4020 MiB.
  
  Submitted by: Lasse Collin 
  Reviewed by:  kib, bcr
  Differential Revision:https://reviews.freebsd.org/D23474

Modified:
  head/contrib/xz/src/common/tuklib_physmem.c
  head/contrib/xz/src/xz/hardware.c
  head/contrib/xz/src/xz/xz.1
Directory Properties:
  head/contrib/xz/   (props changed)

Modified: head/contrib/xz/src/common/tuklib_physmem.c
==
--- head/contrib/xz/src/common/tuklib_physmem.c Thu Feb  6 07:45:07 2020
(r357608)
+++ head/contrib/xz/src/common/tuklib_physmem.c Thu Feb  6 07:47:28 2020
(r357609)
@@ -45,7 +45,6 @@
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
-#  include 
 #  include 
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
@@ -146,16 +145,13 @@ tuklib_physmem(void)
 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
const long pagesize = sysconf(_SC_PAGESIZE);
const long pages = sysconf(_SC_PHYS_PAGES);
-   if (pagesize != -1 && pages != -1) {
+   if (pagesize != -1 && pages != -1)
// According to docs, pagesize * pages can overflow.
// Simple case is 32-bit box with 4 GiB or more RAM,
// which may report exactly 4 GiB of RAM, and "long"
// being 32-bit will overflow. Casting to uint64_t
// hopefully avoids overflows in the near future.
ret = (uint64_t)pagesize * (uint64_t)pages;
-   if (ret > SIZE_T_MAX)
-   ret = SIZE_T_MAX;
-   }
 
 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
int name[2] = {

Modified: head/contrib/xz/src/xz/hardware.c
==
--- head/contrib/xz/src/xz/hardware.c   Thu Feb  6 07:45:07 2020
(r357608)
+++ head/contrib/xz/src/xz/hardware.c   Thu Feb  6 07:47:28 2020
(r357609)
@@ -68,8 +68,38 @@ hardware_memlimit_set(uint64_t new_memlimit,
new_memlimit = (uint32_t)new_memlimit * total_ram / 100;
}
 
-   if (set_compress)
+   if (set_compress) {
memlimit_compress = new_memlimit;
+
+#if SIZE_MAX == UINT32_MAX
+   // FIXME?
+   //
+   // When running a 32-bit xz on a system with a lot of RAM and
+   // using a percentage-based memory limit, the result can be
+   // bigger than the 32-bit address space. Limiting the limit
+   // below SIZE_MAX for compression (not decompression) makes
+   // xz lower the compression settings (or number of threads)
+   // to a level that *might* work. In practice it has worked
+   // when using a 64-bit kernel that gives full 4 GiB address
+   // space to 32-bit programs. In other situations this might
+   // still be too high, like 32-bit kernels that may give much
+   // less than 4 GiB to a single application.
+   //
+   // So this is an ugly hack but I will keep it here while
+   // it does more good than bad.
+   //
+   // Use a value less than SIZE_MAX so that there's some room
+   // for the xz program and so on. Don't use 4000 MiB because
+   // it could look like someone mixed up base-2 and base-10.
+   const uint64_t limit_max = UINT64_C(4020) << 20;
+
+   // UINT64_MAX is a special case for the string "max" so
+   // that has to be handled specially.
+   if (memlimit_compress != UINT64_MAX
+   && memlimit_compress > limit_max)
+   memlimit_compress = limit_max;
+#endif
+   }
 
if (set_decompress)
memlimit_decompress = new_memlimit;

Modified: head/contrib/xz/src/xz/xz.1
==
--- head/contrib/xz/src/xz/xz.1 Thu Feb  6 07:45:07 2020(r357608)
+++ head/contrib/xz/src/xz/xz.1 Thu Feb  6 07:47:28 2020(r357609)
@@ -1005,6 +1005,25 @@ instead of
 until the details have been decided.
 .RE
 .IP ""
+For 32-bit
+.BR xz
+there is a special case: if the
+.I limit
+would be over
+.BR "4020\ MiB" ,
+the
+.I limit
+is set to
+.BR "4020\ MiB" .
+(The values
+.B 0
+and
+.B max
+aren't affected by this.
+A similar feature doesn't exist for decompression.)
+This can be helpful when a 32-bit executable has access
+to 4\ GiB address space while hopefully doing no harm in other situations.
+.IP ""
 See also the section
 .BR "Memory usage" .
 .TP
___
svn-src-head@freebsd.org mailing 

svn commit: r357607 - head/sys/powerpc/powerpc

2020-02-05 Thread Justin Hibbits
Author: jhibbits
Date: Thu Feb  6 01:25:30 2020
New Revision: 357607
URL: https://svnweb.freebsd.org/changeset/base/357607

Log:
  powerpc: Fix altivec disabling in set_mcontext()
  
  We somewhat blindly copy the srr1 from the new context to the trap frame,
  but disable FPU and VSX unconditionally, relying on the trap to re-enable
  them.  This works because the FPU manages the VSX extended FP registers,
  which is governed by the PCB_FPFREGS flag.  However, with altivec, we
  would blindly disable PSL_VEC, without touching PCB_VEC.  Handle this case
  by disabling altivec in both srr1 and pcb_flags, if the mcontext doesn't
  have _MC_AV_VALID set.
  
  Reported by:  pkubaj

Modified:
  head/sys/powerpc/powerpc/exec_machdep.c

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Wed Feb  5 22:29:01 2020
(r357606)
+++ head/sys/powerpc/powerpc/exec_machdep.c Thu Feb  6 01:25:30 2020
(r357607)
@@ -526,6 +526,9 @@ set_mcontext(struct thread *td, mcontext_t *mcp)
pcb->pcb_vec.vscr = mcp->mc_vscr;
pcb->pcb_vec.vrsave = mcp->mc_vrsave;
memcpy(pcb->pcb_vec.vr, mcp->mc_avec, sizeof(mcp->mc_avec));
+   } else {
+   tf->srr1 &= ~PSL_VEC;
+   pcb->pcb_flags &= ~PCB_VEC;
}
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357553 - head/sys/dev/cxgbe

2020-02-05 Thread Navdeep Parhar
On 2/5/20 3:19 AM, Slawa Olhovchenkov wrote:
> On Wed, Feb 05, 2020 at 12:13:15AM +, Navdeep Parhar wrote:
> 
>> Author: np
>> Date: Wed Feb  5 00:13:15 2020
>> New Revision: 357553
>> URL: https://svnweb.freebsd.org/changeset/base/357553
>>
>> Log:
>>   cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed by
>>   the hardware.
>>   
>>   hw.cxgbe.nm_txcsum=1
> 
> Very interesting.
> Please, describe some more detail about using this feture (for
> example, set this before driver loading? first netmap open? any netmap
> open? on the fly?)
> 

If you set this to 1 then all netmap Tx traffic that is recognized as
valid TCP/UDP on IP/IPv6 by the chip will get L3 and L4 checksums
inserted in proper places automatically.  This means a netmap
application trying to send legitimate traffic doesn't have to calculate
checksums in software.

It is safe to change this at any time and it will take effect immediately.

netmap(4) says that hw checksum should be disabled on the interface but
cxgbe has always had a way to bypass this.  It used to be via the normal
csum capabilities of the interface but those sometimes caused confusion
because they aren't supposed to be set with netmap so r355673 removed
netmap tx checksumming.  This rev brought it back with a driver-specific
knob.

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


svn commit: r357606 - head/sys/dev/cxgbe

2020-02-05 Thread Navdeep Parhar
Author: np
Date: Wed Feb  5 22:29:01 2020
New Revision: 357606
URL: https://svnweb.freebsd.org/changeset/base/357606

Log:
  cxgbe(4): Add native netmap support to the main interface.
  
  This means that extra virtual interfaces (VIs) created with
  hw.cxgbe.num_vis are no longer required to use netmap.  Use this
  tunable to enable native netmap support on the main interface:
  
  hw.cxgbe.native_netmap="3"
  
  There is no change in default behavior.
  
  Suggested by: jch@
  MFC after:2 weeks
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cWed Feb  5 21:30:31 2020
(r357605)
+++ head/sys/dev/cxgbe/t4_main.cWed Feb  5 22:29:01 2020
(r357606)
@@ -401,6 +401,22 @@ SYSCTL_INT(_hw_cxgbe_toe_rexmt_backoff, OID_AUTO, 15, 
 #endif
 
 #ifdef DEV_NETMAP
+#define NN_MAIN_VI (1 << 0)/* Native netmap on the main VI */
+#define NN_EXTRA_VI(1 << 1)/* Native netmap on the extra VI(s) */
+static int t4_native_netmap = NN_EXTRA_VI;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, native_netmap, CTLFLAG_RDTUN, 
_native_netmap,
+0, "Native netmap support.  bit 0 = main VI, bit 1 = extra VIs");
+
+#define NNMTXQ 8
+static int t4_nnmtxq = -NNMTXQ;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmtxq, CTLFLAG_RDTUN, _nnmtxq, 0,
+"Number of netmap TX queues");
+
+#define NNMRXQ 8
+static int t4_nnmrxq = -NNMRXQ;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmrxq, CTLFLAG_RDTUN, _nnmrxq, 0,
+"Number of netmap RX queues");
+
 #define NNMTXQ_VI 2
 static int t4_nnmtxq_vi = -NNMTXQ_VI;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmtxq_vi, CTLFLAG_RDTUN, _nnmtxq_vi, 0,
@@ -621,6 +637,8 @@ struct intrs_and_queues {
uint16_t nrxq;  /* # of NIC rxq's for each port */
uint16_t nofldtxq;  /* # of TOE/ETHOFLD txq's for each port */
uint16_t nofldrxq;  /* # of TOE rxq's for each port */
+   uint16_t nnmtxq;/* # of netmap txq's */
+   uint16_t nnmrxq;/* # of netmap rxq's */
 
/* The vcxgbe/vcxl interfaces use these and not the ones above. */
uint16_t ntxq_vi;   /* # of NIC txq's */
@@ -1247,10 +1265,16 @@ t4_attach(device_t dev)
}
 #endif
 #ifdef DEV_NETMAP
-   if (num_vis > 1) {
-   s->nnmrxq = nports * (num_vis - 1) * iaq.nnmrxq_vi;
-   s->nnmtxq = nports * (num_vis - 1) * iaq.nnmtxq_vi;
+   s->nnmrxq = 0;
+   s->nnmtxq = 0;
+   if (t4_native_netmap & NN_MAIN_VI) {
+   s->nnmrxq += nports * iaq.nnmrxq;
+   s->nnmtxq += nports * iaq.nnmtxq;
}
+   if (num_vis > 1 && t4_native_netmap & NN_EXTRA_VI) {
+   s->nnmrxq += nports * (num_vis - 1) * iaq.nnmrxq_vi;
+   s->nnmtxq += nports * (num_vis - 1) * iaq.nnmtxq_vi;
+   }
s->neq += s->nnmtxq + s->nnmrxq;
s->niq += s->nnmrxq;
 
@@ -1344,14 +1368,17 @@ t4_attach(device_t dev)
ofld_rqidx += vi->nofldrxq;
 #endif
 #ifdef DEV_NETMAP
-   if (j > 0) {
-   vi->first_nm_rxq = nm_rqidx;
-   vi->first_nm_txq = nm_tqidx;
+   vi->first_nm_rxq = nm_rqidx;
+   vi->first_nm_txq = nm_tqidx;
+   if (j == 0) {
+   vi->nnmrxq = iaq.nnmrxq;
+   vi->nnmtxq = iaq.nnmtxq;
+   } else {
vi->nnmrxq = iaq.nnmrxq_vi;
vi->nnmtxq = iaq.nnmtxq_vi;
-   nm_rqidx += vi->nnmrxq;
-   nm_tqidx += vi->nnmtxq;
}
+   nm_rqidx += vi->nnmrxq;
+   nm_tqidx += vi->nnmtxq;
 #endif
}
}
@@ -3316,10 +3343,10 @@ fixup_devlog_params(struct adapter *sc)
 static void
 update_nirq(struct intrs_and_queues *iaq, int nports)
 {
-   int extra = T4_EXTRA_INTR;
 
-   iaq->nirq = extra;
-   iaq->nirq += nports * (iaq->nrxq + iaq->nofldrxq);
+   iaq->nirq = T4_EXTRA_INTR;
+   iaq->nirq += nports * max(iaq->nrxq, iaq->nnmrxq);
+   iaq->nirq += nports * iaq->nofldrxq;
iaq->nirq += nports * (iaq->num_vis - 1) *
max(iaq->nrxq_vi, iaq->nnmrxq_vi);
iaq->nirq += nports * (iaq->num_vis - 1) * iaq->nofldrxq_vi;
@@ -3358,8 +3385,14 @@ calculate_iaq(struct adapter *sc, struct intrs_and_que
}
 #endif
 #ifdef DEV_NETMAP
-   iaq->nnmtxq_vi = t4_nnmtxq_vi;
-   iaq->nnmrxq_vi = t4_nnmrxq_vi;
+   if (t4_native_netmap & NN_MAIN_VI) {
+   iaq->nnmtxq = t4_nnmtxq;
+   iaq->nnmrxq = t4_nnmrxq;
+   }
+   if (t4_native_netmap & NN_EXTRA_VI) {
+   iaq->nnmtxq_vi = t4_nnmtxq_vi;
+   iaq->nnmrxq_vi = 

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

2020-02-05 Thread Enji Cooper
On Sat, Feb 1, 2020 at 12:36 PM Mateusz Guzik  wrote:
>
> Author: mjg
> Date: Sat Feb  1 20:36:35 2020
> New Revision: 357384
> URL: https://svnweb.freebsd.org/changeset/base/357384
>
> Log:
>   cache: remove vnode -> path lookup disablement
>
>   It seems to be of little to no use even when debugging.
>
>   Interested parties can resurrect it and gate compilation with a macro.

Hi Mateusz,

This orphans some other things in the kernel that should potentially
be removed as well:

$ grep -r 'debug\.disablefullpath' ~/svn/freebsd/src/sys/
sys/kern/kern_jail.c: /* proceed if sysctl
debug.disablefullpath == 1 */
sys/kern/vfs_mount.c: /* debug.disablefullpath == 1
results in ENODEV */

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


svn commit: r357598 - head/sys/conf

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 20:57:45 2020
New Revision: 357598
URL: https://svnweb.freebsd.org/changeset/base/357598

Log:
  Define SMP for standalone module builds.
  
  Suggested and reviewed by:kevans
  Differential Revision:https://reviews.freebsd.org/D23519

Modified:
  head/sys/conf/config.mk

Modified: head/sys/conf/config.mk
==
--- head/sys/conf/config.mk Wed Feb  5 20:55:59 2020(r357597)
+++ head/sys/conf/config.mk Wed Feb  5 20:57:45 2020(r357598)
@@ -11,8 +11,9 @@
 opt_global.h:
touch ${.TARGET}
 .if ${MACHINE} != "mips"
-   @echo "#define VIMAGE 1" >> ${.TARGET}
+   @echo "#define SMP 1" >> ${.TARGET}
@echo "#define MAC 1" >> ${.TARGET}
+   @echo "#define VIMAGE 1" >> ${.TARGET}
 .endif
 opt_bpf.h:
echo "#define DEV_BPF 1" > ${.TARGET}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357596 - head/sys/dev/virtio/pci

2020-02-05 Thread Alfredo Dal'Ava Junior
Author: alfredo
Date: Wed Feb  5 20:39:18 2020
New Revision: 357596
URL: https://svnweb.freebsd.org/changeset/base/357596

Log:
  [virtio] Fix r/w to PCI configuration area on big endian platforms
  
  In legacy VirtIO drivers, the header must be PCI endianness (little) and the
  device-specific region is encoded in the native endian of the guest.
  
  This patch makes the access (read/write) to VirtIO header using the little
  endian order. Other read and write access are native endianness. This also
  sets the device's IO region as big endian if on big endian machine.
  
  PR:   205178
  Submitted by: Andre Silva 
  Reported by:  Kenneth Salerno 
  Reviewed by:  bryanv, bdragon, luporl, alfredo
  Approved by:  jhibbits (mentor)
  Differential Revision:https://reviews.freebsd.org/D23401

Modified:
  head/sys/dev/virtio/pci/virtio_pci.c

Modified: head/sys/dev/virtio/pci/virtio_pci.c
==
--- head/sys/dev/virtio/pci/virtio_pci.cWed Feb  5 20:34:22 2020
(r357595)
+++ head/sys/dev/virtio/pci/virtio_pci.cWed Feb  5 20:39:18 2020
(r357596)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -184,6 +185,17 @@ static voidvtpci_config_intr(void *);
 #define vtpci_write_config_2(sc, o, v) bus_write_2((sc)->vtpci_res, (o), (v))
 #define vtpci_write_config_4(sc, o, v) bus_write_4((sc)->vtpci_res, (o), (v))
 
+/*
+ * Legacy VirtIO header is always PCI endianness (little), so if we
+ * are in a BE machine we need to swap bytes from LE to BE when reading
+ * and from BE to LE when writing.
+ * If we are in a LE machine, there will be no swaps.
+ */
+#define vtpci_read_header_2(sc, o) le16toh(vtpci_read_config_2(sc, o))
+#define vtpci_read_header_4(sc, o) le32toh(vtpci_read_config_4(sc, o))
+#define vtpci_write_header_2(sc, o, v)  vtpci_write_config_2(sc, o, 
(htole16(v)))
+#define vtpci_write_header_4(sc, o, v)  vtpci_write_config_4(sc, o, 
(htole32(v)))
+
 /* Tunables. */
 static int vtpci_disable_msix = 0;
 TUNABLE_INT("hw.virtio.pci.disable_msix", _disable_msix);
@@ -278,6 +290,17 @@ vtpci_attach(device_t dev)
return (ENXIO);
}
 
+/*
+ * For legacy VirtIO, the device-specific configuration is guest
+ * endian, while the common configuration header is always
+ * PCI (little) endian and will be handled specifically in
+ * other parts of this file via functions
+ * 'vtpci_[read|write]_header_[2|4]'
+ */
+#if _BYTE_ORDER == _BIG_ENDIAN
+   rman_set_bustag(sc->vtpci_res, _be_tag);
+#endif
+
if (pci_find_cap(dev, PCIY_MSI, NULL) != 0)
sc->vtpci_flags |= VTPCI_FLAG_NO_MSI;
 
@@ -447,7 +470,7 @@ vtpci_negotiate_features(device_t dev, uint64_t child_
 
sc = device_get_softc(dev);
 
-   host_features = vtpci_read_config_4(sc, VIRTIO_PCI_HOST_FEATURES);
+   host_features = vtpci_read_header_4(sc, VIRTIO_PCI_HOST_FEATURES);
vtpci_describe_features(sc, "host", host_features);
 
/*
@@ -459,7 +482,7 @@ vtpci_negotiate_features(device_t dev, uint64_t child_
sc->vtpci_features = features;
 
vtpci_describe_features(sc, "negotiated", features);
-   vtpci_write_config_4(sc, VIRTIO_PCI_GUEST_FEATURES, features);
+   vtpci_write_header_4(sc, VIRTIO_PCI_GUEST_FEATURES, features);
 
return (features);
 }
@@ -502,7 +525,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nv
info = _info[idx];
 
vtpci_select_virtqueue(sc, idx);
-   size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM);
+   size = vtpci_read_header_2(sc, VIRTIO_PCI_QUEUE_NUM);
 
error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN,
~(vm_paddr_t)0, info, );
@@ -512,7 +535,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nv
break;
}
 
-   vtpci_write_config_4(sc, VIRTIO_PCI_QUEUE_PFN,
+   vtpci_write_header_4(sc, VIRTIO_PCI_QUEUE_PFN,
virtqueue_paddr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT);
 
vqx->vtv_vq = *info->vqai_vq = vq;
@@ -646,7 +669,7 @@ vtpci_notify_virtqueue(device_t dev, uint16_t queue)
 
sc = device_get_softc(dev);
 
-   vtpci_write_config_2(sc, VIRTIO_PCI_QUEUE_NOTIFY, queue);
+   vtpci_write_header_2(sc, VIRTIO_PCI_QUEUE_NOTIFY, queue);
 }
 
 static uint8_t
@@ -1046,10 +1069,10 @@ vtpci_register_msix_vector(struct vtpci_softc *sc, int
} else
vector = VIRTIO_MSI_NO_VECTOR;
 
-   vtpci_write_config_2(sc, offset, vector);
+   vtpci_write_header_2(sc, offset, vector);
 
/* Read vector to determine if the host had sufficient resources. */
-   if (vtpci_read_config_2(sc, offset) != vector) {
+   if (vtpci_read_header_2(sc, offset) != vector) {
device_printf(dev,
  

svn commit: r357595 - head/sys/riscv/include

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:34:22 2020
New Revision: 357595
URL: https://svnweb.freebsd.org/changeset/base/357595

Log:
  Fix EXCP_MASK to include all relevant bits from scause.
  
  While cause codes higher than 16 are reserved, the exception code
  field of the register is defined to be all bits but the upper-most
  bit.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23510

Modified:
  head/sys/riscv/include/riscvreg.h

Modified: head/sys/riscv/include/riscvreg.h
==
--- head/sys/riscv/include/riscvreg.h   Wed Feb  5 20:32:37 2020
(r357594)
+++ head/sys/riscv/include/riscvreg.h   Wed Feb  5 20:34:22 2020
(r357595)
@@ -37,8 +37,7 @@
 #ifndef _MACHINE_RISCVREG_H_
 #define_MACHINE_RISCVREG_H_
 
-#defineEXCP_SHIFT  0
-#defineEXCP_MASK   (0xf << EXCP_SHIFT)
+#defineEXCP_MASK   (~EXCP_INTR)
 #defineEXCP_MISALIGNED_FETCH   0
 #defineEXCP_FAULT_FETCH1
 #defineEXCP_ILLEGAL_INSTRUCTION2
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357594 - head/sys/riscv/riscv

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:32:37 2020
New Revision: 357594
URL: https://svnweb.freebsd.org/changeset/base/357594

Log:
  Use csr_read() to read sstatus instead of inline assembly.
  
  While here, remove a local variable to avoid the CSR read in non-debug
  kernels.
  
  Reviewed by:  mhorne
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23511

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

Modified: head/sys/riscv/riscv/trap.c
==
--- head/sys/riscv/riscv/trap.c Wed Feb  5 20:11:08 2020(r357593)
+++ head/sys/riscv/riscv/trap.c Wed Feb  5 20:32:37 2020(r357594)
@@ -245,12 +245,10 @@ void
 do_trap_supervisor(struct trapframe *frame)
 {
uint64_t exception;
-   uint64_t sstatus;
 
/* Ensure we came from supervisor mode, interrupts disabled */
-   __asm __volatile("csrr %0, sstatus" : "=" (sstatus));
-   KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP,
-   ("We must came from S mode with interrupts disabled"));
+   KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) ==
+   SSTATUS_SPP, ("Came from S mode with interrupts enabled"));
 
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
@@ -305,7 +303,6 @@ do_trap_user(struct trapframe *frame)
 {
uint64_t exception;
struct thread *td;
-   uint64_t sstatus;
struct pcb *pcb;
 
td = curthread;
@@ -313,9 +310,8 @@ do_trap_user(struct trapframe *frame)
pcb = td->td_pcb;
 
/* Ensure we came from usermode, interrupts disabled */
-   __asm __volatile("csrr %0, sstatus" : "=" (sstatus));
-   KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
-   ("We must came from U mode with interrupts disabled"));
+   KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
+   ("Came from U mode with interrupts enabled"));
 
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357593 - head/sys/riscv/riscv

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:11:08 2020
New Revision: 357593
URL: https://svnweb.freebsd.org/changeset/base/357593

Log:
  Remove stale workaround for the htif console.
  
  In practice this discarded all characters entered at the DDB prompt.
  
  Reviewed by:  br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23509

Modified:
  head/sys/riscv/riscv/riscv_console.c

Modified: head/sys/riscv/riscv/riscv_console.c
==
--- head/sys/riscv/riscv/riscv_console.cWed Feb  5 20:08:01 2020
(r357592)
+++ head/sys/riscv/riscv/riscv_console.cWed Feb  5 20:11:08 2020
(r357593)
@@ -206,20 +206,6 @@ riscv_cngetc(struct consdev *cp)
 {
int ch;
 
-#if defined(KDB)
-   /*
-* RISCVTODO: BBL polls for console data on timer interrupt,
-* but interrupts are turned off in KDB.
-* So we currently do not have console in KDB.
-*/
-   if (kdb_active) {
-   ch = sbi_console_getchar();
-   while (ch) {
-   ch = sbi_console_getchar();
-   }
-   }
-#endif
-
ch = sbi_console_getchar();
if (ch > 0 && ch < 0xff) {
 #if defined(KDB)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357592 - in head: lib/libc share/mk

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 20:08:01 2020
New Revision: 357592
URL: https://svnweb.freebsd.org/changeset/base/357592

Log:
  libssp_nonshared: use only on i386 and ppc
  
  libssp_nonshared.a defines one symbol, __stack_chk_fail_local.  This
  is used only on i386 and powerpc; other archs emit calls directly to
  __stack_chk_fail.  Simplify linking on other archs by omitting it.
  
  PR:   242941 [exp-run]

Modified:
  head/lib/libc/Makefile
  head/share/mk/src.libnames.mk

Modified: head/lib/libc/Makefile
==
--- head/lib/libc/Makefile  Wed Feb  5 20:06:35 2020(r357591)
+++ head/lib/libc/Makefile  Wed Feb  5 20:08:01 2020(r357592)
@@ -31,7 +31,8 @@ CFLAGS+=-DNO__SCCSID -DNO__RCSID
 
 LIB=c
 SHLIB_MAJOR= 7
-.if ${MK_SSP} != "no"
+.if ${MK_SSP} != "no" && \
+(${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
 SHLIB_LDSCRIPT=libc.ldscript
 .else
 SHLIB_LDSCRIPT=libc_nossp.ldscript
@@ -59,7 +60,8 @@ CFLAGS+=${CANCELPOINTS_CFLAGS}
 LDFLAGS+= -nodefaultlibs
 LIBADD+=   compiler_rt
 
-.if ${MK_SSP} != "no"
+.if ${MK_SSP} != "no" && \
+(${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
 LIBADD+=   ssp_nonshared
 .endif
 

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Wed Feb  5 20:06:35 2020
(r357591)
+++ head/share/mk/src.libnames.mk   Wed Feb  5 20:08:01 2020
(r357592)
@@ -344,7 +344,8 @@ _DP_xo= util
 # The libc dependencies are not strictly needed but are defined to make the
 # assert happy.
 _DP_c= compiler_rt
-.if ${MK_SSP} != "no"
+.if ${MK_SSP} != "no" && \
+(${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
 _DP_c+=ssp_nonshared
 .endif
 _DP_stats= sbuf pthread
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357591 - head/sys/riscv/include

2020-02-05 Thread John Baldwin
Author: jhb
Date: Wed Feb  5 20:06:35 2020
New Revision: 357591
URL: https://svnweb.freebsd.org/changeset/base/357591

Log:
  Read the breakpoint instruction to determine its length in BKPT_SKIP.
  
  This fixes continuing from debug.kdb.enter=1 after enabling the use of
  compressed instructions since the compiler can emit the two byte
  c.ebreak instead of the 4 byte ebreak.
  
  Reviewed by:  br
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D23507

Modified:
  head/sys/riscv/include/db_machdep.h

Modified: head/sys/riscv/include/db_machdep.h
==
--- head/sys/riscv/include/db_machdep.h Wed Feb  5 19:39:48 2020
(r357590)
+++ head/sys/riscv/include/db_machdep.h Wed Feb  5 20:06:35 2020
(r357591)
@@ -53,8 +53,14 @@ typedef long db_expr_t;
 #defineBKPT_SIZE   (INSN_SIZE)
 #defineBKPT_SET(inst)  (BKPT_INST)
 
-#defineBKPT_SKIP do {  \
-   kdb_frame->tf_sepc += BKPT_SIZE;\
+#defineBKPT_SKIP do {  
\
+   uint32_t _instr;\
+   \
+   _instr = db_get_value(PC_REGS(), sizeof(uint32_t), FALSE);  \
+   if ((_instr & 0x3) == 0x3)  \
+   kdb_frame->tf_sepc += 4;/* ebreak */\
+   else\
+   kdb_frame->tf_sepc += 2;/* c.ebreak */  \
 } while (0)
 
 #definedb_clear_single_stepkdb_cpu_clear_singlestep
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357590 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2020-02-05 Thread Brandon Bergren
Author: bdragon
Date: Wed Feb  5 19:39:48 2020
New Revision: 357590
URL: https://svnweb.freebsd.org/changeset/base/357590

Log:
  [PowerPC] [DTrace] Add ELFv2 support in libdtrace
  
  PPC64 ELFv2 acts like a "normal" platform in that it no longer needs
  function descriptors. So, ensure we are only enabling them on ELFv1.
  
  Additionally, ELFv2 requires that the ELF header have a nonzero e_flags,
  so ensure that the synthesized ELF header in dt_link.c is setting it.
  
  Reviewed by:  jhibbits, markj
  Approved by:  gnn
  Differential Revision:https://reviews.freebsd.org/D22403

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cWed Feb 
 5 19:18:04 2020(r357589)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cWed Feb 
 5 19:39:48 2020(r357590)
@@ -687,6 +687,9 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, in
 #elif defined(__mips__)
elf_file.ehdr.e_machine = EM_MIPS;
 #elif defined(__powerpc64__)
+#if defined(_CALL_ELF) && _CALL_ELF == 2
+   elf_file.ehdr.e_flags = 2;
+#endif
elf_file.ehdr.e_machine = EM_PPC64;
 #elif defined(__sparc)
elf_file.ehdr.e_machine = EM_SPARCV9;
@@ -1276,7 +1279,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
static const char dt_symfmt[] = "%s%u.%s";
static const char dt_weaksymfmt[] = "%s.%s";
char probename[DTRACE_NAMELEN];
-   int fd, i, ndx, eprobe, mod = 0;
+   int fd, i, ndx, eprobe, uses_funcdesc = 0, mod = 0;
Elf *elf = NULL;
GElf_Ehdr ehdr;
Elf_Scn *scn_rel, *scn_sym, *scn_str, *scn_tgt;
@@ -1328,6 +1331,9 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
emachine1 = emachine2 = EM_MIPS;
 #elif defined(__powerpc__)
emachine1 = emachine2 = EM_PPC64;
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
+   uses_funcdesc = 1;
+#endif
 #elif defined(__sparc)
emachine1 = emachine2 = EM_SPARCV9;
 #elif defined(__i386) || defined(__amd64)
@@ -1473,7 +1479,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
continue;
 
if (dt_symtab_lookup(data_sym, 0, isym, rela.r_offset,
-   shdr_rel.sh_info, , (emachine1 == EM_PPC64),
+   shdr_rel.sh_info, , uses_funcdesc,
elf) != 0) {
dt_strtab_destroy(strtab);
goto err;
@@ -1644,7 +1650,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
 
if (dt_symtab_lookup(data_sym, osym, isym,
rela.r_offset, shdr_rel.sh_info, ,
-   (emachine1 == EM_PPC64), elf) == 0) {
+   uses_funcdesc, elf) == 0) {
if (fsym.st_name > data_str->d_size)
goto err;
 
@@ -1653,7 +1659,7 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
s = strchr(s, '.') + 1;
} else if (dt_symtab_lookup(data_sym, 0, osym,
rela.r_offset, shdr_rel.sh_info, ,
-   (emachine1 == EM_PPC64), elf) == 0) {
+   uses_funcdesc, elf) == 0) {
u_int bind;
 
bind = GELF_ST_BIND(fsym.st_info) == STB_WEAK ?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357566 - head

2020-02-05 Thread Mathieu

On 2/5/20 2:05 PM, Andrew Gierth wrote:

"Kyle" == Kyle Evans  writes:

  >> Unfortunately, the utility of this cool series of changes is mostly
  >> destroyed by the fact that PATH is the variable that could be most
  >> usefully set in login.conf for running daemons, specifically because
  >> it is set in 3 separate places now.

  Kyle> It is (and has been) set in each of them respectively, but the
  Kyle> submitter (along with sig...@gmail.com) have some idea to accept
  Kyle> a hint in cron (and perhaps the others) from login.conf that it
  Kyle> should accept PATH as well unless it's been explicitly set in the
  Kyle> executing job.

  Kyle> I've CC'd these two so they can expand on that or discuss as
  Kyle> needed.

I'd be quite happy to go along with a proposal to unconditionally set
PATH from login.conf in cron and elsewhere.

(The idea of having a flag for it is just to avoid changing existing PATH
behavior without an explicit admin choice, to head off arguments about
security. If that's not an issue, then no need for the flag.)



If there are objections to using the "daemon" class's PATH for 
rc/service, there could be a new "system" class added that inherits from 
"daemon" configured with the traditional PATH that they override with 
(i.e. without /usr/local paths).  That would require no other changes to 
rc/service after modifying them to not always override PATH.  And leave 
only the cron issue.



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


Re: svn commit: r357586 - in head/sys/modules/dtrace: dtrace fasttrap

2020-02-05 Thread Kyle Evans
On Wed, Feb 5, 2020 at 1:08 PM Mark Johnston  wrote:
>
> Author: markj
> Date: Wed Feb  5 19:08:45 2020
> New Revision: 357586
> URL: https://svnweb.freebsd.org/changeset/base/357586
>
> Log:
>   Stop compiling dtrace modules with -DSMP.
>
>   I believe this is left over from when dtrace was being ported and
>   developed out-of-tree.  Now it just ensures that dtrace.ko and a non-SMP
>   kernel have incompatible KBIs.
>
>   PR:   243711
>   Sponsored by: The FreeBSD Foundation
>

This is another one that we should perhaps consider adding to
opt_global.h in config.mk for independent builds... I suspect mips is
the only primarily-UP arch left, so it probably fits in cleanly with
the other mips-excepted defaults.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357589 - head/sys/sparc64

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 19:18:04 2020
New Revision: 357589
URL: https://svnweb.freebsd.org/changeset/base/357589

Log:
  delete empty directories after r357455

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


svn commit: r357588 - head/sys/mips/beri

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 19:15:36 2020
New Revision: 357588
URL: https://svnweb.freebsd.org/changeset/base/357588

Log:
  beri: correct kernel printf typo
  
  (From review D23453)
  
  Submitted by: Gordon Bergling 
  Reviewed by:  rwatson

Modified:
  head/sys/mips/beri/beri_mp.c

Modified: head/sys/mips/beri/beri_mp.c
==
--- head/sys/mips/beri/beri_mp.cWed Feb  5 19:11:07 2020
(r357587)
+++ head/sys/mips/beri/beri_mp.cWed Feb  5 19:15:36 2020
(r357588)
@@ -132,7 +132,7 @@ platform_cpu_mask(cpuset_t *mask)
continue;
}
if (se->entry_addr != 1) {
-   printf("%s: CPU %d has uninitalized spin "
+   printf("%s: CPU %d has uninitialized spin "
"entry\n", __func__, reg);
continue;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357587 - head/sys/net

2020-02-05 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb  5 19:11:07 2020
New Revision: 357587
URL: https://svnweb.freebsd.org/changeset/base/357587

Log:
  ethernet: Add a couple more Ethertypes.
  
  Powerlink and Sercos III are used in automation. Both have been standardized
  and In the case of Ethernet Powerlink there is a BSD-licensed stack.

Modified:
  head/sys/net/ethernet.h

Modified: head/sys/net/ethernet.h
==
--- head/sys/net/ethernet.h Wed Feb  5 19:08:45 2020(r357586)
+++ head/sys/net/ethernet.h Wed Feb  5 19:11:07 2020(r357587)
@@ -356,7 +356,9 @@ struct ether_vlan_header {
 #defineETHERTYPE_AOE   0x88A2  /* ATA Protocol */
 #defineETHERTYPE_ETHERCAT  0x88A4  /* EtherCat Protocol */
 #defineETHERTYPE_QINQ  0x88A8  /* 802.1ad VLAN stacking */
+#defineETHERTYPE_POWERLINK 0x88AB  /* Ethernet Powerlink (EPL) */
 #defineETHERTYPE_LLDP  0x88CC  /* Link Layer Discovery 
Protocol */
+#defineETHERTYPE_SERCOS0x88CD  /* SERCOS III Protocol */
 #defineETHERTYPE_MACSEC0x88E5  /* 802.1AE MAC Security */
 #defineETHERTYPE_PBB   0x88E7  /* 802.1Q Provider Backbone 
Bridges */
 #defineETHERTYPE_FCOE  0x8906  /* Fibre Channel over Ethernet 
*/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357585 - in head/sys: amd64/include arm/include arm64/include i386/include powerpc/include riscv/include

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 19:08:21 2020
New Revision: 357585
URL: https://svnweb.freebsd.org/changeset/base/357585

Log:
  Define MAXCPU consistently between the kernel and KLDs.
  
  This reverts r177661.  The change is no longer very useful since
  out-of-tree KLDs will be built to target SMP kernels anyway.  Moveover
  it breaks the KBI in !SMP builds since cpuset_t's layout depends on the
  value of MAXCPU, and several kernel interfaces, notably
  smp_rendezvous_cpus(), take a cpuset_t as a parameter.
  
  PR:   243711
  Reviewed by:  jhb, kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D23512

Modified:
  head/sys/amd64/include/param.h
  head/sys/arm/include/param.h
  head/sys/arm64/include/param.h
  head/sys/i386/include/param.h
  head/sys/powerpc/include/param.h
  head/sys/riscv/include/param.h

Modified: head/sys/amd64/include/param.h
==
--- head/sys/amd64/include/param.h  Wed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/amd64/include/param.h  Wed Feb  5 19:08:21 2020
(r357585)
@@ -65,7 +65,7 @@
 #defineMACHINE_ARCH32  "i386"
 #endif
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #define MAXCPU 256
 #endif

Modified: head/sys/arm/include/param.h
==
--- head/sys/arm/include/param.hWed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/arm/include/param.hWed Feb  5 19:08:21 2020
(r357585)
@@ -75,13 +75,13 @@
 #defineMACHINE_ARCH"arm" _V_SUFFIX _EB_SUFFIX
 #endif
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #defineMAXCPU  4
 #endif
 #else
 #defineMAXCPU  1
-#endif /* SMP || KLD_MODULE */
+#endif
 
 #ifndef MAXMEMDOM
 #defineMAXMEMDOM   1

Modified: head/sys/arm64/include/param.h
==
--- head/sys/arm64/include/param.h  Wed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/arm64/include/param.h  Wed Feb  5 19:08:21 2020
(r357585)
@@ -54,13 +54,13 @@
 #defineMACHINE_ARCH32  "armv7"
 #endif
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #defineMAXCPU  256
 #endif
 #else
 #defineMAXCPU  1
-#endif /* SMP || KLD_MODULE */
+#endif
 
 #ifndef MAXMEMDOM
 #defineMAXMEMDOM   2

Modified: head/sys/i386/include/param.h
==
--- head/sys/i386/include/param.h   Wed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/i386/include/param.h   Wed Feb  5 19:08:21 2020
(r357585)
@@ -58,13 +58,13 @@
 #endif
 #define MID_MACHINEMID_I386
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #define MAXCPU 32
 #endif
 #else
 #define MAXCPU 1
-#endif /* SMP || KLD_MODULE */
+#endif
 
 #ifndef MAXMEMDOM
 #defineMAXMEMDOM   1

Modified: head/sys/powerpc/include/param.h
==
--- head/sys/powerpc/include/param.hWed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/powerpc/include/param.hWed Feb  5 19:08:21 2020
(r357585)
@@ -73,13 +73,13 @@
 #endif
 #endif
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #defineMAXCPU  256
 #endif
 #else
 #defineMAXCPU  1
-#endif /* SMP || KLD_MODULE */
+#endif
 
 #ifndef MAXMEMDOM
 #defineMAXMEMDOM   8

Modified: head/sys/riscv/include/param.h
==
--- head/sys/riscv/include/param.h  Wed Feb  5 18:38:07 2020
(r357584)
+++ head/sys/riscv/include/param.h  Wed Feb  5 19:08:21 2020
(r357585)
@@ -49,13 +49,13 @@
 #defineMACHINE_ARCH"riscv64"
 #endif
 
-#if defined(SMP) || defined(KLD_MODULE)
+#ifdef SMP
 #ifndef MAXCPU
 #defineMAXCPU  16
 #endif
 #else
 #defineMAXCPU  1
-#endif /* SMP || KLD_MODULE */
+#endif
 
 #ifndef MAXMEMDOM
 #defineMAXMEMDOM   1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357586 - in head/sys/modules/dtrace: dtrace fasttrap

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 19:08:45 2020
New Revision: 357586
URL: https://svnweb.freebsd.org/changeset/base/357586

Log:
  Stop compiling dtrace modules with -DSMP.
  
  I believe this is left over from when dtrace was being ported and
  developed out-of-tree.  Now it just ensures that dtrace.ko and a non-SMP
  kernel have incompatible KBIs.
  
  PR:   243711
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/modules/dtrace/dtrace/Makefile
  head/sys/modules/dtrace/fasttrap/Makefile

Modified: head/sys/modules/dtrace/dtrace/Makefile
==
--- head/sys/modules/dtrace/dtrace/Makefile Wed Feb  5 19:08:21 2020
(r357585)
+++ head/sys/modules/dtrace/dtrace/Makefile Wed Feb  5 19:08:45 2020
(r357586)
@@ -47,8 +47,6 @@ CFLAGS+=  -I${SYSDIR}/cddl/compat/opensolaris \
-I${SYSDIR}/cddl/contrib/opensolaris/common/util \
-I${SYSDIR} -DDIS_MEM
 
-CFLAGS+=   -DSMP
-
 EXPORT_SYMS=   dtrace_register \
dtrace_unregister \
dtrace_probe_lookup

Modified: head/sys/modules/dtrace/fasttrap/Makefile
==
--- head/sys/modules/dtrace/fasttrap/Makefile   Wed Feb  5 19:08:21 2020
(r357585)
+++ head/sys/modules/dtrace/fasttrap/Makefile   Wed Feb  5 19:08:45 2020
(r357586)
@@ -24,8 +24,6 @@ CFLAGS+=  -I${SYSDIR}/cddl/contrib/opensolaris/uts/powe
 .PATH: ${SYSDIR}/cddl/contrib/opensolaris/common/unicode
 SRCS+= u8_textprep.c
 
-CFLAGS+=   -DSMP
-
 .include 
 
 CFLAGS+=   -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357566 - head

2020-02-05 Thread Andrew Gierth
> "Kyle" == Kyle Evans  writes:

 >> Unfortunately, the utility of this cool series of changes is mostly
 >> destroyed by the fact that PATH is the variable that could be most
 >> usefully set in login.conf for running daemons, specifically because
 >> it is set in 3 separate places now.

 Kyle> It is (and has been) set in each of them respectively, but the
 Kyle> submitter (along with sig...@gmail.com) have some idea to accept
 Kyle> a hint in cron (and perhaps the others) from login.conf that it
 Kyle> should accept PATH as well unless it's been explicitly set in the
 Kyle> executing job.

 Kyle> I've CC'd these two so they can expand on that or discuss as
 Kyle> needed.

I'd be quite happy to go along with a proposal to unconditionally set
PATH from login.conf in cron and elsewhere.

(The idea of having a flag for it is just to avoid changing existing PATH
behavior without an explicit admin choice, to head off arguments about
security. If that's not an issue, then no need for the flag.)

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


svn commit: r357584 - head/contrib/netbsd-tests

2020-02-05 Thread Kyle Evans
Author: kevans
Date: Wed Feb  5 18:38:07 2020
New Revision: 357584
URL: https://svnweb.freebsd.org/changeset/base/357584

Log:
  Record-only MFV of r357583: netbsd-tests: import upstreamed changes
  
  The changes in question originated in FreeBSD/head; no further action is
  required.

Modified:
Directory Properties:
  head/contrib/netbsd-tests/   (props changed)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357566 - head

2020-02-05 Thread Kyle Evans
On Wed, Feb 5, 2020 at 11:21 AM Ian Lepore  wrote:
>
> On Wed, 2020-02-05 at 04:43 +, Kyle Evans wrote:
> > Author: kevans
> > Date: Wed Feb  5 04:43:58 2020
> > New Revision: 357566
> > URL: https://svnweb.freebsd.org/changeset/base/357566
> >
> > Log:
> >   Add RELNOTES entry for various daemons pulling in environment variables
> >
> > Modified:
> >   head/RELNOTES
> >
> > Modified: head/RELNOTES
> > ==
> > --- head/RELNOTES Wed Feb  5 04:35:54 2020(r357565)
> > +++ head/RELNOTES Wed Feb  5 04:43:58 2020(r357566)
> > @@ -10,6 +10,12 @@ newline.  Entries should be separated by a newline.
> >
> >  Changes to this file should not be MFCed.
> >
> > +r357560-r357565:
> > + init(8), service(8), and cron(8) will now adopt user/class environment
> > + variables (excluding PATH, by default, which will be overwritten) by
> > + default.  Notably, environment variables for all cron jobs and rc
> > + services can now be set via login.conf(5).
> > +
> >
>
> Unfortunately, the utility of this cool series of changes is mostly
> destroyed by the fact that PATH is the variable that could be most
> usefully set in login.conf for running daemons, specifically because it
> is set in 3 separate places now.
>

It is (and has been) set in each of them respectively, but the
submitter (along with sig...@gmail.com) have some idea to accept a
hint in cron (and perhaps the others) from login.conf that it should
accept PATH as well unless it's been explicitly set in the executing
job.

I've CC'd these two so they can expand on that or discuss as needed.

Thanks,

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


Re: svn commit: r357566 - head

2020-02-05 Thread Ian Lepore
On Wed, 2020-02-05 at 04:43 +, Kyle Evans wrote:
> Author: kevans
> Date: Wed Feb  5 04:43:58 2020
> New Revision: 357566
> URL: https://svnweb.freebsd.org/changeset/base/357566
> 
> Log:
>   Add RELNOTES entry for various daemons pulling in environment variables
> 
> Modified:
>   head/RELNOTES
> 
> Modified: head/RELNOTES
> ==
> --- head/RELNOTES Wed Feb  5 04:35:54 2020(r357565)
> +++ head/RELNOTES Wed Feb  5 04:43:58 2020(r357566)
> @@ -10,6 +10,12 @@ newline.  Entries should be separated by a newline.
>  
>  Changes to this file should not be MFCed.
>  
> +r357560-r357565:
> + init(8), service(8), and cron(8) will now adopt user/class environment
> + variables (excluding PATH, by default, which will be overwritten) by
> + default.  Notably, environment variables for all cron jobs and rc
> + services can now be set via login.conf(5).
> +
> 

Unfortunately, the utility of this cool series of changes is mostly
destroyed by the fact that PATH is the variable that could be most
usefully set in login.conf for running daemons, specifically because it
is set in 3 separate places now.

-- Ian

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


svn commit: r357580 - head/contrib/netbsd-tests/lib/libc/c063

2020-02-05 Thread Kyle Evans
Author: kevans
Date: Wed Feb  5 17:21:36 2020
New Revision: 357580
URL: https://svnweb.freebsd.org/changeset/base/357580

Log:
  O_SEARCH test: drop O_SEARCH|O_RDWR local diff
  
  In FreeBSD's O_SEARCH implementation, O_SEARCH in conjunction with O_RDWR or
  O_WRONLY is explicitly rejected. In this case, O_RDWR was not necessary
  anyways as the file will get created with or without it.
  
  This was submitted upstream as misc/54940 and committed in rev 1.8 of the
  file.

Modified:
  head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c

Modified: head/contrib/netbsd-tests/lib/libc/c063/t_o_search.c
==
--- head/contrib/netbsd-tests/lib/libc/c063/t_o_search.cWed Feb  5 
16:55:00 2020(r357579)
+++ head/contrib/netbsd-tests/lib/libc/c063/t_o_search.cWed Feb  5 
17:21:36 2020(r357580)
@@ -258,11 +258,7 @@ ATF_TC_BODY(o_search_notdir, tc)
int fd;
 
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-#ifndef __FreeBSD__
-   ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
-#else
ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
-#endif
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == ENOTDIR);
ATF_REQUIRE(close(dfd) == 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357579 - head/lib/libfetch

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 16:55:00 2020
New Revision: 357579
URL: https://svnweb.freebsd.org/changeset/base/357579

Log:
  libfetch: disallow invalid escape sequences
  
  Per RFC1738 escape is "% hex hex"; other sequences do not form a valid URL.
  
  Suggested by: Matthew Dillon
  Reviewed by:  Matthew Dillon
  MFC after:1 week

Modified:
  head/lib/libfetch/fetch.c

Modified: head/lib/libfetch/fetch.c
==
--- head/lib/libfetch/fetch.c   Wed Feb  5 16:54:16 2020(r357578)
+++ head/lib/libfetch/fetch.c   Wed Feb  5 16:55:00 2020(r357579)
@@ -327,6 +327,9 @@ fetch_pctdecode(char *dst, const char *src, size_t dle
(d2 = fetch_hexval(s[2])) >= 0 && (d1 > 0 || d2 > 0)) {
c = d1 << 4 | d2;
s += 2;
+   } else if (s[0] == '%') {
+   /* Invalid escape sequence. */
+   return (NULL);
} else {
c = *s;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357578 - in head/sys: amd64/linux32 arm/linux i386/linux

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 16:54:16 2020
New Revision: 357578
URL: https://svnweb.freebsd.org/changeset/base/357578

Log:
  regen linuxulator sysent after r357577

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/arm/linux/linux_proto.h
  head/sys/arm/linux/linux_syscall.h
  head/sys/arm/linux/linux_syscalls.c
  head/sys/arm/linux/linux_sysent.c
  head/sys/arm/linux/linux_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Wed Feb  5 16:53:02 2020
(r357577)
+++ head/sys/amd64/linux32/linux32_proto.h  Wed Feb  5 16:54:16 2020
(r357578)
@@ -606,7 +606,10 @@ struct linux_sigaltstack_args {
char uoss_l_[PADL_(l_stack_t *)]; l_stack_t * uoss; char 
uoss_r_[PADR_(l_stack_t *)];
 };
 struct linux_sendfile_args {
-   register_t dummy;
+   char out_l_[PADL_(l_int)]; l_int out; char out_r_[PADR_(l_int)];
+   char in_l_[PADL_(l_int)]; l_int in; char in_r_[PADR_(l_int)];
+   char offset_l_[PADL_(l_long *)]; l_long * offset; char 
offset_r_[PADR_(l_long *)];
+   char count_l_[PADL_(l_size_t)]; l_size_t count; char 
count_r_[PADR_(l_size_t)];
 };
 struct linux_vfork_args {
register_t dummy;
@@ -737,6 +740,12 @@ struct linux_tkill_args {
char tid_l_[PADL_(int)]; int tid; char tid_r_[PADR_(int)];
char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
 };
+struct linux_sendfile64_args {
+   char out_l_[PADL_(l_int)]; l_int out; char out_r_[PADR_(l_int)];
+   char in_l_[PADL_(l_int)]; l_int in; char in_r_[PADR_(l_int)];
+   char offset_l_[PADL_(l_loff_t *)]; l_loff_t * offset; char 
offset_r_[PADR_(l_loff_t *)];
+   char count_l_[PADL_(l_size_t)]; l_size_t count; char 
count_r_[PADR_(l_size_t)];
+};
 struct linux_sys_futex_args {
char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void 
*)];
char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
@@ -1698,6 +1707,7 @@ int   linux_removexattr(struct thread *, struct 
linux_re
 intlinux_lremovexattr(struct thread *, struct linux_lremovexattr_args *);
 intlinux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
 intlinux_tkill(struct thread *, struct linux_tkill_args *);
+intlinux_sendfile64(struct thread *, struct linux_sendfile64_args *);
 intlinux_sys_futex(struct thread *, struct linux_sys_futex_args *);
 intlinux_sched_setaffinity(struct thread *, struct 
linux_sched_setaffinity_args *);
 intlinux_sched_getaffinity(struct thread *, struct 
linux_sched_getaffinity_args *);
@@ -2092,6 +2102,7 @@ int   linux_io_uring_register(struct thread *, struct 
li
 #defineLINUX32_SYS_AUE_linux_lremovexattr  AUE_NULL
 #defineLINUX32_SYS_AUE_linux_fremovexattr  AUE_NULL
 #defineLINUX32_SYS_AUE_linux_tkill AUE_NULL
+#defineLINUX32_SYS_AUE_linux_sendfile64AUE_SENDFILE
 #defineLINUX32_SYS_AUE_linux_sys_futex AUE_NULL
 #defineLINUX32_SYS_AUE_linux_sched_setaffinity AUE_NULL
 #defineLINUX32_SYS_AUE_linux_sched_getaffinity AUE_NULL

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hWed Feb  5 16:53:02 2020
(r357577)
+++ head/sys/amd64/linux32/linux32_syscall.hWed Feb  5 16:54:16 2020
(r357578)
@@ -216,6 +216,7 @@
 #defineLINUX32_SYS_linux_lremovexattr  236
 #defineLINUX32_SYS_linux_fremovexattr  237
 #defineLINUX32_SYS_linux_tkill 238
+#defineLINUX32_SYS_linux_sendfile64239
 #defineLINUX32_SYS_linux_sys_futex 240
 #defineLINUX32_SYS_linux_sched_setaffinity 241
 #defineLINUX32_SYS_linux_sched_getaffinity 242

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Wed Feb  5 16:53:02 2020
(r357577)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Wed Feb  5 16:54:16 2020
(r357578)
@@ -246,7 +246,7 @@ const char *linux32_syscallnames[] = {
"linux_lremovexattr",   /* 236 = linux_lremovexattr */
"linux_fremovexattr",   /* 237 = linux_fremovexattr */
"linux_tkill",  /* 238 = linux_tkill */
-   "#239", /* 239 = linux_sendfile64 */
+   "linux_sendfile64", /* 239 = 

svn commit: r357577 - in head/sys: amd64/linux amd64/linux32 arm/linux arm64/linux compat/linux i386/linux

2020-02-05 Thread Ed Maste
Author: emaste
Date: Wed Feb  5 16:53:02 2020
New Revision: 357577
URL: https://svnweb.freebsd.org/changeset/base/357577

Log:
  linuxulator: implement sendfile
  
  Submitted by: Bora Özarslan 
  Submitted by: Yang Wang <2...@outlook.jp>
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19917

Modified:
  head/sys/amd64/linux/linux_dummy.c
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/arm/linux/syscalls.master
  head/sys/arm64/linux/linux_dummy.c
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux/linux_dummy.c
==
--- head/sys/amd64/linux/linux_dummy.c  Wed Feb  5 16:10:09 2020
(r357576)
+++ head/sys/amd64/linux/linux_dummy.c  Wed Feb  5 16:53:02 2020
(r357577)
@@ -59,7 +59,6 @@ UNIMPLEMENTED(set_thread_area);
 UNIMPLEMENTED(uselib);
 UNIMPLEMENTED(vserver);
 
-DUMMY(sendfile);
 DUMMY(setfsuid);
 DUMMY(setfsgid);
 DUMMY(sysfs);

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Wed Feb  5 16:10:09 2020
(r357576)
+++ head/sys/amd64/linux32/linux32_dummy.c  Wed Feb  5 16:53:02 2020
(r357577)
@@ -72,7 +72,6 @@ DUMMY(delete_module);
 DUMMY(quotactl);
 DUMMY(bdflush);
 DUMMY(sysfs);
-DUMMY(sendfile);
 DUMMY(setfsuid);
 DUMMY(setfsgid);
 DUMMY(pivot_root);

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Wed Feb  5 16:10:09 2020
(r357576)
+++ head/sys/amd64/linux32/syscalls.master  Wed Feb  5 16:53:02 2020
(r357577)
@@ -338,7 +338,8 @@
struct l_user_cap_data *datap); }
 186AUE_NULLSTD { int linux_sigaltstack(l_stack_t *uss, \
l_stack_t *uoss); }
-187AUE_SENDFILESTD { int linux_sendfile(void); }
+187AUE_SENDFILESTD { int linux_sendfile(l_int out, l_int in, \
+   l_long *offset, l_size_t count); }
 188AUE_GETPMSG UNIMPL  getpmsg
 189AUE_PUTPMSG UNIMPL  putpmsg
 190AUE_VFORK   STD { int linux_vfork(void); }
@@ -412,7 +413,8 @@
 236AUE_NULLSTD { int linux_lremovexattr(void); }
 237AUE_NULLSTD { int linux_fremovexattr(void); }
 238AUE_NULLSTD { int linux_tkill(int tid, int sig); }
-239AUE_SENDFILEUNIMPL  linux_sendfile64
+239AUE_SENDFILESTD { int linux_sendfile64(l_int out, l_int in, \
+   l_loff_t *offset, l_size_t count); }
 240AUE_NULLSTD { int linux_sys_futex(void *uaddr, int op, 
uint32_t val, \
struct l_timespec *timeout, uint32_t 
*uaddr2, uint32_t val3); }
 241AUE_NULLSTD { int linux_sched_setaffinity(l_pid_t pid, 
l_uint len, \

Modified: head/sys/arm/linux/syscalls.master
==
--- head/sys/arm/linux/syscalls.master  Wed Feb  5 16:10:09 2020
(r357576)
+++ head/sys/arm/linux/syscalls.master  Wed Feb  5 16:53:02 2020
(r357577)
@@ -868,7 +868,12 @@
);
}
 187AUE_SENDFILESTD {
-   int linux_sendfile(void);
+   int linux_sendfile(
+   l_int out,
+   l_int in,
+   l_long *offset,
+   l_size_t count
+   );
}
 188AUE_NULLUNIMPL  ; was getpmsg
 189AUE_NULLUNIMPL  ; was putpmsg
@@ -1090,7 +1095,14 @@
int sig
);
}
-239AUE_SENDFILEUNIMPL  linux_sendfile64
+239AUE_SENDFILESTD {
+   int linux_sendfile64(
+   l_int out,
+   l_int in,
+   l_loff_t *offset,
+   l_size_t count
+   );
+   }
 240AUE_NULLSTD {
int linux_sys_futex(void *uaddr,
int op,

Modified: head/sys/arm64/linux/linux_dummy.c
==
--- head/sys/arm64/linux/linux_dummy.c  Wed Feb  5 16:10:09 2020
(r357576)
+++ head/sys/arm64/linux/linux_dummy.c  Wed Feb  5 16:53:02 2020
(r357577)
@@ -64,7 +64,6 @@ UNIMPLEMENTED(tuxcall);
 UNIMPLEMENTED(uselib);
 UNIMPLEMENTED(vserver);
 
-DUMMY(sendfile);
 DUMMY(setfsuid);
 DUMMY(setfsgid);
 DUMMY(vhangup);

Modified: head/sys/compat/linux/linux_socket.c

svn commit: r357576 - head/lib/libc/rpc

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 16:10:09 2020
New Revision: 357576
URL: https://svnweb.freebsd.org/changeset/base/357576

Log:
  Fix a use of an uninitialized pointer in xdr_rpcbs_rmtcalllist().
  
  This appears to have been introduced in r173763.  Also fix the confusing
  indentation that probably led to the bug in the first place.
  
  PR:   243759
  Diagnosed by: mar...@lispworks.com
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libc/rpc/rpcb_st_xdr.c

Modified: head/lib/libc/rpc/rpcb_st_xdr.c
==
--- head/lib/libc/rpc/rpcb_st_xdr.c Wed Feb  5 16:09:44 2020
(r357575)
+++ head/lib/libc/rpc/rpcb_st_xdr.c Wed Feb  5 16:10:09 2020
(r357576)
@@ -54,29 +54,28 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
 {
struct rpcbs_addrlist **pnext;
 
-   if (!xdr_rpcprog(xdrs, >prog)) {
+   if (!xdr_rpcprog(xdrs, >prog)) {
return (FALSE);
-   }
-   if (!xdr_rpcvers(xdrs, >vers)) {
+   }
+   if (!xdr_rpcvers(xdrs, >vers)) {
return (FALSE);
-   }
-   if (!xdr_int(xdrs, >success)) {
+   }
+   if (!xdr_int(xdrs, >success)) {
return (FALSE);
-   }
-   if (!xdr_int(xdrs, >failure)) {
+   }
+   if (!xdr_int(xdrs, >failure)) {
return (FALSE);
-   }
-   if (!xdr_string(xdrs, >netid, RPC_MAXDATASIZE)) {
+   }
+   if (!xdr_string(xdrs, >netid, RPC_MAXDATASIZE)) {
return (FALSE);
-   }
+   }
 
-   pnext = >next;
-
-   if (!xdr_pointer(xdrs, (char **) pnext,
+   pnext = >next;
+   if (!xdr_pointer(xdrs, (char **) pnext,
sizeof (rpcbs_addrlist),
(xdrproc_t)xdr_rpcbs_addrlist)) {
return (FALSE);
-   }
+   }
 
return (TRUE);
 }
@@ -86,86 +85,86 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
 bool_t
 xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
 {
-   int32_t *buf;
struct rpcbs_rmtcalllist **pnext;
+   int32_t *buf;
 
+   pnext = >next;
if (xdrs->x_op == XDR_ENCODE) {
-   buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
-   if (buf == NULL) {
-   if (!xdr_rpcprog(xdrs, >prog)) {
-   return (FALSE);
+   buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
+   if (buf == NULL) {
+   if (!xdr_rpcprog(xdrs, >prog)) {
+   return (FALSE);
+   }
+   if (!xdr_rpcvers(xdrs, >vers)) {
+   return (FALSE);
+   }
+   if (!xdr_rpcproc(xdrs, >proc)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, >success)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, >failure)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, >indirect)) {
+   return (FALSE);
+   }
+   } else {
+   IXDR_PUT_U_INT32(buf, objp->prog);
+   IXDR_PUT_U_INT32(buf, objp->vers);
+   IXDR_PUT_U_INT32(buf, objp->proc);
+   IXDR_PUT_INT32(buf, objp->success);
+   IXDR_PUT_INT32(buf, objp->failure);
+   IXDR_PUT_INT32(buf, objp->indirect);
}
-   if (!xdr_rpcvers(xdrs, >vers)) {
+   if (!xdr_string(xdrs, >netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
-   if (!xdr_rpcproc(xdrs, >proc)) {
+   if (!xdr_pointer(xdrs, (char **) pnext,
+   sizeof (rpcbs_rmtcalllist),
+   (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
-   if (!xdr_int(xdrs, >success)) {
-   return (FALSE);
-   }
-   if (!xdr_int(xdrs, >failure)) {
-   return (FALSE);
-   }
-   if (!xdr_int(xdrs, >indirect)) {
-   return (FALSE);
-   }
-   } else {
-   IXDR_PUT_U_INT32(buf, objp->prog);
-   IXDR_PUT_U_INT32(buf, objp->vers);
-   IXDR_PUT_U_INT32(buf, objp->proc);
-   IXDR_PUT_INT32(buf, objp->success);
-   IXDR_PUT_INT32(buf, objp->failure);
-   IXDR_PUT_INT32(buf, objp->indirect);
-   }
-   if (!xdr_string(xdrs, >netid, RPC_MAXDATASIZE)) {
-   return (FALSE);
-   }
-   pnext = >next;
-   if 

svn commit: r357575 - head/lib/libc/net

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 16:09:44 2020
New Revision: 357575
URL: https://svnweb.freebsd.org/changeset/base/357575

Log:
  Improve validation of the sockaddr length in iruserok_sa().
  
  Negative numbers are not valid sockaddr lengths.
  
  PR:   243747
  Submitted by: Andrew Reiter 
  MFC after:1 week

Modified:
  head/lib/libc/net/rcmd.c

Modified: head/lib/libc/net/rcmd.c
==
--- head/lib/libc/net/rcmd.cWed Feb  5 16:09:21 2020(r357574)
+++ head/lib/libc/net/rcmd.cWed Feb  5 16:09:44 2020(r357575)
@@ -438,8 +438,8 @@ iruserok_sa(const void *ra, int rlen, int superuser, c
struct sockaddr_storage ss;
 
/* avoid alignment issue */
-   if (rlen > sizeof(ss)) 
-   return(-1);
+   if (rlen <= 0 || rlen > sizeof(ss))
+   return (-1);
memcpy(, ra, rlen);
raddr = (struct sockaddr *)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357574 - head/sys/kern

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 16:09:21 2020
New Revision: 357574
URL: https://svnweb.freebsd.org/changeset/base/357574

Log:
  Avoid releasing object PIP in vn_sendfile() if no pages were grabbed.
  
  sendfile(2) optionally takes a set of headers that get prepended to the
  file data.  If the request length is less than that of the headers,
  sendfile may not allocate an sfio structure, in which case its pointer
  is null and we should be careful not to dereference.  This was
  introduced in r356902.
  
  Reported by:  syzkaller
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Wed Feb  5 16:09:02 2020
(r357573)
+++ head/sys/kern/kern_sendfile.c   Wed Feb  5 16:09:21 2020
(r357574)
@@ -1060,8 +1060,10 @@ prepend_header:
 * we can send data right now without the
 * PRUS_NOTREADY flag.
 */
-   vm_object_pip_wakeup(sfio->obj);
-   free(sfio, M_TEMP);
+   if (sfio != NULL) {
+   vm_object_pip_wakeup(sfio->obj);
+   free(sfio, M_TEMP);
+   }
 #ifdef KERN_TLS
if (tls != NULL && tls->mode == TCP_TLS_MODE_SW) {
error = (*so->so_proto->pr_usrreqs->pru_send)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357573 - head/sys/amd64/amd64

2020-02-05 Thread Mark Johnston
Author: markj
Date: Wed Feb  5 16:09:02 2020
New Revision: 357573
URL: https://svnweb.freebsd.org/changeset/base/357573

Log:
  Fix map locking in the CLEAR_PKRU sysarch(2) handler.
  
  Reported and tested by:   pho
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/sys_machdep.c

Modified: head/sys/amd64/amd64/sys_machdep.c
==
--- head/sys/amd64/amd64/sys_machdep.c  Wed Feb  5 14:00:27 2020
(r357572)
+++ head/sys/amd64/amd64/sys_machdep.c  Wed Feb  5 16:09:02 2020
(r357573)
@@ -380,7 +380,7 @@ sysarch(struct thread *td, struct sysarch_args *uap)
error = pmap_pkru_clear(PCPU_GET(curpmap),
(vm_offset_t)a64pkru.addr,
(vm_offset_t)a64pkru.addr + a64pkru.len);
-   vm_map_unlock(map);
+   vm_map_unlock_read(map);
break;
 
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357572 - head/usr.bin/wc

2020-02-05 Thread Kyle Evans
Author: kevans
Date: Wed Feb  5 14:00:27 2020
New Revision: 357572
URL: https://svnweb.freebsd.org/changeset/base/357572

Log:
  wc(1): account for possibility of file == NULL
  
  file could reasonably be NULL here if we we're using stdin. Albeit less
  likely in normal usage, one could actually hit either of these warnings on
  stdin.
  
  ubmitted by:  sig...@gmail.com
  MFC after:3 days

Modified:
  head/usr.bin/wc/wc.c

Modified: head/usr.bin/wc/wc.c
==
--- head/usr.bin/wc/wc.cWed Feb  5 13:08:24 2020(r357571)
+++ head/usr.bin/wc/wc.cWed Feb  5 14:00:27 2020(r357572)
@@ -246,7 +246,7 @@ cnt(const char *file)
 */
if (doline == 0 && dolongline == 0) {
if (fstat(fd, )) {
-   xo_warn("%s: fstat", file);
+   xo_warn("%s: fstat", file != NULL ? file : "stdin");
(void)close(fd);
return (1);
}
@@ -267,7 +267,7 @@ cnt(const char *file)
 */
while ((len = read(fd, buf, MAXBSIZE))) {
if (len == -1) {
-   xo_warn("%s: read", file);
+   xo_warn("%s: read", file != NULL ? file : "stdin");
(void)close(fd);
return (1);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357571 - head/stand/libsa/zfs

2020-02-05 Thread Toomas Soome
Author: tsoome
Date: Wed Feb  5 13:08:24 2020
New Revision: 357571
URL: https://svnweb.freebsd.org/changeset/base/357571

Log:
  followup on r357497: clean obsolete comment and use shift instead of 
multiplication
  
  Based on illumos review feedback: leftover comment, but also
  have consistent block size calculation and add missing else leg to if
  statement.

Modified:
  head/stand/libsa/zfs/zfsimpl.c

Modified: head/stand/libsa/zfs/zfsimpl.c
==
--- head/stand/libsa/zfs/zfsimpl.c  Wed Feb  5 11:34:10 2020
(r357570)
+++ head/stand/libsa/zfs/zfsimpl.c  Wed Feb  5 13:08:24 2020
(r357571)
@@ -2294,8 +2294,7 @@ dnode_read(const spa_t *spa, const dnode_phys_t *dnode
 }
 
 /*
- * Lookup a value in a microzap directory. Assumes that the zap
- * scratch buffer contains the directory contents.
+ * Lookup a value in a microzap directory.
  */
 static int
 mzap_lookup(const mzap_phys_t *mz, size_t size, const char *name,
@@ -2777,7 +2776,7 @@ static int
 zap_list(const spa_t *spa, const dnode_phys_t *dnode)
 {
zap_phys_t *zap;
-   size_t size = dnode->dn_datablkszsec * 512;
+   size_t size = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
int rc;
 
zap = malloc(size);
@@ -2917,7 +2916,7 @@ zap_rlookup(const spa_t *spa, const dnode_phys_t *dnod
 uint64_t value)
 {
zap_phys_t *zap;
-   size_t size = dnode->dn_datablkszsec * 512;
+   size_t size = dnode->dn_datablkszsec << SPA_MINBLOCKSHIFT;
int rc;
 
zap = malloc(size);
@@ -3116,7 +3115,7 @@ zfs_callback_dataset(const spa_t *spa, uint64_t objnum
return (err);
}
 
-   size = child_dir_zap.dn_datablkszsec * 512;
+   size = child_dir_zap.dn_datablkszsec << SPA_MINBLOCKSHIFT;
zap = malloc(size);
if (zap != NULL) {
err = dnode_read(spa, _dir_zap, 0, zap, size);
@@ -3128,6 +3127,8 @@ zfs_callback_dataset(const spa_t *spa, uint64_t objnum
callback);
else
err = fzap_list(spa, _dir_zap, zap, callback);
+   } else {
+   err = ENOMEM;
}
 done:
free(zap);
@@ -3286,7 +3287,7 @@ check_mos_features(const spa_t *spa)
if (dir.dn_type != DMU_OTN_ZAP_METADATA)
return (EIO);
 
-   size = dir.dn_datablkszsec * 512;
+   size = dir.dn_datablkszsec << SPA_MINBLOCKSHIFT;
zap = malloc(size);
if (zap == NULL)
return (ENOMEM);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357570 - head/sys/kern

2020-02-05 Thread Leandro Lupori
Author: luporl
Date: Wed Feb  5 11:34:10 2020
New Revision: 357570
URL: https://svnweb.freebsd.org/changeset/base/357570

Log:
  Add SYSCTL to get KERNBASE and relocated KERNBASE
  
  This change adds 2 new SYSCTLs, to retrieve the original and relocated 
KERNBASE
  values. This provides an easy, architecture independent way to calculate the
  running kernel displacement (current/load address minus original base 
address).
  
  The initial goal for this change is to add a new libkvm function that returns
  the kernel displacement, both for live kernels and crashdumps. This would in
  turn be used by kgdb to find out how to relocate kernel symbols (if needed).
  
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D23284

Modified:
  head/sys/kern/link_elf.c

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cWed Feb  5 11:02:00 2020(r357569)
+++ head/sys/kern/link_elf.cWed Feb  5 11:34:10 2020(r357570)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -389,6 +390,13 @@ link_elf_link_common_finish(linker_file_t lf)
 
 extern vm_offset_t __startkernel, __endkernel;
 
+static unsigned long kern_relbase = KERNBASE;
+
+SYSCTL_ULONG(_kern, OID_AUTO, base_address, CTLFLAG_RD,
+   SYSCTL_NULL_ULONG_PTR, KERNBASE, "Kernel base address");
+SYSCTL_ULONG(_kern, OID_AUTO, relbase_address, CTLFLAG_RD,
+   _relbase, 0, "Kernel relocated base address");
+
 static void
 link_elf_init(void* arg)
 {
@@ -431,6 +439,7 @@ link_elf_init(void* arg)
 #ifdef __powerpc__
linker_kernel_file->address = (caddr_t)__startkernel;
linker_kernel_file->size = (intptr_t)(__endkernel - __startkernel);
+   kern_relbase = (unsigned long)__startkernel;
 #else
linker_kernel_file->address += KERNBASE;
linker_kernel_file->size = -(intptr_t)linker_kernel_file->address;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r357553 - head/sys/dev/cxgbe

2020-02-05 Thread Slawa Olhovchenkov
On Wed, Feb 05, 2020 at 12:13:15AM +, Navdeep Parhar wrote:

> Author: np
> Date: Wed Feb  5 00:13:15 2020
> New Revision: 357553
> URL: https://svnweb.freebsd.org/changeset/base/357553
> 
> Log:
>   cxgbe(4): Add a knob to allow netmap tx traffic to be checksummed by
>   the hardware.
>   
>   hw.cxgbe.nm_txcsum=1

Very interesting.
Please, describe some more detail about using this feture (for
example, set this before driver loading? first netmap open? any netmap
open? on the fly?)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r357569 - head/stand/i386/zfsboot

2020-02-05 Thread Toomas Soome
Author: tsoome
Date: Wed Feb  5 11:02:00 2020
New Revision: 357569
URL: https://svnweb.freebsd.org/changeset/base/357569

Log:
  zfsboot: vdev_read_pad2 does allocate buffer with wrong size
  
  vdev_read_pad2() does read VDEV_PAD_SIZE of data, and will copy size bytes
  of it, hence, we need buffer of VDEV_PAD_SIZE bytes.
  
  Issue introduced in r357497.
  
  Reported by:  se

Modified:
  head/stand/i386/zfsboot/zfsboot.c

Modified: head/stand/i386/zfsboot/zfsboot.c
==
--- head/stand/i386/zfsboot/zfsboot.c   Wed Feb  5 08:55:19 2020
(r357568)
+++ head/stand/i386/zfsboot/zfsboot.c   Wed Feb  5 11:02:00 2020
(r357569)
@@ -324,7 +324,7 @@ vdev_read_pad2(vdev_t *vdev, char *buf, size_t size)
if (size > VDEV_PAD_SIZE)
size = VDEV_PAD_SIZE;
 
-   tmp = malloc(size);
+   tmp = malloc(VDEV_PAD_SIZE);
if (tmp == NULL)
return (ENOMEM);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"