svn commit: r335670 - in stable: 10 11

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 16:16:08 2018
New Revision: 335670
URL: https://svnweb.freebsd.org/changeset/base/335670

Log:
  MFC r325107, r335665:
   r325107 (eadler, partial):
Update the updating URL in UPDATING.
  
   r335665:
Use the 'Updating from Source' Handbook section in UPDATING.
  
  PR:   229345
  Submitted by: Niels Bakker
  Approved by:  re (marius, insta-MFC)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/UPDATING
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/UPDATING
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/UPDATING
==
--- stable/11/UPDATING  Tue Jun 26 16:00:16 2018(r335669)
+++ stable/11/UPDATING  Tue Jun 26 16:16:08 2018(r335670)
@@ -6,7 +6,7 @@ COMMON ITEMS: section later in the file.  These instru
 basically know what you are doing.  If not, then please consult the FreeBSD
 handbook:
 
-
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-src.html
+https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
 
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
___
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: r335670 - in stable: 10 11

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 16:16:08 2018
New Revision: 335670
URL: https://svnweb.freebsd.org/changeset/base/335670

Log:
  MFC r325107, r335665:
   r325107 (eadler, partial):
Update the updating URL in UPDATING.
  
   r335665:
Use the 'Updating from Source' Handbook section in UPDATING.
  
  PR:   229345
  Submitted by: Niels Bakker
  Approved by:  re (marius, insta-MFC)
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/UPDATING
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/UPDATING
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/UPDATING
==
--- stable/10/UPDATING  Tue Jun 26 16:00:16 2018(r335669)
+++ stable/10/UPDATING  Tue Jun 26 16:16:08 2018(r335670)
@@ -6,7 +6,7 @@ COMMON ITEMS: section later in the file.  These instru
 basically know what you are doing.  If not, then please consult the FreeBSD
 handbook:
 
-
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-src.html
+https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
 
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
___
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: r335668 - head/sys/x86/xen

2018-06-26 Thread Roger Pau Monné
Author: royger
Date: Tue Jun 26 15:00:54 2018
New Revision: 335668
URL: https://svnweb.freebsd.org/changeset/base/335668

Log:
  xen: obtain vCPU ID from CPUID
  
  The Xen vCPU ID can be fetched from the cpuid instead of inferring it
  from the ACPI ID.
  
  Sponsored by: Citrix Systems R

Modified:
  head/sys/x86/xen/hvm.c

Modified: head/sys/x86/xen/hvm.c
==
--- head/sys/x86/xen/hvm.c  Tue Jun 26 14:48:23 2018(r335667)
+++ head/sys/x86/xen/hvm.c  Tue Jun 26 15:00:54 2018(r335668)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -103,6 +104,9 @@ TUNABLE_INT("hw.xen.disable_pv_disks", _disable_pv
 TUNABLE_INT("hw.xen.disable_pv_nics", _disable_pv_nics);
 
 /*-- XEN Hypervisor Probe and Setup 
--*/
+
+static uint32_t cpuid_base;
+
 static uint32_t
 xen_hvm_cpuid_base(void)
 {
@@ -123,21 +127,21 @@ xen_hvm_cpuid_base(void)
 static int
 xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
 {
-   uint32_t base, regs[4];
+   uint32_t regs[4];
 
if (xen_pv_domain()) {
/* hypercall page is already set in the PV case */
return (0);
}
 
-   base = xen_hvm_cpuid_base();
-   if (base == 0)
+   cpuid_base = xen_hvm_cpuid_base();
+   if (cpuid_base == 0)
return (ENXIO);
 
if (init_type == XEN_HVM_INIT_COLD) {
int major, minor;
 
-   do_cpuid(base + 1, regs);
+   do_cpuid(cpuid_base + 1, regs);
 
major = regs[0] >> 16;
minor = regs[0] & 0x;
@@ -165,7 +169,7 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type in
/*
 * Find the hypercall pages.
 */
-   do_cpuid(base + 2, regs);
+   do_cpuid(cpuid_base + 2, regs);
if (regs[0] != 1)
return (EINVAL);
 
@@ -371,31 +375,14 @@ xen_hvm_sysinit(void *arg __unused)
 {
xen_hvm_init(XEN_HVM_INIT_COLD);
 }
+SYSINIT(xen_hvm_init, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, xen_hvm_sysinit, 
NULL);
 
 static void
-xen_set_vcpu_id(void)
-{
-   struct pcpu *pc;
-   int i;
-
-   if (!xen_hvm_domain())
-   return;
-
-   /* Set vcpu_id to acpi_id */
-   CPU_FOREACH(i) {
-   pc = pcpu_find(i);
-   pc->pc_vcpu_id = pc->pc_acpi_id;
-   if (bootverbose)
-   printf("XEN: CPU %u has VCPU ID %u\n",
-  i, pc->pc_vcpu_id);
-   }
-}
-
-static void
 xen_hvm_cpu_init(void)
 {
struct vcpu_register_vcpu_info info;
struct vcpu_info *vcpu_info;
+   uint32_t regs[4];
int cpu, rc;
 
if (!xen_domain())
@@ -410,6 +397,22 @@ xen_hvm_cpu_init(void)
return;
}
 
+   /*
+* Set vCPU ID. If available fetch the ID from CPUID, if not just use
+* the ACPI ID.
+*/
+   KASSERT(cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
+   cpuid_count(cpuid_base + 4, 0, regs);
+   PCPU_SET(vcpu_id, (regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ?
+   regs[1] : PCPU_GET(acpi_id));
+
+   /*
+* Set the vCPU info.
+*
+* NB: the vCPU info for vCPUs < 32 can be fetched from the shared info
+* page, but in order to make sure the mapping code is correct always
+* attempt to map the vCPU info at a custom place.
+*/
vcpu_info = DPCPU_PTR(vcpu_local_info);
cpu = PCPU_GET(vcpu_id);
info.mfn = vtophys(vcpu_info) >> PAGE_SHIFT;
@@ -421,7 +424,4 @@ xen_hvm_cpu_init(void)
else
DPCPU_SET(vcpu_info, vcpu_info);
 }
-
-SYSINIT(xen_hvm_init, SI_SUB_HYPERVISOR, SI_ORDER_FIRST, xen_hvm_sysinit, 
NULL);
 SYSINIT(xen_hvm_cpu_init, SI_SUB_INTR, SI_ORDER_FIRST, xen_hvm_cpu_init, NULL);
-SYSINIT(xen_set_vcpu_id, SI_SUB_CPU, SI_ORDER_ANY, xen_set_vcpu_id, NULL);
___
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: r335662 - stable/11/release/doc/en_US.ISO8859-1/hardware

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 13:53:33 2018
New Revision: 335662
URL: https://svnweb.freebsd.org/changeset/base/335662

Log:
  Add a few missing drivers to the 11-STABLE hardware page.
  
  Submitted by: Grzegorz Junka list1 _@t_ gjunka.com
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml  Tue Jun 26 
13:29:49 2018(r335661)
+++ stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml  Tue Jun 26 
13:53:33 2018(r335662)
@@ -822,6 +822,8 @@
 
   
 
+  
+
   
 
   
@@ -855,6 +857,8 @@
 
   
 
+  
+
   
 
   
@@ -896,6 +900,8 @@
 
   
 
+  
+
   
 
   
@@ -1094,6 +1100,8 @@
   
 
   
+
+  
 
 
 
___
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: r335629 - in head: share/man/man4 sys/dev/vt/hw/vga

2018-06-26 Thread Ian Lepore
On Tue, 2018-06-26 at 08:55 -0700, Rodney W. Grimes wrote:
> > 
> > On Tue, Jun 26, 2018 at 05:21:27AM +, Alexey Dokuchaev wrote:
> > > 
> > > On Mon, Jun 25, 2018 at 08:43:51AM -0700, Rodney W. Grimes wrote:
> > > > 
> > > > > 
> > > > > New Revision: 335629
> > > > > URL: https://svnweb.freebsd.org/changeset/base/335629
> > > > > 
> > > > > Log:
> > > > >   vt: add option to ignore NO_VGA flag in ACPI
> > > > >   
> > > > >   To workaround buggy firmware that sets this flag when
> > > > > there's actually
> > > > >   a VGA present.
> > > > >   
> > > > >   Reported and tested by: Yasuhiro KIMURA  > > > > e.org>
> > > > >   Sponsored by:   Citrix Systems R
> > > > >   Reviewed by:kib
> > > > >   Differential revision:  https://reviews.freebsd.org/D
> > > > > 16003
> > > > It is generally best to avoid double negatives,
> > > > couldnt this of been better named? (hw.vga.acpi_force_vga)
> > > Yes please; I get constantly confused when calculating negatives
> > > and
> > > often get them wrong.
> > This is specifically done to workaround a firmware bug where some
> > buggy firmwares set the NO_VGA flag in ACPI.
> We are not conflicted about working around the buggy ACPI.
> 
> > 
> > So the option does
> > exactly what the name says, it ignores the NO_VGA flag in ACPI. IMO
> > acpi_force_vga is not as descriptive as the current name.
> Interestingly that is the text you use to describe it in the man
> page, so it seems as if it is good for the description, but not
> good for the name of the flag itself?
> 
> .It Va hw.vga.acpi_ignore_no_vga
> Set to 1 to force the usage of the VGA driver regardless of whether
> ACPI IAPC_BOOT_ARCH signals no VGA support.
> Can be used to workaround firmware bugs in the ACPI tables.
> 
> This does not mention the ACPI table entry being over ridden,
>if (flags & ACPI_FADT_NO_VGA)
> 
> Further digging I believe you have placed this in the wrong
> part of the hierarchy.  You put it in hw.vga, and it really
> should be in hw.acpi.
> Maybe hw.acpi.bootflags.ignore.no_vga.
> 
> Are there any other bootflags we may want to ignore?
> 
> Regards,


There is ACPI_FADT_NO_CMOS_RTC, with an associated tunable
hw.atrtc.enabled (default is -1), which can be:

  -1 - enabled unless acpi says ACPI_FADT_NO_CMOS_RTC
   0 - unconditionally disabled
   1 - unconditionally enabled

The idea was that if RTC is provided by EFI runtime services, this flag
would indicate that old-school CMOS RTC drivers should not be used.
 But, predictably, it turns out there are bioses that set this flag
even when booting in legacy non-efi mode, leading to a need to ignore
the flag and force use of the old driver.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335665 - head

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 14:30:33 2018
New Revision: 335665
URL: https://svnweb.freebsd.org/changeset/base/335665

Log:
  Use the 'Updating from Source' Handbook section in UPDATING.
  
  PR:   229345 (related)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Tue Jun 26 14:07:11 2018(r335664)
+++ head/UPDATING   Tue Jun 26 14:30:33 2018(r335665)
@@ -6,7 +6,7 @@ COMMON ITEMS: section later in the file.  These instru
 basically know what you are doing.  If not, then please consult the FreeBSD
 handbook:
 
-
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html
+https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
 
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
___
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: r335663 - stable/11/release/doc/en_US.ISO8859-1/errata

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 14:01:03 2018
New Revision: 335663
URL: https://svnweb.freebsd.org/changeset/base/335663

Log:
  Document that a few device drivers were omitted from the 11.2
  hardware page.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
13:53:33 2018(r335662)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
14:01:03 2018(r335663)
@@ -190,6 +190,19 @@ boot

xlink:href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228535;>228535
  for more information.
   
+
+  
+   [2018-06-26] It was discovered after the releng/11.2 branch was tagged
+ for 11.2-RELEASE that a few device drivers were
+ missing from the https://www.FreeBSD.org/releases/11.2R/hardware.html;>hardware
+ page.  The missing drivers, , ,
+ , and  were added to the
+ 11-STABLE https://www.FreeBSD.org/relnotes/11-STABLE/hardware/support.html;>hardware
+   page.
+  
 
   
 
___
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: r335667 - stable/11/release/doc/en_US.ISO8859-1/errata

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 14:48:23 2018
New Revision: 335667
URL: https://svnweb.freebsd.org/changeset/base/335667

Log:
  Add an errata note that the URL in UPDATING for source-based
  upgrades is incorrect.
  
  PR:   229345
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
14:39:27 2018(r335666)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
14:48:23 2018(r335667)
@@ -203,6 +203,14 @@ boot

xlink:href="https://www.FreeBSD.org/relnotes/11-STABLE/hardware/support.html;>hardware
page.
   
+
+  
+   [2018-06-26] The URL to the
+ instructions for source-based upgrades in
+ UPDATING incorrectly points to a page
+ that no longer exists.  The correct URL is https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html;
 />.
+  
 
   
 
___
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: r335669 - head/lib/libusb

2018-06-26 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Jun 26 16:00:16 2018
New Revision: 335669
URL: https://svnweb.freebsd.org/changeset/base/335669

Log:
  Improve the userspace USB string reading function in LibUSB.
  Some USB devices does not allow a partial descriptor readout.
  
  Found by: bz @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/lib/libusb/libusb20.c

Modified: head/lib/libusb/libusb20.c
==
--- head/lib/libusb/libusb20.c  Tue Jun 26 15:00:54 2018(r335668)
+++ head/lib/libusb/libusb20.c  Tue Jun 26 16:00:16 2018(r335669)
@@ -814,6 +814,7 @@ libusb20_dev_req_string_sync(struct libusb20_device *p
 {
struct LIBUSB20_CONTROL_SETUP_DECODED req;
int error;
+   int flags;
 
/* make sure memory is initialised */
memset(ptr, 0, len);
@@ -840,22 +841,24 @@ libusb20_dev_req_string_sync(struct libusb20_device *p
error = libusb20_dev_request_sync(pdev, ,
ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK);
if (error) {
-   return (error);
+   /* try to request full string */
+   req.wLength = 255;
+   flags = 0;
+   } else {
+   /* extract length and request full string */
+   req.wLength = *(uint8_t *)ptr;
+   flags = LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK;
}
-   req.wLength = *(uint8_t *)ptr;  /* bytes */
if (req.wLength > len) {
/* partial string read */
req.wLength = len;
}
-   error = libusb20_dev_request_sync(pdev, ,
-   ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK);
-
-   if (error) {
+   error = libusb20_dev_request_sync(pdev, , ptr, NULL, 1000, flags);
+   if (error)
return (error);
-   }
-   if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING) {
+
+   if (((uint8_t *)ptr)[1] != LIBUSB20_DT_STRING)
return (LIBUSB20_ERROR_OTHER);
-   }
return (0); /* success */
 }
 
___
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: r335629 - in head: share/man/man4 sys/dev/vt/hw/vga

2018-06-26 Thread Rodney W. Grimes
> On Tue, Jun 26, 2018 at 05:21:27AM +, Alexey Dokuchaev wrote:
> > On Mon, Jun 25, 2018 at 08:43:51AM -0700, Rodney W. Grimes wrote:
> > > > New Revision: 335629
> > > > URL: https://svnweb.freebsd.org/changeset/base/335629
> > > > 
> > > > Log:
> > > >   vt: add option to ignore NO_VGA flag in ACPI
> > > >   
> > > >   To workaround buggy firmware that sets this flag when there's actually
> > > >   a VGA present.
> > > >   
> > > >   Reported and tested by:   Yasuhiro KIMURA 
> > > >   Sponsored by: Citrix Systems R
> > > >   Reviewed by:  kib
> > > >   Differential revision:https://reviews.freebsd.org/D16003
> > > 
> > > It is generally best to avoid double negatives,
> > > couldnt this of been better named? (hw.vga.acpi_force_vga)
> > 
> > Yes please; I get constantly confused when calculating negatives and
> > often get them wrong.
> 
> This is specifically done to workaround a firmware bug where some
> buggy firmwares set the NO_VGA flag in ACPI.

We are not conflicted about working around the buggy ACPI.

> So the option does
> exactly what the name says, it ignores the NO_VGA flag in ACPI. IMO
> acpi_force_vga is not as descriptive as the current name.

Interestingly that is the text you use to describe it in the man
page, so it seems as if it is good for the description, but not
good for the name of the flag itself?

.It Va hw.vga.acpi_ignore_no_vga
Set to 1 to force the usage of the VGA driver regardless of whether
ACPI IAPC_BOOT_ARCH signals no VGA support.
Can be used to workaround firmware bugs in the ACPI tables.

This does not mention the ACPI table entry being over ridden,
 if (flags & ACPI_FADT_NO_VGA)

Further digging I believe you have placed this in the wrong
part of the hierarchy.  You put it in hw.vga, and it really
should be in hw.acpi.
Maybe hw.acpi.bootflags.ignore.no_vga.

Are there any other bootflags we may want to ignore?

Regards,
-- 
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: r335664 - head/sys/dev/xen/netback

2018-06-26 Thread Roger Pau Monné
Author: royger
Date: Tue Jun 26 14:07:11 2018
New Revision: 335664
URL: https://svnweb.freebsd.org/changeset/base/335664

Log:
  xen-netback: fix LOR
  
  lock order reversal: (sleepable after non-sleepable)
   1st 0xfe00357ff538 xnb_softc (xen netback softc lock) @ 
/usr/src/sys/dev/xen/netback/netback.c:1069
   2nd 0x81fdccb0 intrsrc (intrsrc) @ 
/usr/src/sys/x86/x86/intr_machdep.c:224
  
  There's no need to hold the lock since the cleaning of the interrupt
  cannot happen in parallel due to the XNBF_IN_SHUTDOWN flag being set.
  Note that the locking in netback needs some improvement or
  clarification.
  
  While there also remove a double newline.
  
  Sponsored by:   Citrix Systems R

Modified:
  head/sys/dev/xen/netback/netback.c

Modified: head/sys/dev/xen/netback/netback.c
==
--- head/sys/dev/xen/netback/netback.c  Tue Jun 26 14:01:03 2018
(r335663)
+++ head/sys/dev/xen/netback/netback.c  Tue Jun 26 14:07:11 2018
(r335664)
@@ -662,6 +662,7 @@ xnb_disconnect(struct xnb_softc *xnb)
mtx_lock(>rx_lock);
mtx_unlock(>rx_lock);
 
+   mtx_lock(>sc_lock);
/* Free malloc'd softc member variables */
if (xnb->bridge != NULL) {
free(xnb->bridge, M_XENSTORE);
@@ -689,6 +690,8 @@ xnb_disconnect(struct xnb_softc *xnb)
sizeof(struct xnb_ring_config));
 
xnb->flags &= ~XNBF_RING_CONNECTED;
+   mtx_unlock(>sc_lock);
+
return (0);
 }
 
@@ -1066,17 +1069,14 @@ xnb_shutdown(struct xnb_softc *xnb)
if_free(xnb->xnb_ifp);
xnb->xnb_ifp = NULL;
}
-   mtx_lock(>sc_lock);
 
xnb_disconnect(xnb);
 
-   mtx_unlock(>sc_lock);
if (xenbus_get_state(xnb->dev) < XenbusStateClosing)
xenbus_set_state(xnb->dev, XenbusStateClosing);
mtx_lock(>sc_lock);
 
xnb->flags &= ~XNBF_IN_SHUTDOWN;
-
 
/* Indicate to xnb_detach() that is it safe to proceed. */
wakeup(xnb);
___
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: r335666 - head/sys/x86/xen

2018-06-26 Thread Roger Pau Monné
Author: royger
Date: Tue Jun 26 14:39:27 2018
New Revision: 335666
URL: https://svnweb.freebsd.org/changeset/base/335666

Log:
  xen: limit the number of hypercall pages to 1
  
  The interface already guarantees that the number of hypercall pages is
  always going to be 1, see the comment in interface/arch-x86/cpuid.h
  
  Sponsored by: Citrix Systems R

Modified:
  head/sys/x86/xen/hvm.c

Modified: head/sys/x86/xen/hvm.c
==
--- head/sys/x86/xen/hvm.c  Tue Jun 26 14:30:33 2018(r335665)
+++ head/sys/x86/xen/hvm.c  Tue Jun 26 14:39:27 2018(r335666)
@@ -124,7 +124,6 @@ static int
 xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
 {
uint32_t base, regs[4];
-   int i;
 
if (xen_pv_domain()) {
/* hypercall page is already set in the PV case */
@@ -167,9 +166,10 @@ xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type in
 * Find the hypercall pages.
 */
do_cpuid(base + 2, regs);
+   if (regs[0] != 1)
+   return (EINVAL);
 
-   for (i = 0; i < regs[0]; i++)
-   wrmsr(regs[1], vtophys(_page + i * PAGE_SIZE) + i);
+   wrmsr(regs[1], vtophys(_page));
 
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335671 - head/share/man/man9

2018-06-26 Thread Conrad Meyer
Author: cem
Date: Tue Jun 26 16:20:19 2018
New Revision: 335671
URL: https://svnweb.freebsd.org/changeset/base/335671

Log:
  atomic.9: Add missing MLINK for testandclear, thread_fence routines
  
  Missed in r299912, r326982.
  
  X-MFC-With:   r299912, r326982
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Jun 26 16:16:08 2018
(r335670)
+++ head/share/man/man9/MakefileTue Jun 26 16:20:19 2018
(r335671)
@@ -461,7 +461,9 @@ MLINKS+=atomic.9 atomic_add.9 \
atomic.9 atomic_store.9 \
atomic.9 atomic_subtract.9 \
atomic.9 atomic_swap.9 \
-   atomic.9 atomic_testandset.9
+   atomic.9 atomic_testandclear.9 \
+   atomic.9 atomic_testandset.9 \
+   atomic.9 atomic_thread_fence.9
 MLINKS+=bhnd.9 BHND_MATCH_BOARD_TYPE.9 \
bhnd.9 BHND_MATCH_BOARD_VENDOR.9 \
bhnd.9 BHND_MATCH_CHIP_ID.9 \
___
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: r335672 - head/sys/modules

2018-06-26 Thread Ed Maste
Author: emaste
Date: Tue Jun 26 16:50:41 2018
New Revision: 335672
URL: https://svnweb.freebsd.org/changeset/base/335672

Log:
  Build linprocfs and linsysfs also on arm64
  
  Sponsored by: Turing Robotic Industries

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Jun 26 16:20:19 2018(r335671)
+++ head/sys/modules/Makefile   Tue Jun 26 16:50:41 2018(r335672)
@@ -218,8 +218,6 @@ SUBDIR= \
libalias \
libiconv \
libmchain \
-   ${_linprocfs} \
-   ${_linsysfs} \
${_linux} \
${_linux_common} \
${_linux64} \
@@ -493,6 +491,12 @@ SUBDIR+=   iscsi
 SUBDIR+=   iscsi_initiator
 .endif
 
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} != "amd64" || \
+${MACHINE_CPUARCH} == "i386"
+SUBDIR+=   linprocfs
+SUBDIR+=   linsysfs
+.endif
+
 .if ${MK_NAND} != "no" || defined(ALL_MODULES)
 _nandfs=   nandfs
 _nandsim=  nandsim
@@ -607,8 +611,6 @@ _iser=  iser
 .endif
 _ix=   ix
 _ixv=  ixv
-_linprocfs=linprocfs
-_linsysfs= linsysfs
 _linux=linux
 .if ${MK_SOURCELESS_UCODE} != "no"
 _lio=  lio
___
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: r335677 - head/tests/sys/audit

2018-06-26 Thread Alan Somers
Author: asomers
Date: Tue Jun 26 19:26:07 2018
New Revision: 335677
URL: https://svnweb.freebsd.org/changeset/base/335677

Log:
  audit(4): add tests for pipe, posix_openpt, shm_open, and shm_unlink
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15963

Modified:
  head/tests/sys/audit/inter-process.c

Modified: head/tests/sys/audit/inter-process.c
==
--- head/tests/sys/audit/inter-process.cTue Jun 26 19:13:49 2018
(r335676)
+++ head/tests/sys/audit/inter-process.cTue Jun 26 19:26:07 2018
(r335677)
@@ -36,6 +36,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "utils.h"
@@ -47,7 +48,6 @@ struct msgstr {
 };
 typedef struct msgstr msgstr_t;
 
-
 static pid_t pid;
 static int msqid, shmid, semid;
 static union semun semarg;
@@ -57,6 +57,7 @@ static struct shmid_ds shmbuff;
 static struct semid_ds sembuff;
 static char ipcregex[BUFFSIZE];
 static const char *auclass = "ip";
+static char path[BUFFSIZE] = "/fileforaudit";
 static unsigned short semvals[BUFFSIZE];
 
 
@@ -1398,6 +1399,194 @@ ATF_TC_CLEANUP(semctl_illegal_command, tc)
 }
 
 
+ATF_TC_WITH_CLEANUP(shm_open_success);
+ATF_TC_HEAD(shm_open_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "shm_open(2) call");
+}
+
+ATF_TC_BODY(shm_open_success, tc)
+{
+   pid = getpid();
+   snprintf(ipcregex, sizeof(ipcregex), "shm_open.*%d.*ret.*success", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE(shm_open(SHM_ANON, O_CREAT | O_TRUNC | O_RDWR, 0600) != -1);
+   check_audit(fds, ipcregex, pipefd);
+}
+
+ATF_TC_CLEANUP(shm_open_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shm_open_failure);
+ATF_TC_HEAD(shm_open_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "shm_open(2) call");
+}
+
+ATF_TC_BODY(shm_open_failure, tc)
+{
+   const char *regex = "shm_open.*fileforaudit.*return,failure";
+   FILE *pipefd = setup(fds, auclass);
+   /* Failure reason: File does not exist */
+   ATF_REQUIRE_EQ(-1, shm_open(path, O_TRUNC | O_RDWR, 0600));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(shm_open_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shm_unlink_success);
+ATF_TC_HEAD(shm_unlink_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "shm_unlink(2) call");
+}
+
+ATF_TC_BODY(shm_unlink_success, tc)
+{
+   /* Build an absolute path to a file in the test-case directory */
+   char dirpath[50];
+   ATF_REQUIRE(getcwd(dirpath, sizeof(dirpath)) != NULL);
+   strlcat(dirpath, path, sizeof(dirpath));
+   ATF_REQUIRE(shm_open(dirpath, O_CREAT | O_TRUNC | O_RDWR, 0600) != -1);
+
+   const char *regex = "shm_unlink.*fileforaudit.*return,success";
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, shm_unlink(dirpath));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(shm_unlink_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(shm_unlink_failure);
+ATF_TC_HEAD(shm_unlink_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "shm_unlink(2) call");
+}
+
+ATF_TC_BODY(shm_unlink_failure, tc)
+{
+   const char *regex = "shm_unlink.*fileforaudit.*return,failure";
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, shm_unlink(path));
+   check_audit(fds, regex, pipefd);
+}
+
+ATF_TC_CLEANUP(shm_unlink_failure, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(pipe_success);
+ATF_TC_HEAD(pipe_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "pipe(2) call");
+}
+
+ATF_TC_BODY(pipe_success, tc)
+{
+   int filedesc[2];
+   pid = getpid();
+   snprintf(ipcregex, sizeof(ipcregex), "pipe.*%d.*return,success", pid);
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(0, pipe(filedesc));
+   check_audit(fds, ipcregex, pipefd);
+
+   close(filedesc[0]);
+   close(filedesc[1]);
+}
+
+ATF_TC_CLEANUP(pipe_success, tc)
+{
+   cleanup();
+}
+
+
+ATF_TC_WITH_CLEANUP(pipe_failure);
+ATF_TC_HEAD(pipe_failure, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of an unsuccessful "
+   "pipe(2) call");
+}
+
+ATF_TC_BODY(pipe_failure, tc)
+{
+   pid = getpid();
+   snprintf(ipcregex, sizeof(ipcregex), "pipe.*%d.*return.failure", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   ATF_REQUIRE_EQ(-1, pipe(NULL));
+   check_audit(fds, ipcregex, pipefd);
+}
+

svn commit: r335676 - head/sys/modules

2018-06-26 Thread Ed Maste
Author: emaste
Date: Tue Jun 26 19:13:49 2018
New Revision: 335676
URL: https://svnweb.freebsd.org/changeset/base/335676

Log:
  Correct linprocfs/linsysfs arch check in r335672
  
  Pointy hat to:emaste

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Jun 26 18:53:52 2018(r335675)
+++ head/sys/modules/Makefile   Tue Jun 26 19:13:49 2018(r335676)
@@ -491,7 +491,7 @@ SUBDIR+=iscsi
 SUBDIR+=   iscsi_initiator
 .endif
 
-.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} != "amd64" || \
+.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
 ${MACHINE_CPUARCH} == "i386"
 SUBDIR+=   linprocfs
 SUBDIR+=   linsysfs
___
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: r335678 - head/lib/libcasper/services/cap_pwd

2018-06-26 Thread Mariusz Zaborski
Author: oshogbo
Date: Tue Jun 26 19:57:47 2018
New Revision: 335678
URL: https://svnweb.freebsd.org/changeset/base/335678

Log:
  [libcasper] Use explicit_bzero instead of memset to clear pwd struct
  
  Submitted by: David Carlier 
  Differential Revision:https://reviews.freebsd.org/D16015

Modified:
  head/lib/libcasper/services/cap_pwd/cap_pwd.c

Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.c
==
--- head/lib/libcasper/services/cap_pwd/cap_pwd.c   Tue Jun 26 19:26:07 
2018(r335677)
+++ head/lib/libcasper/services/cap_pwd/cap_pwd.c   Tue Jun 26 19:57:47 
2018(r335678)
@@ -100,7 +100,7 @@ passwd_unpack(const nvlist_t *nvl, struct passwd *pwd,
if (!nvlist_exists_string(nvl, "pw_name"))
return (EINVAL);
 
-   memset(pwd, 0, sizeof(*pwd));
+   explicit_bzero(pwd, sizeof(*pwd));
 
error = passwd_unpack_string(nvl, "pw_name", >pw_name, ,
);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335675 - head/contrib/file/magic/Magdir

2018-06-26 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jun 26 18:53:52 2018
New Revision: 335675
URL: https://svnweb.freebsd.org/changeset/base/335675

Log:
  Fix file(1) dumpdate reporting for dump(8) files
  
  Magic file for dump(8) had this dump and previous dump dates reversed.
  Fix order for all three flavours of the dump(8) format.
  This fix was committed to upstream repo as magic/Magdir/dump,v 1.17
  and will be merged during next vendor import.
  
  PR:   223155
  MFC after:2 weeks

Modified:
  head/contrib/file/magic/Magdir/dump

Modified: head/contrib/file/magic/Magdir/dump
==
--- head/contrib/file/magic/Magdir/dump Tue Jun 26 18:29:56 2018
(r335674)
+++ head/contrib/file/magic/Magdir/dump Tue Jun 26 18:53:52 2018
(r335675)
@@ -6,8 +6,8 @@
 # We specify both byte orders in order to recognize byte-swapped dumps.
 #
 0  namenew-dump-be
->4 bedate  x   Previous dump %s,
->8 bedate  x   This dump %s,
+>4 bedate  x   This dump %s,
+>8 bedate  x   Previous dump %s,
 >12belong  >0  Volume %d,
 >692   belong  0   Level zero, type:
 >692   belong  >0  Level %d, type:
@@ -25,8 +25,8 @@
 >888   belong  >0  Flags %x
 
 0  nameold-dump-be
-#>4bedate  x   Previous dump %s,
-#>8bedate  x   This dump %s,
+#>4bedate  x   This dump %s,
+#>8bedate  x   Previous dump %s,
 >12belong  >0  Volume %d,
 >692   belong  0   Level zero, type:
 >692   belong  >0  Level %d, type:
@@ -44,8 +44,8 @@
 >888   belong  >0  Flags %x
 
 0  nameufs2-dump-be
->896   beqdate x   Previous dump %s,
->904   beqdate x   This dump %s,
+>896   beqdate x   This dump %s,
+>904   beqdate x   Previous dump %s,
 >12belong  >0  Volume %d,
 >692   belong  0   Level zero, type:
 >692   belong  >0  Level %d, type:
___
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: r335674 - head/sys/vm

2018-06-26 Thread Alan Cox
Author: alc
Date: Tue Jun 26 18:29:56 2018
New Revision: 335674
URL: https://svnweb.freebsd.org/changeset/base/335674

Log:
  Update the physical page selection strategy used by vm_page_import() so
  that it does not cause rapid fragmentation of the free physical memory.
  
  Reviewed by:  jeff, markj (an earlier version)
  Differential Revision:https://reviews.freebsd.org/D15976

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_phys.c
  head/sys/vm/vm_phys.h

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Jun 26 18:07:16 2018(r335673)
+++ head/sys/vm/vm_page.c   Tue Jun 26 18:29:56 2018(r335674)
@@ -2235,24 +2235,16 @@ static int
 vm_page_import(void *arg, void **store, int cnt, int domain, int flags)
 {
struct vm_domain *vmd;
-   vm_page_t m;
-   int i, j, n;
+   int i;
 
vmd = arg;
/* Only import if we can bring in a full bucket. */
if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt))
return (0);
domain = vmd->vmd_domain;
-   n = 64; /* Starting stride, arbitrary. */
vm_domain_free_lock(vmd);
-   for (i = 0; i < cnt; i+=n) {
-   n = vm_phys_alloc_npages(domain, VM_FREELIST_DEFAULT, ,
-   MIN(n, cnt-i));
-   if (n == 0)
-   break;
-   for (j = 0; j < n; j++)
-   store[i+j] = m++;
-   }
+   i = vm_phys_alloc_npages(domain, VM_FREEPOOL_DEFAULT, cnt,
+   (vm_page_t *)store);
vm_domain_free_unlock(vmd);
if (cnt != i)
vm_domain_freecnt_inc(vmd, cnt - i);

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Tue Jun 26 18:07:16 2018(r335673)
+++ head/sys/vm/vm_phys.c   Tue Jun 26 18:29:56 2018(r335674)
@@ -605,6 +605,76 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_f
 }
 
 /*
+ * Tries to allocate the specified number of pages from the specified pool
+ * within the specified domain.  Returns the actual number of allocated pages
+ * and a pointer to each page through the array ma[].
+ *
+ * The returned pages may not be physically contiguous.  However, in contrast 
to
+ * performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0),
+ * calling this function once to allocate the desired number of pages will 
avoid
+ * wasted time in vm_phys_split_pages().
+ *
+ * The free page queues for the specified domain must be locked.
+ */
+int
+vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
+{
+   struct vm_freelist *alt, *fl;
+   vm_page_t m;
+   int avail, end, flind, freelist, i, need, oind, pind;
+
+   KASSERT(domain >= 0 && domain < vm_ndomains,
+   ("vm_phys_alloc_npages: domain %d is out of range", domain));
+   KASSERT(pool < VM_NFREEPOOL,
+   ("vm_phys_alloc_npages: pool %d is out of range", pool));
+   KASSERT(npages <= 1 << (VM_NFREEORDER - 1),
+   ("vm_phys_alloc_npages: npages %d is out of range", npages));
+   vm_domain_free_assert_locked(VM_DOMAIN(domain));
+   i = 0;
+   for (freelist = 0; freelist < VM_NFREELIST; freelist++) {
+   flind = vm_freelist_to_flind[freelist];
+   if (flind < 0)
+   continue;
+   fl = vm_phys_free_queues[domain][flind][pool];
+   for (oind = 0; oind < VM_NFREEORDER; oind++) {
+   while ((m = TAILQ_FIRST([oind].pl)) != NULL) {
+   vm_freelist_rem(fl, m, oind);
+   avail = 1 << oind;
+   need = imin(npages - i, avail);
+   for (end = i + need; i < end;)
+   ma[i++] = m++;
+   if (need < avail) {
+   vm_phys_free_contig(m, avail - need);
+   return (npages);
+   } else if (i == npages)
+   return (npages);
+   }
+   }
+   for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) {
+   for (pind = 0; pind < VM_NFREEPOOL; pind++) {
+   alt = vm_phys_free_queues[domain][flind][pind];
+   while ((m = TAILQ_FIRST([oind].pl)) !=
+   NULL) {
+   vm_freelist_rem(alt, m, oind);
+   vm_phys_set_pool(pool, m, oind);
+   avail = 1 << oind;
+   need = imin(npages - i, avail);
+   for (end = i + need; i < end;)
+

svn commit: r335679 - head/tests/sys/audit

2018-06-26 Thread Alan Somers
Author: asomers
Date: Tue Jun 26 20:26:57 2018
New Revision: 335679
URL: https://svnweb.freebsd.org/changeset/base/335679

Log:
  audit(4): add tests for the process-control audit class
  
  Tested syscalls include rfork(2), chdir(2), fchdir(2), chroot(2),
  getresuid(2), getresgid(2), setpriority(2), setgroups(2), setpgrp(2),
  setrlimit(2), setlogin(2), mlock(2), munlock(2), minherit(2), rtprio(2),
  profil(2), ktrace(2), ptrace(2), fork(2), umask(2), setuid(2), setgid(2),
  seteuid(2), and setegid(2).  The last six are only tested in the success
  case, either because they're infalliable or a failure is difficult to cause
  on-demand.
  
  Submitted by: aniketp
  MFC after:2 weeks
  Sponsored by: Google, Inc. (GSoC 2018)
  Differential Revision:https://reviews.freebsd.org/D15966

Added:
  head/tests/sys/audit/process-control.c   (contents, props changed)
Modified:
  head/tests/sys/audit/Makefile

Modified: head/tests/sys/audit/Makefile
==
--- head/tests/sys/audit/Makefile   Tue Jun 26 19:57:47 2018
(r335678)
+++ head/tests/sys/audit/Makefile   Tue Jun 26 20:26:57 2018
(r335679)
@@ -14,6 +14,7 @@ ATF_TESTS_C+= ioctl
 ATF_TESTS_C+=  network
 ATF_TESTS_C+=  inter-process
 ATF_TESTS_C+=  administrative
+ATF_TESTS_C+=  process-control
 
 SRCS.file-attribute-access+=   file-attribute-access.c
 SRCS.file-attribute-access+=   utils.c
@@ -39,6 +40,8 @@ SRCS.inter-process+=  inter-process.c
 SRCS.inter-process+=   utils.c
 SRCS.administrative+=  administrative.c
 SRCS.administrative+=  utils.c
+SRCS.process-control+= process-control.c
+SRCS.process-control+= utils.c
 
 TEST_METADATA+= timeout="30"
 TEST_METADATA+= required_user="root"

Added: head/tests/sys/audit/process-control.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/audit/process-control.c  Tue Jun 26 20:26:57 2018
(r335679)
@@ -0,0 +1,1265 @@
+/*-
+ * Copyright (c) 2018 Aniket Pandey
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "utils.h"
+
+static pid_t pid;
+static int filedesc, status;
+static struct pollfd fds[1];
+static char pcregex[80];
+static const char *auclass = "pc";
+
+
+ATF_TC_WITH_CLEANUP(fork_success);
+ATF_TC_HEAD(fork_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "fork(2) call");
+}
+
+ATF_TC_BODY(fork_success, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), "fork.*%d.*return,success", pid);
+
+   FILE *pipefd = setup(fds, auclass);
+   /* Check if fork(2) succeded. If so, exit from the child process */
+   ATF_REQUIRE((pid = fork()) != -1);
+   if (pid)
+   check_audit(fds, pcregex, pipefd);
+   else
+   _exit(0);
+
+}
+
+ATF_TC_CLEANUP(fork_success, tc)
+{
+   cleanup();
+}
+
+/*
+ * No fork(2) in failure mode since possibilities for failure are only when
+ * user is not privileged or when the number of processes exceed KERN_MAXPROC.
+ */
+
+
+ATF_TC_WITH_CLEANUP(rfork_success);
+ATF_TC_HEAD(rfork_success, tc)
+{
+   atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful "
+   "rfork(2) call");
+}
+
+ATF_TC_BODY(rfork_success, tc)
+{
+   pid = getpid();
+   snprintf(pcregex, sizeof(pcregex), 

svn commit: r335673 - in head: etc/defaults etc/rc.d lib/geom/eli share/man/man5

2018-06-26 Thread Ben Woods
Author: woodsb02 (ports committer)
Date: Tue Jun 26 18:07:16 2018
New Revision: 335673
URL: https://svnweb.freebsd.org/changeset/base/335673

Log:
  geli attach multiple providers
  
  Allow attaching of multiple geli providers at once if they use same
  passphrase and keyfiles.
  
  This is helpful when the providers being attached are not used for boot,
  and therefore the existing code to first try the cached password when
  tasting the providers during boot does not apply.
  
  Multiple providers with the same passphrase and keyfiles can be attached
  at the same time during system start-up by adding the following to
  rc.conf:
geli_groups="storage backup"
geli_storage_flags="-k /etc/geli/storage.keys"
geli_storage_devices="ada0 ada1"
geli_backup_flags="-j /etc/geli/backup.passfile -k /etc/geli/backup.keys"
geli_backup_devices="ada2 ada3"
  
  Reviewed by:  wblock, delphij, jilles
  Approved by:  sobomax (src), bcr (doc)
  Differential Revision:https://reviews.freebsd.org/D12644

Modified:
  head/etc/defaults/rc.conf
  head/etc/rc.d/geli
  head/lib/geom/eli/geli.8
  head/lib/geom/eli/geom_eli.c
  head/share/man/man5/rc.conf.5

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Tue Jun 26 16:50:41 2018(r335672)
+++ head/etc/defaults/rc.conf   Tue Jun 26 18:07:16 2018(r335673)
@@ -79,6 +79,8 @@ gbde_lockdir="/etc"   # Where to look for gbde lockfiles
 # GELI disk encryption configuration.
 geli_devices=""# List of devices to automatically attach in 
addition to
# GELI devices listed in /etc/fstab.
+geli_groups="" # List of groups containing devices to automatically
+   # attach with the same keyfiles and passphrase
 geli_tries=""  # Number of times to attempt attaching geli device.
# If empty, kern.geom.eli.tries will be used.
 geli_default_flags=""  # Default flags for geli(8).
@@ -90,6 +92,11 @@ geli_autodetach="YES"# Automatically detach on last c
 #geli_da1_flags="-p -k /etc/geli/da1.keys"
 #geli_da1_autodetach="NO"
 #geli_mirror_home_flags="-k /etc/geli/home.keys"
+#geli_groups="storage backup"
+#geli_storage_flags="-k /etc/geli/storage.keys"
+#geli_storage_devices="ada0 ada1"
+#geli_backup_flags="-j /etc/geli/backup.passfile -k /etc/geli/backup.keys"
+#geli_backup_devices="ada2 ada3"
 
 root_rw_mount="YES"# Set to NO to inhibit remounting root read-write.
 root_hold_delay="30"   # Time to wait for root mount hold release.

Modified: head/etc/rc.d/geli
==
--- head/etc/rc.d/geli  Tue Jun 26 16:50:41 2018(r335672)
+++ head/etc/rc.d/geli  Tue Jun 26 18:07:16 2018(r335673)
@@ -34,7 +34,7 @@
 
 name="geli"
 desc="GELI disk encryption"
-start_precmd='[ -n "$(geli_make_list)" ]'
+start_precmd='[ -n "$(geli_make_list)" -o -n "${geli_groups}" ]'
 start_cmd="geli_start"
 stop_cmd="geli_stop"
 required_modules="geom_eli:g_eli"
@@ -72,11 +72,47 @@ geli_start()
done
fi
done
+
+   for group in ${geli_groups}; do
+   group_=`ltr ${group} '/-' '_'`
+
+   eval "flags=\${geli_${group_}_flags}"
+   if [ -z "${flags}" ]; then
+   flags=${geli_default_flags}
+   fi
+
+   eval "providers=\${geli_${group_}_devices}"
+   if [ -z "${providers}" ]; then
+   echo "No devices listed in geli group ${group}."
+   continue
+   fi
+
+   if [ -e "/dev/${providers%% *}" -a ! -e "/dev/${providers%% 
*}.eli" ]; then
+   echo "Configuring Disk Encryption for geli group 
${group}, containing ${providers}."
+   count=1
+   while [ ${count} -le ${geli_tries} ]; do
+   geli attach ${flags} ${providers}
+   if [ -e "/dev/${providers%% *}.eli" ]; then
+   break
+   fi
+   echo "Attach failed; attempt ${count} of 
${geli_tries}."
+   count=$((count+1))
+   done
+   fi
+   done
 }
 
 geli_stop()
 {
devices=`geli_make_list`
+
+   for group in ${geli_groups}; do
+   group_=`ltr ${group} '/-' '_'`
+
+   eval "providers=\${geli_${group_}_devices}"
+
+   devices="${devices} ${providers}"
+   done
 
for provider in ${devices}; do
if [ -e "/dev/${provider}.eli" ]; then

Modified: head/lib/geom/eli/geli.8
==
--- head/lib/geom/eli/geli.8Tue Jun 26 16:50:41 2018(r335672)
+++ 

svn commit: r335655 - head/sbin/fsck_msdosfs

2018-06-26 Thread Xin LI
Author: delphij
Date: Tue Jun 26 06:18:59 2018
New Revision: 335655
URL: https://svnweb.freebsd.org/changeset/base/335655

Log:
  Fix division by zero when reading boot block by postponing division
  until it is necessary and after we validated bytes per sector is non-
  zero.
  
  Obtained from:Android 
https://android-review.googlesource.com/c/platform/external/fsck_msdos/+/36362
  MFC after:2 weeks

Modified:
  head/sbin/fsck_msdosfs/boot.c

Modified: head/sbin/fsck_msdosfs/boot.c
==
--- head/sbin/fsck_msdosfs/boot.c   Tue Jun 26 04:06:49 2018
(r335654)
+++ head/sbin/fsck_msdosfs/boot.c   Tue Jun 26 06:18:59 2018
(r335655)
@@ -178,12 +178,8 @@ readboot(int dosfs, struct bootblock *boot)
/* Check backup bpbFSInfo?  
XXX */
}
 
-   boot->ClusterOffset = (boot->bpbRootDirEnts * 32 +
-   boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec +
-   boot->bpbResSectors + boot->bpbFATs * boot->FATsecs -
-   CLUST_FIRST * boot->bpbSecPerClust;
-
-   if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0) {
+   if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0 ||
+   boot->bpbBytesPerSec == 0) {
pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
return FSFATAL;
}
@@ -196,6 +192,10 @@ readboot(int dosfs, struct bootblock *boot)
boot->NumSectors = boot->bpbSectors;
} else
boot->NumSectors = boot->bpbHugeSectors;
+   boot->ClusterOffset = (boot->bpbRootDirEnts * 32 +
+   boot->bpbBytesPerSec - 1) / boot->bpbBytesPerSec +
+   boot->bpbResSectors + boot->bpbFATs * boot->FATsecs -
+   CLUST_FIRST * boot->bpbSecPerClust;
boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) /
boot->bpbSecPerClust;
 
___
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: r335629 - in head: share/man/man4 sys/dev/vt/hw/vga

2018-06-26 Thread Roger Pau Monné
On Tue, Jun 26, 2018 at 05:21:27AM +, Alexey Dokuchaev wrote:
> On Mon, Jun 25, 2018 at 08:43:51AM -0700, Rodney W. Grimes wrote:
> > > New Revision: 335629
> > > URL: https://svnweb.freebsd.org/changeset/base/335629
> > > 
> > > Log:
> > >   vt: add option to ignore NO_VGA flag in ACPI
> > >   
> > >   To workaround buggy firmware that sets this flag when there's actually
> > >   a VGA present.
> > >   
> > >   Reported and tested by: Yasuhiro KIMURA 
> > >   Sponsored by:   Citrix Systems R
> > >   Reviewed by:kib
> > >   Differential revision:  https://reviews.freebsd.org/D16003
> > 
> > It is generally best to avoid double negatives,
> > couldnt this of been better named? (hw.vga.acpi_force_vga)
> 
> Yes please; I get constantly confused when calculating negatives and
> often get them wrong.

This is specifically done to workaround a firmware bug where some
buggy firmwares set the NO_VGA flag in ACPI. So the option does
exactly what the name says, it ignores the NO_VGA flag in ACPI. IMO
acpi_force_vga is not as descriptive as the current name.

Roger.
___
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: r335659 - in stable/11/sys: dev/uart kern sys x86/acpica

2018-06-26 Thread Andriy Gapon
Author: avg
Date: Tue Jun 26 09:04:24 2018
New Revision: 335659
URL: https://svnweb.freebsd.org/changeset/base/335659

Log:
  MFC r334340: add support for console resuming, implement it for uart, use on 
x86

Modified:
  stable/11/sys/dev/uart/uart_tty.c
  stable/11/sys/kern/kern_cons.c
  stable/11/sys/sys/cons.h
  stable/11/sys/x86/acpica/acpi_wakeup.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/uart/uart_tty.c
==
--- stable/11/sys/dev/uart/uart_tty.c   Tue Jun 26 08:56:34 2018
(r335658)
+++ stable/11/sys/dev/uart/uart_tty.c   Tue Jun 26 09:04:24 2018
(r335659)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 
 static cn_probe_t uart_cnprobe;
 static cn_init_t uart_cninit;
+static cn_init_t uart_cnresume;
 static cn_term_t uart_cnterm;
 static cn_getc_t uart_cngetc;
 static cn_putc_t uart_cnputc;
@@ -67,7 +68,10 @@ static tsw_modem_t uart_tty_modem;
 static tsw_free_t uart_tty_free;
 static tsw_busy_t uart_tty_busy;
 
-CONSOLE_DRIVER(uart);
+CONSOLE_DRIVER(
+   uart,
+   .cn_resume = uart_cnresume,
+);
 
 static struct uart_devinfo uart_console;
 
@@ -110,6 +114,13 @@ uart_cninit(struct consdev *cp)
di->type = UART_DEV_CONSOLE;
uart_add_sysdev(di);
uart_init(di);
+}
+
+static void
+uart_cnresume(struct consdev *cp)
+{
+
+   uart_init(cp->cn_arg);
 }
 
 static void

Modified: stable/11/sys/kern/kern_cons.c
==
--- stable/11/sys/kern/kern_cons.c  Tue Jun 26 08:56:34 2018
(r335658)
+++ stable/11/sys/kern/kern_cons.c  Tue Jun 26 09:04:24 2018
(r335659)
@@ -382,6 +382,19 @@ cnungrab()
}
 }
 
+void
+cnresume()
+{
+   struct cn_device *cnd;
+   struct consdev *cn;
+
+   STAILQ_FOREACH(cnd, _devlist, cnd_next) {
+   cn = cnd->cnd_cn;
+   if (cn->cn_ops->cn_resume != NULL)
+   cn->cn_ops->cn_resume(cn);
+   }
+}
+
 /*
  * Low level console routines.
  */

Modified: stable/11/sys/sys/cons.h
==
--- stable/11/sys/sys/cons.hTue Jun 26 08:56:34 2018(r335658)
+++ stable/11/sys/sys/cons.hTue Jun 26 09:04:24 2018(r335659)
@@ -64,6 +64,8 @@ struct consdev_ops {
/* grab console for exclusive kernel use */
cn_ungrab_t *cn_ungrab;
/* ungrab console */
+   cn_init_t   *cn_resume;
+   /* set up console after sleep, optional */
 };
 
 struct consdev {
@@ -103,8 +105,9 @@ extern  struct tty *constty;/* Temporary virtual 
conso
};  \
DATA_SET(cons_set, name)
 
-#defineCONSOLE_DRIVER(name)
\
+#defineCONSOLE_DRIVER(name, ...)   
\
static const struct consdev_ops name##_consdev_ops = {  \
+   /* Mandatory methods. */\
.cn_probe = name##_cnprobe, \
.cn_init = name##_cninit,   \
.cn_term = name##_cnterm,   \
@@ -112,6 +115,8 @@ extern  struct tty *constty;/* Temporary virtual 
conso
.cn_putc = name##_cnputc,   \
.cn_grab = name##_cngrab,   \
.cn_ungrab = name##_cnungrab,   \
+   /* Optional fields. */  \
+   __VA_ARGS__ \
};  \
CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL)
 
@@ -124,6 +129,7 @@ voidcnremove(struct consdev *);
 void   cnselect(struct consdev *);
 void   cngrab(void);
 void   cnungrab(void);
+void   cnresume(void);
 intcncheckc(void);
 intcngetc(void);
 void   cngets(char *, size_t, int);

Modified: stable/11/sys/x86/acpica/acpi_wakeup.c
==
--- stable/11/sys/x86/acpica/acpi_wakeup.c  Tue Jun 26 08:56:34 2018
(r335658)
+++ stable/11/sys/x86/acpica/acpi_wakeup.c  Tue Jun 26 09:04:24 2018
(r335659)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -265,6 +266,12 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
for (;;)
ia32_pause();
} else {
+   /*
+* Re-initialize console hardware as soon as possibe.
+* No console output (e.g. printf) is 

svn commit: r335660 - head/share/man/man9

2018-06-26 Thread Mark Johnston
Author: markj
Date: Tue Jun 26 09:30:14 2018
New Revision: 335660
URL: https://svnweb.freebsd.org/changeset/base/335660

Log:
  Add missing MLINK.
  
  MFC after:3 days

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Jun 26 09:04:24 2018
(r335659)
+++ head/share/man/man9/MakefileTue Jun 26 09:30:14 2018
(r335660)
@@ -453,6 +453,7 @@ MLINKS+=altq.9 ALTQ.9
 MLINKS+=atomic.9 atomic_add.9 \
atomic.9 atomic_clear.9 \
atomic.9 atomic_cmpset.9 \
+   atomic.9 atomic_fcmpset.9 \
atomic.9 atomic_fetchadd.9 \
atomic.9 atomic_load.9 \
atomic.9 atomic_readandclear.9 \
___
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: r335657 - in stable/11/sys: amd64/include dev/acpica i386/include x86/x86

2018-06-26 Thread Andriy Gapon
Author: avg
Date: Tue Jun 26 08:35:58 2018
New Revision: 335657
URL: https://svnweb.freebsd.org/changeset/base/335657

Log:
  MFC r334204,r334338: re-synchronize TSC-s on SMP systems after resume

Modified:
  stable/11/sys/amd64/include/clock.h
  stable/11/sys/dev/acpica/acpi.c
  stable/11/sys/i386/include/clock.h
  stable/11/sys/x86/x86/tsc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/include/clock.h
==
--- stable/11/sys/amd64/include/clock.h Tue Jun 26 08:31:08 2018
(r335656)
+++ stable/11/sys/amd64/include/clock.h Tue Jun 26 08:35:58 2018
(r335657)
@@ -34,6 +34,7 @@ void  clock_init(void);
 
 void   startrtclock(void);
 void   init_TSC(void);
+void   resume_TSC(void);
 
 #defineHAS_TIMER_SPKR 1
 inttimer_spkr_acquire(void);

Modified: stable/11/sys/dev/acpica/acpi.c
==
--- stable/11/sys/dev/acpica/acpi.c Tue Jun 26 08:31:08 2018
(r335656)
+++ stable/11/sys/dev/acpica/acpi.c Tue Jun 26 08:35:58 2018
(r335657)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #if defined(__i386__) || defined(__amd64__)
+#include 
 #include 
 #endif
 #include 
@@ -2991,6 +2992,10 @@ backout:
 if (slp_state >= ACPI_SS_SLP_PREP)
AcpiLeaveSleepState(state);
 if (slp_state >= ACPI_SS_SLEPT) {
+#if defined(__i386__) || defined(__amd64__)
+   /* NB: we are still using ACPI timecounter at this point. */
+   resume_TSC();
+#endif
acpi_resync_clock(sc);
acpi_enable_fixed_events(sc);
 }

Modified: stable/11/sys/i386/include/clock.h
==
--- stable/11/sys/i386/include/clock.h  Tue Jun 26 08:31:08 2018
(r335656)
+++ stable/11/sys/i386/include/clock.h  Tue Jun 26 08:35:58 2018
(r335657)
@@ -32,6 +32,7 @@ void  clock_init(void);
 void   startrtclock(void);
 void   timer_restore(void);
 void   init_TSC(void);
+void   resume_TSC(void);
 
 #defineHAS_TIMER_SPKR 1
 inttimer_spkr_acquire(void);

Modified: stable/11/sys/x86/x86/tsc.c
==
--- stable/11/sys/x86/x86/tsc.c Tue Jun 26 08:31:08 2018(r335656)
+++ stable/11/sys/x86/x86/tsc.c Tue Jun 26 08:35:58 2018(r335657)
@@ -450,7 +450,7 @@ adj_smp_tsc(void *arg)
 }
 
 static int
-test_tsc(void)
+test_tsc(int adj_max_count)
 {
uint64_t *data, *tsc;
u_int i, size, adj;
@@ -466,7 +466,7 @@ retry:
smp_tsc = 1;/* XXX */
smp_rendezvous(smp_no_rendezvous_barrier, comp_smp_tsc,
smp_no_rendezvous_barrier, data);
-   if (!smp_tsc && adj < smp_tsc_adjust) {
+   if (!smp_tsc && adj < adj_max_count) {
adj++;
smp_rendezvous(smp_no_rendezvous_barrier, adj_smp_tsc,
smp_no_rendezvous_barrier, data);
@@ -504,19 +504,6 @@ retry:
 
 #undef N
 
-#else
-
-/*
- * The function is not called, it is provided to avoid linking failure
- * on uniprocessor kernel.
- */
-static int
-test_tsc(void)
-{
-
-   return (0);
-}
-
 #endif /* SMP */
 
 static void
@@ -577,9 +564,12 @@ init_TSC_tc(void)
 * non-zero value.  The TSC seems unreliable in virtualized SMP
 * environments, so it is set to a negative quality in those cases.
 */
+#ifdef SMP
if (mp_ncpus > 1)
-   tsc_timecounter.tc_quality = test_tsc();
-   else if (tsc_is_invariant)
+   tsc_timecounter.tc_quality = test_tsc(smp_tsc_adjust);
+   else
+#endif /* SMP */
+   if (tsc_is_invariant)
tsc_timecounter.tc_quality = 1000;
max_freq >>= tsc_shift;
 
@@ -613,6 +603,32 @@ init:
}
 }
 SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc, NULL);
+
+void
+resume_TSC(void)
+{
+#ifdef SMP
+   int quality;
+
+   /* If TSC was not good on boot, it is unlikely to become good now. */
+   if (tsc_timecounter.tc_quality < 0)
+   return;
+   /* Nothing to do with UP. */
+   if (mp_ncpus < 2)
+   return;
+
+   /*
+* If TSC was good, a single synchronization should be enough,
+* but honour smp_tsc_adjust if it's set.
+*/
+   quality = test_tsc(MAX(smp_tsc_adjust, 1));
+   if (quality != tsc_timecounter.tc_quality) {
+   printf("TSC timecounter quality changed: %d -> %d\n",
+   tsc_timecounter.tc_quality, quality);
+   tsc_timecounter.tc_quality = quality;
+   }
+#endif /* SMP */
+}
 
 /*
  * When cpufreq levels change, find out about the (new) max frequency.  We
___
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: r335658 - stable/11/sys/kern

2018-06-26 Thread Andriy Gapon
Author: avg
Date: Tue Jun 26 08:56:34 2018
New Revision: 335658
URL: https://svnweb.freebsd.org/changeset/base/335658

Log:
  MFC r333268: for bus suspend, detach and shutdown iterate children in reverse 
order

Modified:
  stable/11/sys/kern/subr_bus.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/subr_bus.c
==
--- stable/11/sys/kern/subr_bus.c   Tue Jun 26 08:35:58 2018
(r335657)
+++ stable/11/sys/kern/subr_bus.c   Tue Jun 26 08:56:34 2018
(r335658)
@@ -3697,7 +3697,11 @@ bus_generic_detach(device_t dev)
if (dev->state != DS_ATTACHED)
return (EBUSY);
 
-   TAILQ_FOREACH(child, >children, link) {
+   /*
+* Detach children in the reverse order.
+* See bus_generic_suspend for details.
+*/
+   TAILQ_FOREACH_REVERSE(child, >children, device_list, link) {
if ((error = device_detach(child)) != 0)
return (error);
}
@@ -3717,7 +3721,11 @@ bus_generic_shutdown(device_t dev)
 {
device_t child;
 
-   TAILQ_FOREACH(child, >children, link) {
+   /*
+* Shut down children in the reverse order.
+* See bus_generic_suspend for details.
+*/
+   TAILQ_FOREACH_REVERSE(child, >children, device_list, link) {
device_shutdown(child);
}
 
@@ -3770,15 +3778,23 @@ int
 bus_generic_suspend(device_t dev)
 {
int error;
-   device_tchild, child2;
+   device_tchild;
 
-   TAILQ_FOREACH(child, >children, link) {
+   /*
+* Suspend children in the reverse order.
+* For most buses all children are equal, so the order does not matter.
+* Other buses, such as acpi, carefully order their child devices to
+* express implicit dependencies between them.  For such buses it is
+* safer to bring down devices in the reverse order.
+*/
+   TAILQ_FOREACH_REVERSE(child, >children, device_list, link) {
error = BUS_SUSPEND_CHILD(dev, child);
-   if (error) {
-   for (child2 = TAILQ_FIRST(>children);
-child2 && child2 != child;
-child2 = TAILQ_NEXT(child2, link))
-   BUS_RESUME_CHILD(dev, child2);
+   if (error != 0) {
+   child = TAILQ_NEXT(child, link);
+   if (child != NULL) {
+   TAILQ_FOREACH_FROM(child, >children, link)
+   BUS_RESUME_CHILD(dev, child);
+   }
return (error);
}
}
___
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: r334329 - head/sys/arm64/arm64

2018-06-26 Thread Patryk Duda
Could you provide some details about firmware? I would like to
reproduce it on our ThunderX2.

2018-06-25 17:28 GMT+02:00 Andrew Turner :
> I’ve not seen this on the ThunderX2 I have access to with the latest 
> firmware. You’ll need to find out why the kernel is trying to access the 
> memory, and where it is in the EFI memory map.
>
> Andrew
>
>> On 21 Jun 2018, at 13:41, Patryk Duda  wrote:
>>
>> Hi,
>>
>> I'm trying to boot kernel on ThunderX2 but I've got following error:
>>
>> panic: efi_init: PA out of range, PA: 0xfafd0018
>>
>> This error comes from PHYS_TO_DMAP macro.
>> I can workaround this issue by disabling EFI Runtime Services in
>> kernel config but it seems to be
>> a problem with discontignous DMAP mapping.
>>
>>
>> 2018-05-29 15:52 GMT+02:00 Andrew Turner :
>>> Author: andrew
>>> Date: Tue May 29 13:52:25 2018
>>> New Revision: 334329
>>> URL: https://svnweb.freebsd.org/changeset/base/334329
>>>
>>> Log:
>>>  On ThunderX2 we need to be careful to only map the memory the firmware
>>>  lists in the EFI memory map. As such we need to reduce the mappings to
>>>  restrict them to not be the full 1G block. For now reduce this to a 2M
>>>  block, however this may be further restricted to be 4k page aligned as
>>>  other SoCs may require.
>>>
>>>  This allows ThunderX2 to boot reliably to userspace without performing
>>>  any speculative memory accesses to invalid physical memory.
>>>
>>>  This is a recommit of r334035 now that we can access the EFI Runtime data
>>>  through the DMAP region.
>>>
>>>  Tested by:tuexen
>>>  Sponsored by: DARPA, AFRL
>>>
>>> Modified:
>>>  head/sys/arm64/arm64/pmap.c
>>>
>>> Modified: head/sys/arm64/arm64/pmap.c
>>> ==
>>> --- head/sys/arm64/arm64/pmap.c Tue May 29 13:43:16 2018(r334328)
>>> +++ head/sys/arm64/arm64/pmap.c Tue May 29 13:52:25 2018(r334329)
>>> @@ -590,33 +590,100 @@ pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va)
>>>return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET));
>>> }
>>>
>>> -static void
>>> -pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, vm_paddr_t 
>>> max_pa)
>>> +static vm_offset_t
>>> +pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa,
>>> +vm_offset_t freemempos)
>>> {
>>> +   pt_entry_t *l2;
>>>vm_offset_t va;
>>> -   vm_paddr_t pa;
>>> -   u_int l1_slot;
>>> +   vm_paddr_t l2_pa, pa;
>>> +   u_int l1_slot, l2_slot, prev_l1_slot;
>>>int i;
>>>
>>>dmap_phys_base = min_pa & ~L1_OFFSET;
>>>dmap_phys_max = 0;
>>>dmap_max_addr = 0;
>>> +   l2 = NULL;
>>> +   prev_l1_slot = -1;
>>>
>>> +#defineDMAP_TABLES ((DMAP_MAX_ADDRESS - DMAP_MIN_ADDRESS) >> 
>>> L0_SHIFT)
>>> +   memset(pagetable_dmap, 0, PAGE_SIZE * DMAP_TABLES);
>>> +
>>>for (i = 0; i < (physmap_idx * 2); i += 2) {
>>> -   pa = physmap[i] & ~L1_OFFSET;
>>> +   pa = physmap[i] & ~L2_OFFSET;
>>>va = pa - dmap_phys_base + DMAP_MIN_ADDRESS;
>>>
>>> -   for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1];
>>> +   /* Create L2 mappings at the start of the region */
>>> +   if ((pa & L1_OFFSET) != 0) {
>>> +   l1_slot = ((va - DMAP_MIN_ADDRESS) >> L1_SHIFT);
>>> +   if (l1_slot != prev_l1_slot) {
>>> +   prev_l1_slot = l1_slot;
>>> +   l2 = (pt_entry_t *)freemempos;
>>> +   l2_pa = pmap_early_vtophys(kern_l1,
>>> +   (vm_offset_t)l2);
>>> +   freemempos += PAGE_SIZE;
>>> +
>>> +   pmap_load_store(_dmap[l1_slot],
>>> +   (l2_pa & ~Ln_TABLE_MASK) | L1_TABLE);
>>> +
>>> +   memset(l2, 0, PAGE_SIZE);
>>> +   }
>>> +   KASSERT(l2 != NULL,
>>> +   ("pmap_bootstrap_dmap: NULL l2 map"));
>>> +   for (; va < DMAP_MAX_ADDRESS && pa < physmap[i + 1];
>>> +   pa += L2_SIZE, va += L2_SIZE) {
>>> +   /*
>>> +* We are on a boundary, stop to
>>> +* create a level 1 block
>>> +*/
>>> +   if ((pa & L1_OFFSET) == 0)
>>> +   break;
>>> +
>>> +   l2_slot = pmap_l2_index(va);
>>> +   KASSERT(l2_slot != 0, ("..."));
>>> +   pmap_load_store([l2_slot],
>>> +   (pa & ~L2_OFFSET) | ATTR_DEFAULT | 
>>> ATTR_XN |
>>> +   ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
>>> +   }
>>> +   

svn commit: r335656 - in stable/11/sys: dev/acpica kern sys

2018-06-26 Thread Andriy Gapon
Author: avg
Date: Tue Jun 26 08:31:08 2018
New Revision: 335656
URL: https://svnweb.freebsd.org/changeset/base/335656

Log:
  MFC r333994: stop and restart kernel event timers in the suspend / resume 
cycle

Modified:
  stable/11/sys/dev/acpica/acpi.c
  stable/11/sys/kern/kern_clocksource.c
  stable/11/sys/sys/systm.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi.c
==
--- stable/11/sys/dev/acpica/acpi.c Tue Jun 26 06:18:59 2018
(r335655)
+++ stable/11/sys/dev/acpica/acpi.c Tue Jun 26 08:31:08 2018
(r335656)
@@ -2909,6 +2909,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
 if (sc->acpi_sleep_delay > 0)
DELAY(sc->acpi_sleep_delay * 100);
 
+suspendclock();
 intr = intr_disable();
 if (state != ACPI_STATE_S1) {
sleep_result = acpi_sleep_machdep(sc, state);
@@ -2979,6 +2980,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
  * process.  This handles both the error and success cases.
  */
 backout:
+if (slp_state >= ACPI_SS_SLP_PREP)
+   resumeclock();
 if (slp_state >= ACPI_SS_GPE_SET) {
acpi_wake_prep_walk(state);
sc->acpi_sstate = ACPI_STATE_S0;

Modified: stable/11/sys/kern/kern_clocksource.c
==
--- stable/11/sys/kern/kern_clocksource.c   Tue Jun 26 06:18:59 2018
(r335655)
+++ stable/11/sys/kern/kern_clocksource.c   Tue Jun 26 08:31:08 2018
(r335656)
@@ -692,6 +692,22 @@ cpu_initclocks_ap(void)
spinlock_exit();
 }
 
+void
+suspendclock(void)
+{
+   ET_LOCK();
+   configtimer(0);
+   ET_UNLOCK();
+}
+
+void
+resumeclock(void)
+{
+   ET_LOCK();
+   configtimer(1);
+   ET_UNLOCK();
+}
+
 /*
  * Switch to profiling clock rates.
  */

Modified: stable/11/sys/sys/systm.h
==
--- stable/11/sys/sys/systm.h   Tue Jun 26 06:18:59 2018(r335655)
+++ stable/11/sys/sys/systm.h   Tue Jun 26 08:31:08 2018(r335656)
@@ -318,6 +318,8 @@ voidstartprofclock(struct proc *);
 void   stopprofclock(struct proc *);
 void   cpu_startprofclock(void);
 void   cpu_stopprofclock(void);
+void   suspendclock(void);
+void   resumeclock(void);
 sbintime_t cpu_idleclock(void);
 void   cpu_activeclock(void);
 void   cpu_new_callout(int cpu, sbintime_t bt, sbintime_t bt_opt);
___
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: r335683 - head/usr.sbin/powerd

2018-06-26 Thread Eitan Adler
Author: eadler
Date: Wed Jun 27 01:28:09 2018
New Revision: 335683
URL: https://svnweb.freebsd.org/changeset/base/335683

Log:
  powerd: correct ifdef check for ppc
  
  Reviewed by:  jhibbits

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

Modified: head/usr.sbin/powerd/powerd.c
==
--- head/usr.sbin/powerd/powerd.c   Tue Jun 26 23:28:03 2018
(r335682)
+++ head/usr.sbin/powerd/powerd.c   Wed Jun 27 01:28:09 2018
(r335683)
@@ -293,7 +293,7 @@ acline_init(void)
acline_mode = ac_sysctl;
if (vflag)
warnx("using sysctl for AC line status");
-#if __powerpc__
+#ifdef __powerpc__
} else if (sysctlnametomib(PMUAC, acline_mib, _mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
___
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: r335692 - in head/sys: kern sys

2018-06-26 Thread Warner Losh
Author: imp
Date: Wed Jun 27 04:11:19 2018
New Revision: 335692
URL: https://svnweb.freebsd.org/changeset/base/335692

Log:
  Remove devctl_safe_quote since it's now unused.
  
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D16026

Modified:
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cWed Jun 27 04:11:14 2018(r335691)
+++ head/sys/kern/subr_bus.cWed Jun 27 04:11:19 2018(r335692)
@@ -860,38 +860,6 @@ sysctl_devctl_queue(SYSCTL_HANDLER_ARGS)
  * Strings are always terminated with a NUL, but may be truncated if longer
  * than @p len bytes after quotes.
  *
- * @param dst  Buffer to hold the string. Must be at least @p len bytes long
- * @param src  Original buffer.
- * @param len  Length of buffer pointed to by @dst, including trailing NUL
- */
-void
-devctl_safe_quote(char *dst, const char *src, size_t len)
-{
-   char *walker = dst, *ep = dst + len - 1;
-
-   if (len == 0)
-   return;
-   while (src != NULL && walker < ep)
-   {
-   if (*src == '"' || *src == '\\') {
-   if (ep - walker < 2)
-   break;
-   *walker++ = '\\';
-   }
-   *walker++ = *src++;
-   }
-   *walker = '\0';
-}
-
-/**
- * @brief safely quotes strings that might have double quotes in them.
- *
- * The devctl protocol relies on quoted strings having matching quotes.
- * This routine quotes any internal quotes so the resulting string
- * is safe to pass to snprintf to construct, for example pnp info strings.
- * Strings are always terminated with a NUL, but may be truncated if longer
- * than @p len bytes after quotes.
- *
  * @param sb   sbuf to place the characters into
  * @param src  Original buffer.
  */

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Wed Jun 27 04:11:14 2018(r335691)
+++ head/sys/sys/bus.h  Wed Jun 27 04:11:19 2018(r335692)
@@ -156,7 +156,6 @@ void devctl_notify(const char *__system, const char *_
 const char *__type, const char *__data);
 void devctl_queue_data_f(char *__data, int __flags);
 void devctl_queue_data(char *__data);
-void devctl_safe_quote(char *__dst, const char *__src, size_t __len);
 struct sbuf;
 void devctl_safe_quote_sb(struct sbuf *__sb, const char *__src);
 
___
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: r335685 - head/usr.bin/top

2018-06-26 Thread Daichi GOTO
Author: daichi
Date: Wed Jun 27 02:55:30 2018
New Revision: 335685
URL: https://svnweb.freebsd.org/changeset/base/335685

Log:
  top(1): increased the maximum length of command shown by "-a"
  
  Reviewed by:  eadler
  Approved by:  gnn (mentor)
  Differential Revision:https://reviews.freebsd.org/D16006

Modified:
  head/usr.bin/top/machine.c

Modified: head/usr.bin/top/machine.c
==
--- head/usr.bin/top/machine.c  Wed Jun 27 01:51:17 2018(r335684)
+++ head/usr.bin/top/machine.c  Wed Jun 27 02:55:30 2018(r335685)
@@ -871,7 +871,7 @@ format_next_process(struct handle * xhandle, char *(*g
long p_tot, s_tot;
char *cmdbuf = NULL;
char **args;
-   const int cmdlen = 128;
+   const int cmdlen = 256;
static struct sbuf* procbuf = NULL;
 
/* clean up from last time. */
___
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: r335684 - head/sys/dev/cxgbe

2018-06-26 Thread Navdeep Parhar
Author: np
Date: Wed Jun 27 01:51:17 2018
New Revision: 335684
URL: https://svnweb.freebsd.org/changeset/base/335684

Log:
  cxgbe(4): Do not leak the filters in the hashfilter table on module
  unload.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_filter.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/adapter.h
==
--- head/sys/dev/cxgbe/adapter.hWed Jun 27 01:28:09 2018
(r335683)
+++ head/sys/dev/cxgbe/adapter.hWed Jun 27 01:51:17 2018
(r335684)
@@ -1260,6 +1260,7 @@ int t4_filter_rpl(struct sge_iq *, const struct rss_he
 int t4_hashfilter_ao_rpl(struct sge_iq *, const struct rss_header *, struct 
mbuf *);
 int t4_hashfilter_tcb_rpl(struct sge_iq *, const struct rss_header *, struct 
mbuf *);
 int t4_del_hashfilter_rpl(struct sge_iq *, const struct rss_header *, struct 
mbuf *);
+void free_hftid_tab(struct tid_info *);
 
 static inline struct wrqe *
 alloc_wrqe(int wr_len, struct sge_wrq *wrq)

Modified: head/sys/dev/cxgbe/t4_filter.c
==
--- head/sys/dev/cxgbe/t4_filter.c  Wed Jun 27 01:28:09 2018
(r335683)
+++ head/sys/dev/cxgbe/t4_filter.c  Wed Jun 27 01:51:17 2018
(r335684)
@@ -70,6 +70,46 @@ static int set_hashfilter(struct adapter *, struct t4_
 static int del_hashfilter(struct adapter *, struct t4_filter *);
 static int configure_hashfilter_tcb(struct adapter *, struct filter_entry *);
 
+static int
+alloc_hftid_tab(struct tid_info *t, int flags)
+{
+
+   MPASS(t->ntids > 0);
+   MPASS(t->hftid_tab == NULL);
+
+   t->hftid_tab = malloc(sizeof(*t->hftid_tab) * t->ntids, M_CXGBE,
+   M_ZERO | flags);
+   if (t->hftid_tab == NULL)
+   return (ENOMEM);
+   mtx_init(>hftid_lock, "T4 hashfilters", 0, MTX_DEF);
+   cv_init(>hftid_cv, "t4hfcv");
+
+   return (0);
+}
+
+void
+free_hftid_tab(struct tid_info *t)
+{
+   int i;
+
+   if (t->hftid_tab != NULL) {
+   MPASS(t->ntids > 0);
+   for (i = 0; t->tids_in_use > 0 && i < t->ntids; i++) {
+   if (t->hftid_tab[i] == NULL)
+   continue;
+   free(t->hftid_tab[i], M_CXGBE);
+   t->tids_in_use--;
+   }
+   free(t->hftid_tab, M_CXGBE);
+   t->hftid_tab = NULL;
+   }
+
+   if (mtx_initialized(>hftid_lock)) {
+   mtx_destroy(>hftid_lock);
+   cv_destroy(>hftid_cv);
+   }
+}
+
 static void
 insert_hftid(struct adapter *sc, int tid, void *ctx, int ntids)
 {
@@ -653,14 +693,9 @@ set_filter(struct adapter *sc, struct t4_filter *t)
}
if (t->fs.hash) {
if (__predict_false(ti->hftid_tab == NULL)) {
-   ti->hftid_tab = malloc(sizeof(*ti->hftid_tab) * 
ti->ntids,
-   M_CXGBE, M_NOWAIT | M_ZERO);
-   if (ti->hftid_tab == NULL) {
-   rc = ENOMEM;
+   rc = alloc_hftid_tab(>tids, M_NOWAIT);
+   if (rc != 0)
goto done;
-   }
-   mtx_init(>hftid_lock, "T4 hashfilters", 0, MTX_DEF);
-   cv_init(>hftid_cv, "t4hfcv");
}
if (__predict_false(sc->tids.atid_tab == NULL)) {
rc = alloc_atid_tab(>tids, M_NOWAIT);

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cWed Jun 27 01:28:09 2018
(r335683)
+++ head/sys/dev/cxgbe/t4_main.cWed Jun 27 01:51:17 2018
(r335684)
@@ -1403,7 +1403,8 @@ t4_detach_common(device_t dev)
free(sc->sge.iqmap, M_CXGBE);
free(sc->sge.eqmap, M_CXGBE);
free(sc->tids.ftid_tab, M_CXGBE);
-   free(sc->tids.hftid_tab, M_CXGBE);
+   if (sc->tids.hftid_tab)
+   free_hftid_tab(>tids);
free(sc->tids.atid_tab, M_CXGBE);
free(sc->tids.tid_tab, M_CXGBE);
free(sc->tt.tls_rx_ports, M_CXGBE);
@@ -1419,10 +1420,6 @@ t4_detach_common(device_t dev)
if (mtx_initialized(>tids.ftid_lock)) {
mtx_destroy(>tids.ftid_lock);
cv_destroy(>tids.ftid_cv);
-   }
-   if (mtx_initialized(>tids.hftid_lock)) {
-   mtx_destroy(>tids.hftid_lock);
-   cv_destroy(>tids.hftid_cv);
}
if (mtx_initialized(>tids.atid_lock))
mtx_destroy(>tids.atid_lock);
___
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: r335686 - stable/11/usr.bin/rctl

2018-06-26 Thread Eitan Adler
Author: eadler
Date: Wed Jun 27 03:29:36 2018
New Revision: 335686
URL: https://svnweb.freebsd.org/changeset/base/335686

Log:
  MFC r334208:
  
  rctl:correct use of "vmem" instead of "vmemoryuse"
  
  PR:   228482

Modified:
  stable/11/usr.bin/rctl/rctl.8
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/rctl/rctl.8
==
--- stable/11/usr.bin/rctl/rctl.8   Wed Jun 27 02:55:30 2018
(r335685)
+++ stable/11/usr.bin/rctl/rctl.8   Wed Jun 27 03:29:36 2018
(r335686)
@@ -137,13 +137,13 @@ Resources which limit bytes may use prefixes from
 defines what entity the
 .Em amount
 gets accounted for.
-For example, rule "loginclass:users:vmem:deny=100M/process" means
+For example, rule "loginclass:users:vmemoryuse:deny=100M/process" means
 that each process of any user belonging to login class "users" may allocate
 up to 100MB of virtual memory.
-Rule "loginclass:users:vmem:deny=100M/user" would mean that for each
+Rule "loginclass:users:vmemoryuse:deny=100M/user" would mean that for each
 user belonging to the login class "users", the sum of virtual memory allocated
 by all the processes of that user will not exceed 100MB.
-Rule "loginclass:users:vmem:deny=100M/loginclass" would mean that the sum of
+Rule "loginclass:users:vmemoryuse:deny=100M/loginclass" would mean that the 
sum of
 virtual memory allocated by all processes of all users belonging to that login
 class will not exceed 100MB.
 .El
___
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: r335687 - head/share/misc

2018-06-26 Thread Martin Wilke
Author: miwi
Date: Wed Jun 27 03:50:11 2018
New Revision: 335687
URL: https://svnweb.freebsd.org/changeset/base/335687

Log:
  - Added myself to committers-src.dot
  
  Approved by:  araujo (mentor)
  Differential Revision:https://reviews.freebsd.org/D16030

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Wed Jun 27 03:29:36 2018
(r335686)
+++ head/share/misc/committers-src.dot  Wed Jun 27 03:50:11 2018
(r335687)
@@ -251,6 +251,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"]
+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"]
 mjg [label="Mateusz Guzik\n...@freebsd.org\n2012/06/04"]
@@ -396,6 +397,8 @@ andre -> qingli
 andrew -> manu
 
 anholt -> jkim
+
+araujo -> miwi
 
 avg -> art
 avg -> eugen
___
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: r335688 - stable/11/usr.sbin/bhyve

2018-06-26 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 27 03:58:02 2018
New Revision: 335688
URL: https://svnweb.freebsd.org/changeset/base/335688

Log:
  MFC r333622, r334019, r334084
  
  r333622:
  vq_getchain() can return -1 if some descriptor(s) are invalid and prints
  a diagnostic message. So we do a sanity checking on the return value
  of vq_getchain().
  
  Spotted by:   gcc49
  Reviewed by:  avg
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15388
  
  r334019:
  Include atkbdc header where there are declared the prototype functions
  atkbdc_event and atkbdc_init.
  
  Sponsored by: iXsystems Inc.
  
  r334084:
  pthread_rwlock_unlock(3) returns 0 if successful, otherwise an error number
  will be returned to indicate the error, so I'm applying an assert(3) to do
  a sanity check of the return value.
  
  Reported by:  Coverity CID: 1391235, 1193654 and 1193651
  Reviewed by:  grehan
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15533

Modified:
  stable/11/usr.sbin/bhyve/atkbdc.c
  stable/11/usr.sbin/bhyve/mem.c
  stable/11/usr.sbin/bhyve/pci_virtio_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/atkbdc.c
==
--- stable/11/usr.sbin/bhyve/atkbdc.c   Wed Jun 27 03:50:11 2018
(r335687)
+++ stable/11/usr.sbin/bhyve/atkbdc.c   Wed Jun 27 03:58:02 2018
(r335688)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "acpi.h"
+#include "atkbdc.h"
 #include "inout.h"
 #include "pci_emul.h"
 #include "pci_irq.h"

Modified: stable/11/usr.sbin/bhyve/mem.c
==
--- stable/11/usr.sbin/bhyve/mem.c  Wed Jun 27 03:50:11 2018
(r335687)
+++ stable/11/usr.sbin/bhyve/mem.c  Wed Jun 27 03:58:02 2018
(r335688)
@@ -123,6 +123,7 @@ mmio_rb_add(struct mmio_rb_tree *rbt, struct mmio_rb_r
 static void
 mmio_rb_dump(struct mmio_rb_tree *rbt)
 {
+   int perror;
struct mmio_rb_range *np;
 
pthread_rwlock_rdlock(_rwlock);
@@ -130,7 +131,8 @@ mmio_rb_dump(struct mmio_rb_tree *rbt)
printf(" %lx:%lx, %s\n", np->mr_base, np->mr_end,
   np->mr_param.name);
}
-   pthread_rwlock_unlock(_rwlock);
+   perror = pthread_rwlock_unlock(_rwlock);
+   assert(perror == 0);
 }
 #endif
 
@@ -164,7 +166,7 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
 
 {
struct mmio_rb_range *entry;
-   int err, immutable;
+   int err, perror, immutable;

pthread_rwlock_rdlock(_rwlock);
/*
@@ -182,7 +184,8 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
/* Update the per-vCPU cache */
mmio_hint[vcpu] = entry;
} else if (mmio_rb_lookup(_rb_fallback, paddr, )) {
-   pthread_rwlock_unlock(_rwlock);
+   perror = pthread_rwlock_unlock(_rwlock);
+   assert(perror == 0);
return (ESRCH);
}
}
@@ -201,15 +204,20 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
 * config space window as 'immutable' the deadlock can be avoided.
 */
immutable = (entry->mr_param.flags & MEM_F_IMMUTABLE);
-   if (immutable)
-   pthread_rwlock_unlock(_rwlock);
+   if (immutable) {
+   perror = pthread_rwlock_unlock(_rwlock);
+   assert(perror == 0);
+   }
 
err = vmm_emulate_instruction(ctx, vcpu, paddr, vie, paging,
  mem_read, mem_write, >mr_param);
 
-   if (!immutable)
-   pthread_rwlock_unlock(_rwlock);
+   if (!immutable) {
+   perror = pthread_rwlock_unlock(_rwlock);
+   assert(perror == 0);
+   }
 
+
return (err);
 }
 
@@ -217,7 +225,7 @@ static int
 register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp)
 {
struct mmio_rb_range *entry, *mrp;
-   int err;
+   int err, perror;
 
err = 0;
 
@@ -230,7 +238,8 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
pthread_rwlock_wrlock(_rwlock);
if (mmio_rb_lookup(rbt, memp->base, ) != 0)
err = mmio_rb_add(rbt, mrp);
-   pthread_rwlock_unlock(_rwlock);
+   perror = pthread_rwlock_unlock(_rwlock);
+   assert(perror == 0);
if (err)
free(mrp);
} else
@@ -258,7 +267,7 @@ unregister_mem(struct mem_range *memp)
 {
struct mem_range *mr;
struct mmio_rb_range *entry = NULL;
-   int err, i;
+   int err, perror, i;

pthread_rwlock_wrlock(_rwlock);
err = mmio_rb_lookup(_rb_root, memp->base, );
@@ -275,7 

svn commit: r335689 - in head/sys: kern sys

2018-06-26 Thread Warner Losh
Author: imp
Date: Wed Jun 27 04:10:48 2018
New Revision: 335689
URL: https://svnweb.freebsd.org/changeset/base/335689

Log:
  Create new devctl_safe_quote_sb to copy a source string into a struct
  sbuf to make it safe. Callers are expected to add the " " around it,
  if needed.
  
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D16026

Modified:
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cWed Jun 27 03:58:02 2018(r335688)
+++ head/sys/kern/subr_bus.cWed Jun 27 04:10:48 2018(r335689)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -880,6 +881,29 @@ devctl_safe_quote(char *dst, const char *src, size_t l
*walker++ = *src++;
}
*walker = '\0';
+}
+
+/**
+ * @brief safely quotes strings that might have double quotes in them.
+ *
+ * The devctl protocol relies on quoted strings having matching quotes.
+ * This routine quotes any internal quotes so the resulting string
+ * is safe to pass to snprintf to construct, for example pnp info strings.
+ * Strings are always terminated with a NUL, but may be truncated if longer
+ * than @p len bytes after quotes.
+ *
+ * @param sb   sbuf to place the characters into
+ * @param src  Original buffer.
+ */
+void
+devctl_safe_quote_sb(struct sbuf *sb, const char *src)
+{
+
+   while (*src != '\0') {
+   if (*src == '"' || *src == '\\')
+   sbuf_putc(sb, '\\');
+   sbuf_putc(sb, *src++);
+   }
 }
 
 /* End of /dev/devctl code */

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Wed Jun 27 03:58:02 2018(r335688)
+++ head/sys/sys/bus.h  Wed Jun 27 04:10:48 2018(r335689)
@@ -156,7 +156,9 @@ void devctl_notify(const char *__system, const char *_
 const char *__type, const char *__data);
 void devctl_queue_data_f(char *__data, int __flags);
 void devctl_queue_data(char *__data);
-void devctl_safe_quote(char *__dst, const char *__src, size_t len);
+void devctl_safe_quote(char *__dst, const char *__src, size_t __len);
+struct sbuf;
+void devctl_safe_quote_sb(struct sbuf *__sb, const char *__src);
 
 /**
  * Device name parsers.  Hook to allow device enumerators to map
___
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: r335690 - head/sys/kern

2018-06-26 Thread Warner Losh
Author: imp
Date: Wed Jun 27 04:11:09 2018
New Revision: 335690
URL: https://svnweb.freebsd.org/changeset/base/335690

Log:
  Fix devctl generation for core files.
  
  We have a problem with vn_fullpath_global when the file exists. Work
  around it by printing the full path if the core file name starts with /,
  or current working directory followed by the filename if not.
  
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D16026

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cWed Jun 27 04:10:48 2018(r335689)
+++ head/sys/kern/kern_sig.cWed Jun 27 04:11:09 2018(r335690)
@@ -3431,24 +3431,6 @@ out:
return (0);
 }
 
-static int
-coredump_sanitise_path(const char *path)
-{
-   size_t i;
-
-   /*
-* Only send a subset of ASCII to devd(8) because it
-* might pass these strings to sh -c.
-*/
-   for (i = 0; path[i]; i++)
-   if (!(isalpha(path[i]) || isdigit(path[i])) &&
-   path[i] != '/' && path[i] != '.' &&
-   path[i] != '-')
-   return (0);
-
-   return (1);
-}
-
 /*
  * Dump a process' core.  The main routine does some
  * policy checking, and creates the name of the coredump;
@@ -3469,11 +3451,8 @@ coredump(struct thread *td)
char *name; /* name of corefile */
void *rl_cookie;
off_t limit;
-   char *data = NULL;
char *fullpath, *freepath = NULL;
-   size_t len;
-   static const char comm_name[] = "comm=";
-   static const char core_name[] = "core=";
+   struct sbuf *sb;
 
PROC_LOCK_ASSERT(p, MA_OWNED);
MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td);
@@ -3556,23 +3535,35 @@ coredump(struct thread *td)
 */
if (error != 0 || coredump_devctl == 0)
goto out;
-   len = MAXPATHLEN * 2 + sizeof(comm_name) - 1 +
-   sizeof(' ') + sizeof(core_name) - 1;
-   data = malloc(len, M_TEMP, M_WAITOK);
+   sb = sbuf_new_auto();
if (vn_fullpath_global(td, p->p_textvp, , ) != 0)
-   goto out;
-   if (!coredump_sanitise_path(fullpath))
-   goto out;
-   snprintf(data, len, "%s%s ", comm_name, fullpath);
+   goto out2;
+   sbuf_printf(sb, "comm=\"");
+   devctl_safe_quote_sb(sb, fullpath);
free(freepath, M_TEMP);
-   freepath = NULL;
-   if (vn_fullpath_global(td, vp, , ) != 0)
-   goto out;
-   if (!coredump_sanitise_path(fullpath))
-   goto out;
-   strlcat(data, core_name, len);
-   strlcat(data, fullpath, len);
-   devctl_notify("kernel", "signal", "coredump", data);
+   sbuf_printf(sb, "\" core=\"");
+
+   /*
+* We can't lookup core file vp directly. When we're replacing a core, 
and
+* other random times, we flush the name cache, so it will fail. 
Instead,
+* if the path of the core is relative, add the current dir in front if 
it.
+*/
+   if (name[0] != '/') {
+   fullpath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
+   if (kern___getcwd(td, fullpath, UIO_SYSSPACE, MAXPATHLEN, 
MAXPATHLEN) != 0) {
+   free(fullpath, M_TEMP);
+   goto out2;
+   }
+   devctl_safe_quote_sb(sb, fullpath);
+   free(fullpath, M_TEMP);
+   sbuf_putc(sb, '/');
+   }
+   devctl_safe_quote_sb(sb, name);
+   sbuf_printf(sb, "\"");
+   if (sbuf_finish(sb) == 0)
+   devctl_notify("kernel", "signal", "coredump", sbuf_data(sb));
+out2:
+   sbuf_delete(sb);
 out:
error1 = vn_close(vp, FWRITE, cred, td);
if (error == 0)
@@ -3580,8 +3571,6 @@ out:
 #ifdef AUDIT
audit_proc_coredump(td, name, error);
 #endif
-   free(freepath, M_TEMP);
-   free(data, M_TEMP);
free(name, M_TEMP);
return (error);
 }
___
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: r335691 - head/sys/dev/pccard

2018-06-26 Thread Warner Losh
Author: imp
Date: Wed Jun 27 04:11:14 2018
New Revision: 335691
URL: https://svnweb.freebsd.org/changeset/base/335691

Log:
  pccard: recode to use devctl_safe_quote_sb instead of devctl_safe_quote.
  
  Sponsored by: Netflix
  Differential Review: https://reviews.freebsd.org/D16026

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

Modified: head/sys/dev/pccard/pccard.c
==
--- head/sys/dev/pccard/pccard.cWed Jun 27 04:11:09 2018
(r335690)
+++ head/sys/dev/pccard/pccard.cWed Jun 27 04:11:14 2018
(r335691)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1036,13 +1037,18 @@ pccard_child_pnpinfo_str(device_t bus, device_t child,
struct pccard_ivar *devi = PCCARD_IVAR(child);
struct pccard_function *pf = devi->pf;
struct pccard_softc *sc = PCCARD_SOFTC(bus);
-   char cis0[128], cis1[128];
+   struct sbuf sb;
 
-   devctl_safe_quote(cis0, sc->card.cis1_info[0], sizeof(cis0));
-   devctl_safe_quote(cis1, sc->card.cis1_info[1], sizeof(cis1));
-   snprintf(buf, buflen, "manufacturer=0x%04x product=0x%04x "
-   "cisvendor=\"%s\" cisproduct=\"%s\" function_type=%d",
-   sc->card.manufacturer, sc->card.product, cis0, cis1, pf->function);
+   sbuf_new(, buf, buflen, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
+   sbuf_printf(, "manufacturer=0x%04x product=0x%04x "
+   "cisvendor=\"", sc->card.manufacturer, sc->card.product);
+   devctl_safe_quote_sb(, sc->card.cis1_info[0]);
+   sbuf_printf(, "\" cisproduct=\"");
+   devctl_safe_quote_sb(, sc->card.cis1_info[1]);
+   sbuf_printf(, "\" function_type=%d", pf->function);
+   sbuf_finish();
+   sbuf_delete();
+
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335682 - head/sys/modules

2018-06-26 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Jun 26 23:28:03 2018
New Revision: 335682
URL: https://svnweb.freebsd.org/changeset/base/335682

Log:
  Partial revert of r335399 and r335400:
  Unhook the MAC/veriexec, fingerprint handlers, and veriexec modules from
  the kernel modules Makefile.
  
  Reviewed by:  sjg

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Jun 26 23:19:55 2018(r335681)
+++ head/sys/modules/Makefile   Tue Jun 26 23:28:03 2018(r335682)
@@ -235,12 +235,6 @@ SUBDIR=\
mac_seeotheruids \
mac_stub \
mac_test \
-   mac_veriexec \
-   mac_veriexec_rmd160 \
-   mac_veriexec_sha1 \
-   mac_veriexec_sha256 \
-   mac_veriexec_sha384 \
-   mac_veriexec_sha512 \
malo \
md \
mdio \
@@ -392,7 +386,6 @@ SUBDIR= \
uinput \
unionfs \
usb \
-   veriexec \
${_vesa} \
${_virtio} \
vge \
___
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: r335681 - head/sbin/veriexecctl

2018-06-26 Thread Stephen J. Kiernan
Author: stevek
Date: Tue Jun 26 23:19:55 2018
New Revision: 335681
URL: https://svnweb.freebsd.org/changeset/base/335681

Log:
  Revert r335402
  
  While useful as an example, veriexecctl, as it is, has very little practical
  use, since there is nothing ensuring the integrity of the manifest of hashes.
  A more appropriate set of utilities will replace it.

Deleted:
  head/sbin/veriexecctl/
___
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: r335661 - stable/11/release/doc/en_US.ISO8859-1/errata

2018-06-26 Thread Glen Barber
Author: gjb
Date: Tue Jun 26 13:29:49 2018
New Revision: 335661
URL: https://svnweb.freebsd.org/changeset/base/335661

Log:
  Document an issue with emulators/virtualbox-ose reported in
  Bugzilla 228535.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/en_US.ISO8859-1/errata/article.xml

Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml
==
--- stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
09:30:14 2018(r335660)
+++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xmlTue Jun 26 
13:29:49 2018(r335661)
@@ -173,6 +173,23 @@ boot
  for more information and updates as the issue is
  investigated.
   
+
+  
+   [2018-06-26] An issue had been discovered late in the
+ release cycle where a system crash could occur after
+ installing emulators/virtualbox-ose from
+ upstream package mirrors via .
+
+   Building emulators/virtualbox-ose from
+ the  collection has been observed to work
+ around the crash.
+
+   See PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228535;>228535
+ for more information.
+  
 
   
 
___
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: r335695 - stable/11

2018-06-26 Thread Eitan Adler
Author: eadler
Date: Wed Jun 27 04:58:39 2018
New Revision: 335695
URL: https://svnweb.freebsd.org/changeset/base/335695

Log:
  MFC r302776, r302799:
  
  mail(1): Bring some fixes from other BSDs.
  
  - Use varargs properly
  - Use pid_t
  - Better handling of error conditions on forked jobs.
  - Some prototype and warning cleanups.
  
  Fix missing forked job changes from r302776 in wait_child().

Modified:
Directory Properties:
  stable/11/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335694 - stable/10/usr.bin/mail

2018-06-26 Thread Eitan Adler
Author: eadler
Date: Wed Jun 27 04:56:01 2018
New Revision: 335694
URL: https://svnweb.freebsd.org/changeset/base/335694

Log:
  MFC r302776, r302799:
  
  mail(1): Bring some fixes from other BSDs.
  
  - Use varargs properly
  - Use pid_t
  - Better handling of error conditions on forked jobs.
  - Some prototype and warning cleanups.
  
  Fix missing forked job changes from r302776 in wait_child().

Modified:
  stable/10/usr.bin/mail/cmd1.c
  stable/10/usr.bin/mail/cmd2.c
  stable/10/usr.bin/mail/cmd3.c
  stable/10/usr.bin/mail/edit.c
  stable/10/usr.bin/mail/extern.h
  stable/10/usr.bin/mail/fio.c
  stable/10/usr.bin/mail/getname.c
  stable/10/usr.bin/mail/popen.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/mail/cmd1.c
==
--- stable/10/usr.bin/mail/cmd1.c   Wed Jun 27 04:37:22 2018
(r335693)
+++ stable/10/usr.bin/mail/cmd1.c   Wed Jun 27 04:56:01 2018
(r335694)
@@ -439,7 +439,7 @@ folders(void)
}
if ((cmd = value("LISTER")) == NULL)
cmd = "ls";
-   (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL);
+   (void)run_command(cmd, 0, -1, -1, dirname, NULL);
return (0);
 }
 

Modified: stable/10/usr.bin/mail/cmd2.c
==
--- stable/10/usr.bin/mail/cmd2.c   Wed Jun 27 04:37:22 2018
(r335693)
+++ stable/10/usr.bin/mail/cmd2.c   Wed Jun 27 04:56:01 2018
(r335694)
@@ -130,8 +130,9 @@ hitit:
  * so we can discard when the user quits.
  */
 int
-save(char str[])
+save(void *v)
 {
+   char *str = v;
 
return (save1(str, 1, "save", saveignore));
 }
@@ -140,8 +141,9 @@ save(char str[])
  * Copy a message to a file without affected its saved-ness
  */
 int
-copycmd(char str[])
+copycmd(void *v)
 {
+   char *str = v;
 
return (save1(str, 0, "copy", saveignore));
 }

Modified: stable/10/usr.bin/mail/cmd3.c
==
--- stable/10/usr.bin/mail/cmd3.c   Wed Jun 27 04:37:22 2018
(r335693)
+++ stable/10/usr.bin/mail/cmd3.c   Wed Jun 27 04:56:01 2018
(r335694)
@@ -79,7 +79,7 @@ dosh(char *str __unused)
 
if ((sh = value("SHELL")) == NULL)
sh = _PATH_CSHELL;
-   (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL);
+   (void)run_command(sh, 0, -1, -1, NULL);
(void)signal(SIGINT, sigint);
printf("\n");
return (0);
@@ -102,7 +102,7 @@ bangexp(char *str, size_t strsize)
n = sizeof(bangbuf);
while (*cp != '\0') {
if (*cp == '!') {
-   if (n < strlen(lastbang)) {
+   if (n < (int)strlen(lastbang)) {
 overf:
printf("Command buffer overflow\n");
return (-1);

Modified: stable/10/usr.bin/mail/edit.c
==
--- stable/10/usr.bin/mail/edit.c   Wed Jun 27 04:37:22 2018
(r335693)
+++ stable/10/usr.bin/mail/edit.c   Wed Jun 27 04:56:01 2018
(r335694)
@@ -180,7 +180,7 @@ run_editor(FILE *fp, off_t size, int type, int readonl
nf = NULL;
if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL)
edit = type == 'e' ? _PATH_EX : _PATH_VI;
-   if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) {
+   if (run_command(edit, 0, -1, -1, tempname, NULL) < 0) {
(void)rm(tempname);
goto out;
}

Modified: stable/10/usr.bin/mail/extern.h
==
--- stable/10/usr.bin/mail/extern.h Wed Jun 27 04:37:22 2018
(r335693)
+++ stable/10/usr.bin/mail/extern.h Wed Jun 27 04:56:01 2018
(r335694)
@@ -49,7 +49,7 @@ char  *copyin(char *, char **);
 char   *detract(struct name *, int);
 char   *expand(char *);
 char   *getdeadletter(void);
-char   *getname(int);
+char   *getname(uid_t);
 char   *hfield(const char *, struct message *);
 FILE   *infix(struct header *, FILE *);
 char   *ishfield(char [], char *, const char *);
@@ -95,7 +95,7 @@ void   collhup(int);
 voidcollint(int);
 voidcollstop(int);
 voidcommands(void);
-int copycmd(char []);
+int copycmd(void *v);
 int core(void);
 int count(struct name *);
 int delete(int []);
@@ -130,7 +130,7 @@ int  getfold(char *, int);
 int gethfield(FILE *, char [], int, char **);
 int getmsglist(char *, int *, int);
 int getrawlist(char [], char **, int);
-int getuserid(char []);
+uid_t   getuserid(char []);
 int grabh(struct header *, int);
 int group(char **);
 voidhangup(int);
@@ -198,8 +198,8 @@ int  respond(int *);
 int retfield(char *[]);
 int rexit(int);
 int rm(char *);
-int 

svn commit: r335693 - stable/11/usr.bin/mail

2018-06-26 Thread Eitan Adler
Author: eadler
Date: Wed Jun 27 04:37:22 2018
New Revision: 335693
URL: https://svnweb.freebsd.org/changeset/base/335693

Log:
  MFC r302776, r302799:
  
  mail(1): Bring some fixes from other BSDs.
  
  - Use varargs properly
  - Use pid_t
  - Better handling of error conditions on forked jobs.
  - Some prototype and warning cleanups.
  
  Fix missing forked job changes from r302776 in wait_child().

Modified:
  stable/11/usr.bin/mail/cmd1.c
  stable/11/usr.bin/mail/cmd2.c
  stable/11/usr.bin/mail/cmd3.c
  stable/11/usr.bin/mail/edit.c
  stable/11/usr.bin/mail/extern.h
  stable/11/usr.bin/mail/fio.c
  stable/11/usr.bin/mail/getname.c
  stable/11/usr.bin/mail/popen.c

Modified: stable/11/usr.bin/mail/cmd1.c
==
--- stable/11/usr.bin/mail/cmd1.c   Wed Jun 27 04:11:19 2018
(r335692)
+++ stable/11/usr.bin/mail/cmd1.c   Wed Jun 27 04:37:22 2018
(r335693)
@@ -439,7 +439,7 @@ folders(void)
}
if ((cmd = value("LISTER")) == NULL)
cmd = "ls";
-   (void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL);
+   (void)run_command(cmd, 0, -1, -1, dirname, NULL);
return (0);
 }
 

Modified: stable/11/usr.bin/mail/cmd2.c
==
--- stable/11/usr.bin/mail/cmd2.c   Wed Jun 27 04:11:19 2018
(r335692)
+++ stable/11/usr.bin/mail/cmd2.c   Wed Jun 27 04:37:22 2018
(r335693)
@@ -130,8 +130,9 @@ hitit:
  * so we can discard when the user quits.
  */
 int
-save(char str[])
+save(void *v)
 {
+   char *str = v;
 
return (save1(str, 1, "save", saveignore));
 }
@@ -140,8 +141,9 @@ save(char str[])
  * Copy a message to a file without affected its saved-ness
  */
 int
-copycmd(char str[])
+copycmd(void *v)
 {
+   char *str = v;
 
return (save1(str, 0, "copy", saveignore));
 }

Modified: stable/11/usr.bin/mail/cmd3.c
==
--- stable/11/usr.bin/mail/cmd3.c   Wed Jun 27 04:11:19 2018
(r335692)
+++ stable/11/usr.bin/mail/cmd3.c   Wed Jun 27 04:37:22 2018
(r335693)
@@ -79,7 +79,7 @@ dosh(char *str __unused)
 
if ((sh = value("SHELL")) == NULL)
sh = _PATH_CSHELL;
-   (void)run_command(sh, 0, -1, -1, NULL, NULL, NULL);
+   (void)run_command(sh, 0, -1, -1, NULL);
(void)signal(SIGINT, sigint);
printf("\n");
return (0);
@@ -102,7 +102,7 @@ bangexp(char *str, size_t strsize)
n = sizeof(bangbuf);
while (*cp != '\0') {
if (*cp == '!') {
-   if (n < strlen(lastbang)) {
+   if (n < (int)strlen(lastbang)) {
 overf:
printf("Command buffer overflow\n");
return (-1);

Modified: stable/11/usr.bin/mail/edit.c
==
--- stable/11/usr.bin/mail/edit.c   Wed Jun 27 04:11:19 2018
(r335692)
+++ stable/11/usr.bin/mail/edit.c   Wed Jun 27 04:37:22 2018
(r335693)
@@ -180,7 +180,7 @@ run_editor(FILE *fp, off_t size, int type, int readonl
nf = NULL;
if ((edit = value(type == 'e' ? "EDITOR" : "VISUAL")) == NULL)
edit = type == 'e' ? _PATH_EX : _PATH_VI;
-   if (run_command(edit, 0, -1, -1, tempname, NULL, NULL) < 0) {
+   if (run_command(edit, 0, -1, -1, tempname, NULL) < 0) {
(void)rm(tempname);
goto out;
}

Modified: stable/11/usr.bin/mail/extern.h
==
--- stable/11/usr.bin/mail/extern.h Wed Jun 27 04:11:19 2018
(r335692)
+++ stable/11/usr.bin/mail/extern.h Wed Jun 27 04:37:22 2018
(r335693)
@@ -49,7 +49,7 @@ char  *copyin(char *, char **);
 char   *detract(struct name *, int);
 char   *expand(char *);
 char   *getdeadletter(void);
-char   *getname(int);
+char   *getname(uid_t);
 char   *hfield(const char *, struct message *);
 FILE   *infix(struct header *, FILE *);
 char   *ishfield(char [], char *, const char *);
@@ -95,7 +95,7 @@ void   collhup(int);
 voidcollint(int);
 voidcollstop(int);
 voidcommands(void);
-int copycmd(char []);
+int copycmd(void *v);
 int core(void);
 int count(struct name *);
 int delete(int []);
@@ -130,7 +130,7 @@ int  getfold(char *, int);
 int gethfield(FILE *, char [], int, char **);
 int getmsglist(char *, int *, int);
 int getrawlist(char [], char **, int);
-int getuserid(char []);
+uid_t   getuserid(char []);
 int grabh(struct header *, int);
 int group(char **);
 voidhangup(int);
@@ -198,8 +198,8 @@ int  respond(int *);
 int retfield(char *[]);
 int rexit(int);
 int rm(char *);
-int run_command(char *, sigset_t *, int, int, char *, char *, 

svn commit: r335680 - head/usr.sbin/cxgbetool

2018-06-26 Thread Navdeep Parhar
Author: np
Date: Tue Jun 26 21:56:06 2018
New Revision: 335680
URL: https://svnweb.freebsd.org/changeset/base/335680

Log:
  cxgbetool(8): Reject invalid VLAN values.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  MFC after:1 week
  Sponsored by: Chelsio Communications

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

Modified: head/usr.sbin/cxgbetool/cxgbetool.c
==
--- head/usr.sbin/cxgbetool/cxgbetool.c Tue Jun 26 20:26:57 2018
(r335679)
+++ head/usr.sbin/cxgbetool/cxgbetool.c Tue Jun 26 21:56:06 2018
(r335680)
@@ -1102,6 +1102,8 @@ del_filter(uint32_t idx, int hashfilter)
return doit(CHELSIO_T4_DEL_FILTER, );
 }
 
+#define MAX_VLANID (4095)
+
 static int
 set_filter(uint32_t idx, int argc, const char *argv[], int hash)
 {
@@ -1308,7 +1310,8 @@ set_filter(uint32_t idx, int argc, const char *argv[],
t.fs.newvlan == VLAN_INSERT) {
t.fs.vlan = strtoul(argv[start_arg + 1] + 1,
, 0);
-   if (p == argv[start_arg + 1] + 1 || p[0] != 0) {
+   if (p == argv[start_arg + 1] + 1 || p[0] != 0 ||
+   t.fs.vlan > MAX_VLANID) {
warnx("invalid vlan \"%s\"",
 argv[start_arg + 1]);
return (EINVAL);
___
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"