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&D
> > >   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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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(&pagetable_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[l2_slot],
>>> +   (pa & ~L2_OFFSET) | ATTR_DEFAULT | 
>>> ATTR_XN |
>>> +   ATTR_IDX(CACHED_MEMORY) | L2_BLOCK);
>>> +   }
>>> +   

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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&D

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(&xnb->rx_lock);
mtx_unlock(&xnb->rx_lock);
 
+   mtx_lock(&xnb->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(&xnb->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(&xnb->sc_lock);
 
xnb_disconnect(xnb);
 
-   mtx_unlock(&xnb->sc_lock);
if (xenbus_get_state(xnb->dev) < XenbusStateClosing)
xenbus_set_state(xnb->dev, XenbusStateClosing);
mtx_lock(&xnb->sc_lock);
 
xnb->flags &= ~XNBF_IN_SHUTDOWN;
-
 
/* Indicate to xnb_detach() that is it safe to proceed. */
wakeup(xnb);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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&D

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(&hypercall_page + i * PAGE_SIZE) + i);
+   wrmsr(regs[1], vtophys(&hypercall_page));
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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&D

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", &xen_disable_pv
 TUNABLE_INT("hw.xen.disable_pv_nics", &xen_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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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&D
> > > >   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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &req,
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, &req,
-   ptr, NULL, 1000, LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK);
-
-   if (error) {
+   error = libusb20_dev_request_sync(pdev, &req, 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: 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&D
> > > > >   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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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)
+++ head/lib/

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, &m,
-   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(&fl[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(&alt[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 < en

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r335672 - head/sys/modules [ broke ci.freebsd.org FreeBSD-head-{powerpcspe,mips,mips64,powerpc,armv6,armv7}-build ]

2018-06-26 Thread Mark Millard via svn-src-head
> 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
> 
> . . .


https://ci.freebsd.org/job/FreeBSD-head-powerpcspe-build/6487/consoleText
(a gcc 4.2.1 32-bit target example):

--- all_subdir_linprocfs ---
/usr/src/sys/compat/linprocfs/linprocfs.c: In function 'linprocfs_doprocstat':
/usr/src/sys/compat/linprocfs/linprocfs.c:747: warning: format '%ld' expects 
type 'long int', but argument 3 has type 'time_t' [-Wformat]
/usr/src/sys/compat/linprocfs/linprocfs.c:748: warning: format '%ld' expects 
type 'long int', but argument 3 has type 'time_t' [-Wformat]
/usr/src/sys/compat/linprocfs/linprocfs.c:749: warning: format '%ld' expects 
type 'long int', but argument 3 has type 'time_t' [-Wformat]
/usr/src/sys/compat/linprocfs/linprocfs.c:750: warning: format '%ld' expects 
type 'long int', but argument 3 has type 'time_t' [-Wformat]
/usr/src/sys/compat/linprocfs/linprocfs.c:755: warning: format '%lu' expects 
type 'long unsigned int', but argument 3 has type 'time_t' [-Wformat]
--- all_subdir_libiconv ---
ctfmerge -L VERSION -g -o libiconv.kld iconv.o iconv_ucs.o iconv_xlat.o 
iconv_xlat16.o iconv_converter_if.o
--- all_subdir_linprocfs ---
*** [linprocfs.o] Error code 1


https://ci.freebsd.org/job/FreeBSD-head-armv7-build/444/consoleText
(32-bit clang example):

--- all_subdir_linprocfs ---
/usr/src/sys/compat/linprocfs/linprocfs.c:747:26: error: format specifies type 
'long' but the argument has type 'long long' [-Werror,-Wformat]
PS_ADD("utime", "%ld",  TV2J(&kp.ki_rusage.ru_utime));
^
 %lld
/usr/src/sys/compat/linprocfs/linprocfs.c:122:17: note: expanded from macro 
'TV2J'
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 1)
^
/usr/src/sys/compat/linprocfs/linprocfs.c:723:57: note: expanded from macro 
'PS_ADD'
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
^~~
/usr/src/sys/compat/linprocfs/linprocfs.c:748:26: error: format specifies type 
'long' but the argument has type 'long long' [-Werror,-Wformat]
PS_ADD("stime", "%ld",  TV2J(&kp.ki_rusage.ru_stime));
^
 %lld
/usr/src/sys/compat/linprocfs/linprocfs.c:122:17: note: expanded from macro 
'TV2J'
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 1)
^
/usr/src/sys/compat/linprocfs/linprocfs.c:723:57: note: expanded from macro 
'PS_ADD'
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
^~~
/usr/src/sys/compat/linprocfs/linprocfs.c:749:26: error: format specifies type 
'long' but the argument has type 'long long' [-Werror,-Wformat]
PS_ADD("cutime","%ld",  TV2J(&kp.ki_rusage_ch.ru_utime));
^~~~
 %lld
/usr/src/sys/compat/linprocfs/linprocfs.c:122:17: note: expanded from macro 
'TV2J'
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 1)
^
/usr/src/sys/compat/linprocfs/linprocfs.c:723:57: note: expanded from macro 
'PS_ADD'
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
^~~
/usr/src/sys/compat/linprocfs/linprocfs.c:750:26: error: format specifies type 
'long' but the argument has type 'long long' [-Werror,-Wformat]
PS_ADD("cstime","%ld",  TV2J(&kp.ki_rusage_ch.ru_stime));
^~~~
 %lld
/usr/src/sys/compat/linprocfs/linprocfs.c:122:17: note: expanded from macro 
'TV2J'
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 1)
^
/usr/src/sys/compat/linprocfs/linprocfs.c:723:57: note: expanded from macro 
'PS_ADD'
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
^~~
/usr/src/sys/compat/linprocfs/linprocfs.c:755:29: error: format specifies type 
'unsigned long' but the argument has type 'long long' [-Werror,-Wformat]
PS_ADD("starttime", "%lu",  TV2J(&kp.ki_start) - TV2J(&boottime));
^
 %lld
/usr/src/sys/compat/linprocfs/linprocfs.c:122:17: note: expanded from macro 
'TV2J'
#define TV2J(x) ((x)->tv_sec * 100UL + (x)->tv_usec / 1)
^
/usr/src/sys/compat/linprocfs/linprocfs.c:723:57: note: expanded from macro 
'PS_ADD'
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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);
+}
+
+ATF_TC_CLEANUP(pipe_failur

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", &pwd->pw_name, &buffer,
&bufsize);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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), "rfor

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, &t);
 }
 
+#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,
&p, 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &acline_mib_len) == 0) {
acline_mode = ac_sysctl;
if (vflag)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&t->hftid_lock, "T4 hashfilters", 0, MTX_DEF);
+   cv_init(&t->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(&t->hftid_lock)) {
+   mtx_destroy(&t->hftid_lock);
+   cv_destroy(&t->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(&sc->tids, M_NOWAIT);
+   if (rc != 0)
goto done;
-   }
-   mtx_init(&ti->hftid_lock, "T4 hashfilters", 0, MTX_DEF);
-   cv_init(&ti->hftid_cv, "t4hfcv");
}
if (__predict_false(sc->tids.atid_tab == NULL)) {
rc = alloc_atid_tab(&sc->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(&sc->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(&sc->tids.ftid_lock)) {
mtx_destroy(&sc->tids.ftid_lock);
cv_destroy(&sc->tids.ftid_cv);
-   }
-   if (mtx_initialized(&sc->tids.hftid_lock)) {
-   mtx_destroy(&sc->tids.hftid_lock);
-   cv_destroy(&sc->tids.hftid_cv);
}
if (mtx_initialized(&sc->tids.atid_lock))
mtx_destroy(&sc->tids.atid_lock);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubsc

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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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, &fullpath, &freepath) != 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, &fullpath, &freepath) != 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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(&sb, buf, buflen, SBUF_FIXEDLEN | SBUF_INCLUDENUL);
+   sbuf_printf(&sb, "manufacturer=0x%04x product=0x%04x "
+   "cisvendor=\"", sc->card.manufacturer, sc->card.product);
+   devctl_safe_quote_sb(&sb, sc->card.cis1_info[0]);
+   sbuf_printf(&sb, "\" cisproduct=\"");
+   devctl_safe_quote_sb(&sb, sc->card.cis1_info[1]);
+   sbuf_printf(&sb, "\" function_type=%d", pf->function);
+   sbuf_finish(&sb);
+   sbuf_delete(&sb);
+
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: 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-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335696 - head/sbin/fsck_msdosfs

2018-06-26 Thread Xin LI
Author: delphij
Date: Wed Jun 27 06:49:20 2018
New Revision: 335696
URL: https://svnweb.freebsd.org/changeset/base/335696

Log:
  Detect exFAT filesystems and abort if found and tighten BPB sanity
  check.
  
  Obtained from:Android https://android-review.googlesource.com/61827
  MFC after:2 weeks

Modified:
  head/sbin/fsck_msdosfs/Makefile
  head/sbin/fsck_msdosfs/boot.c

Modified: head/sbin/fsck_msdosfs/Makefile
==
--- head/sbin/fsck_msdosfs/Makefile Wed Jun 27 04:58:39 2018
(r335695)
+++ head/sbin/fsck_msdosfs/Makefile Wed Jun 27 06:49:20 2018
(r335696)
@@ -9,6 +9,8 @@ PROG=   fsck_msdosfs
 MAN=   fsck_msdosfs.8
 SRCS=  main.c check.c boot.c fat.c dir.c fsutil.c
 
+DEBUG_FLAGS+=  -g
+
 CFLAGS+= -I${FSCK}
 
 .include 

Modified: head/sbin/fsck_msdosfs/boot.c
==
--- head/sbin/fsck_msdosfs/boot.c   Wed Jun 27 04:58:39 2018
(r335695)
+++ head/sbin/fsck_msdosfs/boot.c   Wed Jun 27 06:49:20 2018
(r335696)
@@ -82,6 +82,11 @@ readboot(int dosfs, struct bootblock *boot)
 
boot->FATsecs = boot->bpbFATsmall;
 
+   if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0 ||
+   boot->bpbBytesPerSec / DOSBOOTBLOCKSIZE_REAL == 0) {
+   pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
+   return FSFATAL;
+   }
if (!boot->bpbRootDirEnts)
boot->flags |= FAT32;
if (boot->flags & FAT32) {
@@ -102,6 +107,22 @@ readboot(int dosfs, struct bootblock *boot)
boot->bpbFSInfo = block[48] + (block[49] << 8);
boot->bpbBackup = block[50] + (block[51] << 8);
 
+   /* If the OEM Name field is EXFAT, it's not FAT32, so bail */
+   if (!memcmp(&block[3], "EXFAT   ", 8)) {
+   pfatal("exFAT filesystem is not supported.");
+   return FSFATAL;
+   }
+
+   /* check basic parameters */
+   if ((boot->bpbFSInfo == 0) || (boot->bpbSecPerClust == 0)) {
+   /*
+* Either the BIOS Parameter Block has been corrupted,
+* or this is not a FAT32 filesystem, most likely an
+* exFAT filesystem.
+*/
+   pfatal("Invalid FAT32 Extended BIOS Parameter Block");
+   return FSFATAL;
+   }
if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec,
SEEK_SET) != boot->bpbFSInfo * boot->bpbBytesPerSec
|| read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) {
@@ -178,11 +199,6 @@ readboot(int dosfs, struct bootblock *boot)
/* Check backup bpbFSInfo?  
XXX */
}
 
-   if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE_REAL != 0 ||
-   boot->bpbBytesPerSec == 0) {
-   pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
-   return FSFATAL;
-   }
if (boot->bpbSecPerClust == 0) {
pfatal("Invalid cluster size: %u", boot->bpbSecPerClust);
return FSFATAL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r335697 - head/sbin/fsck_msdosfs

2018-06-26 Thread Xin LI
Author: delphij
Date: Wed Jun 27 06:50:24 2018
New Revision: 335697
URL: https://svnweb.freebsd.org/changeset/base/335697

Log:
  Revert Makefile@335696 that sneaked into the commit.
  
  X-MFC with:   335696
  MFC after:2 weeks

Modified:
  head/sbin/fsck_msdosfs/Makefile

Modified: head/sbin/fsck_msdosfs/Makefile
==
--- head/sbin/fsck_msdosfs/Makefile Wed Jun 27 06:49:20 2018
(r335696)
+++ head/sbin/fsck_msdosfs/Makefile Wed Jun 27 06:50:24 2018
(r335697)
@@ -9,8 +9,6 @@ PROG=   fsck_msdosfs
 MAN=   fsck_msdosfs.8
 SRCS=  main.c check.c boot.c fat.c dir.c fsutil.c
 
-DEBUG_FLAGS+=  -g
-
 CFLAGS+= -I${FSCK}
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"