svn commit: r345436 - in stable/11/usr.bin/mkimg: . tests

2019-03-22 Thread Marcel Moolenaar
Author: marcel
Date: Sat Mar 23 03:37:08 2019
New Revision: 345436
URL: https://svnweb.freebsd.org/changeset/base/345436

Log:
  MFC 344826:
  
  Round # partitions up to fill the last GPT table sector
  
  Set the number of partitions entries in the GPT header to a
  multiple of the number of entries that fit in a sector.
  
  PR:   236238
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D19465

Modified:
  stable/11/usr.bin/mkimg/gpt.c
  stable/11/usr.bin/mkimg/tests/Makefile
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu
  stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu
  stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/mkimg/gpt.c
==
--- stable/11/usr.bin/mkimg/gpt.c   Sat Mar 23 03:23:20 2019
(r345435)
+++ stable/11/usr.bin/mkimg/gpt.c   Sat Mar 23 03:37:08 2019
(r345436)
@@ -265,9 +265,9 @@ gpt_write(lba_t imgsz, void *bootcode)
le64enc(>hdr_lba_end, imgsz - tblsz - 2);
mkimg_uuid();
mkimg_uuid_enc(>hdr_uuid, );
-   le32enc(>hdr_entries, nparts);
+   le32enc(>hdr_entries, tblsz * secsz / sizeof(struct gpt_ent));
le32enc(>hdr_entsz, sizeof(struct gpt_ent));
-   crc = crc32(tbl, nparts * sizeof(struct gpt_ent));
+   crc = crc32(tbl, tblsz * secsz);
le32enc(>hdr_crc_table, crc);
error = gpt_write_hdr(hdr, 1, imgsz - 1, 2);
if (!error)

Modified: stable/11/usr.bin/mkimg/tests/Makefile
==
--- stable/11/usr.bin/mkimg/tests/Makefile  Sat Mar 23 03:23:20 2019
(r345435)
+++ stable/11/usr.bin/mkimg/tests/Makefile  Sat Mar 23 03:37:08 2019
(r345436)
@@ -18,6 +18,6 @@ $f: $f.gz.uu
 CLEANFILES+=   ${${PACKAGE}FILES}}
 
 rebase: .PHONY
-   (cd ${.CURDIR}; atf-sh ${_REBASE_SCRIPT}.sh rebase)
+   (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase)
 
 .include 

Modified: stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
==
--- stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu   Sat Mar 23 
03:23:20 2019(r345435)
+++ stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu   Sat Mar 23 
03:37:08 2019(r345436)
@@ -1,132 +1,132 @@
 # $FreeBSD$
 begin 644 img-1x1-4096-gpt.qcow.gz
-M'XL(",]Q+ED``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W+CAS7L47G
-M^HKDFVR2S8J(S*Q,OFW`!CR3C7MG]P+.Y]`HS_GQ[NH^C^ZHO1D6V!(A4"!R
-MH^IP]2I*6CH\'.[^:)I.FK9OVK'9Y^;F[],W:>[]S<-OS8^___5OU_?_^/';
-MW9@Y`3Y%N).0NQ$^1;B3D+L)/D6XDY"[
-M&3Y%N).0NP4^1;B3D+L5/D6XTY"[#3Y%N".?%_>XV^%3A#N-N!/\%.%.(^X$
-M^4X9=QIQ)\AWRKC3B#M!OE/<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D
-M.V/<6<@=\ITQ[BSD#OG.&'<6*GR+]:QET;<:?(=RWCKHNX4^2[CG'71=PI\EW'N.M"[I#O.L9=%W*'?-'
-MW"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;)R
-MAWRW,.Z6D#ODNX5QMT3<]?@IPMT2<=^6QAW2\1=CWRW,.Z6
-MB+L>^6YAW"T1=SWRW<*X6R/N>N2[E7'2O\/G@._D0+B30\@=\)T<"'=RB+@;\%.8
-M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2
-M]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO
-M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\AWK[R3L[P;D.];?2=C?C?@I
-MPEW8WXW(=ZR_D["_'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[
-M$?F.]7<2]G]8?R=A?SOO).SO)OP4X2[L[R;D
-M.];?2=C?3OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'?
-ML?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W,WZ*OO).SO
-M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z
-M.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W(=ZR_D["_FY'O6'\G87\W

svn commit: r345435 - in head/sys: conf powerpc/include powerpc/powernv powerpc/powerpc

2019-03-22 Thread Justin Hibbits
Author: jhibbits
Date: Sat Mar 23 03:23:20 2019
New Revision: 345435
URL: https://svnweb.freebsd.org/changeset/base/345435

Log:
  powernv: Add Hypervisor Maintenance Interrupt handler
  
  Attempting to build www/firefox on POWER9 resulted in a HMI exception being
  thrown, a fatal trap currently.  This is typically caused by timer facility
  errors, but examination of the Hypervisor Maintenance Exception Register
  (HMER) yielded only that an exception had recovered, with no information of
  the actual exception cause.
  
  When an HMI occurs, OPAL_HANDLE_HMI or OPAL_HANDLE_HMI2 must be called to
  handle the exception at the firmware level.  If the exception is handled, we
  can continue.
  
  This adds only the preliminary handler, enough to prevent package building
  from panicking.  An enhancement in the future is to use the flags returned
  by OPAL_HANDLE_HMI2 to print more useful error messages, and log maintenance
  events.
  
  Reviewed by:  luporl
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19634

Added:
  head/sys/powerpc/powernv/opal_hmi.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/include/spr.h
  head/sys/powerpc/include/trap.h
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powerpc/interrupt.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Sat Mar 23 03:10:23 2019(r345434)
+++ head/sys/conf/files.powerpc Sat Mar 23 03:23:20 2019(r345435)
@@ -192,6 +192,7 @@ powerpc/powernv/opal_async.coptionalpowernv
 powerpc/powernv/opal_console.c optionalpowernv
 powerpc/powernv/opal_dev.c optionalpowernv
 powerpc/powernv/opal_flash.c   optionalpowernv
+powerpc/powernv/opal_hmi.c optionalpowernv
 powerpc/powernv/opal_i2c.c optionaliicbus fdt powernv
 powerpc/powernv/opal_i2cm.coptionaliicbus fdt powernv
 powerpc/powernv/opal_pci.c optionalpowernv pci

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Sat Mar 23 03:10:23 2019
(r345434)
+++ head/sys/powerpc/include/spr.h  Sat Mar 23 03:23:20 2019
(r345435)
@@ -242,6 +242,8 @@
 #define  LPCR_PECE_ME(1ULL << 12) /* Machine Check and 
Hypervisor */
/* Maintenance exceptions */
 #defineSPR_LPID0x13f   /* Logical Partitioning Control 
*/
+#defineSPR_HMER0x150   /* Hypervisor Maintenance 
Exception Register */
+#defineSPR_HMEER   0x151   /* Hypervisor Maintenance 
Exception Enable Register */
 
 #defineSPR_PTCR0x1d0   /* Partition Table Control 
Register */
 #defineSPR_SPEFSCR 0x200   /* ..8 Signal Processing Engine 
FSCR. */

Modified: head/sys/powerpc/include/trap.h
==
--- head/sys/powerpc/include/trap.h Sat Mar 23 03:10:23 2019
(r345434)
+++ head/sys/powerpc/include/trap.h Sat Mar 23 03:23:20 2019
(r345435)
@@ -153,6 +153,7 @@
 #ifndef LOCORE
 struct trapframe;
 struct pcb;
+extern int (*hmi_handler)(struct trapframe *);
 voidtrap(struct trapframe *);
 intppc_instr_emulate(struct trapframe *, struct pcb *);
 #endif

Modified: head/sys/powerpc/powernv/opal.h
==
--- head/sys/powerpc/powernv/opal.h Sat Mar 23 03:10:23 2019
(r345434)
+++ head/sys/powerpc/powernv/opal.h Sat Mar 23 03:23:20 2019
(r345435)
@@ -71,8 +71,10 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45
 #defineOPAL_RETURN_CPU 69
 #defineOPAL_REINIT_CPUS70
+#defineOPAL_CHECK_TOKEN80
 #defineOPAL_CHECK_ASYNC_COMPLETION 86
 #defineOPAL_SENSOR_READ88
+#defineOPAL_HANDLE_HMI 98
 #defineOPAL_IPMI_SEND  107
 #defineOPAL_IPMI_RECV  108
 #defineOPAL_I2C_REQUEST109
@@ -102,6 +104,7 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_SENSOR_GROUP_CLEAR 156
 #defineOPAL_SENSOR_READ_U64162
 #defineOPAL_SENSOR_GROUP_ENABLE163
+#defineOPAL_HANDLE_HMI2166
 
 /* For OPAL_PCI_SET_PE */
 #defineOPAL_UNMAP_PE   0
@@ -133,6 +136,15 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_EMPTY  -16
 #defineOPAL_XIVE_PROVISIONING  -31
 #defineOPAL_XIVE_FREE_ACTIVE   -32
+
+#defineOPAL_TOKEN_ABSENT   0

svn commit: r345434 - stable/11/sys/geom/part

2019-03-22 Thread Marcel Moolenaar
Author: marcel
Date: Sat Mar 23 03:10:23 2019
New Revision: 345434
URL: https://svnweb.freebsd.org/changeset/base/345434

Log:
  MFC 344790:
  
  Revert revision 254095
  
  In revision 254095, gpt_entries is not set to match the on-disk
  hdr_entries, but rather is computed based on available space.
  There are 2 problems with this:
  
  1.  The GPT backend respects hdr_entries and only reads and writes
  that number of partition entries.  On top of that, CRC32 is
  computed over the table that has hdr_entries elements.  When
  the common code works on what is possibly a larger number, the
  behaviour becomes inconsistent and problematic.  In particular,
  it would be possible to add a new partition that on a reboot
  isn't there anymore.
  2.  The calculation of gpt_entries is based on flawed assumptions.
  The GPT specification does not dictate that sectors are layed
  out in a particular way that the available space can be
  determined by looking at LBAs.  In practice, implementations
  do the same thing, because there's no reason to do it any
  other way.  Still, GPT allows certain freedoms that can be
  exploited in some form or shape if the need arises.
  
  PR:   229977
  Differential Revision:https://reviews.freebsd.org/D19438

Modified:
  stable/11/sys/geom/part/g_part_gpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/part/g_part_gpt.c
==
--- stable/11/sys/geom/part/g_part_gpt.cSat Mar 23 02:53:47 2019
(r345433)
+++ stable/11/sys/geom/part/g_part_gpt.cSat Mar 23 03:10:23 2019
(r345434)
@@ -978,10 +978,9 @@ g_part_gpt_read(struct g_part_table *basetable, struct
 
basetable->gpt_first = table->hdr->hdr_lba_start;
basetable->gpt_last = table->hdr->hdr_lba_end;
-   basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) *
-   pp->sectorsize / table->hdr->hdr_entsz;
+   basetable->gpt_entries = table->hdr->hdr_entries;
 
-   for (index = table->hdr->hdr_entries - 1; index >= 0; index--) {
+   for (index = basetable->gpt_entries - 1; index >= 0; index--) {
if (EQUUID([index].ent_type, _uuid_unused))
continue;
entry = (struct g_part_gpt_entry *)g_part_new_entry(
___
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: r345432 - in head/sys/dev: etherswitch/e6000sw neta

2019-03-22 Thread Marcin Wojtas
Author: mw
Date: Sat Mar 23 02:48:47 2019
New Revision: 345432
URL: https://svnweb.freebsd.org/changeset/base/345432

Log:
  Update mvneta/e6000sw for new DSA Device Tree Bindings
  
  In the latest Linux kernel revisions the DSA (Distributed
  Switch Architecture) device tree binding was changed.
  Instead of the top level dsa@ node, the switch and its
  ports is represented as a child node of the mdio bus.
  With that other modifications were added, such as
  relation with the ethernet port of the SoC. Adjust
  e6000sw etherswitch and mvneta drivers to that.
  
  Tested on Armada 3720 EspressoBin and Armada 388 Clearfog Pro boards.
  
  Submitted by: Bert JW Regeer 
  Reviewed by: manu
  Differential Revision: https://reviews.freebsd.org/D19036

Modified:
  head/sys/dev/etherswitch/e6000sw/e6000sw.c
  head/sys/dev/neta/if_mvneta.c

Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c
==
--- head/sys/dev/etherswitch/e6000sw/e6000sw.c  Sat Mar 23 02:17:07 2019
(r345431)
+++ head/sys/dev/etherswitch/e6000sw/e6000sw.c  Sat Mar 23 02:48:47 2019
(r345432)
@@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
+#include 
 
 #include "e6000swreg.h"
 #include "etherswitch_if.h"
@@ -92,6 +92,8 @@ static etherswitch_info_t etherswitch_info = {
 
 static void e6000sw_identify(driver_t *, device_t);
 static int e6000sw_probe(device_t);
+static int e6000sw_parse_fixed_link(e6000sw_softc_t *, phandle_t, uint32_t);
+static int e6000sw_parse_ethernet(e6000sw_softc_t *, phandle_t, uint32_t);
 static int e6000sw_attach(device_t);
 static int e6000sw_detach(device_t);
 static int e6000sw_readphy(device_t, int, int);
@@ -197,15 +199,17 @@ e6000sw_probe(device_t dev)
 {
e6000sw_softc_t *sc;
const char *description;
-   phandle_t dsa_node, switch_node;
+   phandle_t switch_node;
 
-   dsa_node = fdt_find_compatible(OF_finddevice("/"),
-   "marvell,dsa", 0);
-   switch_node = OF_child(dsa_node);
+   switch_node = ofw_bus_find_compatible(OF_finddevice("/"),
+   "marvell,mv88e6085");
 
if (switch_node == 0)
return (ENXIO);
 
+   if (bootverbose)
+   device_printf(dev, "Found switch_node: 0x%x\n", switch_node);
+
sc = device_get_softc(dev);
sc->dev = dev;
sc->node = switch_node;
@@ -214,8 +218,12 @@ e6000sw_probe(device_t dev)
sizeof(sc->sw_addr)) < 0)
return (ENXIO);
 
-   if (!OF_hasprop(sc->node, "single-chip-addressing") &&
-   (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0))
+   /*
+* According to the Linux source code, all of the Switch IDs we support
+* are multi_chip capable, and should go into multi-chip mode if the
+* sw_addr != 0.
+*/
+   if (!OF_hasprop(sc->node, "single-chip-addressing") && sc->sw_addr != 0)
sc->multi_chip = true;
 
/*
@@ -262,11 +270,58 @@ e6000sw_probe(device_t dev)
 }
 
 static int
-e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport)
+e6000sw_parse_fixed_link(e6000sw_softc_t *sc, phandle_t node, uint32_t port)
 {
-   char *name, *portlabel;
int speed;
phandle_t fixed_link;
+
+   fixed_link = ofw_bus_find_child(node, "fixed-link");
+
+   if (fixed_link != 0) {
+   sc->fixed_mask |= (1 << port);
+
+   if (OF_getencprop(fixed_link, "speed", , sizeof(speed))> 
0) {
+   if (speed == 2500 &&
+   (MVSWITCH(sc, MV88E6141) ||
+MVSWITCH(sc, MV88E6341)))
+   sc->fixed25_mask |= (1 << port);
+   } else {
+   device_printf(sc->dev,
+   "Port %d has a fixed-link node without a speed "
+   "property\n", port);
+
+   return (ENXIO);
+   }
+   }
+
+   return (0);
+}
+
+static int
+e6000sw_parse_ethernet(e6000sw_softc_t *sc, phandle_t port_handle, uint32_t 
port) {
+   phandle_t switch_eth, switch_eth_handle;
+
+   if (OF_getencprop(port_handle, "ethernet", (void*)_eth_handle,
+   sizeof(switch_eth_handle)) > 0) {
+   if (switch_eth_handle > 0) {
+   switch_eth = OF_node_from_xref(switch_eth_handle);
+
+   device_printf(sc->dev, "CPU port at %d\n", port);
+   sc->cpuports_mask |= (1 << port);
+
+   return (e6000sw_parse_fixed_link(sc, switch_eth, port));
+   } else
+   device_printf(sc->dev,
+   "Port %d has ethernet property but it points "
+   "to an invalid location\n", port);
+   }
+
+   return (0);
+}
+
+static int
+e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport)
+{

svn commit: r345431 - head/contrib/elftoolchain/strings

2019-03-22 Thread Mariusz Zaborski
Author: oshogbo
Date: Sat Mar 23 02:17:07 2019
New Revision: 345431
URL: https://svnweb.freebsd.org/changeset/base/345431

Log:
  strings: return an error code and the char value separately
  
  If we returning 32 bits value it's hard to distinguish if the returned value
  is a valid one or if its an error (in case of EOF). For that reason separate
  exit code of the function from the returned character.
  
  Reported by:  cem, se

Modified:
  head/contrib/elftoolchain/strings/strings.c

Modified: head/contrib/elftoolchain/strings/strings.c
==
--- head/contrib/elftoolchain/strings/strings.c Sat Mar 23 01:07:51 2019
(r345430)
+++ head/contrib/elftoolchain/strings/strings.c Sat Mar 23 02:17:07 2019
(r345431)
@@ -84,7 +84,7 @@ static struct option strings_longopts[] = {
{ NULL, 0, NULL, 0 }
 };
 
-long   getcharacter(FILE *);
+intgetcharacter(FILE *, long *);
 inthandle_file(const char *);
 inthandle_elf(const char *, FILE *);
 inthandle_binary(const char *, FILE *, size_t);
@@ -291,42 +291,43 @@ handle_elf(const char *name, FILE *pfile)
  * Retrieves a character from input stream based on the encoding
  * type requested.
  */
-long
-getcharacter(FILE *pfile)
+int
+getcharacter(FILE *pfile, long *rt)
 {
-   long rt;
int i, c;
char buf[4];
 
for(i = 0; i < encoding_size; i++) {
c = getc(pfile);
if (c == EOF)
-   return (EOF);
+   return (-1);
buf[i] = c;
}
 
-   rt = EOF;
switch (encoding) {
case ENCODING_7BIT:
case ENCODING_8BIT:
-   rt = buf[0];
+   *rt = buf[0];
break;
case ENCODING_16BIT_BIG:
-   rt = (buf[0] << 8) | buf[1];
+   *rt = (buf[0] << 8) | buf[1];
break;
case ENCODING_16BIT_LITTLE:
-rt = buf[0] | (buf[1] << 8);
-break;
+   *rt = buf[0] | (buf[1] << 8);
+   break;
case ENCODING_32BIT_BIG:
-   rt = ((long) buf[0] << 24) | ((long) buf[1] << 16) |
+   *rt = ((long) buf[0] << 24) | ((long) buf[1] << 16) |
((long) buf[2] << 8) | buf[3];
break;
case ENCODING_32BIT_LITTLE:
-   rt = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) |
+   *rt = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) |
((long) buf[3] << 24);
break;
+   default:
+   return (-1);
}
-   return (rt);
+
+   return (0);
 }
 
 /*
@@ -357,8 +358,7 @@ find_strings(const char *name, FILE *pfile, off_t offs
start_off = cur_off;
memset(obuf, 0, min_len + 1);
for(i = 0; i < min_len; i++) {
-   c = getcharacter(pfile);
-   if (c == EOF)
+   if (getcharacter(pfile, ) < 0)
goto _exit1;
if (PRINTABLE(c)) {
obuf[i] = c;
@@ -400,15 +400,16 @@ find_strings(const char *name, FILE *pfile, off_t offs
if ((offset + size) &&
(cur_off >= offset + size))
break;
-   c = getcharacter(pfile);
-   cur_off += encoding_size;
-   if (!PRINTABLE(c) || c == EOF)
+   if (getcharacter(pfile, ) < 0)
break;
+   cur_off += encoding_size;
if (encoding == ENCODING_8BIT &&
(uint8_t)c > 127) {
putchar(c);
continue;
}
+   if (!PRINTABLE(c))
+   break;
putchar(c);
}
putchar('\n');
___
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: r345433 - head/sys/arm64/conf

2019-03-22 Thread Marcin Wojtas
Author: mw
Date: Sat Mar 23 02:53:47 2019
New Revision: 345433
URL: https://svnweb.freebsd.org/changeset/base/345433

Log:
  Enable etherswitchcfg and e6000sw driver in arm64 build
  
  After latest binding update, this patch enables usage of
  the switch on Armada 3720 EspressoBin, so compile it
  by default with arm64 GENERIC.
  
  A patch was extracted from https://reviews.freebsd.org/D19036
  
  Submitted by: Bert JW Regeer 
  Reviewed by: manu

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sat Mar 23 02:48:47 2019(r345432)
+++ head/sys/arm64/conf/GENERIC Sat Mar 23 02:53:47 2019(r345433)
@@ -163,6 +163,11 @@ device vnic# Cavium ThunderX NIC
 device al_eth  # Annapurna Alpine Ethernet NIC
 device dwc_rk  # Rockchip Designware
 
+# Etherswitch devices
+device etherswitch # Enable etherswitch support
+device miiproxy# Required for etherswitch
+device e6000sw # Marvell mv88e6085 based switches
+
 # Block devices
 device ahci
 device scbus
___
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: r345430 - head/tests/sys/netpfil/pf

2019-03-22 Thread Kristof Provost
Author: kp
Date: Sat Mar 23 01:07:51 2019
New Revision: 345430
URL: https://svnweb.freebsd.org/changeset/base/345430

Log:
  pf tests: Fix accidental duplication of content
  
  Also use the correct name for the scapy test script.

Modified:
  head/tests/sys/netpfil/pf/icmp.sh

Modified: head/tests/sys/netpfil/pf/icmp.sh
==
--- head/tests/sys/netpfil/pf/icmp.sh   Sat Mar 23 00:22:29 2019
(r345429)
+++ head/tests/sys/netpfil/pf/icmp.sh   Sat Mar 23 01:07:51 2019
(r345430)
@@ -32,56 +32,7 @@ cve_2019_5598_body()
"pass in proto udp to 198.51.100.3 port 53" \
"pass out proto udp to 198.51.100.3 port 53"
 
-   atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \
-   --sendif ${epair_in}a \
-   --recvif ${epair_out}a \
-   --src 192.0.2.1 \
-   --to 198.51.100.3
-}
-
-cve_2019_5598_cleanup()
-{
-   pft_cleanup
-}
-
-atf_init_test_cases()
-{
-   atf_add_test_case "cve_2019_5598"
-}
-# $FreeBSD$
-
-. $(atf_get_srcdir)/utils.subr
-
-atf_test_case "cve_2019_5598" "cleanup"
-cve_2019_5598_head()
-{
-   atf_set descr 'Test CVE-2019-5598'
-   atf_set require.user root
-   atf_set require.progs scapy
-}
-
-cve_2019_5598_body()
-{
-   pft_init
-
-   epair_in=$(vnet_mkepair)
-   epair_out=$(vnet_mkepair)
-   ifconfig ${epair_in}a 192.0.2.1/24 up
-   ifconfig ${epair_out}a up
-
-   vnet_mkjail alcatraz ${epair_in}b ${epair_out}b
-   jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up
-   jexec alcatraz ifconfig ${epair_out}b 198.51.100.2/24 up
-   jexec alcatraz sysctl net.inet.ip.forwarding=1
-   jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05
-   route add -net 198.51.100.0/24 192.0.2.2
-
-   jexec alcatraz pfctl -e
-   pft_set_rules alcatraz "block all" \
-   "pass in proto udp to 198.51.100.3 port 53" \
-   "pass out proto udp to 198.51.100.3 port 53"
-
-   atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \
+   atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-5598.py \
--sendif ${epair_in}a \
--recvif ${epair_out}a \
--src 192.0.2.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: r345428 - in stable/12/usr.bin/mkimg: . tests

2019-03-22 Thread Marcel Moolenaar
Author: marcel
Date: Fri Mar 22 23:55:35 2019
New Revision: 345428
URL: https://svnweb.freebsd.org/changeset/base/345428

Log:
  MFC 344826:
  
  Round # partitions up to fill the last GPT table sector
  
  Set the number of partitions entries in the GPT header to a
  multiple of the number of entries that fit in a sector.
  
  PR:   236238
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D19465

Modified:
  stable/12/usr.bin/mkimg/gpt.c
  stable/12/usr.bin/mkimg/tests/Makefile
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu
  stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu
  stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/mkimg/gpt.c
==
--- stable/12/usr.bin/mkimg/gpt.c   Fri Mar 22 23:39:16 2019
(r345427)
+++ stable/12/usr.bin/mkimg/gpt.c   Fri Mar 22 23:55:35 2019
(r345428)
@@ -259,9 +259,9 @@ gpt_write(lba_t imgsz, void *bootcode)
le64enc(>hdr_lba_end, imgsz - tblsz - 2);
mkimg_uuid();
mkimg_uuid_enc(>hdr_uuid, );
-   le32enc(>hdr_entries, nparts);
+   le32enc(>hdr_entries, tblsz * secsz / sizeof(struct gpt_ent));
le32enc(>hdr_entsz, sizeof(struct gpt_ent));
-   crc = crc32(tbl, nparts * sizeof(struct gpt_ent));
+   crc = crc32(tbl, tblsz * secsz);
le32enc(>hdr_crc_table, crc);
error = gpt_write_hdr(hdr, 1, imgsz - 1, 2);
if (!error)

Modified: stable/12/usr.bin/mkimg/tests/Makefile
==
--- stable/12/usr.bin/mkimg/tests/Makefile  Fri Mar 22 23:39:16 2019
(r345427)
+++ stable/12/usr.bin/mkimg/tests/Makefile  Fri Mar 22 23:55:35 2019
(r345428)
@@ -18,6 +18,6 @@ $f: $f.gz.uu
 CLEANFILES+=   ${${PACKAGE}FILES}}
 
 rebase: .PHONY
-   (cd ${.CURDIR}; atf-sh ${_REBASE_SCRIPT}.sh rebase)
+   (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase)
 
 .include 

Modified: stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu
==
--- stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu   Fri Mar 22 
23:39:16 2019(r345427)
+++ stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu   Fri Mar 22 
23:55:35 2019(r345428)
@@ -1,132 +1,132 @@
 # $FreeBSD$
 begin 644 img-1x1-4096-gpt.qcow.gz
-M'XL(",]Q+ED``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W+CAS7L47G
-M^HKDFVR2S8J(S*Q,OFW`!CR3C7MG]P+.Y]`HS_GQ[NH^C^ZHO1D6V!(A4"!R
-MH^IP]2I*6CH\'.[^:)I.FK9OVK'9Y^;F[],W:>[]S<-OS8^___5OU_?_^/';
-MW9@Y`3Y%N).0NQ$^1;B3D+L)/D6XDY"[
-M&3Y%N).0NP4^1;B3D+L5/D6XTY"[#3Y%N".?%_>XV^%3A#N-N!/\%.%.(^X$
-M^4X9=QIQ)\AWRKC3B#M!OE/<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D
-M.V/<6<@=\ITQ[BSD#OG.&'<6*GR+]:QET;<:?(=RWCKHNX4^2[CG'71=PI\EW'N.M"[I#O.L9=%W*'?-'
-MW"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;)R
-MAWRW,.Z6D#ODNX5QMT3<]?@IPMT2<=^6QAW2\1=CWRW,.Z6
-MB+L>^6YAW"T1=SWRW<*X6R/N>N2[E7'2O\/G@._D0+B30\@=\)T<"'=RB+@;\%.8
-M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2
-M]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO
-M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\AWK[R3L[P;D.];?2=C?C?@I
-MPEW8WXW(=ZR_D["_'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[
-M$?F.]7<2]G]8?R=A?SOO).SO)OP4X2[L[R;D
-M.];?2=C?3OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'?
-ML?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W,WZ*OO).SO
-M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z
-M.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W(=ZR_D["_FY'O6'\G87\W

svn commit: r345427 - stable/12/sys/geom/part

2019-03-22 Thread Marcel Moolenaar
Author: marcel
Date: Fri Mar 22 23:39:16 2019
New Revision: 345427
URL: https://svnweb.freebsd.org/changeset/base/345427

Log:
  MFC 344790:
  
  Revert revision 254095
  
  In revision 254095, gpt_entries is not set to match the on-disk
  hdr_entries, but rather is computed based on available space.
  There are 2 problems with this:
  
  1.  The GPT backend respects hdr_entries and only reads and writes
  that number of partition entries.  On top of that, CRC32 is
  computed over the table that has hdr_entries elements.  When
  the common code works on what is possibly a larger number, the
  behaviour becomes inconsistent and problematic.  In particular,
  it would be possible to add a new partition that on a reboot
  isn't there anymore.
  2.  The calculation of gpt_entries is based on flawed assumptions.
  The GPT specification does not dictate that sectors are layed
  out in a particular way that the available space can be
  determined by looking at LBAs.  In practice, implementations
  do the same thing, because there's no reason to do it any
  other way.  Still, GPT allows certain freedoms that can be
  exploited in some form or shape if the need arises.
  
  PR:   229977
  Differential Revision:https://reviews.freebsd.org/D19438

Modified:
  stable/12/sys/geom/part/g_part_gpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/geom/part/g_part_gpt.c
==
--- stable/12/sys/geom/part/g_part_gpt.cFri Mar 22 22:14:14 2019
(r345426)
+++ stable/12/sys/geom/part/g_part_gpt.cFri Mar 22 23:39:16 2019
(r345427)
@@ -990,10 +990,9 @@ g_part_gpt_read(struct g_part_table *basetable, struct
 
basetable->gpt_first = table->hdr->hdr_lba_start;
basetable->gpt_last = table->hdr->hdr_lba_end;
-   basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) *
-   pp->sectorsize / table->hdr->hdr_entsz;
+   basetable->gpt_entries = table->hdr->hdr_entries;
 
-   for (index = table->hdr->hdr_entries - 1; index >= 0; index--) {
+   for (index = basetable->gpt_entries - 1; index >= 0; index--) {
if (EQUUID([index].ent_type, _uuid_unused))
continue;
entry = (struct g_part_gpt_entry *)g_part_new_entry(
___
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: r345426 - in head/sys: conf powerpc/aim

2019-03-22 Thread Justin Hibbits
Author: jhibbits
Date: Fri Mar 22 22:14:14 2019
New Revision: 345426
URL: https://svnweb.freebsd.org/changeset/base/345426

Log:
  powerpc: Re-merge isa3 HPT with moea64 native HPT
  
  r345402 fixed the bug that led to the split of the ISA 3.0 HPT handling from
  the existing manager.  The cause of the bug was gcc moving the register
  holding VPN to a different register (not r0), which triggered bizarre
  behaviors.  With the fix, things work, so they can be re-merged.  No
  performance lost with the merge.

Deleted:
  head/sys/powerpc/aim/isa3_hashtb.c
Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/aim/aim_machdep.c
  head/sys/powerpc/aim/moea64_native.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Fri Mar 22 21:31:21 2019(r345425)
+++ head/sys/conf/files.powerpc Fri Mar 22 22:14:14 2019(r345426)
@@ -103,7 +103,6 @@ libkern/qdivrem.c   optionalpowerpc | 
powerpcspe
 libkern/ucmpdi2.c  optionalpowerpc | powerpcspe
 libkern/udivdi3.c  optionalpowerpc | powerpcspe
 libkern/umoddi3.c  optionalpowerpc | powerpcspe
-powerpc/aim/isa3_hashtb.c  optionalaim powerpc64
 powerpc/aim/locore.S   optionalaim no-obj
 powerpc/aim/aim_machdep.c  optionalaim
 powerpc/aim/mmu_oea.c  optionalaim powerpc

Modified: head/sys/powerpc/aim/aim_machdep.c
==
--- head/sys/powerpc/aim/aim_machdep.c  Fri Mar 22 21:31:21 2019
(r345425)
+++ head/sys/powerpc/aim/aim_machdep.c  Fri Mar 22 22:14:14 2019
(r345426)
@@ -421,9 +421,7 @@ aim_cpu_init(vm_offset_t toc)
 * in case the platform module had a better idea of what we
 * should do.
 */
-   if (cpu_features2 & PPC_FEATURE2_ARCH_3_00)
-   pmap_mmu_install(MMU_TYPE_P9H, BUS_PROBE_GENERIC);
-   else if (cpu_features & PPC_FEATURE_64)
+   if (cpu_features & PPC_FEATURE_64)
pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC);
else
pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC);

Modified: head/sys/powerpc/aim/moea64_native.c
==
--- head/sys/powerpc/aim/moea64_native.cFri Mar 22 21:31:21 2019
(r345425)
+++ head/sys/powerpc/aim/moea64_native.cFri Mar 22 22:14:14 2019
(r345426)
@@ -134,7 +134,8 @@ __FBSDID("$FreeBSD$");
 /* POWER9 only permits a 64k partition table size. */
 #definePART_SIZE   0x1
 
-static int moea64_crop_tlbie;
+static bool moea64_crop_tlbie;
+static bool moea64_need_lock;
 
 static __inline void
 TLBIE(uint64_t vpn) {
@@ -149,14 +150,26 @@ TLBIE(uint64_t vpn) {
vpn <<= ADDR_PIDX_SHFT;
 
/* Hobo spinlock: we need stronger guarantees than mutexes provide */
-   while (!atomic_cmpset_int(_lock, 0, 1));
-   isync(); /* Flush instruction queue once lock acquired */
+   if (moea64_need_lock) {
+   while (!atomic_cmpset_int(_lock, 0, 1));
+   isync(); /* Flush instruction queue once lock acquired */
+   }
 
if (moea64_crop_tlbie)
vpn &= ~(0xULL << 48);
 
 #ifdef __powerpc64__
-   __asm __volatile("li 0, 0; tlbie %0" :: "r"(vpn) : "0","memory");
+   /*
+* Explicitly clobber r0.  The tlbie instruction has two forms: an old
+* one used by PowerISA 2.03 and prior, and a newer one used by PowerISA
+* 2.06 (maybe 2.05?) and later.  We need to support both, and it just
+* so happens that since we use 4k pages we can simply zero out r0, and
+* clobber it, and the assembler will interpret the single-operand form
+* of tlbie as having RB set, and everything else as 0.  The RS operand
+* in the newer form is in the same position as the L(page size) bit of
+* the old form, so a slong as RS is 0, we're good on both sides.
+*/
+   __asm __volatile("li 0, 0 \n tlbie %0" :: "r"(vpn) : "r0", "memory");
__asm __volatile("eieio; tlbsync; ptesync" ::: "memory");
 #else
vpn_hi = (uint32_t)(vpn >> 32);
@@ -183,7 +196,8 @@ TLBIE(uint64_t vpn) {
 #endif
 
/* No barriers or special ops -- taken care of by ptesync above */
-   tlbie_lock = 0;
+   if (moea64_need_lock)
+   tlbie_lock = 0;
 }
 
 #define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR)
@@ -195,6 +209,8 @@ TLBIE(uint64_t vpn) {
 static volatile struct lpte *moea64_pteg_table;
 static struct rwlock moea64_eviction_lock;
 
+static volatile struct pate *moea64_part_table;
+
 /*
  * PTE calls.
  */
@@ -409,9 +425,14 @@ moea64_cpu_bootstrap_native(mmu_t mmup, int ap)
 * Install page table
 */
 
-   __asm __volatile ("ptesync; mtsdr1 %0; isync"
- 

svn commit: r345425 - head/sys/fs/tmpfs

2019-03-22 Thread Maxim Sobolev
Author: sobomax
Date: Fri Mar 22 21:31:21 2019
New Revision: 345425
URL: https://svnweb.freebsd.org/changeset/base/345425

Log:
  Make it possible to update TMPFS mount point from read-only to read-write
  and vice versa.
  
  Reviewed by:  delphij
  Approved by:  delphij
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D19682

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_vfsops.c

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Fri Mar 22 19:43:50 2019(r345424)
+++ head/sys/fs/tmpfs/tmpfs.h   Fri Mar 22 21:31:21 2019(r345425)
@@ -325,6 +325,11 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node);
  */
 struct tmpfs_mount {
/*
+* Original value of the "size" parameter, for reference purposes,
+* mostly.
+*/
+   off_t   tm_size_max;
+   /*
 * Maximum number of memory pages available for use by the file
 * system, set during mount time.  This variable must never be
 * used directly as it may be bigger than the current amount of

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cFri Mar 22 19:43:50 2019
(r345424)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cFri Mar 22 21:31:21 2019
(r345425)
@@ -88,7 +88,7 @@ static const char *tmpfs_opts[] = {
 };
 
 static const char *tmpfs_updateopts[] = {
-   "from", "export", NULL
+   "from", "export", "size", NULL
 };
 
 static int
@@ -134,6 +134,8 @@ tmpfs_node_fini(void *mem, int size)
mtx_destroy(>tn_interlock);
 }
 
+#define TMPFS_SC(mp) ((struct tmpfs_mount *)(mp)->mnt_data)
+
 static int
 tmpfs_mount(struct mount *mp)
 {
@@ -141,7 +143,7 @@ tmpfs_mount(struct mount *mp)
sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node));
struct tmpfs_mount *tmp;
struct tmpfs_node *root;
-   int error;
+   int error, flags;
bool nonc;
/* Size counters. */
u_quad_t pages;
@@ -161,9 +163,41 @@ tmpfs_mount(struct mount *mp)
/* Only support update mounts for certain options. */
if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
return (EOPNOTSUPP);
-   if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) !=
-   ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly)
-   return (EOPNOTSUPP);
+   if (vfs_getopt_size(mp->mnt_optnew, "size", _max) == 0) {
+   /*
+* On-the-fly resizing is not supported (yet). We still
+* need to have "size" listed as "supported", otherwise
+* trying to update fs that is listed in fstab with size
+* parameter, say trying to change rw to ro or vice
+* versa, would cause vfs_filteropt() to bail.
+*/
+   if (size_max != TMPFS_SC(mp)->tm_size_max)
+   return (EOPNOTSUPP);
+   }
+   if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
+   !(TMPFS_SC(mp)->tm_ronly)) {
+   /* RW -> RO */
+   error = VFS_SYNC(mp, MNT_WAIT);
+   if (error)
+   return (error);
+   flags = WRITECLOSE;
+   if (mp->mnt_flag & MNT_FORCE)
+   flags |= FORCECLOSE;
+   error = vflush(mp, 0, flags, curthread);
+   if (error)
+   return (error);
+   TMPFS_SC(mp)->tm_ronly = 1;
+   MNT_ILOCK(mp);
+   mp->mnt_flag |= MNT_RDONLY;
+   MNT_IUNLOCK(mp);
+   } else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
+   TMPFS_SC(mp)->tm_ronly) {
+   /* RO -> RW */
+   TMPFS_SC(mp)->tm_ronly = 0;
+   MNT_ILOCK(mp);
+   mp->mnt_flag &= ~MNT_RDONLY;
+   MNT_IUNLOCK(mp);
+   }
return (0);
}
 
@@ -229,6 +263,7 @@ tmpfs_mount(struct mount *mp)
tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX;
LIST_INIT(>tm_nodes_used);
 
+   tmp->tm_size_max = size_max;
tmp->tm_pages_max = pages;
tmp->tm_pages_used = 0;
new_unrhdr64(>tm_ino_unr, 2);
___
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: r345418 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-03-22 Thread Andriy Gapon
Author: avg
Date: Fri Mar 22 17:44:47 2019
New Revision: 345418
URL: https://svnweb.freebsd.org/changeset/base/345418

Log:
  Revert r345410, VOP_FSYNC change in ZFS vdev_file
  
  I overlooked the fact that that VOP_FSYNC() call is not a FreeBSD VFS
  call, but a macro that provides an illumos-compatible wrapper for the
  FreeBSD operation.
  
  PR:   236475
  Reported by:  lwhsu
  Pointyhat to: avg

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 
22 17:37:14 2019(r345417)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 
22 17:44:47 2019(r345418)
@@ -239,13 +239,8 @@ vdev_file_io_start(zio_t *zio)
 
switch (zio->io_cmd) {
case DKIOCFLUSHWRITECACHE:
-#ifdef illumos
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
kcred, NULL);
-#else
-   zio->io_error = VOP_FSYNC(vf->vf_vnode, MNT_WAIT,
-   kcred, NULL);
-#endif
break;
default:
zio->io_error = SET_ERROR(ENOTSUP);
___
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: r345417 - in head: share/misc usr.bin/calendar/calendars

2019-03-22 Thread Mitchell Horne
Author: mhorne
Date: Fri Mar 22 17:37:14 2019
New Revision: 345417
URL: https://svnweb.freebsd.org/changeset/base/345417

Log:
  Update mentor and calendar files
  
  Add an entry for myself (mhorne) to these files.
  
  Approved by:  markj

Modified:
  head/share/misc/committers-src.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Mar 22 16:19:37 2019
(r345416)
+++ head/share/misc/committers-src.dot  Fri Mar 22 17:37:14 2019
(r345417)
@@ -254,6 +254,7 @@ maxim [label="Maxim Konovalov\nma...@freebsd.org\n2002
 mdf [label="Matthew Fleming\n...@freebsd.org\n2010/06/04"]
 mdodd [label="Matthew N. Dodd\nmd...@freebsd.org\n1999/07/27"]
 melifaro [label="Alexander V. Chernikov\nmelif...@freebsd.org\n2011/10/04"]
+mhorne [label="Mitchell Horne\nmho...@freebsd.org\n2019/03/20"]
 miwi [label="Martin Wilke\nm...@freebsd.org\n2011/02/18\n2018/06/14"]
 mizhka [label="Michael Zhilin\nmiz...@freebsd.org\n2016/07/19"]
 mjacob [label="Matt Jacob\nmja...@freebsd.org\n1997/08/13"]
@@ -693,6 +694,7 @@ marcel -> sjg
 
 markj -> cem
 markj -> lwhsu
+markj -> mhorne
 markj -> rlibby
 
 markm -> jasone

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdFri Mar 22 16:19:37 
2019(r345416)
+++ head/usr.bin/calendar/calendars/calendar.freebsdFri Mar 22 17:37:14 
2019(r345417)
@@ -35,6 +35,7 @@
 01/19  Marcelo S. Araujo  born in Joinville, Santa 
Catarina, Brazil, 1981
 01/20  Poul-Henning Kamp  born in Korsoer, Denmark, 1966
 01/21  Mahdi Mokhtari  born in Tehran, Iran, 1995
+01/21  Mitchell Horne  born in Toronto, Ontario, Canada, 
1997
 01/22  Johann Visagie  born in Cape Town, South Africa, 1970
 01/23  Hideyuki KURASHINA  born in Niigata, Japan, 1982
 01/24  Fabien Thomas  born in Avignon, France, 1971
___
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: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386

2019-03-22 Thread Bruce Evans

On Thu, 21 Mar 2019, Mark Johnston wrote:


On Thu, Mar 21, 2019 at 10:44:49PM +1100, Bruce Evans wrote:

On Wed, 20 Mar 2019, Mark Johnston wrote:


On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote:

Author: markj
Date: Thu Mar 21 02:52:22 2019
New Revision: 345359
URL: https://svnweb.freebsd.org/changeset/base/345359

Log:
  Don't attempt to measure TSC skew when running as a VM guest.

  It simply doesn't work in general since VCPUs may migrate between
  physical cores.  The approach used to measure skew also doesn't
  make much sense in a VM.


I think it simply doesn't work.
...
The method is bogus (buggy) out of a VM.

XX static void
XX dtrace_gethrtime_init(void *arg)
XX {
XX  struct pcpu *pc;
XX  cpuset_t map;
XX  int i;
XX #endif
XX
XX  /* The current CPU is the reference one. */
XX  sched_pin();

It is also necessary to disable interrupts in hardware.  Or maybe better
and necessary, detect when they occur and discard related samples.  It
is impossible to disable NMIs.


Not quite, just carry out the measurement from an NMI handler. :)


:-)

I can break that by single-stepping it in ddb.  That is similar to emulation
wit random large stretching of cycles.


I plan to try a variation of this: all CPUs spin reading the TSC and
appending the result atomically to a log buffer.  Then analyze the results.
With no skew or interrupts, it is expected that the results are almost
monotonic.  Contention causes non-monotonicity only occasionally.  The
average non-mononicity should be 0.  If there is significant skew, then
the order for the sameples form each pair of CPUs will reverse on almost
every second reading.  The skew is the adjustment needed to stop this
reversal.


I tried this.

The free-running method sort of works, but it is better to serialize
everything.  The result of the serialization is essentially the same as
in the fixed tscdrift, though I used a log buffer index instead of a
gate variable to synchronize.

The method is to calculate the serialization latency in both directions,
with each direction using identically code and hopefully identical CPU
state after warming up caches.  The skew is then the difference of the
latency divided by 2.  Oops, I forgot to divide by 2.  This gives the
following output on i4790K:

XX |   CPUs  |  latij |  latji |   skew  |   nr   |
XX |-+++-+|
XX  0 <->  172/143/460/ 768/143/460/ 5   -316/  0/416/ 9   524286

latij is latency from CPU i to CPU j.  nr is the number of samples (512K
rdtsc()s on each CPU in the pair, with a few discards for latencies above
999 cycles discarded.  The i4790K was run with interrupts disabled, so I
don't know why there were so many discards).  The 4 values in each of the
3 middle columns are min/avg/max/sdev.

Note: for CPUs on the same core, the latencies are about 120 cycles
smaller and the averag skews are very close to 0.  This and latencies
never being negative show that the method basically works.

XX  0 <->  2   192/263/992/25   192/258/992/16   -724/  5/748/29   524267
XX  0 <->  3   192/263/992/25   188/258/992/15   -724/  5/748/29   524266
XX  0 <->  4   188/255/964/21   188/273/964/42   -724/-18/752/46   524266
XX  0 <->  5   188/255/976/20   188/273/976/42   -724/-18/752/45   524274
XX  0 <->  6   200/281/996/20   200/270/996/14   -728/ 11/752/22   524273
XX  0 <->  7   200/281/964/20   196/270/964/13   -728/ 10/752/22   524276

There does seem to be some skew.  Parts of rest of table collected
manually and repeated here for comparison with the above:

XX  2 <->  0   188/258/968/16   192/263/968/25   -768/ -5/760/29   524273
XX  3 <->  0   188/259/988/15   188/263/988/26   -768/ -5/760/29   524282
XX  4 <->  0   188/271/996/40   188/255/996/20   -768/ 16/764/45   524275
XX  5 <->  0   192/271/952/40   188/255/952/20   -768/ 16/768/45   524280
XX  6 <->  0   196/268/992/16   200/280/992/23   -768/-12/768/27   524276
XX  7 <->  0   200/268/976/15   196/280/976/22   -768/-12/768/27   524283

The signs of the average skews are reversed perfectly when the direction is
reversed, and the values are reversed almost perfectly too.  This wasn't
so clear on freefall's Xeon with interrupts enabled.  Otherwise, the
behaviour on freefall is similar.

XX  1 <->  072/143/476/1072/143/476/ 5   -728/ -0/752/11   524286
XX  1 <->  2   192/263/944/25   192/258/944/15   -728/  5/752/29   524268
XX  1 <->  3   192/263/948/25   192/258/948/15   -728/  5/752/29   524264
XX  1 <->  4   188/255/996/20   188/274/996/42   -740/-18/760/45   524264
XX  1 <->  5   188/255/996/21   192/273/996/42   -768/-18/760/45   524272
XX  1 <->  6   196/280/996/21   196/270/996/14   -768/ 10/760/23   524270
XX  1 <->  7   196/281/952/20   200/270/952/14   -768/ 11/760/23   524275
XX  2 <->  0   188/258/968/16   192/263/968/25   -768/ -5/760/29   524273
XX  2 <->  1   188/258/928/16   192/263/928/25   -768/ -5/760/29   

svn commit: r345414 - in stable/11/sys: amd64/amd64 i386/i386

2019-03-22 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 22 14:49:22 2019
New Revision: 345414
URL: https://svnweb.freebsd.org/changeset/base/345414

Log:
  MFC r345190:
  Provide deterministic (and somewhat useful) value for RDPID result,
  and for %ecx after RDTSCP.

Modified:
  stable/11/sys/amd64/amd64/initcpu.c
  stable/11/sys/i386/i386/initcpu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/initcpu.c
==
--- stable/11/sys/amd64/amd64/initcpu.c Fri Mar 22 14:35:15 2019
(r345413)
+++ stable/11/sys/amd64/amd64/initcpu.c Fri Mar 22 14:49:22 2019
(r345414)
@@ -255,6 +255,10 @@ initializecpu(void)
init_via();
break;
}
+
+   if ((amd_feature & AMDID_RDTSCP) != 0 ||
+   (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+   wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void

Modified: stable/11/sys/i386/i386/initcpu.c
==
--- stable/11/sys/i386/i386/initcpu.c   Fri Mar 22 14:35:15 2019
(r345413)
+++ stable/11/sys/i386/i386/initcpu.c   Fri Mar 22 14:49:22 2019
(r345414)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -768,6 +769,9 @@ initializecpu(void)
elf32_nxstack = 1;
}
 #endif
+   if ((amd_feature & AMDID_RDTSCP) != 0 ||
+   (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+   wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void
___
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: r345413 - in stable/12/sys: amd64/amd64 i386/i386

2019-03-22 Thread Konstantin Belousov
Author: kib
Date: Fri Mar 22 14:35:15 2019
New Revision: 345413
URL: https://svnweb.freebsd.org/changeset/base/345413

Log:
  MFC r345190:
  Provide deterministic (and somewhat useful) value for RDPID result,
  and for %ecx after RDTSCP.

Modified:
  stable/12/sys/amd64/amd64/initcpu.c
  stable/12/sys/i386/i386/initcpu.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/initcpu.c
==
--- stable/12/sys/amd64/amd64/initcpu.c Fri Mar 22 11:46:35 2019
(r345412)
+++ stable/12/sys/amd64/amd64/initcpu.c Fri Mar 22 14:35:15 2019
(r345413)
@@ -265,6 +265,10 @@ initializecpu(void)
init_via();
break;
}
+
+   if ((amd_feature & AMDID_RDTSCP) != 0 ||
+   (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+   wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void

Modified: stable/12/sys/i386/i386/initcpu.c
==
--- stable/12/sys/i386/i386/initcpu.c   Fri Mar 22 11:46:35 2019
(r345412)
+++ stable/12/sys/i386/i386/initcpu.c   Fri Mar 22 14:35:15 2019
(r345413)
@@ -754,6 +754,9 @@ initializecpu(void)
elf32_nxstack = 1;
}
 #endif
+   if ((amd_feature & AMDID_RDTSCP) != 0 ||
+   (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0)
+   wrmsr(MSR_TSC_AUX, PCPU_GET(cpuid));
 }
 
 void
___
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: r345380 - head/lib/libc/gen

2019-03-22 Thread Bruce Evans

On Fri, 22 Mar 2019, Bruce Evans wrote:


On Thu, 21 Mar 2019, Conrad Meyer wrote:


Log:
 arc4random: Adjust example code to use uniform() API


This changes the example from correct to broken.

I see 4 bugs:


I see many more (old but related) bugs.


1. The log message says that the example uses uniform(), but it actually
  uses arc4random_uniform().
2. This description still says that the example uses arc4random(), but it
actually uses arc4random_uniform().
3. RAND_MAX is usually INT_MAX, so adding 1 to it gives undefined behavior.
  The previous version carefully converted RAND_MAX to unsigned to get
  defined behaviour.
..
Oops.  Since RAND_MAX is now 2 smaller than INT_MAX, adding 1 to it doesn't
cause overflow.  So the badness in the current example is just a style bug.

4. Another (old) bug in the example is that it says that the #define for
  foo4random() produces a drop-in replacement for [both] rand() and 
random().

  The maximum value for random() is still 0x7fff, so the same #define
  doesn't work for both, and it only ever worked accidentally if
  RAND_MAX happens to be 0x7fff, but RAND_MAX has been 0x7ffd since
  before this example existed.


5. arc4random() doesn't support seeding or returning a reproducible sequence,
   so it cannot provide a drop-in replacement for either rand() or random().

6. arc4random() is limited to 32 bits, but rand() is only limited by the
   number of bits in an int, so arc4random() cannot even provide a drop-out
   replacement for rand() on systems with more >= 34 bit ints unless
   RAND_MAX is restricted to 32 bits.

7. arc4random_uniform()'s arg is named 'upper_bound', but it is actually 1
   larger than the upper bound.

8. It is a design error for the arc4random_uniform()'s arg to be 1 larger
   than the upper bound.  This makes arc4random_uniform() harder to use
   when it works, and impossible to use when the upper bound is UINT32_MAX
   since the value 1 larger is unrepresentable them.  Portable code needs
   to use messes like:

#if RANDFOO_MAX < UINT32_MAX
#define randfoo()   arc4random_uniform((uint32_t)RANDFOO_MAX + 1)
#else if RANDFOO_MAX == UINT32_MAX
#define randfoo()   arc4random()
#else
#error "Can't implement drop-out replacement for randfoo() using arc4random()"
#endif

9. Casting to unsigned has another bug which I noticed while writing the
   above.  arc4random_uniform() doesn't take args of type unsigned;
   it takes args of type uint32_t.  Casting to unsigned works if
   unsigned is at least as large as uint32_t or the value is
   representable in both.  This assumption is unportable, but it became
   portable in POSIX in 2001 (?) when POSIX started requiring 32-bit
   ints.  So using unsigned is just a style bug if arc4random() is
   only supported on POSIX systems.

   Casting to either may overflow unless it is conditional on a test like
   the above.  Casting RAND_MAX to unsigned is known to work, since
   RAND_MAX <= INT_MAX.  But arc4random_uniform()'s API converts to
   uint32_t, so overflow may occur later.

Bruce
___
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: r345412 - head/libexec/rc/rc.d

2019-03-22 Thread Rodney W. Grimes
> Author: cy
> Date: Fri Mar 22 11:46:35 2019
> New Revision: 345412
> URL: https://svnweb.freebsd.org/changeset/base/345412
> 
> Log:
>   Use internal command variables for consistent style.
>   
>   Reported by:rgrimes@
>   MFC after:  13 days
>   X-MFC with: r345400

Thank you.

> Modified:
>   head/libexec/rc/rc.d/ippool
> 
> Modified: head/libexec/rc/rc.d/ippool
> ==
> --- head/libexec/rc/rc.d/ippool   Fri Mar 22 10:38:22 2019
> (r345411)
> +++ head/libexec/rc/rc.d/ippool   Fri Mar 22 11:46:35 2019
> (r345412)
> @@ -32,8 +32,8 @@ ippool_start()
>  ippool_reload()
>  {
>   echo "Reloading IP Pools."
> - ${ippool_program} -F
> - ippool_start
> + ${stop_cmd}
> + ${start_cmd}
>  }

-- 
Rod Grimes rgri...@freebsd.org
___
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: r345412 - head/libexec/rc/rc.d

2019-03-22 Thread Cy Schubert
Author: cy
Date: Fri Mar 22 11:46:35 2019
New Revision: 345412
URL: https://svnweb.freebsd.org/changeset/base/345412

Log:
  Use internal command variables for consistent style.
  
  Reported by:  rgrimes@
  MFC after:13 days
  X-MFC with:   r345400

Modified:
  head/libexec/rc/rc.d/ippool

Modified: head/libexec/rc/rc.d/ippool
==
--- head/libexec/rc/rc.d/ippool Fri Mar 22 10:38:22 2019(r345411)
+++ head/libexec/rc/rc.d/ippool Fri Mar 22 11:46:35 2019(r345412)
@@ -32,8 +32,8 @@ ippool_start()
 ippool_reload()
 {
echo "Reloading IP Pools."
-   ${ippool_program} -F
-   ippool_start
+   ${stop_cmd}
+   ${start_cmd}
 }
 
 
___
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: r345400 - in head/libexec/rc: . rc.d

2019-03-22 Thread Cy Schubert
In message <201903220517.x2m5hbqg063...@gndrsh.dnsmgr.net>, "Rodney W. 
Grimes"
writes:
> > Author: cy
> > Date: Fri Mar 22 01:30:51 2019
> > New Revision: 345400
> > URL: https://svnweb.freebsd.org/changeset/base/345400
> > 
> > Log:
> >   Add rc.d support for ippool(8).
> >   
> >   I've been using ippool at my site for approximately two years. It's
> >   about time this was committed.
> >   
> >   PR:   218433
> >   MFC after:2 weeks
> > 
> > Added:
> >   head/libexec/rc/rc.d/ippool   (contents, props changed)
> > Modified:
> >   head/libexec/rc/rc.conf
> > 
> > Modified: head/libexec/rc/rc.conf
> > ===
> ===
> > --- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019(r345399)
> > +++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019(r345400)
> > @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf"   # where the ipfilter pr
> og
> >  ipfilter_rules="/etc/ipf.rules"# rules definition file for ipfilter, s
> ee
> > # /usr/src/contrib/ipfilter/rules for examples
> >  ipfilter_flags=""  # additional flags for ipfilter
> > +ippool_enable="NO" # Set to YES to enable ip filter pools
> > +ippool_program="/sbin/ippool"  # where the ippool program lives
> > +ippool_rules="/etc/ippool.tables"  # rules definition file for ippool
> > +ippool_flags=""# additional flags for ippool
> >  ipnat_enable="NO"  # Set to YES to enable ipnat functionality
> >  ipnat_program="/sbin/ipnat"# where the ipnat program lives
> >  ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat
> > 
> > Added: head/libexec/rc/rc.d/ippool
> > ===
> ===
> > --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> > +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019(r34540
> 0)
> > @@ -0,0 +1,40 @@
> > +#!/bin/sh
> > +#
> > +# $FreeBSD$
> > +#
> > +
> > +# PROVIDE: ippool
> > +# REQUIRE: FILESYSTEMS
> > +# BEFORE:  ipfilter
> > +# KEYWORD: nojail
> > +
> > +. /etc/rc.subr
> > +
> > +name="ippool"
> > +desc="user interface to the IPFilter pools"
> > +rcvar="ippool_enable"
> > +load_rc_config $name
> > +start_cmd="ippool_start"
> > +stop_cmd="${ippool_program} -F"
> > +reload_cmd="ippool_reload"
> > +extra_commands="reload"
> > +required_files="${ippool_rules}"
> > +required_modules="ipl:ipfilter"
> > +
> > +ippool_start()
> > +{
> > +   if [ -r "${ippool_rules}" ]; then
> > +   echo "Loading IP Pools."
> > +   ${ippool_program} -f ${ippool_rules} ${ippool_flags}
> > +   fi
> > +}
> > +
> > +ippool_reload()
> > +{
> > +   echo "Reloading IP Pools."
> > +   ${ippool_program} -F
> > +   ippool_start
>
> Couldnt this better be expressed
>   ${stop_cmd}
>   ${start_cmd}
>

Yes. I'll fix that.

> > +}
> > +
> > +
> > +run_rc_command "$1"
> > 
> > 
>
> -- 
> Rod Grimes rgri...@freebsd.or
> g
>



-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
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: r345411 - head/sys/dev/intpm

2019-03-22 Thread Andriy Gapon
Author: avg
Date: Fri Mar 22 10:38:22 2019
New Revision: 345411
URL: https://svnweb.freebsd.org/changeset/base/345411

Log:
  intpm: change translation of HBA error status to smbus(4) errors
  
  PIIX4_SMBHSTSTAT_ERR can be set for several reasons that, unfortunately,
  cannot be distinguished, but the most typical case is a missing or hung
  slave (SMB_ENOACK).
  
  PIIX4_SMBHSTSTAT_FAIL means failed or killed / aborted transaction, so
  it's previous mapping to SMB_ENOACK was not ideal.
  
  After this change an smb(4) access to a missing slave results in ENXIO
  rather than EIO.  To me, that seems to be more appropriate.
  
  MFC after:3 weeks

Modified:
  head/sys/dev/intpm/intpm.c

Modified: head/sys/dev/intpm/intpm.c
==
--- head/sys/dev/intpm/intpm.c  Fri Mar 22 09:11:45 2019(r345410)
+++ head/sys/dev/intpm/intpm.c  Fri Mar 22 10:38:22 2019(r345411)
@@ -525,12 +525,19 @@ intsmb_error(device_t dev, int status)
 {
int error = 0;
 
+   /*
+* PIIX4_SMBHSTSTAT_ERR can mean either of
+* - SMB_ENOACK ("Unclaimed cycle"),
+* - SMB_ETIMEOUT ("Host device time-out"),
+* - SMB_EINVAL ("Illegal command field").
+* SMB_ENOACK seems to be most typical.
+*/
if (status & PIIX4_SMBHSTSTAT_ERR)
-   error |= SMB_EBUSERR;
+   error |= SMB_ENOACK;
if (status & PIIX4_SMBHSTSTAT_BUSC)
error |= SMB_ECOLLI;
if (status & PIIX4_SMBHSTSTAT_FAIL)
-   error |= SMB_ENOACK;
+   error |= SMB_EABORT;
 
if (error != 0 && bootverbose)
device_printf(dev, "error = %d, status = %#x\n", error, status);
___
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: r345410 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-03-22 Thread Andriy Gapon
Author: avg
Date: Fri Mar 22 09:11:45 2019
New Revision: 345410
URL: https://svnweb.freebsd.org/changeset/base/345410

Log:
  ZFS vdev_file: use correct value for waitfor parameter of VOP_FSYNC
  
  PR:   236475
  Reported by:  asomers
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 
22 07:39:28 2019(r345409)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 
22 09:11:45 2019(r345410)
@@ -239,8 +239,13 @@ vdev_file_io_start(zio_t *zio)
 
switch (zio->io_cmd) {
case DKIOCFLUSHWRITECACHE:
+#ifdef illumos
zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC,
kcred, NULL);
+#else
+   zio->io_error = VOP_FSYNC(vf->vf_vnode, MNT_WAIT,
+   kcred, NULL);
+#endif
break;
default:
zio->io_error = SET_ERROR(ENOTSUP);
___
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: r345409 - head/tests/sys/netpfil/pf

2019-03-22 Thread Kristof Provost
Author: kp
Date: Fri Mar 22 07:39:28 2019
New Revision: 345409
URL: https://svnweb.freebsd.org/changeset/base/345409

Log:
  pf tests: Test CVE-2019-5598
  
  Verify that pf correctly drops inconsistent ICMP packets (i.e. where the
  IP src/dst do not match the IP src/dst in the ICMP packet.

Added:
  head/tests/sys/netpfil/pf/CVE-2019-5598.py   (contents, props changed)
  head/tests/sys/netpfil/pf/icmp.sh   (contents, props changed)
Modified:
  head/tests/sys/netpfil/pf/Makefile

Added: head/tests/sys/netpfil/pf/CVE-2019-5598.py
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/netpfil/pf/CVE-2019-5598.py  Fri Mar 22 07:39:28 2019
(r345409)
@@ -0,0 +1,130 @@
+#!/usr/local/bin/python2.7
+
+import argparse
+import scapy.all as sp
+import sys
+from sniffer import Sniffer
+
+def check_icmp_error(args, packet):
+   ip = packet.getlayer(sp.IP)
+   if not ip:
+   return False
+   if ip.dst != args.to[0]:
+   return False
+
+   icmp = packet.getlayer(sp.ICMP)
+   if not icmp:
+   return False
+   if icmp.type != 3 or icmp.code != 3:
+   return False
+
+   return True
+
+def main():
+   parser = argparse.ArgumentParser("CVE-2019-icmp.py",
+   description="CVE-2019-icmp test tool")
+   parser.add_argument('--sendif', nargs=1,
+   required=True,
+   help='The interface through which the packet will be sent')
+   parser.add_argument('--recvif', nargs=1,
+   required=True,
+   help='The interface on which to check for the packet')
+   parser.add_argument('--src', nargs=1,
+   required=True,
+   help='The source IP address')
+   parser.add_argument('--to', nargs=1,
+   required=True,
+   help='The destination IP address')
+
+   args = parser.parse_args()
+
+# Send the allowed packet to establish state
+udp = sp.Ether() / \
+sp.IP(src=args.src[0], dst=args.to[0]) / \
+sp.UDP(dport=53, sport=1234)
+sp.sendp(udp, iface=args.sendif[0], verbose=False)
+
+   # Start sniffing on recvif
+   sniffer = Sniffer(args, check_icmp_error)
+
+   # Send the bad error packet
+   icmp_reachable = sp.Ether() / \
+sp.IP(src=args.src[0], dst=args.to[0]) / \
+   sp.ICMP(type=3, code=3) / \
+   sp.IP(src="4.3.2.1", dst="1.2.3.4") / \
+   sp.UDP(dport=53, sport=1234)
+   sp.sendp(icmp_reachable, iface=args.sendif[0], verbose=False)
+
+   sniffer.join()
+   if sniffer.foundCorrectPacket:
+   sys.exit(1)
+
+   sys.exit(0)
+
+if __name__ == '__main__':
+   main()
+#!/usr/local/bin/python2.7
+
+import argparse
+import scapy.all as sp
+import sys
+from sniffer import Sniffer
+
+def check_icmp_error(args, packet):
+   ip = packet.getlayer(sp.IP)
+   if not ip:
+   return False
+   if ip.dst != args.to[0]:
+   return False
+
+   icmp = packet.getlayer(sp.ICMP)
+   if not icmp:
+   return False
+   if icmp.type != 3 or icmp.code != 3:
+   return False
+
+   return True
+
+def main():
+   parser = argparse.ArgumentParser("CVE-2019-icmp.py",
+   description="CVE-2019-icmp test tool")
+   parser.add_argument('--sendif', nargs=1,
+   required=True,
+   help='The interface through which the packet will be sent')
+   parser.add_argument('--recvif', nargs=1,
+   required=True,
+   help='The interface on which to check for the packet')
+   parser.add_argument('--src', nargs=1,
+   required=True,
+   help='The source IP address')
+   parser.add_argument('--to', nargs=1,
+   required=True,
+   help='The destination IP address')
+
+   args = parser.parse_args()
+
+# Send the allowed packet to establish state
+udp = sp.Ether() / \
+sp.IP(src=args.src[0], dst=args.to[0]) / \
+sp.UDP(dport=53, sport=1234)
+sp.sendp(udp, iface=args.sendif[0], verbose=False)
+
+   # Start sniffing on recvif
+   sniffer = Sniffer(args, check_icmp_error)
+
+   # Send the bad error packet
+   icmp_reachable = sp.Ether() / \
+sp.IP(src=args.src[0], dst=args.to[0]) / \
+   sp.ICMP(type=3, code=3) / \
+   sp.IP(src=args.src[0], dst=args.to[0]) / \
+   sp.UDP(dport=53, sport=1234)
+   sp.sendp(icmp_reachable, iface=args.sendif[0], verbose=False)
+
+   sniffer.join()
+   if sniffer.foundCorrectPacket:
+   sys.exit(1)
+
+   sys.exit(0)
+
+if __name__ == '__main__':
+   main()

Modified: head/tests/sys/netpfil/pf/Makefile
==
--- 

svn commit: r345408 - head/sys/arm64/conf

2019-03-22 Thread Colin Percival
Author: cperciva
Date: Fri Mar 22 06:36:40 2019
New Revision: 345408
URL: https://svnweb.freebsd.org/changeset/base/345408

Log:
  Add nvme support to the arm64 GENERIC kernel.
  
  Submitted by: Greg V
  Differential Revision:https://reviews.freebsd.org/D19657

Modified:
  head/sys/arm64/conf/GENERIC

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Fri Mar 22 06:33:26 2019(r345407)
+++ head/sys/arm64/conf/GENERIC Fri Mar 22 06:36:40 2019(r345408)
@@ -171,6 +171,11 @@ device da
 # ATA/SCSI peripherals
 device pass# Passthrough device (direct ATA/SCSI access)
 
+# NVM Express (NVMe) support
+device nvme# base NVMe driver
+optionsNVME_USE_NVD=0  # prefer the cam(4) based nda(4) driver
+device nvd # expose NVMe namespaces as disks, depends on 
nvme
+
 # MMC/SD/SDIO Card slot support
 device sdhci
 device sdhci_xenon # Marvell Xenon SD/MMC controller
___
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: r345407 - head/sys/modules

2019-03-22 Thread Colin Percival
Author: cperciva
Date: Fri Mar 22 06:33:26 2019
New Revision: 345407
URL: https://svnweb.freebsd.org/changeset/base/345407

Log:
  Build if_ena.ko on arm64.
  
  This module provides support for the Amazon Elastic Network Adapter; it
  was previously only built on x86 architectures, but Amazon EC2 now also
  has ARM64 instances with this hardware.
  
  Submitted by: Greg V

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Fri Mar 22 06:28:37 2019(r345406)
+++ head/sys/modules/Makefile   Fri Mar 22 06:33:26 2019(r345407)
@@ -482,6 +482,7 @@ SUBDIR+=fdt
 ${MACHINE_CPUARCH} == "i386"
 SUBDIR+=   linprocfs
 SUBDIR+=   linsysfs
+_ena=  ena
 .endif
 
 .if ${MK_NAND} != "no" || defined(ALL_MODULES)
@@ -587,7 +588,6 @@ _cs=cs
 _dpms= dpms
 _ed=   ed
 _em=   em
-_ena=  ena
 _ep=   ep
 _et=   et
 _exca= exca
___
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: r345406 - head/sys/dev/uart

2019-03-22 Thread Colin Percival
Author: cperciva
Date: Fri Mar 22 06:28:37 2019
New Revision: 345406
URL: https://svnweb.freebsd.org/changeset/base/345406

Log:
  Initialize uart_bus_space_mem.
  
  This value was being used uninitialized, resulting in predictable issues
  on systems with memory-mapped UART registers.
  
  A case could be made that memmap_bus should be declared in a header
  rather than being declared in each .c file which needs to refer to it,
  but that's a broader style question.
  
  This commit unbreaks hw.uart.console="mm:..." on ARM64.
  
  Submitted by: Greg V

Modified:
  head/sys/dev/uart/uart_cpu_arm64.c

Modified: head/sys/dev/uart/uart_cpu_arm64.c
==
--- head/sys/dev/uart/uart_cpu_arm64.c  Fri Mar 22 06:21:03 2019
(r345405)
+++ head/sys/dev/uart/uart_cpu_arm64.c  Fri Mar 22 06:28:37 2019
(r345406)
@@ -65,8 +65,9 @@ __FBSDID("$FreeBSD$");
 /*
  * UART console routines.
  */
+extern struct bus_space memmap_bus;
 bus_space_tag_t uart_bus_space_io;
-bus_space_tag_t uart_bus_space_mem;
+bus_space_tag_t uart_bus_space_mem = _bus;
 
 int
 uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
___
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: r345405 - head/sys/dev/uart

2019-03-22 Thread Colin Percival
Author: cperciva
Date: Fri Mar 22 06:21:03 2019
New Revision: 345405
URL: https://svnweb.freebsd.org/changeset/base/345405

Log:
  Obey SPCR AccessWidth parameter.
  
  The "access width" value was hard-coded as 2, indicating 32-bit accesses;
  instead, use the value specified in the SPCR table.
  
  This unbreaks the console on EC2 "A1" family instances.
  
  Submitted by: Greg V

Modified:
  head/sys/dev/uart/uart_cpu_arm64.c

Modified: head/sys/dev/uart/uart_cpu_arm64.c
==
--- head/sys/dev/uart/uart_cpu_arm64.c  Fri Mar 22 06:02:06 2019
(r345404)
+++ head/sys/dev/uart/uart_cpu_arm64.c  Fri Mar 22 06:21:03 2019
(r345405)
@@ -149,7 +149,7 @@ uart_cpu_acpi_probe(struct uart_class **classp, bus_sp
 
*classp = cd->cd_class;
*rclk = 0;
-   *shiftp = 2;
+   *shiftp = spcr->SerialPort.AccessWidth - 1;
*iowidthp = spcr->SerialPort.BitWidth / 8;
 
 out:
___
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: r345404 - in stable/12: libexec/rc share/man/man5

2019-03-22 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Fri Mar 22 06:02:06 2019
New Revision: 345404
URL: https://svnweb.freebsd.org/changeset/base/345404

Log:
  MFC r345080:
  
  Extend descriptions and comments about the need to create /etc/pf.conf.
  
  FreeBSD removed the default /etc/pf.conf file in previous releases, but
  the documentation kept mentioning it like any other file present in the
  system.  Change pf.conf(5) to mention in the description of the
  default ruleset location that this file needs to be created manually. Also,
  the default rc.conf file had it's comment extended a bit to let people
  know that this file does not exist by default.
  
  PR:   231977
  Submitted by: koobs@
  Reviewed by:  kp@, 0mp@
  Approved by:  kp@
  Differential Revision:https://reviews.freebsd.org/D19530

Modified:
  stable/12/libexec/rc/rc.conf
  stable/12/share/man/man5/pf.conf.5
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rc/rc.conf
==
--- stable/12/libexec/rc/rc.confFri Mar 22 01:43:55 2019
(r345403)
+++ stable/12/libexec/rc/rc.confFri Mar 22 06:02:06 2019
(r345404)
@@ -208,7 +208,8 @@ ipfs_enable="NO"# Set to YES to enable saving 
and re
 ipfs_program="/sbin/ipfs"  # where the ipfs program lives
 ipfs_flags=""  # additional flags for ipfs
 pf_enable="NO" # Set to YES to enable packet filter (pf)
-pf_rules="/etc/pf.conf"# rules definition file for pf
+pf_rules="/etc/pf.conf"# rules definition file for pf 
(nonexistent
+   # by default)
 pf_program="/sbin/pfctl"   # where the pfctl program lives
 pf_flags=""# additional flags for pfctl
 pflog_enable="NO"  # Set to YES to enable packet filter logging

Modified: stable/12/share/man/man5/pf.conf.5
==
--- stable/12/share/man/man5/pf.conf.5  Fri Mar 22 01:43:55 2019
(r345403)
+++ stable/12/share/man/man5/pf.conf.5  Fri Mar 22 06:02:06 2019
(r345404)
@@ -28,7 +28,7 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 5, 2019
+.Dd March 10, 2019
 .Dt PF.CONF 5
 .Os
 .Sh NAME
@@ -3053,6 +3053,8 @@ include= "include" filename
 Host name database.
 .It Pa /etc/pf.conf
 Default location of the ruleset file.
+The file has to be created manually as it is not installed with a
+standard installation.
 .It Pa /etc/pf.os
 Default location of OS fingerprints.
 .It Pa /etc/protocols
___
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"