svn commit: r357568 - stable/12/sbin/fsck_msdosfs

2020-02-05 Thread Xin LI
Author: delphij
Date: Wed Feb  5 08:55:19 2020
New Revision: 357568
URL: https://svnweb.freebsd.org/changeset/base/357568

Log:
  MFC r356249-r356250, r356313, r356434, r356657, r357421
  
  r356249-r356250, r356313:
  Reduce memory footprint of fsck_msdosfs.
  
  This utility was initially written for FAT12/16, which were inherently
  small. When FAT32 support was added, the old data structure and
  algorithms remain used with minimal changes.
  
  With growing size of FAT32 media, the current data structure that
  requires 4 32-bit variables per each FAT32 table entry would consume up
  to 4 GiB of RAM, which can be too big for systems with limited RAM
  available.
  
  Address this by taking a different approach of validating the FAT.
  
  The FAT is essentially a set of linked lists of chains that was
  referenced by directory entries, and the checker needs to make sure that
  the linked chains of clusters do not have cross-linked chains, and every
  chain were referenced by one and only one directory entry.  Instead of
  keeping track of the chain's 'head' cluster number, the size of the
  chain, the used status of the chain and the "next" pointer which is
  content of the FAT table, we create accessors for the FAT table data
  for the "next" pointer, and keep only one bit to indicate if the
  current cluster is a 'head' node of a cluster chain, in a bitmap.
  
  We further overhaul the FAT checker to find out the possible head nodes
  by excluding ones that are not (in other words, nodes that have some
  other nodes claiming them as the next node) instead of marking the head
  nodes for each node on the chain.  This approach greatly reduced the
  complexiety of computation from O(N^2) worst case, to an O(N) scan for
  worst case.  The file (cluster chain) length is not useful for the FAT
  checker, so don't bother to calculate them in the FAT checker and
  instead leave the task to the directory structure check, at which point
  we would have non-crossed cluster chains, and we are guaranteed that
  each cluster will be visited for at most one time.
  
  When checking the directory structures, we use the head node indicator
  to as the visited (used) flag: every cluster chain can only be
  referenced by one directory entry, so we clear them when calculating
  the length of the chain, and we can immediately tell if there are
  anomalies in the directory entry.
  
  As a result, the required RAM size is now 1 bit per each entry of
  the FAT table, plus memory needed to hold the FAT table in memory,
  instead of 16 bytes (=128 bits) per each entry.  For FAT12 and FAT16,
  we will load the whole FAT table into memory as they are smaller than
  128KiB, and for FAT32, we first attempt to mmap() it into memory, and
  when that fails, we would fall back to a simple LRU cache of 4 MiB of
  RAM.
  
  sbin/fsck_msdosfs/boot.c:
  
   - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster
 number.
   - FAT32: check if root directory starts with a valid cluster number,
 moved from dir.c.  There is no point to proceed if the filesystem
 is already damaged beyond repair.
  
  sbin/fsck_msdosfs/check.c:
  
   - Combine phase 1 and phase 2, now that the readfat() is able to
 detect cross chains.
  
  sbin/fsck_msdosfs/dir.c:
  
   - Refactor code to use FAT accessor instead of accessing the internal
 representation of FAT table.
   - Make use of the cluster chain head bitmap.
   - Clarify and simplify directory entry check, remove unnecessary
 checks that are would be done at a later time (for example, whether
 the directory's second cluster is a valid one, which is examined
 more throughly in a later checkchain() and does not prevent us
 from proceeding further).
  
  sbin/fsck_msdosfs/dosfs.h:
  
   - Remove internal representation of FAT table, which is replaced by
 the head bitmap that is opaque to other code.
   - Added a special CLUST_DEAD cluster type to indicate errors.
  
  sbin/fsck_msdosfs/ext.h:
  
   - Added a flag that overrides mmap(2) setting.  The corresponding
 command line option, -M is intentionally undocumented as we do not
 expect users to need it.
   - Added accessors for FAT table and convert existing interface to use
 it.
  
  sbin/fsck_msdosfs/fat.c:
  
   - Added head bitmap to represent whether a cluster is a head cluster.
   - Converted FAT internal representation to accessors.
   - Implemented a LRU cache for FAT32 when mmap(2) should not or can not
 be used.
   - _readfat: Attempt a mmap(2) and fall back to regular read for
 non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate
 the cache with the first 4MiB of the entries.
   - readfat: Added support of head bitmap and use the population scan to
 detect bogus chains.
   - clusterdiff: removed, FATs are copied from the checked copy via
 writefat()/copyfat().
   - checkchain: calculates the length of a cluster chain and make sure
 that i

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-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: 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-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: 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,
+   &kern_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-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: 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, &child_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, &child_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-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: 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, &sb)) {
-   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-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: 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-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: 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-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: 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(&ss, ra, rlen);
raddr = (struct sockaddr *)&ss;
 
___
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: 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, &objp->prog)) {
+   if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
-   }
-   if (!xdr_rpcvers(xdrs, &objp->vers)) {
+   }
+   if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
-   }
-   if (!xdr_int(xdrs, &objp->success)) {
+   }
+   if (!xdr_int(xdrs, &objp->success)) {
return (FALSE);
-   }
-   if (!xdr_int(xdrs, &objp->failure)) {
+   }
+   if (!xdr_int(xdrs, &objp->failure)) {
return (FALSE);
-   }
-   if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
+   }
+   if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
-   }
+   }
 
-   pnext = &objp->next;
-
-   if (!xdr_pointer(xdrs, (char **) pnext,
+   pnext = &objp->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 = &objp->next;
if (xdrs->x_op == XDR_ENCODE) {
-   buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
-   if (buf == NULL) {
-   if (!xdr_rpcprog(xdrs, &objp->prog)) {
-   return (FALSE);
+   buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
+   if (buf == NULL) {
+   if (!xdr_rpcprog(xdrs, &objp->prog)) {
+   return (FALSE);
+   }
+   if (!xdr_rpcvers(xdrs, &objp->vers)) {
+   return (FALSE);
+   }
+   if (!xdr_rpcproc(xdrs, &objp->proc)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, &objp->success)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, &objp->failure)) {
+   return (FALSE);
+   }
+   if (!xdr_int(xdrs, &objp->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, &objp->vers)) {
+   if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) {
return (FALSE);
}
-   if (!xdr_rpcproc(xdrs, &objp->proc)) {
+   if (!xdr_pointer(xdrs, (char **) pnext,
+   sizeof (rpcbs_rmtcalllist),
+   (xdrproc_t)xdr_rpcbs_rmtcalllist)) {
return (FALSE);
}
-   if (!xdr_int(xdrs, &objp->success)) {
-   return (FALSE);
-   }
-   if (!xdr_int(xdrs, &objp->failure)) {
-   return (FALSE);
-   }
-   if (!xdr_int(xdrs, &objp->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-

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: 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 = linux_sen

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-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: 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-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: 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-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: 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-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: r357581 - in stable/12/contrib/blacklist: bin diff lib

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

Log:
  MFC r354399: blacklist: update to NetBSD snapshot on 20191106
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/contrib/blacklist/bin/blacklistctl.c
  stable/12/contrib/blacklist/bin/blacklistd.c
  stable/12/contrib/blacklist/bin/blacklistd.conf.5
  stable/12/contrib/blacklist/bin/support.c
  stable/12/contrib/blacklist/diff/ssh.diff
  stable/12/contrib/blacklist/lib/Makefile
  stable/12/contrib/blacklist/lib/libblacklist.3
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/blacklist/bin/blacklistctl.c
==
--- stable/12/contrib/blacklist/bin/blacklistctl.c  Wed Feb  5 17:21:36 
2020(r357580)
+++ stable/12/contrib/blacklist/bin/blacklistctl.c  Wed Feb  5 18:24:28 
2020(r357581)
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $
*/
+/* $NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $   
*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $");
+__RCSID("$NetBSD: blacklistctl.c,v 1.23 2018/05/24 19:21:01 christos Exp $");
 
 #include 
 #include 
@@ -67,6 +67,15 @@ usage(int c)
exit(EXIT_FAILURE);
 }
 
+static const char *
+star(char *buf, size_t len, int val)
+{
+   if (val == -1)
+   return "*";
+   snprintf(buf, len, "%d", val);
+   return buf;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -128,9 +137,10 @@ main(int argc, char *argv[])
"address", remain ? "remaining time" : "last access");
for (i = 1; state_iterate(db, &c, &dbi, i) != 0; i = 0) {
char buf[BUFSIZ];
+   char mbuf[64], pbuf[64];
if (!all) {
if (blocked) {
-   if (dbi.count < c.c_nfail)
+   if (c.c_nfail == -1 || dbi.count < c.c_nfail)
continue;
} else {
if (dbi.count >= c.c_nfail)
@@ -138,13 +148,20 @@ main(int argc, char *argv[])
}
}
sockaddr_snprintf(buf, sizeof(buf), "%a", (void *)&c.c_ss);
-   printf("%*.*s/%d:%d\t", wide, wide, buf, c.c_lmask, c.c_port);
-   if (remain)
-   fmtydhms(buf, sizeof(buf),
-   c.c_duration - (ts.tv_sec - dbi.last));
-   else
-   fmttime(buf, sizeof(buf), dbi.last);
-   printf("%s\t%d/%d\t%-s\n", dbi.id, dbi.count, c.c_nfail, buf);
+   printf("%*.*s/%s:%s\t", wide, wide, buf,
+   star(mbuf, sizeof(mbuf), c.c_lmask),
+   star(pbuf, sizeof(pbuf), c.c_port));
+   if (c.c_duration == -1) {
+   strlcpy(buf, "never", sizeof(buf));
+   } else {
+   if (remain)
+   fmtydhms(buf, sizeof(buf),
+   c.c_duration - (ts.tv_sec - dbi.last));
+   else
+   fmttime(buf, sizeof(buf), dbi.last);
+   }
+   printf("%s\t%d/%s\t%-s\n", dbi.id, dbi.count,
+   star(mbuf, sizeof(mbuf), c.c_nfail), buf);
}
state_close(db);
return EXIT_SUCCESS;

Modified: stable/12/contrib/blacklist/bin/blacklistd.c
==
--- stable/12/contrib/blacklist/bin/blacklistd.cWed Feb  5 17:21:36 
2020(r357580)
+++ stable/12/contrib/blacklist/bin/blacklistd.cWed Feb  5 18:24:28 
2020(r357581)
@@ -1,4 +1,4 @@
-/* $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $ */
+/* $NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "config.h"
 #endif
 #include 
-__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $");
+__RCSID("$NetBSD: blacklistd.c,v 1.38 2019/02/27 02:20:18 christos Exp $");
 
 #include 
 #include 
@@ -408,7 +408,6 @@ rules_restore(void)
for (f = 1; state_iterate(state, &c, &dbi, f) == 1; f = 0) {
if (dbi.id[0] == '\0')
continue;
-   (void)run_change("rem", &c, dbi.id, 0);
(void)run_change("add", &c, dbi.id, sizeof(dbi.id));
}
 }
@@ -505,7 +504,8 @@ main(int argc, char *argv[])
conf_parse(configfile);
if (flush) {
rules_flush();
-   flags |= O_TRUNC;
+   if (!restore)
+   flags |= O_TRUNC;

svn commit: r357582 - stable/10/lib/libfetch

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

Log:
  MFC r357212: libfetch: fix urldecode buffer overrun
  
  Reported by:  Duncan Overbruck
  Security: CVE-2020-7450

Modified:
  stable/10/lib/libfetch/fetch.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/fetch.c
==
--- stable/10/lib/libfetch/fetch.c  Wed Feb  5 18:24:28 2020
(r357581)
+++ stable/10/lib/libfetch/fetch.c  Wed Feb  5 18:26:50 2020
(r357582)
@@ -328,6 +328,8 @@ fetch_pctdecode(char *dst, const char *src, size_t dle
}
if (dlen-- > 0)
*dst++ = c;
+   else
+   return (NULL);
}
return (s);
 }
@@ -375,11 +377,15 @@ fetchParseURL(const char *URL)
if (p && *p == '@') {
/* username */
q = fetch_pctdecode(u->user, URL, URL_USERLEN);
+   if (q == NULL)
+   goto ouch;
 
/* password */
-   if (*q == ':')
+   if (*q == ':') {
q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN);
-
+   if (q == NULL)
+   goto ouch;
+   }
p++;
} else {
p = URL;
___
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: r357583 - vendor/NetBSD/tests/dist/lib/libc/c063

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

Log:
  netbsd-tests: import recently upstreamed O_SEARCH test fixes

Modified:
  vendor/NetBSD/tests/dist/lib/libc/c063/t_o_search.c

Modified: vendor/NetBSD/tests/dist/lib/libc/c063/t_o_search.c
==
--- vendor/NetBSD/tests/dist/lib/libc/c063/t_o_search.c Wed Feb  5 18:26:50 
2020(r357582)
+++ vendor/NetBSD/tests/dist/lib/libc/c063/t_o_search.c Wed Feb  5 18:35:18 
2020(r357583)
@@ -1,4 +1,4 @@
-/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
+/* $NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.8 2020/02/05 17:13:24 martin Exp $");
 
 #include 
 
@@ -79,7 +79,7 @@ ATF_TC_BODY(o_search_perm1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == EACCES);
@@ -109,12 +109,12 @@ ATF_TC_BODY(o_search_root_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 444) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -141,12 +141,12 @@ ATF_TC_BODY(o_search_unpriv_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 444) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
 
@@ -173,7 +173,7 @@ ATF_TC_BODY(o_search_perm2, tc)
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == -1);
ATF_REQUIRE(errno == EACCES);
@@ -202,11 +202,11 @@ ATF_TC_BODY(o_search_root_flag2, tc)
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 444) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
@@ -232,11 +232,11 @@ ATF_TC_BODY(o_search_unpriv_flag2, tc)
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 644) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0644) == 0);
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
-   ATF_REQUIRE(fchmod(dfd, 444) == 0);
+   ATF_REQUIRE(fchmod(dfd, 0444) == 0);
 
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
 
@@ -257,9 +257,10 @@ ATF_TC_BODY(o_search_notdir, tc)
int fd;
 
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-   ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_RDWR|O_SEARCH, 0644)) != -1);
+   ATF_REQUIRE((dfd = open(FILE, O_CREAT|O_SEARCH, 0644)) != -1);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == ENOTDIR);
+   ATF_REQUIRE(close(dfd) == 0);
 }
 
 ATF_TP_ADD_TCS(tp)
___
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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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, &fsym, (emachine1 == EM_PPC64),
+   shdr_rel.sh_info, &fsym, 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, &fsym,
-   (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, &fsym,
-   (emachine1 == EM_PPC64), elf) == 0) {
+   uses_funcdesc, elf) == 0) {
u_int bind;
 
bind = GELF_ST_BIND(fsym.st_info) == STB_WEAK ?
___
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: 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-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: 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-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: 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-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: 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" : "=&r" (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" : "=&r" (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-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: 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-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: 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", &vtpci_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, &bs_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 = &vq_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, &vq);
@@ -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: r357597 - in stable: 11/usr.sbin/wpa/wpa_supplicant 12/usr.sbin/wpa/wpa_supplicant

2020-02-05 Thread Cy Schubert
Author: cy
Date: Wed Feb  5 20:55:59 2020
New Revision: 357597
URL: https://svnweb.freebsd.org/changeset/base/357597

Log:
  MFC r356949:
  
  Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
  
  The build failure was discoved by Michael Dexter's recent Build Options
  Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
  WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.
  
  Reported by:  Michael Dexter  via emaste

Modified:
  stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
==
--- stable/12/usr.sbin/wpa/wpa_supplicant/Makefile  Wed Feb  5 20:39:18 
2020(r357596)
+++ stable/12/usr.sbin/wpa/wpa_supplicant/Makefile  Wed Feb  5 20:55:59 
2020(r357597)
@@ -15,19 +15,15 @@ SRCS=   base64.c bitfield.c blacklist.c bss.c cli.c comm
ctrl_iface.c ctrl_iface_common.c ctrl_iface_unix.c \
dh_groups.c driver_bsd.c driver_common.c \
driver_ndis.c driver_wired.c driver_wired_common.c drivers.c \
-   eap_register.c eap_wsc.c eap_wsc_common.c eloop.c \
-   events.c gas.c gas_query.c hs20_supplicant.c \
+   eap_register.c eloop.c \
+   events.c gas.c gas_query.c \
http_client.c http_server.c \
httpread.c hw_features_common.c \
-   ieee802_11_common.c interworking.c l2_packet_freebsd.c main.c \
+   ieee802_11_common.c l2_packet_freebsd.c main.c \
notify.c offchannel.c op_classes.c os_unix.c pmksa_cache.c preauth.c \
-   rrm.c scan.c upnp_xml.c uuid.c \
+   rrm.c scan.c upnp_xml.c \
wmm_ac.c wpa.c wpa_common.c wpa_ctrl.c \
wpa_debug.c wpa_ft.c wpa_ie.c wpa_supplicant.c wpabuf.c wpas_glue.c \
-   wps.c wps_attr_build.c wps_attr_parse.c wps_attr_process.c \
-   wps_common.c wps_dev_attr.c wps_enrollee.c wps_registrar.c \
-   wps_supplicant.c wps_upnp.c wps_upnp_ap.c wps_upnp_event.c \
-   wps_upnp_ssdp.c wps_upnp_web.c \
Packet32.c
 
 MAN=   wpa_supplicant.8 wpa_supplicant.conf.5
@@ -44,15 +40,12 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \
-DCONFIG_DRIVER_NDIS \
-DCONFIG_DRIVER_WIRED \
-DCONFIG_GAS \
-   -DCONFIG_HS20 \
-DCONFIG_IEEE80211R \
-   -DCONFIG_INTERWORKING \
-DCONFIG_PEERKEY \
-DCONFIG_PRIVSEP \
-DCONFIG_SMARTCARD \
-DCONFIG_TERMINATE_ONLASTIF \
-DCONFIG_TLS=openssl \
-   -DCONFIG_WPS \
-DCONFIG_WPS2 \
-DCONFIG_WPS_UPNP \
-DPKCS12_FUNCS
@@ -66,7 +59,10 @@ LDADD+=${WPA_SUPPLICANT_LDADD}
 #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
 
 .if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
-CFLAGS+=-DEAP_GTC \
+CFLAGS+=-DCONFIG_WPS \
+   -DCONFIG_HS20 \
+   -DCONFIG_INTERWORKING \
+   -DEAP_GTC \
-DEAP_LEAP \
-DEAP_MD5 \
-DEAP_MSCHAPv2 \
@@ -75,6 +71,7 @@ CFLAGS+=-DEAP_GTC \
-DEAP_PSK \
-DEAP_TLS \
-DEAP_TTLS \
+   -DEAP_WSC \
-DIEEE8021X_EAPOL
 SRCS+= chap.c \
eap.c \
@@ -92,14 +89,23 @@ SRCS+=  chap.c \
eap_tls.c \
eap_tls_common.c \
eap_ttls.c \
+   eap_wsc.c \
eapol_supp_sm.c \
+   eap_wsc_common.c \
+   hs20_supplicant.c \
+   interworking.c \
ms_funcs.c \
-   mschapv2.c
-TLS_FUNCS=y
+   mschapv2.c \
+   uuid.c \
+   wps.c wps_attr_build.c wps_attr_parse.c wps_attr_process.c \
+   wps_common.c wps_dev_attr.c wps_enrollee.c wps_registrar.c \
+   wps_supplicant.c wps_upnp.c wps_upnp_ap.c wps_upnp_event.c \
+   wps_upnp_ssdp.c wps_upnp_web.c
 NEED_AES_EAX=y
 NEED_AES_ENCBLOCK=y
 NEED_AES_OMAC1=y
 .endif
+TLS_FUNCS=y
 
 .if !empty(CFLAGS:M*-DEAP_AKA)
 SRCS+= eap_aka.c
___
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: r357597 - in stable: 11/usr.sbin/wpa/wpa_supplicant 12/usr.sbin/wpa/wpa_supplicant

2020-02-05 Thread Cy Schubert
Author: cy
Date: Wed Feb  5 20:55:59 2020
New Revision: 357597
URL: https://svnweb.freebsd.org/changeset/base/357597

Log:
  MFC r356949:
  
  Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
  
  The build failure was discoved by Michael Dexter's recent Build Options
  Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
  WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.
  
  Reported by:  Michael Dexter  via emaste

Modified:
  stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/wpa/wpa_supplicant/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/wpa/wpa_supplicant/Makefile
==
--- stable/11/usr.sbin/wpa/wpa_supplicant/Makefile  Wed Feb  5 20:39:18 
2020(r357596)
+++ stable/11/usr.sbin/wpa/wpa_supplicant/Makefile  Wed Feb  5 20:55:59 
2020(r357597)
@@ -15,19 +15,15 @@ SRCS=   base64.c bitfield.c blacklist.c bss.c cli.c comm
ctrl_iface.c ctrl_iface_common.c ctrl_iface_unix.c \
dh_groups.c driver_bsd.c driver_common.c \
driver_ndis.c driver_wired.c driver_wired_common.c drivers.c \
-   eap_register.c eap_wsc.c eap_wsc_common.c eloop.c \
-   events.c gas.c gas_query.c hs20_supplicant.c \
+   eap_register.c eloop.c \
+   events.c gas.c gas_query.c \
http_client.c http_server.c \
httpread.c hw_features_common.c \
-   ieee802_11_common.c interworking.c l2_packet_freebsd.c main.c \
+   ieee802_11_common.c l2_packet_freebsd.c main.c \
notify.c offchannel.c op_classes.c os_unix.c pmksa_cache.c preauth.c \
-   rrm.c scan.c upnp_xml.c uuid.c \
+   rrm.c scan.c upnp_xml.c \
wmm_ac.c wpa.c wpa_common.c wpa_ctrl.c \
wpa_debug.c wpa_ft.c wpa_ie.c wpa_supplicant.c wpabuf.c wpas_glue.c \
-   wps.c wps_attr_build.c wps_attr_parse.c wps_attr_process.c \
-   wps_common.c wps_dev_attr.c wps_enrollee.c wps_registrar.c \
-   wps_supplicant.c wps_upnp.c wps_upnp_ap.c wps_upnp_event.c \
-   wps_upnp_ssdp.c wps_upnp_web.c \
Packet32.c
 
 MAN=   wpa_supplicant.8 wpa_supplicant.conf.5
@@ -44,15 +40,12 @@ CFLAGS+=-DCONFIG_BACKEND_FILE \
-DCONFIG_DRIVER_NDIS \
-DCONFIG_DRIVER_WIRED \
-DCONFIG_GAS \
-   -DCONFIG_HS20 \
-DCONFIG_IEEE80211R \
-   -DCONFIG_INTERWORKING \
-DCONFIG_PEERKEY \
-DCONFIG_PRIVSEP \
-DCONFIG_SMARTCARD \
-DCONFIG_TERMINATE_ONLASTIF \
-DCONFIG_TLS=openssl \
-   -DCONFIG_WPS \
-DCONFIG_WPS2 \
-DCONFIG_WPS_UPNP \
-DPKCS12_FUNCS
@@ -66,7 +59,10 @@ LDADD+=${WPA_SUPPLICANT_LDADD}
 #LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
 
 .if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
-CFLAGS+=-DEAP_GTC \
+CFLAGS+=-DCONFIG_WPS \
+   -DCONFIG_HS20 \
+   -DCONFIG_INTERWORKING \
+   -DEAP_GTC \
-DEAP_LEAP \
-DEAP_MD5 \
-DEAP_MSCHAPv2 \
@@ -75,6 +71,7 @@ CFLAGS+=-DEAP_GTC \
-DEAP_PSK \
-DEAP_TLS \
-DEAP_TTLS \
+   -DEAP_WSC \
-DIEEE8021X_EAPOL
 SRCS+= chap.c \
eap.c \
@@ -92,14 +89,23 @@ SRCS+=  chap.c \
eap_tls.c \
eap_tls_common.c \
eap_ttls.c \
+   eap_wsc.c \
eapol_supp_sm.c \
+   eap_wsc_common.c \
+   hs20_supplicant.c \
+   interworking.c \
ms_funcs.c \
-   mschapv2.c
-TLS_FUNCS=y
+   mschapv2.c \
+   uuid.c \
+   wps.c wps_attr_build.c wps_attr_parse.c wps_attr_process.c \
+   wps_common.c wps_dev_attr.c wps_enrollee.c wps_registrar.c \
+   wps_supplicant.c wps_upnp.c wps_upnp_ap.c wps_upnp_event.c \
+   wps_upnp_ssdp.c wps_upnp_web.c
 NEED_AES_EAX=y
 NEED_AES_ENCBLOCK=y
 NEED_AES_OMAC1=y
 .endif
+TLS_FUNCS=y
 
 .if !empty(CFLAGS:M*-DEAP_AKA)
 SRCS+= eap_aka.c
___
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: 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-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: r357599 - stable/12/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:05:52 2020
New Revision: 357599
URL: https://svnweb.freebsd.org/changeset/base/357599

Log:
  MFCr356925:
Those files are already removed in ObsoleteFiles.
There is no need to remove them twice.
  
PR:   242971

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

Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 20:57:45 
2020(r357598)
+++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:05:52 
2020(r357599)
@@ -1129,43 +1129,7 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
-OLD_FILES+=etc/casper/system.dns
-OLD_FILES+=etc/casper/system.grp
-OLD_FILES+=etc/casper/system.pwd
-OLD_FILES+=etc/casper/system.random
-OLD_FILES+=etc/casper/system.sysctl
-OLD_FILES+=etc/rc.d/casperd
-OLD_LIBS+=lib/libcapsicum.so.0
-OLD_LIBS+=lib/libcasper.so.0
-OLD_FILES+=libexec/casper/dns
-OLD_FILES+=libexec/casper/grp
-OLD_FILES+=libexec/casper/pwd
-OLD_FILES+=libexec/casper/random
-OLD_FILES+=libexec/casper/sysctl
-OLD_FILES+=sbin/casper
-OLD_FILES+=sbin/casperd
-OLD_FILES+=usr/include/libcapsicum.h
-OLD_FILES+=usr/include/libcapsicum_dns.h
-OLD_FILES+=usr/include/libcapsicum_grp.h
-OLD_FILES+=usr/include/libcapsicum_pwd.h
-OLD_FILES+=usr/include/libcapsicum_random.h
-OLD_FILES+=usr/include/libcapsicum_service.h
-OLD_FILES+=usr/include/libcapsicum_sysctl.h
 OLD_FILES+=usr/include/libcasper.h
-OLD_FILES+=usr/lib/libcapsicum.a
-OLD_FILES+=usr/lib/libcapsicum.so
-OLD_FILES+=usr/lib/libcapsicum_p.a
-OLD_FILES+=usr/lib/libcasper.a
-OLD_FILES+=usr/lib/libcasper.so
-OLD_FILES+=usr/lib/libcasper_p.a
-OLD_FILES+=usr/lib32/libcapsicum.a
-OLD_FILES+=usr/lib32/libcapsicum.so
-OLD_LIBS+=usr/lib32/libcapsicum.so.0
-OLD_FILES+=usr/lib32/libcapsicum_p.a
-OLD_FILES+=usr/lib32/libcasper.a
-OLD_FILES+=usr/lib32/libcasper.so
-OLD_LIBS+=usr/lib32/libcasper.so.0
-OLD_FILES+=usr/lib32/libcasper_p.a
 OLD_FILES+=usr/share/man/man3/cap_clone.3.gz
 OLD_FILES+=usr/share/man/man3/cap_close.3.gz
 OLD_FILES+=usr/share/man/man3/cap_init.3.gz
@@ -1178,8 +1142,6 @@ OLD_FILES+=usr/share/man/man3/cap_sock.3.gz
 OLD_FILES+=usr/share/man/man3/cap_unwrap.3.gz
 OLD_FILES+=usr/share/man/man3/cap_wrap.3.gz
 OLD_FILES+=usr/share/man/man3/cap_xfer_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/libcapsicum.3.gz
-OLD_FILES+=usr/share/man/man8/casperd.8.gz
 .endif
 
 .if ${MK_CCD} == no
___
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: r357600 - stable/12/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:10:42 2020
New Revision: 357600
URL: https://svnweb.freebsd.org/changeset/base/357600

Log:
  MFCr356926:
Even when the MK_CASPER is set to "no" we still want to install man pages
and the headers. If the user decides to install the system without Casper
support, then the Casper functions are mocked, but they still exist in
the system.
  
PR:   242971

Modified:
  stable/12/tools/build/mk/OptionalObsoleteFiles.inc

Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:05:52 
2020(r357599)
+++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:10:42 
2020(r357600)
@@ -1129,19 +1129,6 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
-OLD_FILES+=usr/include/libcasper.h
-OLD_FILES+=usr/share/man/man3/cap_clone.3.gz
-OLD_FILES+=usr/share/man/man3/cap_close.3.gz
-OLD_FILES+=usr/share/man/man3/cap_init.3.gz
-OLD_FILES+=usr/share/man/man3/cap_limit_get.3.gz
-OLD_FILES+=usr/share/man/man3/cap_limit_set.3.gz
-OLD_FILES+=usr/share/man/man3/cap_recv_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/cap_send_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/cap_service_open.3.gz
-OLD_FILES+=usr/share/man/man3/cap_sock.3.gz
-OLD_FILES+=usr/share/man/man3/cap_unwrap.3.gz
-OLD_FILES+=usr/share/man/man3/cap_wrap.3.gz
-OLD_FILES+=usr/share/man/man3/cap_xfer_nvlist.3.gz
 .endif
 
 .if ${MK_CCD} == no
___
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: r357601 - stable/12/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:11:40 2020
New Revision: 357601
URL: https://svnweb.freebsd.org/changeset/base/357601

Log:
  MFCr356928:
When MK_CASPER=no is set remove files which are not needed to run system.
  
PR:   242971

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

Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:10:42 
2020(r357600)
+++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:11:40 
2020(r357601)
@@ -1129,6 +1129,15 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
+OLD_LIBS+=lib/libcasper.so.1
+OLD_LIBS+=lib/casper/libcap_dns.so.2
+OLD_LIBS+=lib/casper/libcap_fileargs.so.1
+OLD_LIBS+=lib/casper/libcap_grp.so.1
+OLD_LIBS+=lib/casper/libcap_net.so.1
+OLD_LIBS+=lib/casper/libcap_pwd.so.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.2
+OLD_LIBS+=lib/casper/libcap_syslog.so.1
 .endif
 
 .if ${MK_CCD} == no
___
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: r357602 - stable/11/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:14:27 2020
New Revision: 357602
URL: https://svnweb.freebsd.org/changeset/base/357602

Log:
  MFCr356925:
Those files are already removed in ObsoleteFiles.\
There is no need to remove them twice.
  
PR:   242971

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

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:11:40 
2020(r357601)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:14:27 
2020(r357602)
@@ -1146,43 +1146,7 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
-OLD_FILES+=etc/casper/system.dns
-OLD_FILES+=etc/casper/system.grp
-OLD_FILES+=etc/casper/system.pwd
-OLD_FILES+=etc/casper/system.random
-OLD_FILES+=etc/casper/system.sysctl
-OLD_FILES+=etc/rc.d/casperd
-OLD_LIBS+=lib/libcapsicum.so.0
-OLD_LIBS+=lib/libcasper.so.0
-OLD_FILES+=libexec/casper/dns
-OLD_FILES+=libexec/casper/grp
-OLD_FILES+=libexec/casper/pwd
-OLD_FILES+=libexec/casper/random
-OLD_FILES+=libexec/casper/sysctl
-OLD_FILES+=sbin/casper
-OLD_FILES+=sbin/casperd
-OLD_FILES+=usr/include/libcapsicum.h
-OLD_FILES+=usr/include/libcapsicum_dns.h
-OLD_FILES+=usr/include/libcapsicum_grp.h
-OLD_FILES+=usr/include/libcapsicum_pwd.h
-OLD_FILES+=usr/include/libcapsicum_random.h
-OLD_FILES+=usr/include/libcapsicum_service.h
-OLD_FILES+=usr/include/libcapsicum_sysctl.h
 OLD_FILES+=usr/include/libcasper.h
-OLD_FILES+=usr/lib/libcapsicum.a
-OLD_FILES+=usr/lib/libcapsicum.so
-OLD_FILES+=usr/lib/libcapsicum_p.a
-OLD_FILES+=usr/lib/libcasper.a
-OLD_FILES+=usr/lib/libcasper.so
-OLD_FILES+=usr/lib/libcasper_p.a
-OLD_FILES+=usr/lib32/libcapsicum.a
-OLD_FILES+=usr/lib32/libcapsicum.so
-OLD_LIBS+=usr/lib32/libcapsicum.so.0
-OLD_FILES+=usr/lib32/libcapsicum_p.a
-OLD_FILES+=usr/lib32/libcasper.a
-OLD_FILES+=usr/lib32/libcasper.so
-OLD_LIBS+=usr/lib32/libcasper.so.0
-OLD_FILES+=usr/lib32/libcasper_p.a
 OLD_FILES+=usr/share/man/man3/cap_clone.3.gz
 OLD_FILES+=usr/share/man/man3/cap_close.3.gz
 OLD_FILES+=usr/share/man/man3/cap_init.3.gz
@@ -1195,8 +1159,6 @@ OLD_FILES+=usr/share/man/man3/cap_sock.3.gz
 OLD_FILES+=usr/share/man/man3/cap_unwrap.3.gz
 OLD_FILES+=usr/share/man/man3/cap_wrap.3.gz
 OLD_FILES+=usr/share/man/man3/cap_xfer_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/libcapsicum.3.gz
-OLD_FILES+=usr/share/man/man8/casperd.8.gz
 .endif
 
 .if ${MK_CCD} == no
___
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: r357603 - stable/11/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:15:55 2020
New Revision: 357603
URL: https://svnweb.freebsd.org/changeset/base/357603

Log:
  MFCr356926:
Even when the MK_CASPER is set to "no" we still want to install man pages
and the headers. If the user decides to install the system without Casper
support, then the Casper functions are mocked, but they still exist in
the system.
  
PR:   242971

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

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:14:27 
2020(r357602)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:15:55 
2020(r357603)
@@ -1146,19 +1146,6 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
-OLD_FILES+=usr/include/libcasper.h
-OLD_FILES+=usr/share/man/man3/cap_clone.3.gz
-OLD_FILES+=usr/share/man/man3/cap_close.3.gz
-OLD_FILES+=usr/share/man/man3/cap_init.3.gz
-OLD_FILES+=usr/share/man/man3/cap_limit_get.3.gz
-OLD_FILES+=usr/share/man/man3/cap_limit_set.3.gz
-OLD_FILES+=usr/share/man/man3/cap_recv_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/cap_send_nvlist.3.gz
-OLD_FILES+=usr/share/man/man3/cap_service_open.3.gz
-OLD_FILES+=usr/share/man/man3/cap_sock.3.gz
-OLD_FILES+=usr/share/man/man3/cap_unwrap.3.gz
-OLD_FILES+=usr/share/man/man3/cap_wrap.3.gz
-OLD_FILES+=usr/share/man/man3/cap_xfer_nvlist.3.gz
 .endif
 
 .if ${MK_CCD} == no
___
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: r357604 - stable/11/tools/build/mk

2020-02-05 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Feb  5 21:16:51 2020
New Revision: 357604
URL: https://svnweb.freebsd.org/changeset/base/357604

Log:
  MFCr356928:
When MK_CASPER=no is set remove files which are not needed to run system.
  
PR:   242971

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

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:15:55 
2020(r357603)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc  Wed Feb  5 21:16:51 
2020(r357604)
@@ -1146,6 +1146,15 @@ OLD_DIRS+=usr/tests/usr.bin/calendar
 .endif
 
 .if ${MK_CASPER} == no
+OLD_LIBS+=lib/libcasper.so.1
+OLD_LIBS+=lib/casper/libcap_dns.so.2
+OLD_LIBS+=lib/casper/libcap_fileargs.so.1
+OLD_LIBS+=lib/casper/libcap_grp.so.1
+OLD_LIBS+=lib/casper/libcap_net.so.1
+OLD_LIBS+=lib/casper/libcap_pwd.so.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.1
+OLD_LIBS+=lib/casper/libcap_sysctl.so.2
+OLD_LIBS+=lib/casper/libcap_syslog.so.1
 .endif
 
 .if ${MK_CCD} == no
___
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: r357605 - in stable: 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/pseudofs 12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/sys/fs/pseudofs

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

Log:
  MFC r357410-r357411: Avoid duplicating VEXEC checks in VOP_CACHEDLOOKUP
  
  r357410: pseudofs: don't do VEXEC check in VOP_CACHEDLOOKUP
  
  VOP_CACHEDLOOKUP should assume that the appropriate VEXEC check has been
  done in the caller (vfs_cache_lookup), so it does not belong here.
  
  r357411: zfs: light refactor to indicate cachedlookup in zfs_lookup
  
  If we come from VOP_CACHEDLOOKUP, we must skip the VEXEC check as it will
  have been done in the caller (vfs_cache_lookup). This is a part of D23247,
  which may skip the earlier VEXEC check as well if the root fd was opened
  with O_SEARCH.
  
  This one required slightly more work as zfs_lookup may also be called
  indirectly as VOP_LOOKUP or a couple of other places where we must do the
  check.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/12/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/11/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Wed Feb  5 21:16:51 2020(r357604)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Wed Feb  5 21:30:31 2020(r357605)
@@ -1520,7 +1520,7 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char 
 /* ARGSUSED */
 static int
 zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
-int nameiop, cred_t *cr, kthread_t *td, int flags)
+int nameiop, cred_t *cr, kthread_t *td, int flags, boolean_t cached)
 {
znode_t *zdp = VTOZ(dvp);
znode_t *zp;
@@ -1592,9 +1592,12 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru
/*
 * Check accessibility of directory.
 */
-   if (error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr)) {
-   ZFS_EXIT(zfsvfs);
-   return (error);
+   if (!cached) {
+   error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr);
+   if (error != 0) {
+   ZFS_EXIT(zfsvfs);
+   return (error);
+   }
}
 
if (zfsvfs->z_utf8 && u8_validate(nm, strlen(nm),
@@ -4939,12 +4942,7 @@ zfs_freebsd_access(ap)
 }
 
 static int
-zfs_freebsd_lookup(ap)
-   struct vop_lookup_args /* {
-   struct vnode *a_dvp;
-   struct vnode **a_vpp;
-   struct componentname *a_cnp;
-   } */ *ap;
+zfs_freebsd_lookup(struct vop_lookup_args *ap, boolean_t cached)
 {
struct componentname *cnp = ap->a_cnp;
char nm[NAME_MAX + 1];
@@ -4953,10 +4951,17 @@ zfs_freebsd_lookup(ap)
strlcpy(nm, cnp->cn_nameptr, MIN(cnp->cn_namelen + 1, sizeof(nm)));
 
return (zfs_lookup(ap->a_dvp, nm, ap->a_vpp, cnp, cnp->cn_nameiop,
-   cnp->cn_cred, cnp->cn_thread, 0));
+   cnp->cn_cred, cnp->cn_thread, 0, cached));
 }
 
 static int
+zfs_freebsd_cachedlookup(struct vop_cachedlookup_args *ap)
+{
+
+   return (zfs_freebsd_lookup((struct vop_lookup_args *)ap, B_TRUE));
+}
+
+static int
 zfs_cache_lookup(ap)
struct vop_lookup_args /* {
struct vnode *a_dvp;
@@ -4970,7 +4975,7 @@ zfs_cache_lookup(ap)
if (zfsvfs->z_use_namecache)
return (vfs_cache_lookup(ap));
else
-   return (zfs_freebsd_lookup(ap));
+   return (zfs_freebsd_lookup(ap, B_FALSE));
 }
 
 static int
@@ -5532,7 +5537,7 @@ vop_getextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR);
+   LOOKUP_XATTR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5601,7 +5606,7 @@ vop_deleteextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR);
+   LOOKUP_XATTR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5669,7 +5674,7 @@ vop_setextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR | CREATE_XATTR_DIR);
+   LOOKUP_XATTR | CREATE_XATTR_DIR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5746,7 +5751,7 @@ vop_listextattr {
*sizep = 0;
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR)

svn commit: r357605 - in stable: 11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 11/sys/fs/pseudofs 12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 12/sys/fs/pseudofs

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

Log:
  MFC r357410-r357411: Avoid duplicating VEXEC checks in VOP_CACHEDLOOKUP
  
  r357410: pseudofs: don't do VEXEC check in VOP_CACHEDLOOKUP
  
  VOP_CACHEDLOOKUP should assume that the appropriate VEXEC check has been
  done in the caller (vfs_cache_lookup), so it does not belong here.
  
  r357411: zfs: light refactor to indicate cachedlookup in zfs_lookup
  
  If we come from VOP_CACHEDLOOKUP, we must skip the VEXEC check as it will
  have been done in the caller (vfs_cache_lookup). This is a part of D23247,
  which may skip the earlier VEXEC check as well if the root fd was opened
  with O_SEARCH.
  
  This one required slightly more work as zfs_lookup may also be called
  indirectly as VOP_LOOKUP or a couple of other places where we must do the
  check.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/11/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/12/sys/fs/pseudofs/pseudofs_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Wed Feb  5 21:16:51 2020(r357604)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Wed Feb  5 21:30:31 2020(r357605)
@@ -1525,7 +1525,7 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char 
 /* ARGSUSED */
 static int
 zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
-int nameiop, cred_t *cr, kthread_t *td, int flags)
+int nameiop, cred_t *cr, kthread_t *td, int flags, boolean_t cached)
 {
znode_t *zdp = VTOZ(dvp);
znode_t *zp;
@@ -1597,9 +1597,12 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, stru
/*
 * Check accessibility of directory.
 */
-   if (error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr)) {
-   ZFS_EXIT(zfsvfs);
-   return (error);
+   if (!cached) {
+   error = zfs_zaccess(zdp, ACE_EXECUTE, 0, B_FALSE, cr);
+   if (error != 0) {
+   ZFS_EXIT(zfsvfs);
+   return (error);
+   }
}
 
if (zfsvfs->z_utf8 && u8_validate(nm, strlen(nm),
@@ -4941,12 +4944,7 @@ zfs_freebsd_access(ap)
 }
 
 static int
-zfs_freebsd_lookup(ap)
-   struct vop_lookup_args /* {
-   struct vnode *a_dvp;
-   struct vnode **a_vpp;
-   struct componentname *a_cnp;
-   } */ *ap;
+zfs_freebsd_lookup(struct vop_lookup_args *ap, boolean_t cached)
 {
struct componentname *cnp = ap->a_cnp;
char nm[NAME_MAX + 1];
@@ -4955,10 +4953,17 @@ zfs_freebsd_lookup(ap)
strlcpy(nm, cnp->cn_nameptr, MIN(cnp->cn_namelen + 1, sizeof(nm)));
 
return (zfs_lookup(ap->a_dvp, nm, ap->a_vpp, cnp, cnp->cn_nameiop,
-   cnp->cn_cred, cnp->cn_thread, 0));
+   cnp->cn_cred, cnp->cn_thread, 0, cached));
 }
 
 static int
+zfs_freebsd_cachedlookup(struct vop_cachedlookup_args *ap)
+{
+
+   return (zfs_freebsd_lookup((struct vop_lookup_args *)ap, B_TRUE));
+}
+
+static int
 zfs_cache_lookup(ap)
struct vop_lookup_args /* {
struct vnode *a_dvp;
@@ -4972,7 +4977,7 @@ zfs_cache_lookup(ap)
if (zfsvfs->z_use_namecache)
return (vfs_cache_lookup(ap));
else
-   return (zfs_freebsd_lookup(ap));
+   return (zfs_freebsd_lookup(ap, B_FALSE));
 }
 
 static int
@@ -5535,7 +5540,7 @@ vop_getextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR);
+   LOOKUP_XATTR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5604,7 +5609,7 @@ vop_deleteextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR);
+   LOOKUP_XATTR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5672,7 +5677,7 @@ vop_setextattr {
ZFS_ENTER(zfsvfs);
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR | CREATE_XATTR_DIR);
+   LOOKUP_XATTR | CREATE_XATTR_DIR, B_FALSE);
if (error != 0) {
ZFS_EXIT(zfsvfs);
return (error);
@@ -5749,7 +5754,7 @@ vop_listextattr {
*sizep = 0;
 
error = zfs_lookup(ap->a_vp, NULL, &xvp, NULL, 0, ap->a_cred, td,
-   LOOKUP_XATTR)

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-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: 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, 
&t4_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, &t4_nnmtxq, 0,
+"Number of netmap TX queues");
+
+#define NNMRXQ 8
+static int t4_nnmrxq = -NNMRXQ;
+SYSCTL_INT(_hw_cxgbe, OID_AUTO, nnmrxq, CTLFLAG_RDTUN, &t4_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, &t4_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: 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-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: 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-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: r357608 - vendor/xz/dist/src/xz

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

Log:
  Apply a reduced version of upstream 353970510895f6a80adfe60cf71b70a95adfa8bc
  which implements memory limit in xz(1) when running in 32-bit mode.
  
  The change is applied directly in vendor area to ease future import.

Modified:
  vendor/xz/dist/src/xz/hardware.c
  vendor/xz/dist/src/xz/xz.1

Modified: vendor/xz/dist/src/xz/hardware.c
==
--- vendor/xz/dist/src/xz/hardware.cThu Feb  6 01:25:30 2020
(r357607)
+++ vendor/xz/dist/src/xz/hardware.cThu Feb  6 07:45:07 2020
(r357608)
@@ -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: vendor/xz/dist/src/xz/xz.1
==
--- vendor/xz/dist/src/xz/xz.1  Thu Feb  6 01:25:30 2020(r357607)
+++ vendor/xz/dist/src/xz/xz.1  Thu Feb  6 07:45:07 2020(r357608)
@@ -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-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: 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-all@freebsd.org mailing l