svn commit: r356267 - head/usr.sbin/pciconf

2020-01-01 Thread Scott Long
Author: scottl
Date: Thu Jan  2 06:56:28 2020
New Revision: 356267
URL: https://svnweb.freebsd.org/changeset/base/356267

Log:
  Add a compact columnar output format, available by specifying a second '-l'
  command line option.  Thanks to the removal of unnecessary information and
  the organization into columns, this helps the output be more legible on
  both 80 column displays and non-80 column displays.  imp@ provided the
  idea on this.

Modified:
  head/usr.sbin/pciconf/pciconf.8
  head/usr.sbin/pciconf/pciconf.c

Modified: head/usr.sbin/pciconf/pciconf.8
==
--- head/usr.sbin/pciconf/pciconf.8 Thu Jan  2 04:34:22 2020
(r356266)
+++ head/usr.sbin/pciconf/pciconf.8 Thu Jan  2 06:56:28 2020
(r356267)
@@ -110,6 +110,19 @@ in revision 2.1 of the
 standard.
 Note that they will be 0 for older cards.
 .Pp
+Adding a second
+.Fl l
+option causes output to be in a compact columnar format, suitable for
+80 column output:
+.Bd -literal
+drv selectorclass   rev hdr vendor device subven subdev
+foo0@pci0:0:4:0:01  01  00  1000   000f      
+bar0@pci0:0:5:0:000100  00  00  88c1   5333      
+none0@pci0:0:6:0:   02  00  00  10ec   8029      
+.Ed
+.Pp
+All fields retain the same definition as with the non-compact form.
+.Pp
 If the
 .Fl B
 option is supplied,

Modified: head/usr.sbin/pciconf/pciconf.c
==
--- head/usr.sbin/pciconf/pciconf.c Thu Jan  2 04:34:22 2020
(r356266)
+++ head/usr.sbin/pciconf/pciconf.c Thu Jan  2 06:56:28 2020
(r356267)
@@ -76,7 +76,7 @@ static struct pcisel getsel(const char *str);
 static void list_bridge(int fd, struct pci_conf *p);
 static void list_bars(int fd, struct pci_conf *p);
 static void list_devs(const char *name, int verbose, int bars, int bridge,
-int caps, int errors, int vpd);
+int caps, int errors, int vpd, int listmode);
 static void list_verbose(struct pci_conf *p);
 static void list_vpd(int fd, struct pci_conf *p);
 static const char *guess_class(struct pci_conf *p);
@@ -147,7 +147,7 @@ main(int argc, char **argv)
break;
 
case 'l':
-   listmode = 1;
+   listmode++;
break;
 
case 'r':
@@ -185,7 +185,7 @@ main(int argc, char **argv)
 
if (listmode) {
list_devs(optind + 1 == argc ? argv[optind] : NULL, verbose,
-   bars, bridge, caps, errors, vpd);
+   bars, bridge, caps, errors, vpd, listmode);
} else if (attachedmode) {
chkattached(argv[optind]);
} else if (readmode) {
@@ -207,7 +207,7 @@ main(int argc, char **argv)
 
 static void
 list_devs(const char *name, int verbose, int bars, int bridge, int caps,
-int errors, int vpd)
+int errors, int vpd, int listmode)
 {
int fd;
struct pci_conf_io pc;
@@ -260,21 +260,36 @@ list_devs(const char *name, int verbose, int bars, int
close(fd);
return;
}
+   if (listmode == 2)
+   printf("drv\tselector\tclass   rev hdr vendor device "
+   "subven subdev\n");
for (p = conf; p < [pc.num_matches]; p++) {
-   printf("%s%d@pci%d:%d:%d:%d:"
-   "\tclass=0x%06x rev=0x%02x hdr=0x%02x "
-   "vendor=0x%04x device=0x%04x "
-   "subvendor=0x%04x subdevice=0x%04x\n",
-   *p->pd_name ? p->pd_name :
-   "none",
-   *p->pd_name ? (int)p->pd_unit :
-   none_count++, p->pc_sel.pc_domain,
-   p->pc_sel.pc_bus, p->pc_sel.pc_dev,
-   p->pc_sel.pc_func, (p->pc_class << 16) |
-   (p->pc_subclass << 8) | p->pc_progif,
-   p->pc_revid, p->pc_hdr,
-   p->pc_vendor, p->pc_device,
-   p->pc_subvendor, p->pc_subdevice);
+   if (listmode == 2)
+   printf("%s%d@pci%d:%d:%d:%d:"
+   "\t%06x  %02x  %02x  %04x  %04x   %04x   
%04x\n",
+   *p->pd_name ? p->pd_name : "none",
+   *p->pd_name ? (int)p->pd_unit :
+   none_count++, p->pc_sel.pc_domain,
+   p->pc_sel.pc_bus, p->pc_sel.pc_dev,
+   p->pc_sel.pc_func, (p->pc_class << 16) |
+   (p->pc_subclass << 8) | p->pc_progif,
+   p->pc_revid, p->pc_hdr,
+

svn commit: r356266 - in head/stand: . libofw ofw powerpc/ofw sparc64/loader

2020-01-01 Thread Brandon Bergren
Author: bdragon
Date: Thu Jan  2 04:34:22 2020
New Revision: 356266
URL: https://svnweb.freebsd.org/changeset/base/356266

Log:
  Move stand/ofw/libofw to stand/libofw.
  
  Since rS330365, there has been no particular reason for libofw to be in a
  subdirectory of ofw. Move libofw up a level to make it fit in better with
  the other top level libraries.
  
  Also add a LIBOFWSRC to stand/defs.mk to match what all the other
  libraries are doing.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D23000

Added:
  head/stand/libofw/
 - copied from r356265, head/stand/ofw/libofw/
Deleted:
  head/stand/ofw/
Modified:
  head/stand/Makefile
  head/stand/defs.mk
  head/stand/powerpc/ofw/Makefile
  head/stand/sparc64/loader/Makefile

Modified: head/stand/Makefile
==
--- head/stand/Makefile Thu Jan  2 03:25:37 2020(r356265)
+++ head/stand/Makefile Thu Jan  2 04:34:22 2020(r356266)
@@ -16,7 +16,7 @@ S.${MK_FORTH}+=   forth
 S.${MK_LOADER_LUA}+=   liblua
 S.${MK_LOADER_LUA}+=   lua
 S.${MK_FDT}+=  fdt
-S.${MK_LOADER_OFW}+=   ofw
+S.${MK_LOADER_OFW}+=   libofw
 S.yes+=defaults
 S.yes+=man
 

Modified: head/stand/defs.mk
==
--- head/stand/defs.mk  Thu Jan  2 03:25:37 2020(r356265)
+++ head/stand/defs.mk  Thu Jan  2 04:34:22 2020(r356266)
@@ -28,6 +28,7 @@ FDTSRC=   ${BOOTSRC}/fdt
 FICLSRC=   ${BOOTSRC}/ficl
 LDRSRC=${BOOTSRC}/common
 LIBLUASRC= ${BOOTSRC}/liblua
+LIBOFWSRC= ${BOOTSRC}/libofw
 LUASRC=${SRCTOP}/contrib/lua/src
 SASRC= ${BOOTSRC}/libsa
 SYSDIR=${SRCTOP}/sys

Modified: head/stand/powerpc/ofw/Makefile
==
--- head/stand/powerpc/ofw/Makefile Thu Jan  2 03:25:37 2020
(r356265)
+++ head/stand/powerpc/ofw/Makefile Thu Jan  2 04:34:22 2020
(r356266)
@@ -44,8 +44,8 @@ CFLAGS+=  -DRELOC=${RELOC} -g
 LDFLAGS=   -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
 
 # Open Firmware standalone support library
-LIBOFW=${BOOTOBJ}/ofw/libofw/libofw.a
-CFLAGS+=   -I${BOOTSRC}/ofw/libofw
+LIBOFW=${BOOTOBJ}/libofw/libofw.a
+CFLAGS+=   -I${BOOTSRC}/libofw
 
 DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA}
 LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBFDT} ${LIBSA}

Modified: head/stand/sparc64/loader/Makefile
==
--- head/stand/sparc64/loader/Makefile  Thu Jan  2 03:25:37 2020
(r356265)
+++ head/stand/sparc64/loader/Makefile  Thu Jan  2 04:34:22 2020
(r356266)
@@ -47,8 +47,8 @@ LINKS=${BINDIR}/loader ${BINDIR}/zfsloader
 .endif
 
 # Open Firmware standalone support library
-LIBOFW=${BOOTOBJ}/ofw/libofw/libofw.a
-CFLAGS+=   -I${BOOTSRC}/ofw/libofw/
+LIBOFW=${BOOTOBJ}/libofw/libofw.a
+CFLAGS+=   -I${BOOTSRC}/libofw
 
 DPADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA}
 LDADD= ${LDR_INTERP} ${LIBOFW} ${LIBSA}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356263 - in head: . sys/sys

2020-01-01 Thread Warner Losh
Author: imp
Date: Thu Jan  2 03:25:26 2020
New Revision: 356263
URL: https://svnweb.freebsd.org/changeset/base/356263

Log:
  Remove arm/arm as a valid target.
  
  TARGET=arm now defaults to TARGET_ARCH=armv7
  TARGET_ARCH=arm is no longer valid.
  
  Bump __FreeBSD_version to 1300073
  
  Tested with make universe. Any stale LINT-V5 config files remaining in the 
tree
  will fail the universe build. However, LINT-V5 was removed in r355119.
  
  This retirement has been planned since last summer. The armv5 port is fragile:
  it works OK for some peeople, and fails badly for others. There's a number of
  subtle bugs in busdma, pmap and other MD parts of thee system that present
  themselves under load or in unusual circumstances (like fsck after a
  crash). stable/8, branched 10 years ago, was the last reliable release.  Since
  the support burden is larger then the benefit, the consensus view is armv5
  should be removed from the tree.
  
  Discussed with: arm@ mailing list and arm developer community.

Modified:
  head/Makefile
  head/Makefile.inc1
  head/UPDATING
  head/sys/sys/param.h

Modified: head/Makefile
==
--- head/Makefile   Thu Jan  2 01:23:43 2020(r356262)
+++ head/Makefile   Thu Jan  2 03:25:26 2020(r356263)
@@ -276,7 +276,7 @@ MK_META_MODE= no
 # exceptions.
 .if !defined(TARGET_ARCH) && defined(TARGET)
 # T->TA mapping is usually TARGET with arm64 the odd man out
-_TARGET_ARCH=  ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/}
+_TARGET_ARCH=  ${TARGET:S/arm64/aarch64/:S/riscv/riscv64/:S/arm/armv7}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
 ${TARGET_ARCH} != ${MACHINE_ARCH}
 # TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
@@ -496,7 +496,6 @@ _OBSOLETE_GCC_TARGETS+=powerpc
 .endif
 TARGETS?=amd64 arm arm64 i386 riscv ${_OBSOLETE_GCC_TARGETS}
 _UNIVERSE_TARGETS= ${TARGETS}
-# arm (armv5) excluded due to broken buildworld
 TARGET_ARCHES_arm?=armv6 armv7
 TARGET_ARCHES_arm64?=  aarch64
 TARGET_ARCHES_mips?=   mipsel mips mips64el mips64 mipsn32 mipselhf mipshf 
mips64elhf mips64hf

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jan  2 01:23:43 2020(r356262)
+++ head/Makefile.inc1  Thu Jan  2 03:25:26 2020(r356263)
@@ -134,7 +134,6 @@ TARGET_ABI?=unknown
 TARGET_TRIPLE?=
${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0
 KNOWN_ARCHES?= aarch64/arm64 \
amd64 \
-   arm \
armv6/arm \
armv7/arm \
i386 \

Modified: head/UPDATING
==
--- head/UPDATING   Thu Jan  2 01:23:43 2020(r356262)
+++ head/UPDATING   Thu Jan  2 03:25:26 2020(r356263)
@@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20200102:
+   Support for armv5 has been disconnected and is being removed. The
+   machine combination MACHINE=arm MACHINE_ARCH=arm is no longer valid.
+   You must now use a MACHINE_ARCH of armv6 or armv7. The default
+   MACHINE_ARCH for MACHINE=arm is now armv7.
+
 20191226:
Clang/LLVM is now the default compiler for all powerpc architectures.
LLD is now the default linker for powerpc64.  The change for powerpc64

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Jan  2 01:23:43 2020(r356262)
+++ head/sys/sys/param.hThu Jan  2 03:25:26 2020(r356263)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300072  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300073  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356264 - head/sys/arm/conf

2020-01-01 Thread Warner Losh
Author: imp
Date: Thu Jan  2 03:25:32 2020
New Revision: 356264
URL: https://svnweb.freebsd.org/changeset/base/356264

Log:
  Remove NOTES.armv5. It's no longer relevant.

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


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

2020-01-01 Thread Warner Losh
Author: imp
Date: Thu Jan  2 03:25:37 2020
New Revision: 356265
URL: https://svnweb.freebsd.org/changeset/base/356265

Log:
  Remove MACHINE_ARCH arm where appropriate from the tables to reflect armv5's
  retirement.

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

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Thu Jan  2 03:25:32 2020(r356264)
+++ head/share/man/man7/arch.7  Thu Jan  2 03:25:37 2020(r356265)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 20, 2019
+.Dd January 2, 2020
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -199,8 +199,8 @@ Machine-dependent type sizes:
 .It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t
 .It aarch64 Ta 8 Ta 16 Ta 8
 .It amd64   Ta 8 Ta 16 Ta 8
-.It arm Ta 4 Ta  8 Ta 8
 .It armv6   Ta 4 Ta  8 Ta 8
+.It armv7   Ta 4 Ta  8 Ta 8
 .It i386Ta 4 Ta 12 Ta 4
 .It mipsTa 4 Ta  8 Ta 8
 .It mipsel  Ta 4 Ta  8 Ta 8
@@ -226,7 +226,6 @@ is 8 bytes on all supported architectures except i386.
 .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness
 .It aarch64 Ta little Ta unsigned
 .It amd64   Ta little Ta   signed
-.It arm Ta little Ta unsigned
 .It armv6   Ta little Ta unsigned
 .It armv7   Ta little Ta unsigned
 .It i386Ta little Ta   signed
@@ -251,7 +250,6 @@ is 8 bytes on all supported architectures except i386.
 .It Sy Architecture Ta Sy Page Sizes
 .It aarch64 Ta 4K, 2M, 1G
 .It amd64   Ta 4K, 2M, 1G
-.It arm Ta 4K
 .It armv6   Ta 4K, 1M
 .It armv7   Ta 4K, 1M
 .It i386Ta 4K, 2M (PAE), 4M
@@ -276,7 +274,6 @@ is 8 bytes on all supported architectures except i386.
 .It Sy Architecture Ta Sy float, double Ta Sy long double
 .It aarch64 Ta hard Ta soft, quad precision
 .It amd64   Ta hard Ta hard, 80 bit
-.It arm Ta soft Ta soft, double precision
 .It armv6   Ta hard Ta hard, double precision
 .It armv7   Ta hard Ta hard, double precision
 .It i386Ta hard Ta hard, 80 bit
@@ -313,7 +310,6 @@ This table shows the default tool chain for each archi
 .It Sy Architecture Ta Sy Compiler Ta Sy Linker
 .It aarch64 Ta Clang Ta lld
 .It amd64   Ta Clang Ta lld
-.It arm Ta Clang Ta GNU ld 2.17.50
 .It armv6   Ta Clang Ta lld
 .It armv7   Ta Clang Ta lld
 .It i386Ta Clang Ta lld
@@ -360,7 +356,7 @@ or similar things like boot sequences.
 .It Dv MACHINE Ta Dv MACHINE_CPUARCH Ta Dv MACHINE_ARCH
 .It arm64 Ta aarch64 Ta aarch64
 .It amd64 Ta amd64 Ta amd64
-.It arm Ta arm Ta arm, armv6, armv7
+.It arm Ta arm Ta armv6, armv7
 .It i386 Ta i386 Ta i386
 .It mips Ta mips Ta mips, mipsel, mips64, mips64el, mipshf, mipselhf, 
mips64elhf, mipsn32
 .It powerpc Ta powerpc Ta powerpc, powerpcspe, powerpc64
@@ -394,7 +390,6 @@ Architecture-specific macros:
 .It Sy Architecture Ta Sy Predefined macros
 .It aarch64 Ta Dv __aarch64__
 .It amd64   Ta Dv __amd64__, Dv __x86_64__
-.It arm Ta Dv __arm__
 .It armv6   Ta Dv __arm__, Dv __ARM_ARCH >= 6
 .It armv7   Ta Dv __arm__, Dv __ARM_ARCH >= 7
 .It i386Ta Dv __i386__
@@ -484,7 +479,7 @@ combinations encoding pointer size, endian and hard ve
 all these).
 Generally, the plain CPU name specifies the most common (or at least
 first) variant of the CPU.
-This is why mips and mips64 imply 'big endian' while 'arm' and 'armv7'
+This is why mips and mips64 imply 'big endian' while 'armv6' and 'armv7'
 imply little endian.
 If we ever were to support the so-called x32 ABI (using 32-bit
 pointers on the amd64 architecture), it would most likely be encoded
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356262 - head/sys/kern

2020-01-01 Thread Pawel Biernacki
Author: kaktus
Date: Thu Jan  2 01:23:43 2020
New Revision: 356262
URL: https://svnweb.freebsd.org/changeset/base/356262

Log:
  sysctl: hide 2.x era compat node
  
  r23081 introduced kern.dummy oid as a semi ABI compat for kern.maxsockbuf
  that was moved to a new namespace.  It never functioned as an alias of any
  kind and was just returning 0 unconditionally, hence it was probably
  provided to keep some 3rd party programmes happy about sysctl(3) not
  reporting an error because of non-existing oid.
  After nearly 23 years it seems reasonable to just hide it from sysctl(8)
  list not to cause unnecessary confusion as for its purpose.
  
  Reported by:  Antranig Vartanian 
  Reviewed by:  kib (mentor)
  Approved by:  kib (mentor)
  Differential Revision:https://reviews.freebsd.org/D22982

Modified:
  head/sys/kern/uipc_sockbuf.c

Modified: head/sys/kern/uipc_sockbuf.c
==
--- head/sys/kern/uipc_sockbuf.cWed Jan  1 22:51:17 2020
(r356261)
+++ head/sys/kern/uipc_sockbuf.cThu Jan  2 01:23:43 2020
(r356262)
@@ -1522,7 +1522,7 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
 
 /* This takes the place of kern.maxsockbuf, which moved to kern.ipc. */
 static int dummy;
-SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW, , 0, "");
+SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTLFLAG_RW | CTLFLAG_SKIP, , 0, "");
 SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW,
 _max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size");
 SYSCTL_ULONG(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356261 - head/sys/kern

2020-01-01 Thread Mateusz Guzik
Author: mjg
Date: Wed Jan  1 22:51:17 2020
New Revision: 356261
URL: https://svnweb.freebsd.org/changeset/base/356261

Log:
  vfs: drop an always-false check from vlrureclaim
  
  The vnode gets held few lines prior, making the VI_FREE condition
  illegal.

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Jan  1 22:50:23 2020(r356260)
+++ head/sys/kern/vfs_subr.cWed Jan  1 22:51:17 2020(r356261)
@@ -1059,7 +1059,6 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int
 */
if (vp->v_usecount ||
(!reclaim_nc_src && !LIST_EMPTY(>v_cache_src)) ||
-   (vp->v_iflag & VI_FREE) != 0 ||
(vp->v_object != NULL &&
vp->v_object->resident_page_count > trigger)) {
VOP_UNLOCK(vp, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356260 - head/sys/fs/msdosfs

2020-01-01 Thread Mateusz Guzik
Author: mjg
Date: Wed Jan  1 22:50:23 2020
New Revision: 356260
URL: https://svnweb.freebsd.org/changeset/base/356260

Log:
  msdos: vgone unconstructed vnode before vputing it
  
  Otherwise someone else may race to start using it. Race window
  was opened by r351748 ("vfs: implement usecount implying holdcnt").
  
  Noted by: kib

Modified:
  head/sys/fs/msdosfs/msdosfs_denode.c

Modified: head/sys/fs/msdosfs/msdosfs_denode.c
==
--- head/sys/fs/msdosfs/msdosfs_denode.cWed Jan  1 22:47:00 2020
(r356259)
+++ head/sys/fs/msdosfs/msdosfs_denode.cWed Jan  1 22:50:23 2020
(r356260)
@@ -230,7 +230,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon
 * Arrange for vput() to just forget about it.
 */
ldep->de_Name[0] = SLOT_DELETED;
-
+   vgone(nvp);
vput(nvp);
*depp = NULL;
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356259 - head/sys/fs/msdosfs

2020-01-01 Thread Mateusz Guzik
Author: mjg
Date: Wed Jan  1 22:47:00 2020
New Revision: 356259
URL: https://svnweb.freebsd.org/changeset/base/356259

Log:
  msdosfs: add a missing MNT_VNODE_FOREACH_ALL_ABORT to msdosfs_sync

Modified:
  head/sys/fs/msdosfs/msdosfs_vfsops.c

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cWed Jan  1 22:12:34 2020
(r356258)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cWed Jan  1 22:47:00 2020
(r356259)
@@ -925,8 +925,10 @@ loop:
}
error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, td);
if (error) {
-   if (error == ENOENT)
+   if (error == ENOENT) {
+   MNT_VNODE_FOREACH_ALL_ABORT(mp, nvp);
goto loop;
+   }
continue;
}
error = VOP_FSYNC(vp, waitfor, td);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356256 - head/contrib/llvm-project/llvm/lib/Target/X86

2020-01-01 Thread Dimitry Andric
Author: dim
Date: Wed Jan  1 19:45:00 2020
New Revision: 356256
URL: https://svnweb.freebsd.org/changeset/base/356256

Log:
  Merge commit 468a0cb5f from llvm git (by Craig Topper):
  
[X86] Add X87 FCMOV support to X86FlagsCopyLowering.
  
Fixes PR44396
  
  Merge commit 86f48999f from llvm git (by Craig Topper):
  
[X86] Fix typo in getCMovOpcode.
  
The 64-bit HasMemoryOperand line was using CMOV32rm instead of
CMOV64rm. Not sure how to test this. We have no test coverage that
passes true for HasMemoryOperand.
  
  This fixes 'Assertion failed: (MI.findRegisterDefOperand(X86::EFLAGS) &&
  "Expected a def of EFLAGS for this instruction!"), function
  runOnMachineFunction' when compiling the misc/gpsim port for i386.
  
  Reported by:  yuri
  Upstream PR:  https://bugs.llvm.org/show_bug.cgi?id=44396
  MFC after:1 week

Modified:
  head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
  head/contrib/llvm-project/llvm/lib/Target/X86/X86InstrInfo.cpp

Modified: head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
==
--- head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp  
Wed Jan  1 19:25:20 2020(r356255)
+++ head/contrib/llvm-project/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp  
Wed Jan  1 19:45:00 2020(r356256)
@@ -115,6 +115,10 @@ class X86FlagsCopyLoweringPass : public MachineFunctio
MachineBasicBlock::iterator TestPos, DebugLoc TestLoc,
MachineInstr , MachineOperand ,
CondRegArray );
+  void rewriteFCMov(MachineBasicBlock ,
+MachineBasicBlock::iterator TestPos, DebugLoc TestLoc,
+MachineInstr , MachineOperand ,
+CondRegArray );
   void rewriteCondJmp(MachineBasicBlock ,
   MachineBasicBlock::iterator TestPos, DebugLoc TestLoc,
   MachineInstr , CondRegArray );
@@ -334,6 +338,28 @@ static MachineBasicBlock (MachineBasicBlock
   return NewMBB;
 }
 
+static X86::CondCode getCondFromFCMOV(unsigned Opcode) {
+  switch (Opcode) {
+  default: return X86::COND_INVALID;
+  case X86::CMOVBE_Fp32:  case X86::CMOVBE_Fp64:  case X86::CMOVBE_Fp80:
+return X86::COND_BE;
+  case X86::CMOVB_Fp32:   case X86::CMOVB_Fp64:   case X86::CMOVB_Fp80:
+return X86::COND_B;
+  case X86::CMOVE_Fp32:   case X86::CMOVE_Fp64:   case X86::CMOVE_Fp80:
+return X86::COND_E;
+  case X86::CMOVNBE_Fp32: case X86::CMOVNBE_Fp64: case X86::CMOVNBE_Fp80:
+return X86::COND_A;
+  case X86::CMOVNB_Fp32:  case X86::CMOVNB_Fp64:  case X86::CMOVNB_Fp80:
+return X86::COND_AE;
+  case X86::CMOVNE_Fp32:  case X86::CMOVNE_Fp64:  case X86::CMOVNE_Fp80:
+return X86::COND_NE;
+  case X86::CMOVNP_Fp32:  case X86::CMOVNP_Fp64:  case X86::CMOVNP_Fp80:
+return X86::COND_NP;
+  case X86::CMOVP_Fp32:   case X86::CMOVP_Fp64:   case X86::CMOVP_Fp80:
+return X86::COND_P;
+  }
+}
+
 bool X86FlagsCopyLoweringPass::runOnMachineFunction(MachineFunction ) {
   LLVM_DEBUG(dbgs() << "** " << getPassName() << " : " << MF.getName()
 << " **\n");
@@ -593,6 +619,8 @@ bool X86FlagsCopyLoweringPass::runOnMachineFunction(Ma
 // Otherwise we can just rewrite in-place.
 if (X86::getCondFromCMov(MI) != X86::COND_INVALID) {
   rewriteCMov(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs);
+} else if (getCondFromFCMOV(MI.getOpcode()) != X86::COND_INVALID) {
+  rewriteFCMov(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs);
 } else if (X86::getCondFromSETCC(MI) != X86::COND_INVALID) {
   rewriteSetCC(*TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs);
 } else if (MI.getOpcode() == TargetOpcode::COPY) {
@@ -849,6 +877,51 @@ void X86FlagsCopyLoweringPass::rewriteCMov(MachineBasi
   .setImm(Inverted ? X86::COND_E : X86::COND_NE);
   FlagUse.setIsKill(true);
   LLVM_DEBUG(dbgs() << "fixed cmov: "; CMovI.dump());
+}
+
+void X86FlagsCopyLoweringPass::rewriteFCMov(MachineBasicBlock ,
+MachineBasicBlock::iterator 
TestPos,
+DebugLoc TestLoc,
+MachineInstr ,
+MachineOperand ,
+CondRegArray ) {
+  // First get the register containing this specific condition.
+  X86::CondCode Cond = getCondFromFCMOV(CMovI.getOpcode());
+  unsigned CondReg;
+  bool Inverted;
+  std::tie(CondReg, Inverted) =
+  getCondOrInverseInReg(TestMBB, TestPos, TestLoc, Cond, CondRegs);
+
+  MachineBasicBlock  = *CMovI.getParent();
+
+  // Insert a direct test of the saved register.
+  insertTest(MBB, CMovI.getIterator(), CMovI.getDebugLoc(), CondReg);
+
+  auto getFCMOVOpcode = [](unsigned Opcode, bool Inverted) {
+

svn commit: r356254 - head/usr.sbin/inetd

2020-01-01 Thread Kyle Evans
Author: kevans
Date: Wed Jan  1 18:49:57 2020
New Revision: 356254
URL: https://svnweb.freebsd.org/changeset/base/356254

Log:
  inetd: final round of trivial cleanup, NFC
  
  Highlights:
  - Use MAX() for maxsock raising; small readability improvement IMO
  - malloc(3) + memset(3) -> calloc(3) where appropriate
  - stop casting the return value of malloc(3)
  - mallloc(3) -> reallocarray(3) where appropriate
  
  A future change may enter capability mode when forking for some of the
  built-in handlers.

Modified:
  head/usr.sbin/inetd/inetd.c

Modified: head/usr.sbin/inetd/inetd.c
==
--- head/usr.sbin/inetd/inetd.c Wed Jan  1 17:32:20 2020(r356253)
+++ head/usr.sbin/inetd/inetd.c Wed Jan  1 18:49:57 2020(r356254)
@@ -564,10 +564,7 @@ main(int argc, char **argv)
 #ifdef SANITY_CHECK
nsock++;
 #endif
-   if (signalpipe[0] > maxsock)
-   maxsock = signalpipe[0];
-   if (signalpipe[1] > maxsock)
-   maxsock = signalpipe[1];
+   maxsock = MAX(MAX(maxsock, signalpipe[0]), signalpipe[1]);
 
for (;;) {
int n, ctrl;
@@ -931,12 +928,11 @@ addchild(struct servtab *sep, pid_t pid)
exit(EX_SOFTWARE);
}
 #endif
-   sc = malloc(sizeof(*sc));
+   sc = calloc(1, sizeof(*sc));
if (sc == NULL) {
-   syslog(LOG_ERR, "malloc: %m");
+   syslog(LOG_ERR, "calloc: %m");
exit(EX_OSERR);
}
-   memset(sc, 0, sizeof(*sc));
sc->sc_pid = pid;
LIST_INSERT_HEAD(>se_children, sc, sc_link);
++sep->se_numchild;
@@ -1501,8 +1497,8 @@ enter(struct servtab *cp)
struct servtab *sep;
long omask;
 
-   sep = (struct servtab *)malloc(sizeof (*sep));
-   if (sep == (struct servtab *)0) {
+   sep = malloc(sizeof(*sep));
+   if (sep == NULL) {
syslog(LOG_ERR, "malloc: %m");
exit(EX_OSERR);
}
@@ -1540,8 +1536,7 @@ enable(struct servtab *sep)
nsock++;
 #endif
FD_SET(sep->se_fd, );
-   if (sep->se_fd > maxsock)
-   maxsock = sep->se_fd;
+   maxsock = MAX(maxsock, sep->se_fd);
 }
 
 static void
@@ -1985,20 +1980,14 @@ freeconfig(struct servtab *cp)
struct stabchild *sc;
int i;
 
-   if (cp->se_service)
-   free(cp->se_service);
-   if (cp->se_proto)
-   free(cp->se_proto);
-   if (cp->se_user)
-   free(cp->se_user);
-   if (cp->se_group)
-   free(cp->se_group);
+   free(cp->se_service);
+   free(cp->se_proto);
+   free(cp->se_user);
+   free(cp->se_group);
 #ifdef LOGIN_CAP
-   if (cp->se_class)
-   free(cp->se_class);
+   free(cp->se_class);
 #endif
-   if (cp->se_server)
-   free(cp->se_server);
+   free(cp->se_server);
while (!LIST_EMPTY(>se_children)) {
sc = LIST_FIRST(>se_children);
LIST_REMOVE(sc, sc_link);
@@ -2009,8 +1998,7 @@ freeconfig(struct servtab *cp)
free(cp->se_argv[i]);
free_connlist(cp);
 #ifdef IPSEC
-   if (cp->se_policy)
-   free(cp->se_policy);
+   free(cp->se_policy);
 #endif
 }
 
@@ -2290,8 +2278,7 @@ cpmip(const struct servtab *sep, int ctrl)
strcmp(sep->se_service, chBest->ch_Service) != 0) {
chBest->ch_Family = sin4->sin_family;
chBest->ch_Addr4 = sin4->sin_addr;
-   if (chBest->ch_Service)
-   free(chBest->ch_Service);
+   free(chBest->ch_Service);
chBest->ch_Service = strdup(sep->se_service);
memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times));
} 
@@ -2304,8 +2291,7 @@ cpmip(const struct servtab *sep, int ctrl)
strcmp(sep->se_service, chBest->ch_Service) != 0) {
chBest->ch_Family = sin6->sin6_family;
chBest->ch_Addr6 = sin6->sin6_addr;
-   if (chBest->ch_Service)
-   free(chBest->ch_Service);
+   free(chBest->ch_Service);
chBest->ch_Service = strdup(sep->se_service);
memset(chBest->ch_Times, 0, sizeof(chBest->ch_Times));
}
@@ -2398,9 +2384,10 @@ search_conn(struct servtab *sep, int ctrl)
syslog(LOG_ERR, "malloc: %m");
exit(EX_OSERR);
}
-   conn->co_proc = malloc(sep->se_maxperip * 
sizeof(*conn->co_proc));
+   conn->co_proc = reallocarray(NULL, sep->se_maxperip,
+   sizeof(*conn->co_proc));
if (conn->co_proc == NULL) {
-   syslog(LOG_ERR, "malloc: %m");
+   syslog(LOG_ERR, 

svn commit: r356253 - head/sys/netinet6

2020-01-01 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan  1 17:32:20 2020
New Revision: 356253
URL: https://svnweb.freebsd.org/changeset/base/356253

Log:
  In r343631 error code for a packet blocked by a firewall was
  changed from EACCES to EPERM.  This change was not intentional,
  so fix that.  Return EACCESS if a firewall forbids sending.
  
  Noticed by:   ae

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Wed Jan  1 17:31:43 2020
(r356252)
+++ head/sys/netinet6/ip6_output.c  Wed Jan  1 17:32:20 2020
(r356253)
@@ -898,7 +898,7 @@ again:
ip6 = mtod(m, struct ip6_hdr *);
break;
case PFIL_DROPPED:
-   error = EPERM;
+   error = EACCES;
/* FALLTHROUGH */
case PFIL_CONSUMED:
goto done;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356252 - in head/sys: net netinet

2020-01-01 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan  1 17:31:43 2020
New Revision: 356252
URL: https://svnweb.freebsd.org/changeset/base/356252

Log:
  In r343631 error code for a packet blocked by a firewall was
  changed from EACCES to EPERM.  This change was not intentional,
  so fix that.  Return EACCESS if a firewall forbids sending.
  
  Noticed by:   ae

Modified:
  head/sys/net/if_bridge.c
  head/sys/netinet/ip_output.c

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cWed Jan  1 12:06:37 2020(r356251)
+++ head/sys/net/if_bridge.cWed Jan  1 17:31:43 2020(r356252)
@@ -3191,7 +3191,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
dir == PFIL_OUT && ifp != NULL) {
switch (pfil_run_hooks(V_link_pfil_head, mp, ifp, dir, NULL)) {
case PFIL_DROPPED:
-   return (EPERM);
+   return (EACCES);
case PFIL_CONSUMED:
return (0);
}
@@ -3312,7 +3312,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, stru
case PFIL_CONSUMED:
return (0);
case PFIL_DROPPED:
-   return (EPERM);
+   return (EACCES);
default:
break;
}

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jan  1 12:06:37 2020
(r356251)
+++ head/sys/netinet/ip_output.cWed Jan  1 17:31:43 2020
(r356252)
@@ -130,7 +130,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, in
odst.s_addr = ip->ip_dst.s_addr;
switch (pfil_run_hooks(V_inet_pfil_head, mp, ifp, pflags, inp)) {
case PFIL_DROPPED:
-   *error = EPERM;
+   *error = EACCES;
/* FALLTHROUGH */
case PFIL_CONSUMED:
return 1; /* Finished */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356251 - head/bin/sh

2020-01-01 Thread Jilles Tjoelker
Author: jilles
Date: Wed Jan  1 12:06:37 2020
New Revision: 356251
URL: https://svnweb.freebsd.org/changeset/base/356251

Log:
  sh: Fix rare memory leak with SIGINT
  
  If getcwd() failed earlier on but later succeeded in the pwd builtin,
  there was no INTOFF protection between calling savestr() and storing its
  result.
  
  It is quite rare for getcwd() to fail, and rarer for it to succeed later in
  the same directory.
  
  Found via code inspection for changing ckmalloc() and similar to assert
  INTOFF protection instead of applying it directly (which protects against
  corrupting malloc's internal state but allows memory leaks or double frees).
  
  MFC after:1 week

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==
--- head/bin/sh/cd.cWed Jan  1 09:22:06 2020(r356250)
+++ head/bin/sh/cd.cWed Jan  1 12:06:37 2020(r356251)
@@ -376,8 +376,11 @@ getpwd(void)
return curdir;
 
p = getpwd2();
-   if (p != NULL)
+   if (p != NULL) {
+   INTOFF;
curdir = savestr(p);
+   INTON;
+   }
 
return curdir;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356250 - head/sbin/fsck_msdosfs

2020-01-01 Thread Xin LI
Author: delphij
Date: Wed Jan  1 09:22:06 2020
New Revision: 356250
URL: https://svnweb.freebsd.org/changeset/base/356250

Log:
  Revert r356249 for now as it broke GCC builds.

Modified:
  head/sbin/fsck_msdosfs/boot.c
  head/sbin/fsck_msdosfs/check.c
  head/sbin/fsck_msdosfs/dir.c
  head/sbin/fsck_msdosfs/dosfs.h
  head/sbin/fsck_msdosfs/ext.h
  head/sbin/fsck_msdosfs/fat.c
  head/sbin/fsck_msdosfs/main.c

Modified: head/sbin/fsck_msdosfs/boot.c
==
--- head/sbin/fsck_msdosfs/boot.c   Wed Jan  1 07:43:08 2020
(r356249)
+++ head/sbin/fsck_msdosfs/boot.c   Wed Jan  1 09:22:06 2020
(r356250)
@@ -152,6 +152,9 @@ readboot(int dosfs, struct bootblock *boot)
boot->NumSectors = boot->bpbHugeSectors;
}
 
+
+
+
if (boot->flags & FAT32) {
/* If the OEM Name field is EXFAT, it's not FAT32, so bail */
if (!memcmp([3], "EXFAT   ", 8)) {
@@ -269,30 +272,13 @@ readboot(int dosfs, struct bootblock *boot)
boot->NumClusters = (boot->NumSectors - boot->FirstCluster) / 
boot->bpbSecPerClust +
CLUST_FIRST;
 
-   if (boot->flags & FAT32) {
-   if (boot->NumClusters > (CLUST_RSRVD & CLUST32_MASK)) {
-   pfatal("Filesystem too big (%u clusters) for FAT32 
partition",
-   boot->NumClusters);
-   return FSFATAL;
-   }
-   if (boot->NumClusters < (CLUST_RSRVD & CLUST16_MASK)) {
-   pfatal("Filesystem too small (%u clusters) for FAT32 
partition",
-   boot->NumClusters);
-   return FSFATAL;
-   }
+   if (boot->flags & FAT32)
boot->ClustMask = CLUST32_MASK;
-
-   if (boot->bpbRootClust < CLUST_FIRST ||
-   boot->bpbRootClust >= boot->NumClusters) {
-   pfatal("Root directory starts with cluster out of 
range(%u)",
-  boot->bpbRootClust);
-   return FSFATAL;
-   }
-   } else if (boot->NumClusters < (CLUST_RSRVD_MASK)) {
+   else if (boot->NumClusters < (CLUST_RSRVD_MASK))
boot->ClustMask = CLUST12_MASK;
-   } else if (boot->NumClusters < (CLUST_RSRVD_MASK)) {
+   else if (boot->NumClusters < (CLUST_RSRVD_MASK))
boot->ClustMask = CLUST16_MASK;
-   } else {
+   else {
pfatal("Filesystem too big (%u clusters) for non-FAT32 
partition",
   boot->NumClusters);
return FSFATAL;

Modified: head/sbin/fsck_msdosfs/check.c
==
--- head/sbin/fsck_msdosfs/check.c  Wed Jan  1 07:43:08 2020
(r356249)
+++ head/sbin/fsck_msdosfs/check.c  Wed Jan  1 09:22:06 2020
(r356250)
@@ -47,8 +47,9 @@ checkfilesys(const char *fname)
 {
int dosfs;
struct bootblock boot;
-   struct fat_descriptor *fat = NULL;
+   struct fatEntry *fat = NULL;
int finish_dosdirsection=0;
+   u_int i;
int mod = 0;
int ret = 8;
 
@@ -87,39 +88,65 @@ checkfilesys(const char *fname)
}
 
if (!preen)  {
-   printf("** Phase 1 - Read FAT and checking connectivity\n");
+   if (boot.ValidFat < 0)
+   printf("** Phase 1 - Read and Compare FATs\n");
+   else
+   printf("** Phase 1 - Read FAT\n");
}
 
-   mod |= readfat(dosfs, , );
+   mod |= readfat(dosfs, , boot.ValidFat >= 0 ? boot.ValidFat : 0, 
);
if (mod & FSFATAL) {
close(dosfs);
return 8;
}
 
+   if (boot.ValidFat < 0)
+   for (i = 1; i < boot.bpbFATs; i++) {
+   struct fatEntry *currentFat;
+
+   mod |= readfat(dosfs, , i, );
+
+   if (mod & FSFATAL)
+   goto out;
+
+   mod |= comparefat(, fat, currentFat, i);
+   free(currentFat);
+   if (mod & FSFATAL)
+   goto out;
+   }
+
if (!preen)
-   printf("** Phase 2 - Checking Directories\n");
+   printf("** Phase 2 - Check Cluster Chains\n");
 
-   mod |= resetDosDirSection(fat);
+   mod |= checkfat(, fat);
+   if (mod & FSFATAL)
+   goto out;
+   /* delay writing FATs */
+
+   if (!preen)
+   printf("** Phase 3 - Checking Directories\n");
+
+   mod |= resetDosDirSection(, fat);
finish_dosdirsection = 1;
if (mod & FSFATAL)
goto out;
/* delay writing FATs */
 
-   mod |= handleDirTree(fat);
+   mod |= handleDirTree(dosfs, , fat);
if (mod & FSFATAL)
goto