svn commit: r344089 - head/contrib/libarchive/libarchive

2019-02-12 Thread Martin Matuska
Author: mm
Date: Wed Feb 13 07:37:33 2019
New Revision: 344089
URL: https://svnweb.freebsd.org/changeset/base/344089

Log:
  MFV r344088 (libarchive):
  archive_read_disk_posix.c: initialize delayed_errno
  
  MFC after:2 weeks

Modified:
  head/contrib/libarchive/libarchive/archive_read_disk_posix.c
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_read_disk_posix.c
==
--- head/contrib/libarchive/libarchive/archive_read_disk_posix.cWed Feb 
13 07:35:18 2019(r344088)
+++ head/contrib/libarchive/libarchive/archive_read_disk_posix.cWed Feb 
13 07:37:33 2019(r344089)
@@ -860,6 +860,7 @@ next_entry(struct archive_read_disk *a, struct tree *t
struct archive_string delayed_str;
 
delayed = ARCHIVE_OK;
+   delayed_errno = 0;
archive_string_init(_str);
 
st = NULL;
___
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: r344085 - head/lib/libc/gen

2019-02-12 Thread David E. O'Brien
Author: obrien
Date: Wed Feb 13 04:52:01 2019
New Revision: 344085
URL: https://svnweb.freebsd.org/changeset/base/344085

Log:
  Note that readpassphrase() came into FreeBSD's libc at 4.6.

Modified:
  head/lib/libc/gen/readpassphrase.3

Modified: head/lib/libc/gen/readpassphrase.3
==
--- head/lib/libc/gen/readpassphrase.3  Wed Feb 13 04:19:08 2019
(r344084)
+++ head/lib/libc/gen/readpassphrase.3  Wed Feb 13 04:52:01 2019
(r344085)
@@ -178,4 +178,6 @@ extension and should not be used if portability is des
 The
 .Fn readpassphrase
 function first appeared in
+.Fx 4.6
+and
 .Ox 2.9 .
___
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: r344084 - head/lib/libbe

2019-02-12 Thread Kyle Evans
Author: kevans
Date: Wed Feb 13 04:19:08 2019
New Revision: 344084
URL: https://svnweb.freebsd.org/changeset/base/344084

Log:
  libbe(3): Fix be_destroy behavior w.r.t. deep BE snapshots and -o
  
  be_destroy is documented to recursively destroy a boot environment.  In the
  case of snapshots, one would take this to mean that these are also
  recursively destroyed.  However, this was previously not the case.
  be_destroy would descend into the be_destroy callback and attempt to
  zfs_iter_children on the top-level snapshot, which is bogus.
  
  Our alternative approach is to take note of the snapshot name and iterate
  through all of fs children of the BE to try destruction in the children.
  
  The -o option is also fixed to work properly with deep BEs.  If the BE was
  created with `bectl create -e otherDeepBE newDeepBE`, for instance, then a
  recursive snapshot of otherDeepBE would have been taken for construction of
  newDeepBE but a subsequent destroy with BE_DESTROY_ORIGIN set would only
  clean up the snapshot at the root of otherDeepBE: ${BEROOT}/otherDeepBE@...
  
  The most recent iteration instead pretends not to know how these things
  work, verifies that the origin is another BE and then passes that back
  through be_destroy to DTRT when snapshots and deep BEs may be in play.
  
  MFC after:1 week

Modified:
  head/lib/libbe/be.c
  head/lib/libbe/be.h
  head/lib/libbe/be_error.c
  head/lib/libbe/libbe.3

Modified: head/lib/libbe/be.c
==
--- head/lib/libbe/be.c Wed Feb 13 03:11:12 2019(r344083)
+++ head/lib/libbe/be.c Wed Feb 13 04:19:08 2019(r344084)
@@ -45,6 +45,11 @@ __FBSDID("$FreeBSD$");
 #include "be.h"
 #include "be_impl.h"
 
+struct be_destroy_data {
+   libbe_handle_t  *lbh;
+   char*snapname;
+};
+
 #if SOON
 static int be_create_child_noent(libbe_handle_t *lbh, const char *active,
 const char *child_path);
@@ -186,12 +191,38 @@ be_nicenum(uint64_t num, char *buf, size_t buflen)
 static int
 be_destroy_cb(zfs_handle_t *zfs_hdl, void *data)
 {
+   char path[BE_MAXPATHLEN];
+   struct be_destroy_data *bdd;
+   zfs_handle_t *snap;
int err;
 
-   if ((err = zfs_iter_children(zfs_hdl, be_destroy_cb, data)) != 0)
+   bdd = (struct be_destroy_data *)data;
+   if (bdd->snapname == NULL) {
+   err = zfs_iter_children(zfs_hdl, be_destroy_cb, data);
+   if (err != 0)
+   return (err);
+   return (zfs_destroy(zfs_hdl, false));
+   }
+   /* If we're dealing with snapshots instead, delete that one alone */
+   err = zfs_iter_filesystems(zfs_hdl, be_destroy_cb, data);
+   if (err != 0)
return (err);
-   if ((err = zfs_destroy(zfs_hdl, false)) != 0)
-   return (err);
+   /*
+* This part is intentionally glossing over any potential errors,
+* because there's a lot less potential for errors when we're cleaning
+* up snapshots rather than a full deep BE.  The primary error case
+* here being if the snapshot doesn't exist in the first place, which
+* the caller will likely deem insignificant as long as it doesn't
+* exist after the call.  Thus, such a missing snapshot shouldn't jam
+* up the destruction.
+*/
+   snprintf(path, sizeof(path), "%s@%s", zfs_get_name(zfs_hdl),
+   bdd->snapname);
+   if (!zfs_dataset_exists(bdd->lbh->lzh, path, ZFS_TYPE_SNAPSHOT))
+   return (0);
+   snap = zfs_open(bdd->lbh->lzh, path, ZFS_TYPE_SNAPSHOT);
+   if (snap != NULL)
+   zfs_destroy(snap, false);
return (0);
 }
 
@@ -199,22 +230,26 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data)
  * Destroy the boot environment or snapshot specified by the name
  * parameter. Options are or'd together with the possible values:
  * BE_DESTROY_FORCE : forces operation on mounted datasets
+ * BE_DESTROY_ORIGIN: destroy the origin snapshot as well
  */
 int
 be_destroy(libbe_handle_t *lbh, const char *name, int options)
 {
+   struct be_destroy_data bdd;
char origin[BE_MAXPATHLEN], path[BE_MAXPATHLEN];
zfs_handle_t *fs;
-   char *p;
+   char *snapdelim;
int err, force, mounted;
+   size_t rootlen;
 
-   p = path;
+   bdd.lbh = lbh;
+   bdd.snapname = NULL;
force = options & BE_DESTROY_FORCE;
*origin = '\0';
 
be_root_concat(lbh, name, path);
 
-   if (strchr(name, '@') == NULL) {
+   if ((snapdelim = strchr(path, '@')) == NULL) {
if (!zfs_dataset_exists(lbh->lzh, path, ZFS_TYPE_FILESYSTEM))
return (set_error(lbh, BE_ERR_NOENT));
 
@@ -222,9 +257,10 @@ be_destroy(libbe_handle_t *lbh, const char *name, int 
strcmp(path, lbh->bootfs) == 0)
return (set_error(lbh, 

svn commit: r344083 - head/sys/powerpc/booke

2019-02-12 Thread Justin Hibbits
Author: jhibbits
Date: Wed Feb 13 03:11:12 2019
New Revision: 344083
URL: https://svnweb.freebsd.org/changeset/base/344083

Log:
  powerpc/booke: Use the 'tlbilx' instruction on newer cores
  
  Newer cores have the 'tlbilx' instruction, which doesn't broadcast over
  CoreNet.  This is significantly faster than walking the TLB to invalidate
  the PID mappings.  tlbilx with the arguments given takes 131 clock cycles to
  complete, as opposed to 512 iterations through the loop plus tlbre/tlbwe at
  each iteration.
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/booke/pmap.c

Modified: head/sys/powerpc/booke/pmap.c
==
--- head/sys/powerpc/booke/pmap.c   Wed Feb 13 02:46:46 2019
(r344082)
+++ head/sys/powerpc/booke/pmap.c   Wed Feb 13 03:11:12 2019
(r344083)
@@ -4325,6 +4325,21 @@ tid_flush(tlbtid_t tid)
msr = mfmsr();
__asm __volatile("wrteei 0");
 
+   /*
+* Newer (e500mc and later) have tlbilx, which doesn't broadcast, so use
+* it for PID invalidation.
+*/
+   switch ((mfpvr() >> 16) & 0x) {
+   case FSL_E500mc:
+   case FSL_E5500:
+   case FSL_E6500:
+   mtspr(SPR_MAS6, tid << MAS6_SPID0_SHIFT);
+   /* tlbilxpid */
+   __asm __volatile("isync; .long 0x7c24; isync; msync");
+   mtmsr(msr);
+   return;
+   }
+
for (way = 0; way < TLB0_WAYS; way++)
for (entry = 0; entry < TLB0_ENTRIES_PER_WAY; entry++) {
 
___
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: r344070 - head/sys/cam

2019-02-12 Thread Warner Losh
Author: imp
Date: Wed Feb 13 00:10:12 2019
New Revision: 344070
URL: https://svnweb.freebsd.org/changeset/base/344070

Log:
  Fix panic message.
  
  The panic message lead people to believe some userland CAM request had
  caused a problem when in reallity it was for a kernel request (eg the
  USER bit was cleared). Reword message. Also, improve a couple of
  comments to reflect that the periph shouldn't be completely torn down
  before we get here (so the path and sim pointers should be valid, but
  aren't and the code is designed to be robust enough in the face of
  that to give a specific panic message).

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Tue Feb 12 23:39:18 2019(r344069)
+++ head/sys/cam/cam_xpt.c  Wed Feb 13 00:10:12 2019(r344070)
@@ -5411,8 +5411,9 @@ xpt_done_process(struct ccb_hdr *ccb_h)
}
 
/*
-* Insulate against a race where the periph is destroyed
-* but CCBs are still not all processed.
+* Insulate against a race where the periph is destroyed but CCBs are
+* still not all processed. This shouldn't happen, but allows us better
+* bug diagnostic when it does.
 */
if (ccb_h->path->bus)
sim = ccb_h->path->bus->sim;
@@ -5434,7 +5435,7 @@ xpt_done_process(struct ccb_hdr *ccb_h)
 
if (sim)
devq = sim->devq;
-   KASSERT(devq, ("sim missing for XPT_FC_USER_CCB request"));
+   KASSERT(devq, ("Periph disappeared with request pending."));
 
mtx_lock(>send_mtx);
devq->send_active--;
___
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: r344065 - in head: contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests

2019-02-12 Thread Enji Cooper


> On Feb 12, 2019, at 3:24 PM, Martin Matuska  wrote:
> 
> Author: mm
> Date: Tue Feb 12 23:24:45 2019
> New Revision: 344065
> URL: https://svnweb.freebsd.org/changeset/base/344065
> 
> Log:
>  MFV r344063:
>  Sync libarchive with vendor.
> 
>  Relevant vendor changes:
>PR #1085: Fix a null pointer dereference bug in zip writer
>PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
>  decopmpression
>PR #1116: Add support for 64-bit ar format
>PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
>PR #1125: RAR5 reader - fix an invalid read and a memory leak
>PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
>  due to ENOENT [3]
>PR #1134: Delete unnecessary null pointer checks before calls of free()
>OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
>OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader
> 
>  PR:  233006 [3]
>  Security:CVE-2019-119 [1], CVE-2019-120 [2]
>  MFC after:   2 weeks


Hi Martin,

This change broke the build. From 
https://ci.freebsd.org/job/FreeBSD-head-riscv64-build/12672/ 
:

/usr/src/contrib/libarchive/libarchive/archive_read_disk_posix.c: In function 
'_archive_read_next_header2':
/usr/src/contrib/libarchive/libarchive/archive_read_disk_posix.c:859: warning: 
'delayed_errno' may be used uninitialized in this function
/usr/src/contrib/libarchive/libarchive/archive_read_disk_posix.c:859: note: 
'delayed_errno' was declared here

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: r344069 - head/sys/modules/hwpmc

2019-02-12 Thread Marius Strobl
Author: marius
Date: Tue Feb 12 23:39:18 2019
New Revision: 344069
URL: https://svnweb.freebsd.org/changeset/base/344069

Log:
  With r344062 in place, hwpmc_mod.c generally needs bus_if.h and
  device_if.h.

Modified:
  head/sys/modules/hwpmc/Makefile

Modified: head/sys/modules/hwpmc/Makefile
==
--- head/sys/modules/hwpmc/Makefile Tue Feb 12 23:37:20 2019
(r344068)
+++ head/sys/modules/hwpmc/Makefile Tue Feb 12 23:39:18 2019
(r344069)
@@ -6,7 +6,8 @@
 
 KMOD=  hwpmc
 
-SRCS=  hwpmc_mod.c hwpmc_logging.c hwpmc_soft.c vnode_if.h
+SRCS=  bus_if.h device_if.h hwpmc_mod.c hwpmc_logging.c hwpmc_soft.c
+SRCS+= vnode_if.h
 
 .if ${MACHINE_CPUARCH} == "aarch64"
 SRCS+=  hwpmc_arm64.c hwpmc_arm64_md.c
@@ -15,7 +16,6 @@ SRCS+=  hwpmc_arm64.c hwpmc_arm64_md.c
 .if ${MACHINE_CPUARCH} == "amd64"
 SRCS+= hwpmc_amd.c hwpmc_core.c hwpmc_intel.c hwpmc_tsc.c
 SRCS+= hwpmc_x86.c hwpmc_uncore.c
-SRCS+= device_if.h bus_if.h
 .endif
 
 .if ${MACHINE_CPUARCH} == "arm"
@@ -25,7 +25,6 @@ SRCS+=hwpmc_arm.c
 .if ${MACHINE_CPUARCH} == "i386"
 SRCS+= hwpmc_amd.c hwpmc_core.c hwpmc_intel.c
 SRCS+= hwpmc_tsc.c hwpmc_x86.c hwpmc_uncore.c
-SRCS+= device_if.h bus_if.h
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc"
___
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: r344067 - head/sbin/bectl/tests

2019-02-12 Thread Enji Cooper
Author: ngie
Date: Tue Feb 12 23:35:46 2019
New Revision: 344067
URL: https://svnweb.freebsd.org/changeset/base/344067

Log:
  Fix up concurrent test zpool setup and teardown
  
  Set up zpools with a more unique name, stash the zpool name away in a file 
pointed
  to by `$ZPOOL_NAME_FILE` (which is relative to a per-testcase generated 
temporary
  directory), then remove the file based on `$ZPOOL_NAME_FILE` in the cleanup
  routines.
  
  This is a more concurrency-safe solution and will allow the testcases to be 
safely
  executed in parallel.
  
  Reviewed by:  kevans, jtl
  Approved by:  jtl (mentor)
  MFC after:1 week
  Differential Revision: https://reviews.freebsd.org/D19024

Modified:
  head/sbin/bectl/tests/bectl_test.sh

Modified: head/sbin/bectl/tests/bectl_test.sh
==
--- head/sbin/bectl/tests/bectl_test.sh Tue Feb 12 23:33:16 2019
(r344066)
+++ head/sbin/bectl/tests/bectl_test.sh Tue Feb 12 23:35:46 2019
(r344067)
@@ -26,6 +26,17 @@
 #
 # $FreeBSD$
 
+ZPOOL_NAME_FILE=zpool_name
+get_zpool_name()
+{
+   cat $ZPOOL_NAME_FILE
+}
+make_zpool_name()
+{
+   mktemp -u bectl_test_XX > $ZPOOL_NAME_FILE
+   get_zpool_name
+}
+
 # Establishes a bectl_create zpool that can be used for some light testing; 
contains
 # a 'default' BE and not much else.
 bectl_create_setup()
@@ -34,6 +45,9 @@ bectl_create_setup()
disk=$2
mnt=$3
 
+   # Sanity check to make sure `make_zpool_name` succeeded
+   atf_check test -n "$zpool"
+
kldload -n -q zfs || atf_skip "ZFS module not loaded on the current 
system"
atf_check mkdir -p ${mnt}
atf_check truncate -s 1G ${disk}
@@ -48,6 +62,9 @@ bectl_create_deep_setup()
disk=$2
mnt=$3
 
+   # Sanity check to make sure `make_zpool_name` succeeded
+   atf_check test -n "$zpool"
+
bectl_create_setup ${zpool} ${disk} ${mnt}
atf_check mkdir -p ${root}
atf_check -o ignore bectl -r ${zpool}/ROOT mount default ${root}
@@ -60,8 +77,9 @@ bectl_create_deep_setup()
 bectl_cleanup()
 {
zpool=$1
-
-   if zpool get health ${zpool} >/dev/null 2>&1; then
+   if [ -z "$zpool" ]; then
+   echo "Skipping cleanup; zpool not set up"
+   elif zpool get health ${zpool} >/dev/null 2>&1; then
zpool destroy -f ${zpool}
fi
 }
@@ -76,7 +94,7 @@ bectl_create_head()
 bectl_create_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
 
@@ -89,8 +107,7 @@ bectl_create_body()
 }
 bectl_create_cleanup()
 {
-
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_destroy cleanup
@@ -103,7 +120,7 @@ bectl_destroy_head()
 bectl_destroy_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
 
@@ -116,7 +133,7 @@ bectl_destroy_body()
 bectl_destroy_cleanup()
 {
 
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_export_import cleanup
@@ -129,7 +146,7 @@ bectl_export_import_head()
 bectl_export_import_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
 
@@ -144,7 +161,7 @@ bectl_export_import_body()
 bectl_export_import_cleanup()
 {
 
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_list cleanup
@@ -157,7 +174,7 @@ bectl_list_head()
 bectl_list_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
 
@@ -179,7 +196,7 @@ bectl_list_body()
 bectl_list_cleanup()
 {
 
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_mount cleanup
@@ -192,7 +209,7 @@ bectl_mount_head()
 bectl_mount_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
root=${mount}/root
@@ -213,7 +230,7 @@ bectl_mount_body()
 bectl_mount_cleanup()
 {
 
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_rename cleanup
@@ -226,7 +243,7 @@ bectl_rename_head()
 bectl_rename_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
 
@@ -239,7 +256,7 @@ bectl_rename_body()
 bectl_rename_cleanup()
 {
 
-   bectl_cleanup bectl_test
+   bectl_cleanup $(get_zpool_name)
 }
 
 atf_test_case bectl_jail cleanup
@@ -252,7 +269,7 @@ bectl_jail_head()
 bectl_jail_body()
 {
cwd=$(realpath .)
-   zpool=bectl_test
+   zpool=$(make_zpool_name)
disk=${cwd}/disk.img
mount=${cwd}/mnt
  

svn commit: r344066 - head/share/man/man8

2019-02-12 Thread Enji Cooper
Author: ngie
Date: Tue Feb 12 23:33:16 2019
New Revision: 344066
URL: https://svnweb.freebsd.org/changeset/base/344066

Log:
  Add rc.resume(8) alias for rc(8) to fix the manpage cross references
  
  This issue was noticed when running `make manlint` as part of MFCing r342597 
to
  ^/stable/11:
  ```
  $ make -C share/man/man8 rc.8lint
  mandoc -Tascii -Tlint rc.8
  mandoc: rc.8:548:6: STYLE: referenced manual not found: Xr rc.resume 8
  $
  ```
  
  This is a followup commit to r339818.
  
  Reviewed by:  eugen
  Approved by:  jtl (mentor)
  MFC after:1 week
  MFC to:   ^/stable/12
  Differential Revision: https://reviews.freebsd.org/D19158

Modified:
  head/share/man/man8/Makefile

Modified: head/share/man/man8/Makefile
==
--- head/share/man/man8/MakefileTue Feb 12 23:24:45 2019
(r344065)
+++ head/share/man/man8/MakefileTue Feb 12 23:33:16 2019
(r344066)
@@ -26,6 +26,7 @@ MLINKS= \
rc.8 rc.local.8 \
rc.8 rc.network.8 \
rc.8 rc.pccard.8 \
+   rc.8 rc.resume.8 \
rc.8 rc.serial.8 \
rc.8 rc.shutdown.8
 
___
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: r344065 - in head: contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests

2019-02-12 Thread Martin Matuska
Author: mm
Date: Tue Feb 12 23:24:45 2019
New Revision: 344065
URL: https://svnweb.freebsd.org/changeset/base/344065

Log:
  MFV r344063:
  Sync libarchive with vendor.
  
  Relevant vendor changes:
PR #1085: Fix a null pointer dereference bug in zip writer
PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2
  decopmpression
PR #1116: Add support for 64-bit ar format
PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2]
PR #1125: RAR5 reader - fix an invalid read and a memory leak
PR #1131: POSIX reader - do not fail when tree_current_lstat() fails
  due to ENOENT [3]
PR #1134: Delete unnecessary null pointer checks before calls of free()
OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy.
OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader
  
  PR:   233006 [3]
  Security: CVE-2019-119 [1], CVE-2019-120 [2]
  MFC after:2 weeks

Added:
  head/contrib/libarchive/libarchive/archive_ppmd8.c
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/archive_ppmd8.c
  head/contrib/libarchive/libarchive/archive_ppmd8_private.h
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/archive_ppmd8_private.h
  head/contrib/libarchive/libarchive/test/test_read_format_zip_bzip2.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_bzip2.zipx.uu
  
head/contrib/libarchive/libarchive/test/test_read_format_zip_bzip2_multi.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_bzip2_multi.zipx.uu
  head/contrib/libarchive/libarchive/test/test_read_format_zip_lzma.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_lzma.zipx.uu
  
head/contrib/libarchive/libarchive/test/test_read_format_zip_lzma_multi.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_lzma_multi.zipx.uu
  head/contrib/libarchive/libarchive/test/test_read_format_zip_ppmd8.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_ppmd8.zipx.uu
  
head/contrib/libarchive/libarchive/test/test_read_format_zip_ppmd8_multi.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_ppmd8_multi.zipx.uu
  head/contrib/libarchive/libarchive/test/test_read_format_zip_xz_multi.zipx.uu
 - copied unchanged from r344063, 
vendor/libarchive/dist/libarchive/test/test_read_format_zip_xz_multi.zipx.uu
Deleted:
  head/contrib/libarchive/libarchive/test/test_compat_pax_libarchive_2x.c
  head/contrib/libarchive/libarchive/test/test_compat_pax_libarchive_2x.tar.Z.uu
Modified:
  head/contrib/libarchive/cpio/test/test_option_t.c
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_pack_dev.c
  head/contrib/libarchive/libarchive/archive_read_disk_posix.c
  head/contrib/libarchive/libarchive/archive_read_open_file.c
  head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
  head/contrib/libarchive/libarchive/archive_read_support_format_ar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
  head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c
  head/contrib/libarchive/libarchive/archive_read_support_format_xar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_zip.c
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_disk_set_standard_lookup.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c
  head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_shar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_zip.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip.c
  head/contrib/libarchive/test_utils/test_main.c
  head/lib/libarchive/Makefile
  head/lib/libarchive/tests/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/cpio/test/test_option_t.c
==
--- head/contrib/libarchive/cpio/test/test_option_t.c   Tue Feb 12 22:33:17 
2019(r344064)
+++ head/contrib/libarchive/cpio/test/test_option_t.c   Tue Feb 12 23:24:45 
2019(r344065)
@@ -88,11 +88,11 @@ DEFINE_TEST(test_option_t)

svn commit: r344064 - head/sys/net

2019-02-12 Thread Marius Strobl
Author: marius
Date: Tue Feb 12 22:33:17 2019
New Revision: 344064
URL: https://svnweb.freebsd.org/changeset/base/344064

Log:
  Fix the build with ALTQ after r344060.

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cTue Feb 12 22:29:41 2019(r344063)
+++ head/sys/net/iflib.cTue Feb 12 22:33:17 2019(r344064)
@@ -3658,6 +3658,9 @@ _task_fn_tx(void *context)
 {
iflib_txq_t txq = context;
if_ctx_t ctx = txq->ift_ctx;
+#if defined(ALTQ) || defined(DEV_NETMAP)
+   if_t ifp = ctx->ifc_ifp;
+#endif
int abdicate = ctx->ifc_sysctl_tx_abdicate;
 
 #ifdef IFLIB_DIAGNOSTICS
@@ -3666,11 +3669,11 @@ _task_fn_tx(void *context)
if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING))
return;
 #ifdef DEV_NETMAP
-   if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) {
+   if (if_getcapenable(ifp) & IFCAP_NETMAP) {
bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map,
BUS_DMASYNC_POSTREAD);
if (ctx->isc_txd_credits_update(ctx->ifc_softc, txq->ift_id, 
false))
-   netmap_tx_irq(ctx->ifc_ifp, txq->ift_id);
+   netmap_tx_irq(ifp, txq->ift_id);
IFDI_TX_QUEUE_INTR_ENABLE(ctx, txq->ift_id);
return;
}
___
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: r344062 - in head/sys: compat/linuxkpi/common/src kern net sys

2019-02-12 Thread Marius Strobl
Author: marius
Date: Tue Feb 12 21:23:59 2019
New Revision: 344062
URL: https://svnweb.freebsd.org/changeset/base/344062

Log:
  Make taskqgroup_attach{,_cpu}(9) work across architectures
  
  So far, intr_{g,s}etaffinity(9) take a single int for identifying
  a device interrupt. This approach doesn't work on all architectures
  supported, as a single int isn't sufficient to globally specify a
  device interrupt. In particular, with multiple interrupt controllers
  in one system as found on e. g. arm and arm64 machines, an interrupt
  number as returned by rman_get_start(9) may be only unique relative
  to the bus and, thus, interrupt controller, a certain device hangs
  off from.
  In turn, this makes taskqgroup_attach{,_cpu}(9) and - internal to
  the gtaskqueue implementation - taskqgroup_attach_deferred{,_cpu}()
  not work across architectures. Yet in turn, iflib(4) as gtaskqueue
  consumer so far doesn't fit architectures where interrupt numbers
  aren't globally unique.
  However, at least for intr_setaffinity(..., CPU_WHICH_IRQ, ...) as
  employed by the gtaskqueue implementation to bind an interrupt to a
  particular CPU, using bus_bind_intr(9) instead is equivalent from
  a functional point of view, with bus_bind_intr(9) taking the device
  and interrupt resource arguments required for uniquely specifying a
  device interrupt.
  Thus, change the gtaskqueue implementation to employ bus_bind_intr(9)
  instead and intr_{g,s}etaffinity(9) to take the device and interrupt
  resource arguments required respectively. This change also moves
  struct grouptask from  to  and wraps
  struct gtask along with the gtask_fn_t typedef into #ifdef _KERNEL
  as userland likes to include  or indirectly drags it
  in - for better or worse also with _KERNEL defined -, which with
  device_t and struct resource dependencies otherwise is no longer
  as easily possible now.
  The userland inclusion problem probably can be improved a bit by
  introducing a _WANT_TASK (as well as a _WANT_MOUNT) akin to the
  existing _WANT_PRISON etc., which is orthogonal to this change,
  though, and likely needs an exp-run.
  
  While at it:
  - Change the gt_cpu member in the grouptask structure to be of type
int as used elswhere for specifying CPUs (an int16_t may be too
narrow sooner or later),
  - move the gtaskqueue_enqueue_fn typedef from  to
the gtaskqueue implementation as it's only used and needed there,
  - change the GTASK_INIT macro to use "gtask" rather than "task" as
argument given that it actually operates on a struct gtask rather
than a struct task, and
  - let subr_gtaskqueue.c consistently use __func__ to print functions
names.
  
  Reported by:  mmel
  Reviewed by:  mmel
  Differential Revision:https://reviews.freebsd.org/D19139

Modified:
  head/sys/compat/linuxkpi/common/src/linux_tasklet.c
  head/sys/kern/subr_epoch.c
  head/sys/kern/subr_gtaskqueue.c
  head/sys/net/iflib.c
  head/sys/sys/_task.h
  head/sys/sys/gtaskqueue.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/src/linux_tasklet.c
==
--- head/sys/compat/linuxkpi/common/src/linux_tasklet.c Tue Feb 12 21:22:57 
2019(r344061)
+++ head/sys/compat/linuxkpi/common/src/linux_tasklet.c Tue Feb 12 21:23:59 
2019(r344062)
@@ -109,7 +109,7 @@ tasklet_subsystem_init(void *arg __unused)
GROUPTASK_INIT(>gtask, 0, tasklet_handler, tw);
snprintf(buf, sizeof(buf), "softirq%d", i);
taskqgroup_attach_cpu(qgroup_softirq, >gtask,
-   "tasklet", i, -1, buf);
+   "tasklet", i, NULL, NULL, buf);
}
 }
 SYSINIT(linux_tasklet, SI_SUB_TASKQ, SI_ORDER_THIRD, tasklet_subsystem_init, 
NULL);

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Tue Feb 12 21:22:57 2019(r344061)
+++ head/sys/kern/subr_epoch.c  Tue Feb 12 21:23:59 2019(r344062)
@@ -147,7 +147,7 @@ epoch_init(void *arg __unused)
GROUPTASK_INIT(DPCPU_ID_PTR(cpu, epoch_cb_task), 0,
epoch_call_task, NULL);
taskqgroup_attach_cpu(qgroup_softirq,
-   DPCPU_ID_PTR(cpu, epoch_cb_task), NULL, cpu, -1,
+   DPCPU_ID_PTR(cpu, epoch_cb_task), NULL, cpu, NULL, NULL,
"epoch call task");
}
inited = 1;

Modified: head/sys/kern/subr_gtaskqueue.c
==
--- head/sys/kern/subr_gtaskqueue.c Tue Feb 12 21:22:57 2019
(r344061)
+++ head/sys/kern/subr_gtaskqueue.c Tue Feb 12 21:23:59 2019
(r344062)
@@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -64,6 +63,8 @@ struct gtaskqueue_busy {
 
 static struct gtask * const 

svn commit: r344061 - head/sys/netinet

2019-02-12 Thread Kristof Provost
Author: kp
Date: Tue Feb 12 21:22:57 2019
New Revision: 344061
URL: https://svnweb.freebsd.org/changeset/base/344061

Log:
  garp: Fix vnet related panic for gratuitous arp
  
  Gratuitous ARP packets are sent from a timer, which means we don't have a vnet
  context set. As a result we panic trying to send the packet.
  
  Set the vnet context based on the interface associated with the interface
  address.
  
  To reproduce:
sysctl net.link.ether.inet.garp_rexmit_count=2
ifconfig vtnet1 10.0.0.1/24 up
  
  PR:   235699
  Reviewed by:  vangyzen@
  MFC after:1 week

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Tue Feb 12 21:08:44 2019(r344060)
+++ head/sys/netinet/if_ether.c Tue Feb 12 21:22:57 2019(r344061)
@@ -1335,6 +1335,8 @@ garp_rexmit(void *arg)
return;
}
 
+   CURVNET_SET(ia->ia_ifa.ifa_ifp->if_vnet);
+
/*
 * Drop lock while the ARP request is generated.
 */
@@ -1362,6 +1364,8 @@ garp_rexmit(void *arg)
ifa_free(>ia_ifa);
}
}
+
+   CURVNET_RESTORE();
 }
 
 /*
___
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: r344060 - head/sys/net

2019-02-12 Thread Marius Strobl
Author: marius
Date: Tue Feb 12 21:08:44 2019
New Revision: 344060
URL: https://svnweb.freebsd.org/changeset/base/344060

Log:
  Further correct and optimize the bus_dma(9) usage of iflib(4):
  o Correct the obvious bugs in the netmap(4) parts:
- No longer check for the existence of DMA maps as bus_dma(9)
  is used unconditionally in iflib(4) since r341095.
- Supply the correct DMA tag and map pairs to bus_dma(9)
  functions (see also the commit message of r343753).
- In iflib_netmap_timer_adjust(), add synchronization of the
  TX descriptors before calling the ift_txd_credits_update
  method as the latter evaluates the TX descriptors possibly
  updated by the MAC.
- In _task_fn_tx(), wrap the netmap(4)-specific bits in
  #ifdef DEV_NETMAP just as done in _task_fn_admin() and
  _task_fn_rx() respectively.
  o In iflib_fast_intr_rxtx(), synchronize the TX rather than
the RX descriptors before calling the ift_txd_credits_update
method (see also above).
  o There's no need to synchronize an RX buffer that is going to
be recycled in iflib_rxd_pkt_get(), yet; it's sufficient to
do that as late as passing RX buffers to the MAC via the
ift_rxd_refill method. Hence, combine that synchronization
with the synchronization of new buffers into a common spot
in _iflib_fl_refill().
  o There's no need to synchronize the RX descriptors of a free
list in preparation of the MAC updating their statuses with
every invocation of rxd_frag_to_sd(); it's enough to do this
once before handing control over to the MAC, i. e. before
calling ift_rxd_flush method in _iflib_fl_refill(), which
already performs the necessary synchronization.
  o Given that the ift_rxd_available method evaluates the RX
descriptors which possibly have been altered by the MAC,
synchronize as appropriate beforehand. Most notably this
is now done in iflib_rxd_avail(), which in turn means that
we don't need to issue the same synchronization yet again
before calling the ift_rxd_pkt_get method in iflib_rxeof().
  o In iflib_txd_db_check(), synchronize the TX descriptors
before handing them over to the MAC for transmission via
the ift_txd_flush method.
  o In iflib_encap(), move the TX buffer synchronization after
the invocation of the ift_txd_encap() method. If the MAC
driver fails to encapsulate the packet and we retry with
a defragmented mbuf chain or finally fail, the cycles for
TX buffer synchronization have been wasted. Synchronizing
afterwards matches what non-iflib(4) drivers typically do
and is sufficient as the MAC will not actually start with
the transmission before - in this case - the ift_txd_flush
method is called.
Moreover, for the latter reason the synchronization of the
TX descriptors in iflib_encap() can go as it's enough to
synchronize them before passing control over to the MAC by
issuing the ift_txd_flush() method (see above).
  o In iflib_txq_can_drain(), only synchronize TX descriptors
if the ift_txd_credits_update method accessing these is
actually called.
  
  Differential Revision:https://reviews.freebsd.org/D19081

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cTue Feb 12 21:06:07 2019(r344059)
+++ head/sys/net/iflib.cTue Feb 12 21:08:44 2019(r344060)
@@ -845,11 +845,13 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring 
return netmap_ring_reinit(kring);
 
fl->ifl_vm_addrs[tmp_pidx] = addr;
-   if (__predict_false(init) && map) {
-   netmap_load_map(na, fl->ifl_ifdi->idi_tag, 
map[nic_i], addr);
-   } else if (map && (slot->flags & NS_BUF_CHANGED)) {
+   if (__predict_false(init)) {
+   netmap_load_map(na, fl->ifl_buf_tag,
+   map[nic_i], addr);
+   } else if (slot->flags & NS_BUF_CHANGED) {
/* buffer has changed, reload map */
-   netmap_reload_map(na, fl->ifl_ifdi->idi_tag, 
map[nic_i], addr);
+   netmap_reload_map(na, fl->ifl_buf_tag,
+   map[nic_i], addr);
}
slot->flags &= ~NS_BUF_CHANGED;
 
@@ -861,13 +863,9 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring 
iru.iru_pidx = refill_pidx;
iru.iru_count = tmp_pidx+1;
ctx->isc_rxd_refill(ctx->ifc_softc, );
-
refill_pidx = nic_i;
-   if (map == NULL)
-   continue;
-
for (int n = 0; n < 

svn commit: r344059 - head/share/man/man4

2019-02-12 Thread Poul-Henning Kamp
Author: phk
Date: Tue Feb 12 21:06:07 2019
New Revision: 344059
URL: https://svnweb.freebsd.org/changeset/base/344059

Log:
  Point people to SMP(4) for CPU<->domain mapping.

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

Modified: head/share/man/man4/numa.4
==
--- head/share/man/man4/numa.4  Tue Feb 12 20:12:41 2019(r344058)
+++ head/share/man/man4/numa.4  Tue Feb 12 21:06:07 2019(r344059)
@@ -77,6 +77,9 @@ The
 .Xr cpuset 1
 tool is available for starting processes with a non-default
 policy, or to change the policy of an existing thread or process.
+See
+.Xr SMP 4
+for information about CPU to domain mapping.
 .Pp
 Systems with non-uniform access to I/O devices may mark those devices
 with the local VM domain identifier.
@@ -117,6 +120,7 @@ Policy information is available in both struct thread 
 .Xr cpuset 1 ,
 .Xr cpuset_getaffinity 2 ,
 .Xr cpuset_setaffinity 2 ,
+.Xr SMP 4 ,
 .Xr bus_get_domain 9
 .Sh HISTORY
 .Nm
___
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: r344057 - head/usr.sbin/bhyve

2019-02-12 Thread Warner Losh
Author: imp
Date: Tue Feb 12 19:05:09 2019
New Revision: 344057
URL: https://svnweb.freebsd.org/changeset/base/344057

Log:
  Revert r343077 until the license issues surrounding it can be resolved.
  
  Approved by:  core@

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

Modified: head/usr.sbin/bhyve/uart_emul.c
==
--- head/usr.sbin/bhyve/uart_emul.c Tue Feb 12 18:32:14 2019
(r344056)
+++ head/usr.sbin/bhyve/uart_emul.c Tue Feb 12 19:05:09 2019
(r344057)
@@ -431,13 +431,6 @@ uart_write(struct uart_softc *sc, int offset, uint8_t 
sc->thre_int_pending = true;
break;
case REG_IER:
-   /* Assert an interrupt if re-enabling the THRE intr, since we
-* always report THRE as active in the status register.
-*/
-   if ((sc->ier & IER_ETXRDY) == 0 &&
-   (value & IER_ETXRDY) != 0) {
-   sc->thre_int_pending = true;
-   }
/*
 * Apply mask so that bits 4-7 are 0
 * Also enables bits 0-3 only if they're 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: r344056 - in head/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/AArch64 lib/Target/ARM

2019-02-12 Thread Dimitry Andric
Author: dim
Date: Tue Feb 12 18:32:14 2019
New Revision: 344056
URL: https://svnweb.freebsd.org/changeset/base/344056

Log:
  Pull in r339734 from upstream llvm trunk (by Eli Friedman):
  
[ARM] Make PerformSHLSimplify add nodes to the DAG worklist correctly.
  
Intentionally excluding nodes from the DAGCombine worklist is likely
to lead to weird optimizations and infinite loops, so it's generally
a bad idea.
  
To avoid the infinite loops, fix DAGCombine to use the
isDesirableToCommuteWithShift target hook before performing the
transforms in question, and implement the target hook in the ARM
backend disable the transforms in question.
  
Fixes https://bugs.llvm.org/show_bug.cgi?id=38530 . (I don't have a
reduced testcase for that bug. But we should have sufficient test
coverage for PerformSHLSimplify given that we're not playing weird
tricks with the worklist. I can try to bugpoint it if necessary,
though.)
  
Differential Revision: https://reviews.llvm.org/D50667
  
  This should fix a possible hang when compiling sys/dev/nxge/if_nxge.c
  (which exists now only in the stable/11 branch) for arm.

Modified:
  head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h
  head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.h
  head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
  head/contrib/llvm/lib/Target/ARM/ARMISelLowering.h

Modified: head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h
==
--- head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h Tue Feb 12 
17:07:15 2019(r344055)
+++ head/contrib/llvm/include/llvm/CodeGen/TargetLowering.h Tue Feb 12 
18:32:14 2019(r344056)
@@ -2935,12 +2935,16 @@ class TargetLowering : public TargetLoweringBase { (pu
   ///
   virtual SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo ) const;
 
-  /// Return true if it is profitable to move a following shift through this
-  //  node, adjusting any immediate operands as necessary to preserve 
semantics.
-  //  This transformation may not be desirable if it disrupts a particularly
-  //  auspicious target-specific tree (e.g. bitfield extraction in AArch64).
-  //  By default, it returns true.
-  virtual bool isDesirableToCommuteWithShift(const SDNode *N) const {
+  /// Return true if it is profitable to move this shift by a constant amount
+  /// though its operand, adjusting any immediate operands as necessary to
+  /// preserve semantics. This transformation may not be desirable if it
+  /// disrupts a particularly auspicious target-specific tree (e.g. bitfield
+  /// extraction in AArch64). By default, it returns true.
+  ///
+  /// @param N the shift node
+  /// @param Level the current DAGCombine legalization level.
+  virtual bool isDesirableToCommuteWithShift(const SDNode *N,
+ CombineLevel Level) const {
 return true;
   }
 

Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==
--- head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp  Tue Feb 12 
17:07:15 2019(r344055)
+++ head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp  Tue Feb 12 
18:32:14 2019(r344056)
@@ -6191,7 +6191,7 @@ SDValue DAGCombiner::visitShiftByConstant(SDNode *N, C
   return SDValue();
   }
 
-  if (!TLI.isDesirableToCommuteWithShift(LHS))
+  if (!TLI.isDesirableToCommuteWithShift(N, Level))
 return SDValue();
 
   // Fold the constants, shifting the binop RHS by the shift amount.
@@ -6495,7 +6495,8 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
   if ((N0.getOpcode() == ISD::ADD || N0.getOpcode() == ISD::OR) &&
   N0.getNode()->hasOneUse() &&
   isConstantOrConstantVector(N1, /* No Opaques */ true) &&
-  isConstantOrConstantVector(N0.getOperand(1), /* No Opaques */ true)) {
+  isConstantOrConstantVector(N0.getOperand(1), /* No Opaques */ true) &&
+  TLI.isDesirableToCommuteWithShift(N, Level)) {
 SDValue Shl0 = DAG.getNode(ISD::SHL, SDLoc(N0), VT, N0.getOperand(0), N1);
 SDValue Shl1 = DAG.getNode(ISD::SHL, SDLoc(N1), VT, N0.getOperand(1), N1);
 AddToWorklist(Shl0.getNode());

Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
==
--- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cppTue Feb 
12 17:07:15 2019(r344055)
+++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cppTue Feb 
12 18:32:14 2019(r344056)
@@ -8496,7 +8496,9 @@ AArch64TargetLowering::getScratchRegisters(CallingConv
 }
 
 bool
-AArch64TargetLowering::isDesirableToCommuteWithShift(const SDNode *N) const {

svn commit: r344050 - head/share/man/man7

2019-02-12 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Feb 12 13:01:55 2019
New Revision: 344050
URL: https://svnweb.freebsd.org/changeset/base/344050

Log:
  Fix markup - use .Pa for the directory component, not .Fa.
  
  Reported by:  0mp
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Tue Feb 12 11:29:03 2019(r344049)
+++ head/share/man/man7/ports.7 Tue Feb 12 13:01:55 2019(r344050)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 11, 2019
+.Dd February 12, 2019
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -79,7 +79,7 @@ or from Subversion repository at:
 The
 .Em quarterly
 branches can be found in Subversion in the
-.Fa branches/
+.Pa branches/
 subdirectory, eg:
 .Pp
 .Lk https://svn.FreeBSD.org/ports/branches/2019Q1
___
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: r344049 - head/sys/powerpc/aim

2019-02-12 Thread Leandro Lupori
Author: luporl
Date: Tue Feb 12 11:29:03 2019
New Revision: 344049
URL: https://svnweb.freebsd.org/changeset/base/344049

Log:
  [ppc64] prevent infinite loop on icache sync
  
  At moea64_sync_icache(), when the 'va' argument has page size
  alignment, round_page() will return the same value as 'va'.
  This would cause 'len' to be 0 and thus an infinite loop.
  
  With this change, 'lim' will always point to the next page boundary.
  
  This issue occurred especially during debugging sessions, when a breakpoint
  was placed on an exact page-aligned offset, for instance.
  
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D19149

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cTue Feb 12 10:17:21 2019
(r344048)
+++ head/sys/powerpc/aim/mmu_oea64.cTue Feb 12 11:29:03 2019
(r344049)
@@ -2807,7 +2807,7 @@ moea64_sync_icache(mmu_t mmu, pmap_t pm, vm_offset_t v
 
PMAP_LOCK(pm);
while (sz > 0) {
-   lim = round_page(va);
+   lim = round_page(va+1);
len = MIN(lim - va, sz);
pvo = moea64_pvo_find_va(pm, va & ~ADDR_POFF);
if (pvo != NULL && !(pvo->pvo_pte.pa & LPTE_I)) {
___
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: r344048 - head/sys/netinet

2019-02-12 Thread Michael Tuexen
Author: tuexen
Date: Tue Feb 12 10:17:21 2019
New Revision: 344048
URL: https://svnweb.freebsd.org/changeset/base/344048

Log:
  Improve input validation for raw IPv4 socket using the IP_HDRINCL
  option.
  
  This issue was found by running syzkaller on OpenBSD.
  Greg Steuck made me aware that the problem might also exist on FreeBSD.
  
  Reported by:  Greg Steuck
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D18834

Modified:
  head/sys/netinet/raw_ip.c

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Tue Feb 12 09:26:05 2019(r344047)
+++ head/sys/netinet/raw_ip.c   Tue Feb 12 10:17:21 2019(r344048)
@@ -454,6 +454,8 @@ rip_output(struct mbuf *m, struct socket *so, ...)
u_long dst;
int flags = ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0) |
IP_ALLOWBROADCAST;
+   int cnt;
+   u_char opttype, optlen, *cp;
 
va_start(ap, so);
dst = va_arg(ap, u_long);
@@ -527,6 +529,34 @@ rip_output(struct mbuf *m, struct socket *so, ...)
INP_RUNLOCK(inp);
m_freem(m);
return (EINVAL);
+   }
+   /*
+* Don't allow IP options which do not have the required
+* structure as specified in section 3.1 of RFC 791 on
+* pages 15-23.
+*/
+   cp = (u_char *)(ip + 1);
+   cnt = (ip->ip_hl << 2) - sizeof (struct ip);
+   for (; cnt > 0; cnt -= optlen, cp += optlen) {
+   opttype = cp[IPOPT_OPTVAL];
+   if (opttype == IPOPT_EOL)
+   break;
+   if (opttype == IPOPT_NOP) {
+   optlen = 1;
+   continue;
+   }
+   if (cnt < IPOPT_OLEN + sizeof(u_char)) {
+   INP_RUNLOCK(inp);
+   m_freem(m);
+   return (EINVAL);
+   }
+   optlen = cp[IPOPT_OLEN];
+   if (optlen < IPOPT_OLEN + sizeof(u_char) ||
+   optlen > cnt) {
+   INP_RUNLOCK(inp);
+   m_freem(m);
+   return (EINVAL);
+   }
}
/*
 * This doesn't allow application to specify ID of zero,
___
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: r344045 - head/sys/contrib/dev/iwm

2019-02-12 Thread Li-Wen Hsu
Author: lwhsu
Date: Tue Feb 12 08:16:05 2019
New Revision: 344045
URL: https://svnweb.freebsd.org/changeset/base/344045

Log:
  Remove empty files
  
  Approved by:  markj (mentor)
  Sponsored by: The FreeBSD Foundation

Deleted:
  head/sys/contrib/dev/iwm/iwm-3160-9.fw.uu
  head/sys/contrib/dev/iwm/iwm-7260-9.fw.uu
  head/sys/contrib/dev/iwm/iwm-7265-9.fw.uu
___
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"