svn commit: r348299 - head/sys/kern

2019-05-26 Thread Justin Hibbits
Author: jhibbits
Date: Mon May 27 04:20:31 2019
New Revision: 348299
URL: https://svnweb.freebsd.org/changeset/base/348299

Log:
  kern/CTF: link_elf_ctf_get() on big endian platforms
  
  Check the CTF magic number in big endian platforms.  This lets DTrace FBT
  handle types correctly on these platforms.
  
  Submitted by: Brandon Bergren
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20413

Modified:
  head/sys/kern/kern_ctf.c

Modified: head/sys/kern/kern_ctf.c
==
--- head/sys/kern/kern_ctf.cMon May 27 03:18:56 2019(r348298)
+++ head/sys/kern/kern_ctf.cMon May 27 04:20:31 2019(r348299)
@@ -193,8 +193,12 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
NOCRED, NULL, td)) != 0)
goto out;
 
-   /* Check the CTF magic number. (XXX check for big endian!) */
+   /* Check the CTF magic number. */
+#ifdef __LITTLE_ENDIAN__
if (ctf_hdr[0] != 0xf1 || ctf_hdr[1] != 0xcf) {
+#else
+   if (ctf_hdr[0] != 0xcf || ctf_hdr[1] != 0xf1) {
+#endif
printf("%s(%d): module %s has invalid format\n",
__func__, __LINE__, lf->pathname);
error = EFTYPE;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348298 - head/sys/cddl/dev/fbt/powerpc

2019-05-26 Thread Justin Hibbits
Author: jhibbits
Date: Mon May 27 03:18:56 2019
New Revision: 348298
URL: https://svnweb.freebsd.org/changeset/base/348298

Log:
  powerpc/dtrace: Fix fbt function probing for ELFv2
  
  '.' function names exist only in ELFv1.  ELFv2 does away with function
  descriptors, and look more like they do on powerpc(32) and most other
  platforms, as direct function pointers.  Stop blacklisting regular function
  names in ELFv2.
  
  Submitted by: Brandon Bergren
  Differential Revision:https://reviews.freebsd.org/D20346

Modified:
  head/sys/cddl/dev/fbt/powerpc/fbt_isa.c

Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c
==
--- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Mon May 27 02:18:33 2019
(r348297)
+++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Mon May 27 03:18:56 2019
(r348298)
@@ -116,6 +116,7 @@ fbt_provide_module_function(linker_file_t lf, int symi
uint32_t *instr, *limit;
 
 #ifdef __powerpc64__
+#if !defined(_CALL_ELF) || _CALL_ELF == 1
/*
 * PowerPC64 uses '.' prefixes on symbol names, ignore it, but only
 * allow symbols with the '.' prefix, so that we don't get the function
@@ -125,6 +126,7 @@ fbt_provide_module_function(linker_file_t lf, int symi
name++;
else
return (0);
+#endif
 #endif
 
if (fbt_excluded(name))
___
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: r348297 - in stable/12: lib/libjail sbin/bectl/tests

2019-05-26 Thread Kyle Evans
Author: kevans
Date: Mon May 27 02:18:33 2019
New Revision: 348297
URL: https://svnweb.freebsd.org/changeset/base/348297

Log:
  MFC r348215, r348219: fix bectl(8) jail w/ numeric BE names
  
  r348215:
  jail_getid(3): validate jid string input
  
  Currently, if jail_getid(3) is passed in a numeric string, it assumes that
  this is a jid string and passes it back converted to an int without checking
  that it's a valid/existing jid. This breaks consumers that might use
  jail_getid(3) to see if it can trivially grab a jid from a name if that name
  happens to be numeric but not actually the name/jid of the jail. Instead of
  returning -1 for the jail not existing, it'll return the int version of the
  input and the consumer will not fallback to trying other methods.
  
  Pass the numeric input to jail_get(2) as the jid for validation, rather than
  the name. This works well- the kernel enforces that jid=name if name is
  numeric, so doing the safe thing and checking numeric input as a jid will
  still DTRT based on the description of jail_getid.
  
  r348219:
  bectl(8): Add a test for jail/unjail of numeric BE names
  
  Fixed by r348215, bectl ujail first attempts the trivial fetch of a jid by
  passing the first argument to 'ujail' to jail_getid(3) in case a jid/name
  have been passed in instead of a BE name. For numerically named BEs, this
  was doing the wrong thing: instead of failing to locate the jid specified
  and falling back to mountpath search, jail_getid(3) would return the input
  as-is.
  
  While here, I've fixed bectl_jail_cleanup which still used a hard-coded pool
  name that was overlooked w.r.t. other work that was in-flight around the
  same time.

Modified:
  stable/12/lib/libjail/jail_getid.c
  stable/12/sbin/bectl/tests/bectl_test.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libjail/jail_getid.c
==
--- stable/12/lib/libjail/jail_getid.c  Mon May 27 02:17:41 2019
(r348296)
+++ stable/12/lib/libjail/jail_getid.c  Mon May 27 02:18:33 2019
(r348297)
@@ -53,13 +53,18 @@ jail_getid(const char *name)
struct iovec jiov[4];
 
jid = strtoul(name, , 10);
-   if (*name && !*ep)
-   return jid;
-   jiov[0].iov_base = __DECONST(char *, "name");
-   jiov[0].iov_len = sizeof("name");
-   jiov[1].iov_len = strlen(name) + 1;
-   jiov[1].iov_base = alloca(jiov[1].iov_len);
-   strcpy(jiov[1].iov_base, name);
+   if (*name && !*ep) {
+   jiov[0].iov_base = __DECONST(char *, "jid");
+   jiov[0].iov_len = sizeof("jid");
+   jiov[1].iov_base = 
+   jiov[1].iov_len = sizeof(jid);
+   } else {
+   jiov[0].iov_base = __DECONST(char *, "name");
+   jiov[0].iov_len = sizeof("name");
+   jiov[1].iov_len = strlen(name) + 1;
+   jiov[1].iov_base = alloca(jiov[1].iov_len);
+   strcpy(jiov[1].iov_base, name);
+   }
jiov[2].iov_base = __DECONST(char *, "errmsg");
jiov[2].iov_len = sizeof("errmsg");
jiov[3].iov_base = jail_errmsg;

Modified: stable/12/sbin/bectl/tests/bectl_test.sh
==
--- stable/12/sbin/bectl/tests/bectl_test.shMon May 27 02:17:41 2019
(r348296)
+++ stable/12/sbin/bectl/tests/bectl_test.shMon May 27 02:18:33 2019
(r348297)
@@ -294,9 +294,16 @@ bectl_jail_body()
atf_check cp /rescue/rescue ${root}/rescue/rescue
atf_check bectl -r ${zpool}/ROOT umount default
 
-   # Prepare a second boot environment
+   # Prepare some more boot environments
atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT create -e default 
target
+   atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT create -e default 
1234
 
+   # Attempt to unjail a BE with numeric name; jail_getid at one point
+   # did not validate that the input was a valid jid before returning the
+   # jid.
+   atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b 1234
+   atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT unjail 1234
+
# When a jail name is not explicit, it should match the jail id.
atf_check -o empty -s exit:0 bectl -r ${zpool}/ROOT jail -b -o 
jid=233637 default
atf_check -o inline:"233637\n" -s exit:0 -x "jls -j 233637 name"
@@ -340,9 +347,10 @@ bectl_jail_body()
 # attempts to destroy the zpool.
 bectl_jail_cleanup()
 {
-   for bootenv in "default" "target"; do
+   zpool=$(get_zpool_name)
+   for bootenv in "default" "target" "1234"; do
# mountpoint of the boot environment
-   mountpoint="$(bectl -r bectl_test/ROOT list -H | grep 
${bootenv} | awk '{print $3}')"
+   mountpoint="$(bectl -r ${zpool}/ROOT list -H | grep ${bootenv} 
| awk '{print $3}')"
 
# see if 

svn commit: r348296 - stable/12/sbin/bectl

2019-05-26 Thread Kyle Evans
Author: kevans
Date: Mon May 27 02:17:41 2019
New Revision: 348296
URL: https://svnweb.freebsd.org/changeset/base/348296

Log:
  MFC r348127: bectl(8): add description for create subcommand
  
  In commit r345845, a portion of documentation for the create subcommand was
  removed. Specifically, for creating a snapshot of an existing boot
  environment. bectl even has a test-case for this functionality.
  
  Removing the sub-command description was discussed in PR 235850.
  
  This patch brings back the second "create" description that was originally
  in place. Albeit, with a few wording/clarifying changes.

Modified:
  stable/12/sbin/bectl/bectl.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/bectl/bectl.8
==
--- stable/12/sbin/bectl/bectl.8Mon May 27 00:55:46 2019
(r348295)
+++ stable/12/sbin/bectl/bectl.8Mon May 27 02:17:41 2019
(r348296)
@@ -18,7 +18,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 10, 2019
+.Dd May 12, 2019
 .Dt BECTL 8
 .Os
 .Sh NAME
@@ -122,6 +122,20 @@ Creates a snapshot of the existing boot environment na
 If the
 .Fl r
 flag is given, a recursive boot environment will be made.
+.It Xo
+.Cm create
+.Op Fl r
+.Ar beName@snapshot
+.Xc
+Create a snapshot of the boot environment named
+.Ar beName .
+.Pp
+If the
+.Fl r
+flag is given, a recursive snapshot of the boot environment will be created.
+A snapshot is created for each descendant dataset of the boot environment.
+.Pp
+No new boot environment is created with this command.
 .It Xo
 .Cm destroy
 .Op Fl \
___
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: r348295 - head/sys/dev/virtio/random

2019-05-26 Thread Conrad Meyer
Author: cem
Date: Mon May 27 00:55:46 2019
New Revision: 348295
URL: https://svnweb.freebsd.org/changeset/base/348295

Log:
  virtio_random(4): Remove unneeded reference to device
  
  The device_t always references the softc, so we can pass the device and
  obtain the softc instead of the other way around.

Modified:
  head/sys/dev/virtio/random/virtio_random.c

Modified: head/sys/dev/virtio/random/virtio_random.c
==
--- head/sys/dev/virtio/random/virtio_random.c  Mon May 27 00:51:27 2019
(r348294)
+++ head/sys/dev/virtio/random/virtio_random.c  Mon May 27 00:55:46 2019
(r348295)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 struct vtrnd_softc {
-   device_t vtrnd_dev;
uint64_t vtrnd_features;
struct callout   vtrnd_callout;
struct virtqueue*vtrnd_vq;
@@ -58,8 +57,8 @@ static intvtrnd_probe(device_t);
 static int vtrnd_attach(device_t);
 static int vtrnd_detach(device_t);
 
-static voidvtrnd_negotiate_features(struct vtrnd_softc *);
-static int vtrnd_alloc_virtqueue(struct vtrnd_softc *);
+static voidvtrnd_negotiate_features(device_t);
+static int vtrnd_alloc_virtqueue(device_t);
 static voidvtrnd_harvest(struct vtrnd_softc *);
 static voidvtrnd_timer(void *);
 
@@ -129,14 +128,13 @@ vtrnd_attach(device_t dev)
int error;
 
sc = device_get_softc(dev);
-   sc->vtrnd_dev = dev;
 
callout_init(>vtrnd_callout, 1);
 
virtio_set_feature_desc(dev, vtrnd_feature_desc);
-   vtrnd_negotiate_features(sc);
+   vtrnd_negotiate_features(dev);
 
-   error = vtrnd_alloc_virtqueue(sc);
+   error = vtrnd_alloc_virtqueue(dev);
if (error) {
device_printf(dev, "cannot allocate virtqueue\n");
goto fail;
@@ -164,24 +162,21 @@ vtrnd_detach(device_t dev)
 }
 
 static void
-vtrnd_negotiate_features(struct vtrnd_softc *sc)
+vtrnd_negotiate_features(device_t dev)
 {
-   device_t dev;
-   uint64_t features;
+   struct vtrnd_softc *sc;
 
-   dev = sc->vtrnd_dev;
-   features = VTRND_FEATURES;
-
-   sc->vtrnd_features = virtio_negotiate_features(dev, features);
+   sc = device_get_softc(dev);
+   sc->vtrnd_features = virtio_negotiate_features(dev, VTRND_FEATURES);
 }
 
 static int
-vtrnd_alloc_virtqueue(struct vtrnd_softc *sc)
+vtrnd_alloc_virtqueue(device_t dev)
 {
-   device_t dev;
+   struct vtrnd_softc *sc;
struct vq_alloc_info vq_info;
 
-   dev = sc->vtrnd_dev;
+   sc = device_get_softc(dev);
 
VQ_ALLOC_INFO_INIT(_info, 0, NULL, sc, >vtrnd_vq,
"%s request", device_get_nameunit(dev));
___
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: r348294 - head/share/man/man4

2019-05-26 Thread Conrad Meyer
Author: cem
Date: Mon May 27 00:51:27 2019
New Revision: 348294
URL: https://svnweb.freebsd.org/changeset/base/348294

Log:
  virtio.4: Add missing devices and Xr
  
  This page could probably use further improvement.

Modified:
  head/share/man/man4/virtio.4

Modified: head/share/man/man4/virtio.4
==
--- head/share/man/man4/virtio.4Mon May 27 00:47:51 2019
(r348293)
+++ head/share/man/man4/virtio.4Mon May 27 00:51:27 2019
(r348294)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 22, 2012
+.Dd May 26, 2019
 .Dt VIRTIO 4
 .Os
 .Sh NAME
@@ -64,28 +64,37 @@ interrupt notifications needed to interact with the hy
 .Fx
 supports the following VirtIO devices:
 .Bl -hang -offset indent -width 
-.It Nm Ethernet
+.It Sy Ethernet
 An emulated Ethernet device is provided by the
 .Xr vtnet 4
 device driver.
-.It Nm Block
+.It Sy Block
 An emulated disk controller is provided by the
 .Xr virtio_blk 4
 device driver.
-.It Nm SCSI
-An emulated SCSI HBA is provided by the
-.Xr virtio_scsi 4
-device driver.
-.It Nm Balloon
+.It Sy Console
+Provided by the
+.Xr virtio_console 4
+driver.
+.It Sy Entropy
+Provided by the
+.Xr virtio_random 4
+driver.
+.It Sy Balloon
 A pseudo-device to allow the VM to release memory back to the hypervisor is
 provided by the
 .Xr virtio_balloon 4
 device driver.
+.It Sy SCSI
+An emulated SCSI HBA is provided by the
+.Xr virtio_scsi 4
+device driver.
 .El
 .Sh SEE ALSO
 .Xr virtio_balloon 4 ,
 .Xr virtio_blk 4 ,
 .Xr virtio_console 4 ,
+.Xr virtio_random 4 ,
 .Xr virtio_scsi 4 ,
 .Xr vtnet 4
 .Sh HISTORY
___
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: r348293 - head/sys/crypto/aesni

2019-05-26 Thread Conrad Meyer
Author: cem
Date: Mon May 27 00:47:51 2019
New Revision: 348293
URL: https://svnweb.freebsd.org/changeset/base/348293

Log:
  aesni(4): Fix trivial type typo
  
  This fixes the kernel build with xtoolchain-gcc (6.4.0).
  
  X-MFC-With:   r348268

Modified:
  head/sys/crypto/aesni/aesni_ccm.c

Modified: head/sys/crypto/aesni/aesni_ccm.c
==
--- head/sys/crypto/aesni/aesni_ccm.c   Mon May 27 00:43:43 2019
(r348292)
+++ head/sys/crypto/aesni/aesni_ccm.c   Mon May 27 00:47:51 2019
(r348293)
@@ -58,7 +58,7 @@
 static inline __m128i
 xor_and_encrypt(__m128i a, __m128i b, const unsigned char *k, int nr)
 {
-   __m128 retval = _mm_xor_si128(a, b);
+   __m128i retval = _mm_xor_si128(a, b);
 
retval = AESNI_ENC(retval, k, nr);
return (retval);
___
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: r348292 - head/sys/sys

2019-05-26 Thread Conrad Meyer
Author: cem
Date: Mon May 27 00:43:43 2019
New Revision: 348292
URL: https://svnweb.freebsd.org/changeset/base/348292

Log:
  sys/bufobj.h: Avoid using C++ reserved keyword 'private'
  
  No functional change (except for out-of-tree C++ kmods).

Modified:
  head/sys/sys/bufobj.h

Modified: head/sys/sys/bufobj.h
==
--- head/sys/sys/bufobj.h   Sun May 26 23:04:21 2019(r348291)
+++ head/sys/sys/bufobj.h   Mon May 27 00:43:43 2019(r348292)
@@ -127,7 +127,7 @@ struct bufobj {
 #defineASSERT_BO_LOCKED(bo)rw_assert(BO_LOCKPTR((bo)), RA_LOCKED)
 #defineASSERT_BO_UNLOCKED(bo)  rw_assert(BO_LOCKPTR((bo)), RA_UNLOCKED)
 
-void bufobj_init(struct bufobj *bo, void *private);
+void bufobj_init(struct bufobj *bo, void *priv);
 void bufobj_wdrop(struct bufobj *bo);
 void bufobj_wref(struct bufobj *bo);
 void bufobj_wrefl(struct bufobj *bo);
___
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: r348291 - head/sys/arm64/arm64

2019-05-26 Thread Jayachandran C.
Author: jchandra
Date: Sun May 26 23:04:21 2019
New Revision: 348291
URL: https://svnweb.freebsd.org/changeset/base/348291

Log:
  arm64 nexus: remove incorrect warning
  
  acpi_config_intr() will be called when an arm64 system booted with ACPI.
  We do the interrupt mapping for ACPI interrupts in nexus_acpi_map_intr()
  on arm64, so acpi_config_intr() has to just return success without
  printing this error message.
  
  Reviewed by:  andrew
  Differential Revision:https://reviews.freebsd.org/D19432

Modified:
  head/sys/arm64/arm64/nexus.c

Modified: head/sys/arm64/arm64/nexus.c
==
--- head/sys/arm64/arm64/nexus.cSun May 26 17:18:14 2019
(r348290)
+++ head/sys/arm64/arm64/nexus.cSun May 26 23:04:21 2019
(r348291)
@@ -292,9 +292,11 @@ nexus_config_intr(device_t dev, int irq, enum intr_tri
 enum intr_polarity pol)
 {
 
-   /* TODO: This is wrong, it's needed for ACPI */
-   device_printf(dev, "bus_config_intr is obsolete and not supported!\n");
-   return (EOPNOTSUPP);
+   /*
+* On arm64 (due to INTRNG), ACPI interrupt configuration is 
+* done in nexus_acpi_map_intr().
+*/
+   return (0);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348290 - head/sys/netinet

2019-05-26 Thread Michael Tuexen
Author: tuexen
Date: Sun May 26 17:18:14 2019
New Revision: 348290
URL: https://svnweb.freebsd.org/changeset/base/348290

Log:
  When an ACK segment as the third message of the three way handshake is
  received and support for time stamps was negotiated in the SYN/SYNACK
  exchange, perform the PAWS check and only expand the syn cache entry if
  the check is passed.
  Without this check, endpoints may get stuck on the incomplete queue.
  
  Reviewed by:  jtl@
  MFC after:3 days
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D20374

Modified:
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Sun May 26 16:43:06 2019
(r348289)
+++ head/sys/netinet/tcp_syncache.c Sun May 26 17:18:14 2019
(r348290)
@@ -1142,6 +1142,28 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt
}
}
 #endif /* TCP_SIGNATURE */
+
+   /*
+* RFC 7323 PAWS: If we have a timestamp on this segment and
+* it's less than ts_recent, drop it.
+* XXXMT: RFC 7323 also requires to send an ACK.
+*In tcp_input.c this is only done for TCP segments
+*with user data, so be consistent here and just drop
+*the segment.
+*/
+   if (sc->sc_flags & SCF_TIMESTAMP && to->to_flags & TOF_TS &&
+   TSTMP_LT(to->to_tsval, sc->sc_tsreflect)) {
+   SCH_UNLOCK(sch);
+   if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+   log(LOG_DEBUG,
+   "%s; %s: SEG.TSval %u < TS.Recent %u, "
+   "segment dropped\n", s, __func__,
+   to->to_tsval, sc->sc_tsreflect);
+   free(s, M_TCPLOG);
+   }
+   return (-1);  /* Do not send RST */
+   }
+
/*
 * Pull out the entry to unlock the bucket row.
 * 
___
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: r348289 - stable/12/sys/netinet

2019-05-26 Thread Michael Tuexen
Author: tuexen
Date: Sun May 26 16:43:06 2019
New Revision: 348289
URL: https://svnweb.freebsd.org/changeset/base/348289

Log:
  MFC r347975:
  Improve input validation for the IPPROTO_SCTP level socket options
  SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.
  
  MFC r347976:
  Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
  This issue was found by running syzkaller.

Modified:
  stable/12/sys/netinet/sctp_usrreq.c
  stable/12/sys/netinet/sctputil.c
  stable/12/sys/netinet/sctputil.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/sctp_usrreq.c
==
--- stable/12/sys/netinet/sctp_usrreq.c Sun May 26 15:44:58 2019
(r348288)
+++ stable/12/sys/netinet/sctp_usrreq.c Sun May 26 16:43:06 2019
(r348289)
@@ -1352,13 +1352,12 @@ static int
 sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
 size_t optsize, void *p, int delay)
 {
-   int error = 0;
+   int error;
int creat_lock_on = 0;
struct sctp_tcb *stcb = NULL;
struct sockaddr *sa;
unsigned int num_v6 = 0, num_v4 = 0, *totaddrp, totaddr;
uint32_t vrf_id;
-   int bad_addresses = 0;
sctp_assoc_t *a_id;
 
SCTPDBG(SCTP_DEBUG_PCB1, "Connectx called\n");
@@ -1397,17 +1396,12 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb
totaddrp = (unsigned int *)optval;
totaddr = *totaddrp;
sa = (struct sockaddr *)(totaddrp + 1);
-   stcb = sctp_connectx_helper_find(inp, sa, , _v4, _v6, 
, (unsigned int)(optsize - sizeof(int)), _addresses);
-   if ((stcb != NULL) || bad_addresses) {
+   error = sctp_connectx_helper_find(inp, sa, totaddr, _v4, _v6, 
(unsigned int)(optsize - sizeof(int)));
+   if (error != 0) {
/* Already have or am bring up an association */
SCTP_ASOC_CREATE_UNLOCK(inp);
creat_lock_on = 0;
-   if (stcb)
-   SCTP_TCB_UNLOCK(stcb);
-   if (bad_addresses == 0) {
-   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EALREADY);
-   error = EALREADY;
-   }
+   SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, 
error);
goto out_now;
}
 #ifdef INET6
@@ -5338,10 +5332,11 @@ sctp_setopt(struct socket *so, int optname, void *optv
net->dest_state &= 
~SCTP_ADDR_NOHB;
}
if (paddrp->spp_flags & SPP_HB_DEMAND) {
-   /* on demand HB */
-   sctp_send_hb(stcb, net, 
SCTP_SO_LOCKED);
-   sctp_chunk_output(inp, stcb, 
SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
-   
sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
+   if (SCTP_GET_STATE(stcb) == 
SCTP_STATE_OPEN) {
+   sctp_send_hb(stcb, net, 
SCTP_SO_LOCKED);
+   sctp_chunk_output(inp, 
stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
+   
sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
+   }
}
if ((paddrp->spp_flags & 
SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) {
if 
(SCTP_OS_TIMER_PENDING(>pmtu_timer.timer)) {

Modified: stable/12/sys/netinet/sctputil.c
==
--- stable/12/sys/netinet/sctputil.cSun May 26 15:44:58 2019
(r348288)
+++ stable/12/sys/netinet/sctputil.cSun May 26 16:43:06 2019
(r348289)
@@ -6391,30 +6391,33 @@ out_now:
return (added);
 }
 
-struct sctp_tcb *
+int
 sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr,
-unsigned int *totaddr,
-unsigned int *num_v4, unsigned int *num_v6, int *error,
-unsigned int limit, int *bad_addr)
+unsigned int totaddr,
+unsigned int *num_v4, unsigned int *num_v6,
+unsigned int limit)
 {
struct sockaddr *sa;
-   struct sctp_tcb *stcb = NULL;
+   struct sctp_tcb *stcb;
unsigned int incr, at, i;
 
at = 0;
sa = addr;
-   *error = *num_v6 = *num_v4 = 0;
+   *num_v6 = *num_v4 = 0;
/* account and validate addresses */
-   for (i = 0; i < *totaddr; i++) {
+   if (totaddr == 0) {
+   return (EINVAL);
+   }
+   for (i = 0; i < totaddr; i++) {
+   if (at + 

svn commit: r348288 - head/contrib/llvm/lib/CodeGen/SelectionDAG

2019-05-26 Thread Dimitry Andric
Author: dim
Date: Sun May 26 15:44:58 2019
New Revision: 348288
URL: https://svnweb.freebsd.org/changeset/base/348288

Log:
  Pull in r361696 from upstream llvm trunk (by Sanjay Patel):
  
[SelectionDAG] soften assertion when legalizing narrow vector FP ops
  
The test based on PR42010:
https://bugs.llvm.org/show_bug.cgi?id=42010
  
...may show an inaccuracy for PPC's target defs, but we should not be
so aggressive with an assert here. There's no telling what
out-of-tree targets look like.
  
  This fixes an assertion when building the graphics/mesa-dri port for
  PowerPC64.
  
  Reported by:  Mark Millard 
  PR:   238082
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
==
--- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp  Sun May 
26 14:15:54 2019(r348287)
+++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp  Sun May 
26 15:44:58 2019(r348288)
@@ -2523,13 +2523,11 @@ void DAGTypeLegalizer::WidenVectorResult(SDNode *N, un
 // We're going to widen this vector op to a legal type by padding with 
undef
 // elements. If the wide vector op is eventually going to be expanded to
 // scalar libcalls, then unroll into scalar ops now to avoid unnecessary
-// libcalls on the undef elements. We are assuming that if the scalar op
-// requires expanding, then the vector op needs expanding too.
+// libcalls on the undef elements.
 EVT VT = N->getValueType(0);
-if (TLI.isOperationExpand(N->getOpcode(), VT.getScalarType())) {
-  EVT WideVecVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
-  assert(!TLI.isOperationLegalOrCustom(N->getOpcode(), WideVecVT) &&
- "Target supports vector op, but scalar requires expansion?");
+EVT WideVecVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
+if (!TLI.isOperationLegalOrCustom(N->getOpcode(), WideVecVT) &&
+TLI.isOperationExpand(N->getOpcode(), VT.getScalarType())) {
   Res = DAG.UnrollVectorOp(N, WideVecVT.getVectorNumElements());
   break;
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Alexey Dokuchaev
On Sun, May 26, 2019 at 07:05:20AM -0700, Enji Cooper wrote:
> > On May 26, 2019, at 05:41, Alexey Dokuchaev  wrote:
> > New Revision: 348286
> > URL: https://svnweb.freebsd.org/changeset/base/348286
> > 
> > Log:
> >  Fix two errors reported by PVS Studio: V646 Consider inspecting the
> >  application's logic.  It's possible that 'else' keyword is missing.
> > 
> > ...
> > Modified: head/sys/dev/ctau/ctddk.c
> > --- head/sys/dev/ctau/ctddk.cSun May 26 03:52:35 2019(r348285)
> > +++ head/sys/dev/ctau/ctddk.cSun May 26 12:41:03 2019(r348286)
> > @@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
> >if (c->mode == M_E1) {
> >ct_setup_e1 (c->board);
> >return 0;
> > -} if (c->mode == M_G703) {
> > +} else if (c->mode == M_G703) {
> >ct_setup_g703 (c->board);
> >return 0;
> >} else
> 
> This seems like a good candidate for a switch-case logical block.

Perhaps.  I'm currently doing some PVS Studio runs over our kernel
and these were just some low-hanging fruit I wanted to fix.  Several
others had been forwarded to commit authors, and some already fixed.

./danfe
___
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: r348287 - head/share/man/man4

2019-05-26 Thread Mateusz Piotrowski
Author: 0mp (ports committer)
Date: Sun May 26 14:15:54 2019
New Revision: 348287
URL: https://svnweb.freebsd.org/changeset/base/348287

Log:
  ipheth.4: Explain how to manually configure USB tethering on Apple devices
  
  Reviewed by:  danfe, hselasky
  Approved by:  src (hselasky)
  Differential Revision:https://reviews.freebsd.org/D20353

Modified:
  head/share/man/man4/ipheth.4

Modified: head/share/man/man4/ipheth.4
==
--- head/share/man/man4/ipheth.4Sun May 26 12:41:03 2019
(r348286)
+++ head/share/man/man4/ipheth.4Sun May 26 14:15:54 2019
(r348287)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 24, 2015
+.Dd May 26, 2019
 .Dt IPHETH 4
 .Os
 .Sh NAME
@@ -75,6 +75,87 @@ Apple iPhone tethering (all models)
 .It
 Apple iPad tethering (all models)
 .El
+.Sh EXAMPLES
+.Bl -tag -width 0n
+.It Sy Example 1\&: No Manual Configuration
+.Pp
+The following example shows how to manually configure network access on a
+device that is not automatically recognized.
+.Pp
+First, load the driver and find out the unit and the address of the USB
+Apple
+device:
+.Bd -literal -offset 2n
+.Li # Ic kldload ipheth
+.Li # Ic usbconfig | grep Apple
+ugen0.2:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) 
pwr=ON (500mA)
+.Ed
+.Pp
+In this example, the unit and the address of the device is 0.2
+.Pq Dq Li ugen0.2 ,
+and its configuration index is 0
+.Pq Dq Li cfg=0 .
+.Pp
+Secondly, check what other configurations are available for the device:
+.Bd -literal -offset 2n
+.Li # Ic usbconfig 0.2 dump_all_config_desc | awk '/^ Conf/{print} 
/iConf/{print}'
+ Configuration index 0
+iConfiguration = 0x0005  
+ Configuration index 1
+iConfiguration = 0x0006  
+ Configuration index 2
+iConfiguration = 0x0007  
+ Configuration index 3
+iConfiguration = 0x0008  
+.Ed
+.Pp
+In this example, there are 4 different configurations available.
+The configuration with index 3 seems to be related to Ethernet.
+It is time to configure the device:
+.Bd -literal -offset 2n
+.Li # Ic usbconfig 0.2 set_config 3
+.Li # Ic usbconfig | grep 'Apple.*cfg=3'
+ugen0.2:  at usbus0, cfg=3 md=HOST spd=HIGH (480Mbps) 
pwr=ON (500mA)
+.Ed
+.Pp
+At this point the Apple device should ask whether the
+.Fx
+machine can be trusted
+.Po Dq Mobile Data
+has to be on
+.Pc .
+.Pp
+A new
+.Em ue
+USB Ethernet interface should become available:
+.Bd -literal -offset 2n
+.Li # Ic dmesg | grep 'ue[0-9]'
+ue0:  on ipheth0
+ue0: bpf attached
+ue0: Ethernet address: 4e:7c:5f:2c:5f:7a
+.Ed
+.Pp
+At this point it might be necessary to run
+.Xr usbmuxd 1
+.Po available in
+.Xr ports 7
+at
+.Pa comms/usbmuxd
+.Pc :
+.Bd -literal -offset 2n
+.Li # Ic usbmuxd --enable-exit --foreground --user root --verbose
+.Ed
+.Pp
+Now it is time to configure the network interface:
+.Bd -literal -offset 2n
+.Li # Ic sysrc ifconfig_ue0="SYNCDHCP"
+ifconfig_ue0:  -> SYNCDHCP
+.Li # Ic service netif restart ue0
+.Ed
+.Pp
+That is it.
+The machine should now be connected to the network via USB tethering.
+.El
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr cdce 4 ,
@@ -96,12 +177,10 @@ The
 driver was written by
 .An Hans Petter Selasky Aq Mt hsela...@freebsd.org .
 .Sh BUGS
-Some devices may need to be manually configured to use an alternative
-configuration with the
+Some devices are not recognized automatically and may need to be manually
+configured to use an alternative configuration with the
 .Xr usbconfig 8
 utility.
-A command similar to
-.Dl usbconfig -u 1 -a 2 set_config 3
-may be required if the device is not recognised automatically by
-.Nm
-after it is connected.
+See
+.Sx EXAMPLES
+for workarounds.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Enji Cooper


> On May 26, 2019, at 05:41, Alexey Dokuchaev  wrote:
> 
> Author: danfe (ports committer)
> Date: Sun May 26 12:41:03 2019
> New Revision: 348286
> URL: https://svnweb.freebsd.org/changeset/base/348286
> 
> Log:
>  Fix two errors reported by PVS Studio: V646 Consider inspecting the
>  application's logic.  It's possible that 'else' keyword is missing.
> 
>  Reviewed by:gallatin, np, pfg
>  Approved by:pfg
>  Differential Revision:https://reviews.freebsd.org/D20396
> 
> Modified:
>  head/sys/dev/ctau/ctddk.c
>  head/sys/dev/cxgbe/t4_main.c
> 
> Modified: head/sys/dev/ctau/ctddk.c
> ==
> --- head/sys/dev/ctau/ctddk.cSun May 26 03:52:35 2019(r348285)
> +++ head/sys/dev/ctau/ctddk.cSun May 26 12:41:03 2019(r348286)
> @@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
>if (c->mode == M_E1) {
>ct_setup_e1 (c->board);
>return 0;
> -} if (c->mode == M_G703) {
> +} else if (c->mode == M_G703) {
>ct_setup_g703 (c->board);
>return 0;
>} else

This seems like a good candidate for a switch-case logical block.
Cheers,
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r348286 - in head/sys/dev: ctau cxgbe

2019-05-26 Thread Alexey Dokuchaev
Author: danfe (ports committer)
Date: Sun May 26 12:41:03 2019
New Revision: 348286
URL: https://svnweb.freebsd.org/changeset/base/348286

Log:
  Fix two errors reported by PVS Studio: V646 Consider inspecting the
  application's logic.  It's possible that 'else' keyword is missing.
  
  Reviewed by:  gallatin, np, pfg
  Approved by:  pfg
  Differential Revision:https://reviews.freebsd.org/D20396

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

Modified: head/sys/dev/ctau/ctddk.c
==
--- head/sys/dev/ctau/ctddk.c   Sun May 26 03:52:35 2019(r348285)
+++ head/sys/dev/ctau/ctddk.c   Sun May 26 12:41:03 2019(r348286)
@@ -237,7 +237,7 @@ int ct_set_clk (ct_chan_t *c, int clk)
if (c->mode == M_E1) {
ct_setup_e1 (c->board);
return 0;
-   } if (c->mode == M_G703) {
+   } else if (c->mode == M_G703) {
ct_setup_g703 (c->board);
return 0;
} else

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cSun May 26 03:52:35 2019
(r348285)
+++ head/sys/dev/cxgbe/t4_main.cSun May 26 12:41:03 2019
(r348286)
@@ -9709,7 +9709,7 @@ set_offload_policy(struct adapter *sc, struct t4_offlo
/* Delete installed policies. */
op = NULL;
goto set_policy;
-   } if (uop->nrules > 256) { /* arbitrary */
+   } else if (uop->nrules > 256) { /* arbitrary */
return (E2BIG);
}
 
___
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"