svn commit: r351802 - head/sbin/fsck_msdosfs

2019-09-03 Thread Xin LI
Author: delphij
Date: Wed Sep  4 04:44:03 2019
New Revision: 351802
URL: https://svnweb.freebsd.org/changeset/base/351802

Log:
  Correct overflow logic in fullpath().
  
  Obtained from:OpenBSD
  MFC after:3 days

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==
--- head/sbin/fsck_msdosfs/dir.cWed Sep  4 04:38:31 2019
(r351801)
+++ head/sbin/fsck_msdosfs/dir.cWed Sep  4 04:44:03 2019
(r351802)
@@ -169,20 +169,24 @@ fullpath(struct dosDirEntry *dir)
char *cp, *np;
int nl;
 
-   cp = namebuf + sizeof namebuf - 1;
-   *cp = '\0';
-   do {
+   cp = namebuf + sizeof namebuf;
+   *--cp = '\0';
+
+   for(;;) {
np = dir->lname[0] ? dir->lname : dir->name;
nl = strlen(np);
-   if ((cp -= nl) <= namebuf + 1)
+   if (cp <= namebuf + 1 + nl) {
+   *--cp = '?';
break;
+   }
+   cp -= nl;
memcpy(cp, np, nl);
+   dir = dir->parent;
+   if (!dir)
+   break;
*--cp = '/';
-   } while ((dir = dir->parent) != NULL);
-   if (dir)
-   *--cp = '?';
-   else
-   cp++;
+   }
+
return cp;
 }
 
___
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: r351801 - head/sys/netinet

2019-09-03 Thread Michael Tuexen
Author: tuexen
Date: Wed Sep  4 04:38:31 2019
New Revision: 351801
URL: https://svnweb.freebsd.org/changeset/base/351801

Log:
  Fix the SACK block generation in the base TCP stack by bringing it in
  sync with the RACK stack.
  
  Reviewed by:  rrs@
  MFC after:5 days
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D21513

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cTue Sep  3 22:26:01 2019
(r351800)
+++ head/sys/netinet/tcp_input.cWed Sep  4 04:38:31 2019
(r351801)
@@ -2264,7 +2264,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru
 * DSACK - add SACK block for dropped range
 */
if (tp->t_flags & TF_SACK_PERMIT) {
-   tcp_update_sack_list(tp, th->th_seq, th->th_seq+tlen);
+   tcp_update_sack_list(tp, th->th_seq,
+   th->th_seq + todrop);
/*
 * ACK now, as the next in-sequence segment
 * will clear the DSACK block again
@@ -3051,21 +3052,29 @@ dodata: 
/* XXX */
 * DSACK actually handled in the fastpath
 * above.
 */
-   tcp_update_sack_list(tp, save_start, save_start 
+ save_tlen);
-   } else
-   if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, save_rnxt)) {
+   tcp_update_sack_list(tp, save_start,
+   save_start + save_tlen);
+   } else if ((tlen > 0) && SEQ_GT(tp->rcv_nxt, 
save_rnxt)) {
/*
 * Cleaning sackblks by using zero length
 * update.
 */
-   tcp_update_sack_list(tp, save_start, 
save_start);
-   } else
-   if ((tlen > 0) && (tlen >= save_tlen)) {
+   if ((tp->rcv_numsacks >= 1) &&
+   (tp->sackblks[0].end == save_start)) {
+   /* partial overlap, recorded at todrop 
above */
+   tcp_update_sack_list(tp, 
tp->sackblks[0].start,
+   tp->sackblks[0].end);
+   } else {
+   tcp_update_dsack_list(tp, save_start,
+   save_start + save_tlen);
+   }
+   } else if ((tlen > 0) && (tlen >= save_tlen)) {
/* Update of sackblks. */
-   tcp_update_sack_list(tp, save_start, save_start 
+ save_tlen);
-   } else
-   if (tlen > 0) {
-   tcp_update_sack_list(tp, save_start, 
save_start+tlen);
+   tcp_update_dsack_list(tp, save_start,
+   save_start + save_tlen);
+   } else if (tlen > 0) {
+   tcp_update_dsack_list(tp, save_start,
+   save_start + tlen);
}
}
 #if 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"


Re: svn commit: r351747 - head/sys/dev/nvme

2019-09-03 Thread Warner Losh
On Tue, Sep 3, 2019 at 7:19 PM Warner Losh  wrote:

>
>
> On Tue, Sep 3, 2019 at 2:38 PM Ravi Pokala  wrote:
>
>> Hi Warner,
>>
>> +   /*
>> +* Per Section 7.6.2 of NVMe spec 1.4, to properly suspend, we
>> need to
>> +* delete the hardware I/O queues, and then shutdown. This
>> properly
>> +* flushes any metadata the drive may have stored so it can
>> survive
>> +* having its power removed and prevents the unsafe shutdown
>> count from
>> +* incriminating. Once we delete the qpairs, we have to disable
>> them
>> +* before shutting down. The delay is out of paranoia in
>> +* nvme_ctrlr_hw_reset, and is repeated here (though we should
>> have no
>> +* pending I/O that the delay copes with).
>> +*/
>> +   nvme_ctrlr_delete_qpairs(ctrlr);
>> +   nvme_ctrlr_disable_qpairs(ctrlr);
>> +   DELAY(100*1000);
>> +   nvme_ctrlr_shutdown(ctrlr);
>>
>> This seems backwards to me. From that section:
>>
>> > The host should perform the following actions in sequence for a normal
>> shutdown:
>> > 1. Stop submitting any new I/O commands to the controller and allow
>> any outstanding commands to complete;
>> > 2. If the controller implements I/O queues, then the host should
>> delete all I/O Submission Queues, using the Delete I/O Submission Queue
>> command. A result of the successful completion of the Delete I/O Submission
>> Queue command is that any remaining commands outstanding are aborted;
>> > 3. If the controller implements I/O queues, then the host should
>> delete all I/O Completion Queues, using the Delete I/O Completion Queue
>> command; and
>> > 4. The host should set the Shutdown Notification (CC.SHN) field to
>> 01b to indicate a normal shutdown operation. The controller indicates when
>> shutdown processing is completed by updating the Shutdown Status
>> (CSTS.SHST) field to 10b.
>>
>> You are calling nvme_ctrlr_delete_qpairs() -- which implements steps (2)
>> and (3) -- before you are calling nvme_ctrlr_disable_qpairs() -- which
>> implements step (1).
>>
>> Or am I missing something?
>>
>
> The system stops all I/O and makes sure all I/O is complete before
> starting to suspend. Done in the reverse order, I don't have the queues
>

Doh!

disable_qpairs() makes it impossible to send the delete_qpairs() as well,
so I have to do that first. Not entirely sure why, but since the OS
enforces the I/O ban, not the driver, I'm good. Otherwise, I'd have to
drain all my queues, etc before starting this and come up with some
interlock to prevent new I/O from being submitted...

Warner


> Warner
>
>
>
>>  When we suspend, we need to properly shutdown the NVME controller. The
>>   controller may go into D3 state (or may have the power removed), and
>>   to properly flush the metadata to non-volatile RAM, we must
>> complete a
>>   normal shutdown. This consists of deleting the I/O queues and
>> setting
>>   the shutodown bit. We have to do some extra stuff to make sure we
>>   reset the software state of the queues as well.
>>
>>   On resume, we have to reset the card twice, for reasons described in
>>   the attach funcion. Once we've done that, we can restart the card.
>> If
>>   any of this fails, we'll fail the NVMe card, just like we do when a
>>   reset fails.
>>
>>   Set is_resetting for the duration of the suspend / resume. This
>> keeps
>>   the reset taskqueue from running a concurrent reset, and also is
>>   needed to prevent any hw completions from queueing more I/O to the
>>   card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to
>> get
>>   that from the global state of the ctrlr. Wait for any pending reset
>> to
>>   finish. All queued I/O will get sent to the hardware as part of
>>   nvme_ctrlr_start(), though the upper layers shouldn't send any
>>   down. Disabling the qpairs is the other failsafe to ensure all I/O
>> is
>>   queued.
>>
>>   Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to
>> avoid
>>   confusion with all the other destroy functions.  It just removes the
>>   queues in hardware, while the other _destroy_ functions tear down
>>   driver data structures.
>>
>>   Split parts of the hardware reset function up so that I can
>>   do part of the reset in suspsend. Split out the software disabling
>>   of the qpairs into nvme_ctrlr_disable_qpairs.
>>
>>   Finally, fix a couple of spelling errors in comments related to
>>   this.
>>
>>   Relnotes: Yes
>>   MFC After: 1 week
>>   Reviewed by: scottl@ (prior version)
>>   Differential Revision: https://reviews.freebsd.org/D21493
>>
>> Modified:
>>   head/sys/dev/nvme/nvme.c
>>   head/sys/dev/nvme/nvme_ctrlr.c
>>   head/sys/dev/nvme/nvme_pci.c
>>   head/sys/dev/nvme/nvme_private.h
>>
>> Modified: head/sys/dev/nvme/nvme.c
>>
>> 

Re: svn commit: r351747 - head/sys/dev/nvme

2019-09-03 Thread Warner Losh
On Tue, Sep 3, 2019 at 2:38 PM Ravi Pokala  wrote:

> Hi Warner,
>
> +   /*
> +* Per Section 7.6.2 of NVMe spec 1.4, to properly suspend, we
> need to
> +* delete the hardware I/O queues, and then shutdown. This properly
> +* flushes any metadata the drive may have stored so it can survive
> +* having its power removed and prevents the unsafe shutdown count
> from
> +* incriminating. Once we delete the qpairs, we have to disable
> them
> +* before shutting down. The delay is out of paranoia in
> +* nvme_ctrlr_hw_reset, and is repeated here (though we should
> have no
> +* pending I/O that the delay copes with).
> +*/
> +   nvme_ctrlr_delete_qpairs(ctrlr);
> +   nvme_ctrlr_disable_qpairs(ctrlr);
> +   DELAY(100*1000);
> +   nvme_ctrlr_shutdown(ctrlr);
>
> This seems backwards to me. From that section:
>
> > The host should perform the following actions in sequence for a normal
> shutdown:
> > 1. Stop submitting any new I/O commands to the controller and allow
> any outstanding commands to complete;
> > 2. If the controller implements I/O queues, then the host should
> delete all I/O Submission Queues, using the Delete I/O Submission Queue
> command. A result of the successful completion of the Delete I/O Submission
> Queue command is that any remaining commands outstanding are aborted;
> > 3. If the controller implements I/O queues, then the host should
> delete all I/O Completion Queues, using the Delete I/O Completion Queue
> command; and
> > 4. The host should set the Shutdown Notification (CC.SHN) field to
> 01b to indicate a normal shutdown operation. The controller indicates when
> shutdown processing is completed by updating the Shutdown Status
> (CSTS.SHST) field to 10b.
>
> You are calling nvme_ctrlr_delete_qpairs() -- which implements steps (2)
> and (3) -- before you are calling nvme_ctrlr_disable_qpairs() -- which
> implements step (1).
>
> Or am I missing something?
>

The system stops all I/O and makes sure all I/O is complete before starting
to suspend. Done in the reverse order, I don't have the queues

Warner



>  When we suspend, we need to properly shutdown the NVME controller. The
>   controller may go into D3 state (or may have the power removed), and
>   to properly flush the metadata to non-volatile RAM, we must complete
> a
>   normal shutdown. This consists of deleting the I/O queues and setting
>   the shutodown bit. We have to do some extra stuff to make sure we
>   reset the software state of the queues as well.
>
>   On resume, we have to reset the card twice, for reasons described in
>   the attach funcion. Once we've done that, we can restart the card. If
>   any of this fails, we'll fail the NVMe card, just like we do when a
>   reset fails.
>
>   Set is_resetting for the duration of the suspend / resume. This keeps
>   the reset taskqueue from running a concurrent reset, and also is
>   needed to prevent any hw completions from queueing more I/O to the
>   card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to get
>   that from the global state of the ctrlr. Wait for any pending reset
> to
>   finish. All queued I/O will get sent to the hardware as part of
>   nvme_ctrlr_start(), though the upper layers shouldn't send any
>   down. Disabling the qpairs is the other failsafe to ensure all I/O is
>   queued.
>
>   Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to avoid
>   confusion with all the other destroy functions.  It just removes the
>   queues in hardware, while the other _destroy_ functions tear down
>   driver data structures.
>
>   Split parts of the hardware reset function up so that I can
>   do part of the reset in suspsend. Split out the software disabling
>   of the qpairs into nvme_ctrlr_disable_qpairs.
>
>   Finally, fix a couple of spelling errors in comments related to
>   this.
>
>   Relnotes: Yes
>   MFC After: 1 week
>   Reviewed by: scottl@ (prior version)
>   Differential Revision: https://reviews.freebsd.org/D21493
>
> Modified:
>   head/sys/dev/nvme/nvme.c
>   head/sys/dev/nvme/nvme_ctrlr.c
>   head/sys/dev/nvme/nvme_pci.c
>   head/sys/dev/nvme/nvme_private.h
>
> Modified: head/sys/dev/nvme/nvme.c
>
> ==
> --- head/sys/dev/nvme/nvme.cTue Sep  3 14:55:19 2019
> (r351746)
> +++ head/sys/dev/nvme/nvme.cTue Sep  3 15:26:11 2019
> (r351747)
> @@ -137,9 +137,10 @@ nvme_attach(device_t dev)
> }
>
> /*
> -* Reset controller twice to ensure we do a transition from
> cc.en==1
> -*  to cc.en==0.  This is because we don't really know what status
> -*  the controller was left in when boot handed off to OS.
> +* Reset controller twice to 

Re: svn commit: r351729 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2019-09-03 Thread Rick Macklem
Yea, I know this is a top post...
Another reason for a separate commit is the case where the patch is going to be 
MFC'd.

rick
___
From: owner-src-committ...@freebsd.org  on 
behalf of Shawn Webb 
Sent: Tuesday, September 3, 2019 10:20 AM
To: Brooks Davis
Cc: Mateusz Guzik; src-committ...@freebsd.org; svn-src-...@freebsd.org; 
svn-src-head@freebsd.org
Subject: Re: svn commit: r351729 - in head: lib/libc/gen lib/libc/sys 
sys/compat/freebsd32 sys/kern sys/sys

On Tue, Sep 03, 2019 at 07:47:40AM -0400, Shawn Webb wrote:
> On Tue, Sep 03, 2019 at 11:45:23AM +, Brooks Davis wrote:
> > On Tue, Sep 03, 2019 at 07:35:05AM -0400, Shawn Webb wrote:
> > > Hey Mateusz,
> > >
> > > On Tue, Sep 03, 2019 at 04:16:31AM +, Mateusz Guzik wrote:
> > > > Author: mjg
> > > > Date: Tue Sep  3 04:16:30 2019
> > > > New Revision: 351729
> > > > URL: https://svnweb.freebsd.org/changeset/base/351729
> > > >
> > > > Log:
> > > >   Add sysctlbyname system call
> > > >
> > > >   Previously userspace would issue one syscall to resolve the sysctl 
> > > > and then
> > > >   another one to actually use it. Do it all in one trip.
> > > >
> > > >   Fallback is provided in case newer libc happens to be running on an 
> > > > older
> > > >   kernel.
> > > >
> > > >   Submitted by: Pawel Biernacki
> > > >   Reported by:  kib, brooks
> > > >   Differential Revision:https://reviews.freebsd.org/D17282
> > > >
> > > > Modified:
> > > ... snip ...
> > > >   head/sys/sys/param.h
> > >
> > > ... snip ...
> > >
> > > >
> > > > Modified: head/sys/sys/param.h
> > > > ==
> > > > --- head/sys/sys/param.hMon Sep  2 21:57:57 2019
> > > > (r351728)
> > > > +++ head/sys/sys/param.hTue Sep  3 04:16:30 2019
> > > > (r351729)
> > > > @@ -60,7 +60,7 @@
> > > >   * in the range 5 to 9.
> > > >   */
> > > >  #undef __FreeBSD_version
> > > > -#define __FreeBSD_version 1300044  /* Master, propagated to 
> > > > newvers */
> > > > +#define __FreeBSD_version 1300045  /* Master, propagated to 
> > > > newvers */
> > >
> > > To an outsider, it seems that __FreeBSD_version tends to be bumped in
> > > a separate commit. Am I remembering that right?
> >
> > It should be bumped in the same commit, but people forget or the bump
> > they have in their review turns into a no-op because someone else does a
> > bump in the interim (the latter has bit me several times).
>
> Interesting. Thanks for the clarification!

One thought for making the version bump a seperate commit is if the
original commit needed to be reverted, the commit can be reverted
wholesale (well, from the perspective of __FreeBSD_version) without
worry of accidentally decrementing the version number to a prior
value.

That's my "need-more-caffeine" verbose way of saying "separating the
version bump from the actual work allows for easier maintenance of the
version number, helping ensure an always-increasing number."

Sorry if I sound dry here. My ten-month-old puppy is tiring me out way
faster than I can tire him out.

Thanks,

--
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
___
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: r351800 - in head/sys/amd64: amd64 include

2019-09-03 Thread Mark Johnston
Author: markj
Date: Tue Sep  3 22:26:01 2019
New Revision: 351800
URL: https://svnweb.freebsd.org/changeset/base/351800

Log:
  Fix some nits in pmap_page_array_startup().
  
  - Use ptoa() instead of the archaic ctob().
  - Use pagezero() to zero a PDP page.
  - Remove PA_MIN_ADDRESS, orphaned by r351742.
  - Remove unneeded parens and an unnecessary control flow statement.
  
  Reported by:  alc
  Reviewed by:  alc, kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21495

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/include/vmparam.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue Sep  3 22:01:12 2019(r351799)
+++ head/sys/amd64/amd64/pmap.c Tue Sep  3 22:26:01 2019(r351800)
@@ -3850,22 +3850,21 @@ pmap_page_array_startup(long pages)
end = va + pages * sizeof(struct vm_page);
while (va < end) {
pfn = first_page + (va - start) / sizeof(struct vm_page);
-   domain = _vm_phys_domain(ctob(pfn));
+   domain = _vm_phys_domain(ptoa(pfn));
pdpe = pmap_pdpe(kernel_pmap, va);
if ((*pdpe & X86_PG_V) == 0) {
pa = vm_phys_early_alloc(domain, PAGE_SIZE);
dump_add_page(pa);
-   bzero((void *)PHYS_TO_DMAP(pa), PAGE_SIZE);
+   pagezero((void *)PHYS_TO_DMAP(pa));
*pdpe = (pdp_entry_t)(pa | X86_PG_V | X86_PG_RW |
X86_PG_A | X86_PG_M);
-   continue; /* try again */
}
pde = pmap_pdpe_to_pde(pdpe, va);
if ((*pde & X86_PG_V) != 0)
panic("Unexpected pde");
pa = vm_phys_early_alloc(domain, NBPDR);
for (i = 0; i < NPDEPG; i++)
-   dump_add_page(pa + (i * PAGE_SIZE));
+   dump_add_page(pa + i * PAGE_SIZE);
newpdir = (pd_entry_t)(pa | X86_PG_V | X86_PG_RW | X86_PG_A |
X86_PG_M | PG_PS | pg_g | pg_nx);
pde_store(pde, newpdir);

Modified: head/sys/amd64/include/vmparam.h
==
--- head/sys/amd64/include/vmparam.hTue Sep  3 22:01:12 2019
(r351799)
+++ head/sys/amd64/include/vmparam.hTue Sep  3 22:26:01 2019
(r351800)
@@ -176,8 +176,6 @@
 #defineDMAP_MIN_ADDRESSKVADDR(DMPML4I, 0, 0, 0)
 #defineDMAP_MAX_ADDRESSKVADDR(DMPML4I + NDMPML4E, 0, 0, 0)
 
-#definePA_MIN_ADDRESS  KVADDR(PAPML4I, 0, 0, 0)
-
 #defineLARGEMAP_MIN_ADDRESSKVADDR(LMSPML4I, 0, 0, 0)
 #defineLARGEMAP_MAX_ADDRESSKVADDR(LMEPML4I + 1, 0, 0, 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: r351799 - head/sys/conf

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Sep  3 22:01:12 2019
New Revision: 351799
URL: https://svnweb.freebsd.org/changeset/base/351799

Log:
  LOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work
  
  Currently LOCAL_MODULES= works, but LOCAL_MODULES="" causes build errors as
  .for still has the empty string to loop over. An .if empty prior to the loop
  was considered, but LOCAL_MODULES has empty quotes at that point and thus,
  isn't empty. A better solution likely exists, but this floats us by for
  now...

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Tue Sep  3 21:11:04 2019(r351798)
+++ head/sys/conf/kern.post.mk  Tue Sep  3 22:01:12 2019(r351799)
@@ -77,10 +77,12 @@ modules-${target}:
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
 .endif
 .for module in ${LOCAL_MODULES}
+.if !empty(module)
@${ECHODIR} "===> ${module} 
(${target:S/^reinstall$/install/:S/^clobber$/cleandir/})"
@cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \
DIRPRFX="${module}/" \
${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
+.endif
 .endfor
 .endif
 .endfor
___
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: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-03 Thread Mark Johnston
On Tue, Sep 03, 2019 at 07:14:27PM +0300, Slawa Olhovchenkov wrote:
> On Tue, Sep 03, 2019 at 10:02:59AM +0300, Andriy Gapon wrote:
> 
> > On 02/09/2019 01:22, Mark Johnston wrote:
> > > Author: markj
> > > Date: Sun Sep  1 22:22:43 2019
> > > New Revision: 351673
> > > URL: https://svnweb.freebsd.org/changeset/base/351673
> > > 
> > > Log:
> > >   Extend uma_reclaim() to permit different reclamation targets.
> > >   
> > >   The page daemon periodically invokes uma_reclaim() to reclaim cached
> > >   items from each zone when the system is under memory pressure.  This
> > >   is important since the size of these caches is unbounded by default.
> > >   However it also results in bursts of high latency when allocating from
> > >   heavily used zones as threads miss in the per-CPU caches and must
> > >   access the keg in order to allocate new items.
> > >   
> > >   With r340405 we maintain an estimate of each zone's usage of its
> > >   (per-NUMA domain) cache of full buckets.  Start making use of this
> > >   estimate to avoid reclaiming the entire cache when under memory
> > >   pressure.  In particular, introduce TRIM, DRAIN and DRAIN_CPU
> > >   verbs for uma_reclaim() and uma_zone_reclaim().  When trimming, only
> > >   items in excess of the estimate are reclaimed.  Draining a zone
> > >   reclaims all of the cached full buckets (the previous behaviour of
> > >   uma_reclaim()), and may further drain the per-CPU caches in extreme
> > >   cases.
> > >   
> > >   Now, when under memory pressure, the page daemon will trim zones
> > >   rather than draining them.  As a result, heavily used zones do not incur
> > >   bursts of bucket cache misses following reclamation, but large, unused
> > >   caches will be reclaimed as before.
> > 
> > Mark,
> > 
> > have you considered running UMA_RECLAIM_TRIM periodically, even without a 
> > memory
> > pressure?
> > I think that with such a periodic trimming there will be less need to invoke
> > vm_lowmem().

Slawa and I talked about this in the past.  His complaint is that a
large cache can take a significant amount of time to trim, and it
manifests as a spike of CPU usage and contention on the zone lock.  In
particular, keg_drain() iterates over the list of free slabs with the
keg lock held, and if the many items were freed to the keg while
trimming/draining, the list can be quite long.  This can have effects
outside the zone, for example if we are reclaiming items from zones used
by other UMA zones, like the bucket or slab zones.

Reclaiming cached items when there is no demand for free pages seems
wrong to me.  We historically had similar problems with the page daemon,
which last year was changed to perform smaller reclamations at a greater
frequency.  I suspect a better approach for UMA would be to similarly
increase reclaim frequency and reduce the number of items freed in one
go.

> > Also, I think that we would be able to retire (or re-purpose) lowmem_period.
> > E.g., the trimming would be done every lowmem_period, but vm_lowmem() would 
> > not
> > be throttled.

Some of the vm_lowmem eventhandlers probably shouldn't be called each
time the page daemon scans the inactive queue (every 0.1s under memory
pressure).  ufsdirhash_lowmem and mb_reclaim in particular don't seem
like they need to be invoked very frequently.  We could easily define
multiple eventhandlers to differentiate between these cases, though.

> > One example of the throttling of vm_lowmem being bad is its interaction 
> > with the
> > ZFS ARC.  When there is a spike in memory usage we want the ARC to adapt as
> > quickly as possible.  But at present the lowmem_period logic interferes 
> > with that.
>
> Some time ago, I sent Mark a patch that implements this logic,
> specialy for ARC and mbuf cooperate.
>
> Mostly problem I am see at this
> work -- very slowly vm_page_free(). May be currenly this is more
> speedy...

How did you determine this?

You are on stable/12 I believe, so r350374 might help if you do not
already have it.  I guess the vm_page_free() calls are coming from the
UMA trimmer?
___
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: r351797 - in head: lib/geom/part sys/geom/part

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Sep  3 20:57:20 2019
New Revision: 351797
URL: https://svnweb.freebsd.org/changeset/base/351797

Log:
  Allow more nesting of GEOM partitioning schemes
  
  GEOM is supposed to be topology-agnostic, but the GPT and BSD partition code
  has arbitrary restrictions on nesting that are annoying in cases such as
  running VMs on raw partitions (since the VM's partitioning scheme is not
  visible to the host).
  
  This patch adds sysctls to disable the restrictions except in the case of
  BSD label (and similar) partitions with offset 0 (where we need to avoid
  recursively recognizing the label).
  
  Submitted by: Andrew Gierth
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21350

Modified:
  head/lib/geom/part/gpart.8
  head/sys/geom/part/g_part.c
  head/sys/geom/part/g_part_gpt.c

Modified: head/lib/geom/part/gpart.8
==
--- head/lib/geom/part/gpart.8  Tue Sep  3 20:33:38 2019(r351796)
+++ head/lib/geom/part/gpart.8  Tue Sep  3 20:57:20 2019(r351797)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 17, 2018
+.Dd September 3, 2019
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -1207,7 +1207,13 @@ variables can be used to control the behavior of the
 GEOM class.
 The default value is shown next to each variable.
 .Bl -tag -width indent
-.It Va kern.geom.part.auto_resize: No 1
+.It Va kern.geom.part.allow_nesting : No 0
+By default, some schemes (currently BSD, BSD64 and VTOC8) do not permit
+further nested partitioning.
+This variable overrides this restriction and allows arbitrary nesting (except
+within partitions created at offset 0).
+Some schemes have their own separate checks, for which see below.
+.It Va kern.geom.part.auto_resize : No 1
 This variable controls automatic resize behavior of
 .Nm
 GEOM class.
@@ -1228,6 +1234,9 @@ disk metadata.
 If some inconsistency is detected, the partition table will be
 rejected with a diagnostic message:
 .Sy "GEOM_PART: Integrity check failed (provider, scheme)" .
+.It Va kern.geom.part.gpt.allow_nesting : No 0
+By default the GPT scheme is allowed only at the outermost nesting level.
+This variable allows this restriction to be removed.
 .It Va kern.geom.part.ldm.debug : No 0
 Debug level of the Logical Disk Manager (LDM) module.
 This can be set to a number between 0 and 2 inclusive.

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Tue Sep  3 20:33:38 2019(r351796)
+++ head/sys/geom/part/g_part.c Tue Sep  3 20:57:20 2019(r351797)
@@ -143,6 +143,10 @@ static u_int auto_resize = 1;
 SYSCTL_UINT(_kern_geom_part, OID_AUTO, auto_resize,
 CTLFLAG_RWTUN, _resize, 1,
 "Enable auto resize");
+static u_int allow_nesting = 0;
+SYSCTL_UINT(_kern_geom_part, OID_AUTO, allow_nesting,
+CTLFLAG_RWTUN, _nesting, 0,
+"Allow additional levels of nesting");
 
 /*
  * The GEOM partitioning class.
@@ -2271,7 +2275,13 @@ g_part_start(struct bio *bp)
return;
if (g_handleattr_int(bp, "GEOM::fwsectors", table->gpt_sectors))
return;
-   if (g_handleattr_int(bp, "PART::isleaf", table->gpt_isleaf))
+   /*
+* allow_nesting overrides "isleaf" to false _unless_ the
+* provider offset is zero, since otherwise we would recurse.
+*/
+   if (g_handleattr_int(bp, "PART::isleaf",
+   table->gpt_isleaf &&
+   (allow_nesting == 0 || entry->gpe_offset == 0)))
return;
if (g_handleattr_int(bp, "PART::depth", table->gpt_depth))
return;

Modified: head/sys/geom/part/g_part_gpt.c
==
--- head/sys/geom/part/g_part_gpt.c Tue Sep  3 20:33:38 2019
(r351796)
+++ head/sys/geom/part/g_part_gpt.c Tue Sep  3 20:57:20 2019
(r351797)
@@ -54,6 +54,14 @@ __FBSDID("$FreeBSD$");
 
 FEATURE(geom_part_gpt, "GEOM partitioning class for GPT partitions support");
 
+SYSCTL_DECL(_kern_geom_part);
+static SYSCTL_NODE(_kern_geom_part, OID_AUTO, gpt, CTLFLAG_RW, 0,
+"GEOM_PART_GPT GUID Partition Table");
+
+static u_int allow_nesting = 0;
+SYSCTL_UINT(_kern_geom_part_gpt, OID_AUTO, allow_nesting,
+CTLFLAG_RWTUN, _nesting, 0, "Allow GPT to be nested inside other 
schemes");
+
 CTASSERT(offsetof(struct gpt_hdr, padding) == 92);
 CTASSERT(sizeof(struct gpt_ent) == 128);
 
@@ -652,8 +660,8 @@ g_part_gpt_create(struct g_part_table *basetable, stru
struct g_part_gpt_table *table;
size_t tblsz;
 
-   /* We don't nest, which means that our depth should be 0. */
-   if (basetable->gpt_depth != 0)
+   /* Our depth should be 0 unless nesting was explicitly enabled. */
+   if 

Re: svn commit: r351747 - head/sys/dev/nvme

2019-09-03 Thread Ravi Pokala
Hi Warner,

+   /*
+* Per Section 7.6.2 of NVMe spec 1.4, to properly suspend, we need to
+* delete the hardware I/O queues, and then shutdown. This properly
+* flushes any metadata the drive may have stored so it can survive
+* having its power removed and prevents the unsafe shutdown count from
+* incriminating. Once we delete the qpairs, we have to disable them
+* before shutting down. The delay is out of paranoia in
+* nvme_ctrlr_hw_reset, and is repeated here (though we should have no
+* pending I/O that the delay copes with).
+*/
+   nvme_ctrlr_delete_qpairs(ctrlr);
+   nvme_ctrlr_disable_qpairs(ctrlr);
+   DELAY(100*1000);
+   nvme_ctrlr_shutdown(ctrlr);

This seems backwards to me. From that section:

> The host should perform the following actions in sequence for a normal 
> shutdown:
> 1. Stop submitting any new I/O commands to the controller and allow any 
> outstanding commands to complete;
> 2. If the controller implements I/O queues, then the host should delete 
> all I/O Submission Queues, using the Delete I/O Submission Queue command. A 
> result of the successful completion of the Delete I/O Submission Queue 
> command is that any remaining commands outstanding are aborted;
> 3. If the controller implements I/O queues, then the host should delete 
> all I/O Completion Queues, using the Delete I/O Completion Queue command; and
> 4. The host should set the Shutdown Notification (CC.SHN) field to 01b to 
> indicate a normal shutdown operation. The controller indicates when shutdown 
> processing is completed by updating the Shutdown Status (CSTS.SHST) field to 
> 10b.

You are calling nvme_ctrlr_delete_qpairs() -- which implements steps (2) and 
(3) -- before you are calling nvme_ctrlr_disable_qpairs() -- which implements 
step (1).

Or am I missing something?

Thanks,

Ravi (rpokala@)


-Original Message-
From:  on behalf of Warner Losh 

Date: 2019-09-03, Tuesday at 08:26
To: , , 

Subject: svn commit: r351747 - head/sys/dev/nvme

Author: imp
Date: Tue Sep  3 15:26:11 2019
New Revision: 351747
URL: https://svnweb.freebsd.org/changeset/base/351747

Log:
  Implement nvme suspend / resume for pci attachment
  
  When we suspend, we need to properly shutdown the NVME controller. The
  controller may go into D3 state (or may have the power removed), and
  to properly flush the metadata to non-volatile RAM, we must complete a
  normal shutdown. This consists of deleting the I/O queues and setting
  the shutodown bit. We have to do some extra stuff to make sure we
  reset the software state of the queues as well.
  
  On resume, we have to reset the card twice, for reasons described in
  the attach funcion. Once we've done that, we can restart the card. If
  any of this fails, we'll fail the NVMe card, just like we do when a
  reset fails.
  
  Set is_resetting for the duration of the suspend / resume. This keeps
  the reset taskqueue from running a concurrent reset, and also is
  needed to prevent any hw completions from queueing more I/O to the
  card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to get
  that from the global state of the ctrlr. Wait for any pending reset to
  finish. All queued I/O will get sent to the hardware as part of
  nvme_ctrlr_start(), though the upper layers shouldn't send any
  down. Disabling the qpairs is the other failsafe to ensure all I/O is
  queued.
  
  Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to avoid
  confusion with all the other destroy functions.  It just removes the
  queues in hardware, while the other _destroy_ functions tear down
  driver data structures.
  
  Split parts of the hardware reset function up so that I can
  do part of the reset in suspsend. Split out the software disabling
  of the qpairs into nvme_ctrlr_disable_qpairs.
  
  Finally, fix a couple of spelling errors in comments related to
  this.
  
  Relnotes: Yes
  MFC After: 1 week
  Reviewed by: scottl@ (prior version)
  Differential Revision: https://reviews.freebsd.org/D21493

Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_pci.c
  head/sys/dev/nvme/nvme_private.h

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

==
--- head/sys/dev/nvme/nvme.cTue Sep  3 14:55:19 2019
(r351746)
+++ head/sys/dev/nvme/nvme.cTue Sep  3 15:26:11 2019
(r351747)
@@ -137,9 +137,10 @@ nvme_attach(device_t dev)
}
 
/*
-* Reset controller twice to ensure we do a transition from cc.en==1
-*  to cc.en==0.  This is because we don't really know what status
-   

svn commit: r351796 - head/sys/kern

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Sep  3 20:33:38 2019
New Revision: 351796
URL: https://svnweb.freebsd.org/changeset/base/351796

Log:
  posixshm: start counting writeable mappings
  
  r351650 switched posixshm to using OBJT_SWAP for shm_object
  
  r351795 added support to the swap_pager for tracking writeable mappings
  
  Take advantage of this and start tracking writeable mappings; fd sealing
  will use this to reject a seal on writing with EBUSY if any such mapping
  exist.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D21456

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cTue Sep  3 20:31:48 2019(r351795)
+++ head/sys/kern/uipc_shm.cTue Sep  3 20:33:38 2019(r351796)
@@ -895,6 +895,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
struct shmfd *shmfd;
vm_prot_t maxprot;
int error;
+   bool writecnt;
 
shmfd = fp->f_data;
maxprot = VM_PROT_NONE;
@@ -905,10 +906,10 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
if ((fp->f_flag & FWRITE) != 0)
maxprot |= VM_PROT_WRITE;
 
+   writecnt = (flags & MAP_SHARED) != 0 && (prot & VM_PROT_WRITE) != 0;
+
/* Don't permit shared writable mappings on read-only descriptors. */
-   if ((flags & MAP_SHARED) != 0 &&
-   (maxprot & VM_PROT_WRITE) == 0 &&
-   (prot & VM_PROT_WRITE) != 0)
+   if (writecnt && (maxprot & VM_PROT_WRITE) == 0)
return (EACCES);
maxprot &= cap_maxprot;
 
@@ -931,10 +932,16 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a
mtx_unlock(_timestamp_lock);
vm_object_reference(shmfd->shm_object);
 
+   if (writecnt)
+   vm_pager_update_writecount(shmfd->shm_object, 0, objsize);
error = vm_mmap_object(map, addr, objsize, prot, maxprot, flags,
-   shmfd->shm_object, foff, FALSE, td);
-   if (error != 0)
+   shmfd->shm_object, foff, writecnt, td);
+   if (error != 0) {
+   if (writecnt)
+   vm_pager_release_writecount(shmfd->shm_object, 0,
+   objsize);
vm_object_deallocate(shmfd->shm_object);
+   }
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: r351795 - in head/sys: kern vm

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Sep  3 20:31:48 2019
New Revision: 351795
URL: https://svnweb.freebsd.org/changeset/base/351795

Log:
  vm pager: writemapping accounting for OBJT_SWAP
  
  Currently writemapping accounting is only done for vnode_pager which does
  some accounting on the underlying vnode.
  
  Extend this to allow accounting to be possible for any of the pager types.
  New pageops are added to update/release writecount that need to be
  implemented for any pager wishing to do said accounting, and we implement
  these methods now for both vnode_pager (unchanged) and swap_pager.
  
  The primary motivation for this is to allow other systems with OBJT_SWAP
  objects to check if their objects have any write mappings and reject
  operations with EBUSY if so. posixshm will be the first to do so in order to
  reject adding write seals to the shmfd if any writable mappings exist.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D21456

Modified:
  head/sys/kern/vfs_vnops.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h
  head/sys/vm/vm_mmap.c
  head/sys/vm/vm_object.h
  head/sys/vm/vm_pager.h
  head/sys/vm/vnode_pager.c
  head/sys/vm/vnode_pager.h

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Tue Sep  3 20:26:08 2019(r351794)
+++ head/sys/kern/vfs_vnops.c   Tue Sep  3 20:31:48 2019(r351795)
@@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #ifdef HWPMC_HOOKS
 #include 
@@ -2502,7 +2502,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad
 * writecount, then undo that now.
 */
if (writecounted)
-   vnode_pager_release_writecount(object, 0, size);
+   vm_pager_release_writecount(object, 0, size);
vm_object_deallocate(object);
}
 #ifdef HWPMC_HOOKS

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cTue Sep  3 20:26:08 2019(r351794)
+++ head/sys/vm/swap_pager.cTue Sep  3 20:31:48 2019(r351795)
@@ -376,6 +376,10 @@ static boolean_t
 static voidswap_pager_init(void);
 static voidswap_pager_unswapped(vm_page_t);
 static voidswap_pager_swapoff(struct swdevt *sp);
+static voidswap_pager_update_writecount(vm_object_t object,
+vm_offset_t start, vm_offset_t end);
+static voidswap_pager_release_writecount(vm_object_t object,
+vm_offset_t start, vm_offset_t end);
 
 struct pagerops swappagerops = {
.pgo_init = swap_pager_init,/* early system initialization 
of pager */
@@ -386,6 +390,8 @@ struct pagerops swappagerops = {
.pgo_putpages = swap_pager_putpages,/* pageout  
*/
.pgo_haspage =  swap_pager_haspage, /* get backing store status for 
page*/
.pgo_pageunswapped = swap_pager_unswapped,  /* remove swap related 
to page  */
+   .pgo_update_writecount = swap_pager_update_writecount,
+   .pgo_release_writecount = swap_pager_release_writecount,
 };
 
 /*
@@ -611,6 +617,7 @@ swap_pager_alloc_init(void *handle, struct ucred *cred
object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset +
PAGE_MASK + size));
 
+   object->un_pager.swp.writemappings = 0;
object->handle = handle;
if (cred != NULL) {
object->cred = cred;
@@ -1903,6 +1910,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t p
atomic_thread_fence_rel();
 
object->type = OBJT_SWAP;
+   object->un_pager.swp.writemappings = 0;
KASSERT(object->handle == NULL, ("default pager with handle"));
}
 
@@ -2990,4 +2998,28 @@ sysctl_swap_async_max(SYSCTL_HANDLER_ARGS)
mtx_unlock(_mtx);
 
return (0);
+}
+
+static void
+swap_pager_update_writecount(vm_object_t object, vm_offset_t start,
+vm_offset_t end)
+{
+
+   VM_OBJECT_WLOCK(object);
+   KASSERT((object->flags & OBJ_NOSPLIT) != 0,
+   ("Splittable object with writecount"));
+   object->un_pager.swp.writemappings += (vm_ooffset_t)end - start;
+   VM_OBJECT_WUNLOCK(object);
+}
+
+static void
+swap_pager_release_writecount(vm_object_t object, vm_offset_t start,
+vm_offset_t end)
+{
+
+   VM_OBJECT_WLOCK(object);
+   KASSERT((object->flags & OBJ_NOSPLIT) != 0,
+   ("Splittable object with writecount"));
+   object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start;
+   VM_OBJECT_WUNLOCK(object);
 }

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cTue Sep  3 20:26:08 2019(r351794)
+++ head/sys/vm/vm_map.cTue Sep  3 20:31:48 

svn commit: r351783 - head/sys/amd64/linux

2019-09-03 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep  3 19:48:23 2019
New Revision: 351783
URL: https://svnweb.freebsd.org/changeset/base/351783

Log:
  Unbreak Linux binaries linked against new glibc, such as the ones
  from recent Ubuntu versions.  Without it they segfault on startup.
  
  Reviewed by:  emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20687

Modified:
  head/sys/amd64/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Tue Sep  3 19:48:02 2019
(r351782)
+++ head/sys/amd64/linux/linux_sysvec.c Tue Sep  3 19:48:23 2019
(r351783)
@@ -343,6 +343,12 @@ linux_copyout_strings(struct image_params *imgp)
 */
vectp -= imgp->args->argc + 1 + imgp->args->envc + 1;
 
+   /*
+* Starting with 2.24, glibc depends on a 16-byte stack alignment.
+* One "long argc" will be prepended later.
+*/
+   vectp = (char **)uintptr_t)vectp + 8) & ~0xF) - 8);
+
/* vectp also becomes our initial stack base. */
stack_base = (register_t *)vectp;
 
___
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: r351782 - head/sys/netinet/tcp_stacks

2019-09-03 Thread Michael Tuexen
Author: tuexen
Date: Tue Sep  3 19:48:02 2019
New Revision: 351782
URL: https://svnweb.freebsd.org/changeset/base/351782

Log:
  Fix two TCP RACK issues:
  * Convert the TCP delayed ACK timer from ms to ticks as required.
This fixes the timer on platforms with hz != 1000.
  * Don't delay acknowledgements which report duplicate data using
DSACKs.
  
  Reviewed by:  rrs@
  MFC after:1 week
  Sponsored by: Netflix, Inc.
  Differential Revision:https://reviews.freebsd.org/D21512

Modified:
  head/sys/netinet/tcp_stacks/rack.c

Modified: head/sys/netinet/tcp_stacks/rack.c
==
--- head/sys/netinet/tcp_stacks/rack.c  Tue Sep  3 19:42:04 2019
(r351781)
+++ head/sys/netinet/tcp_stacks/rack.c  Tue Sep  3 19:48:02 2019
(r351782)
@@ -1790,6 +1790,11 @@ rack_drop_checks(struct tcpopt *to, struct mbuf *m, st
 */
tcp_update_sack_list(tp, th->th_seq,
th->th_seq + todrop);
+   /*
+* ACK now, as the next in-sequence segment
+* will clear the DSACK block again
+*/
+   tp->t_flags |= TF_ACKNOW;
}
*drop_hdrlen += todrop; /* drop from the top afterwards */
th->th_seq += todrop;
@@ -2338,7 +2343,7 @@ rack_start_hpts_timer(struct tcp_rack *rack, struct tc
}
hpts_timeout = rack_timer_start(tp, rack, cts);
if (tp->t_flags & TF_DELACK) {
-   delayed_ack = tcp_delacktime;
+   delayed_ack = TICKS_2_MSEC(tcp_delacktime);
rack->r_ctl.rc_hpts_flags |= PACE_TMR_DELACK;
}
if (delayed_ack && ((hpts_timeout == 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: r351781 - in head: . etc/mtree share/man/man5 share/mk targets/pseudo/userland tools/build/mk usr.sbin usr.sbin/pc-sysinstall

2019-09-03 Thread Kris Moore
Author: kmoore (ports committer)
Date: Tue Sep  3 19:42:04 2019
New Revision: 351781
URL: https://svnweb.freebsd.org/changeset/base/351781

Log:
  - Retire pc-sysinstall(8)
  
  https://reviews.freebsd.org/D21094
  
  Submitted by: kmo...@freebsd.org
  Approved by: i...@freebsd.org

Deleted:
  head/usr.sbin/pc-sysinstall/
Modified:
  head/ObsoleteFiles.inc
  head/etc/mtree/BSD.usr.dist
  head/share/man/man5/src.conf.5
  head/share/mk/src.opts.mk
  head/targets/pseudo/userland/Makefile.depend
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Sep  3 19:39:06 2019(r351780)
+++ head/ObsoleteFiles.inc  Tue Sep  3 19:42:04 2019(r351781)
@@ -37,6 +37,87 @@
 #   -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \
 #   xargs -n1 | sort | uniq -d;
 # done
+ 
+# 20190903: pc-sysinstall(8) removed
+OLD_FILES+=usr/share/examples/pc-sysinstall/README
+OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.fbsd-netinstall
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.geli
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.gmirror
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.netinstall
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.restore
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.rsync
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.upgrade
+OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.zfs
+OLD_FILES+=usr/share/man/man8/pc-sysinstall.8.gz
+OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/create-part.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/delete-part.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-emulation.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-laptop.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-nics.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-info.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-list.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-part.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/enable-net.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/get-packages.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-components.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-config.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-mirrors.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-packages.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-rsync-backups.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-tzones.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/query-langs.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/send-logs.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/setup-ssh-keys.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/set-mirror.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/sys-mem.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-live.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-netup.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/update-part-list.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-layouts.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-models.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-variants.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-bsdlabel.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-cleanup.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-disk.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-extractimage.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-ftp.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installcomponents.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installpackages.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-localize.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountdisk.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountoptical.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-networking.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-newfs.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-parse.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-packages.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-runcommands.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-unmount.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-upgrade.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions-users.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/functions.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/installimage.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/parseconfig.sh
+OLD_FILES+=usr/share/pc-sysinstall/backend/startautoinstall.sh
+OLD_FILES+=usr/share/pc-sysinstall/conf/avail-langs
+OLD_FILES+=usr

svn commit: r351774 - head/usr.bin/proccontrol

2019-09-03 Thread Konstantin Belousov
Author: kib
Date: Tue Sep  3 18:58:48 2019
New Revision: 351774
URL: https://svnweb.freebsd.org/changeset/base/351774

Log:
  Add stackgap control mode to proccontrol(1).
  
  PR:   239894
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D21352

Modified:
  head/usr.bin/proccontrol/proccontrol.c

Modified: head/usr.bin/proccontrol/proccontrol.c
==
--- head/usr.bin/proccontrol/proccontrol.c  Tue Sep  3 18:56:25 2019
(r351773)
+++ head/usr.bin/proccontrol/proccontrol.c  Tue Sep  3 18:58:48 2019
(r351774)
@@ -44,6 +44,7 @@ enum {
MODE_TRACE,
MODE_TRAPCAP,
MODE_PROTMAX,
+   MODE_STACKGAP,
 #ifdef PROC_KPTI_CTL
MODE_KPTI,
 #endif
@@ -73,8 +74,8 @@ static void __dead2
 usage(void)
 {
 
-   fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap"
-   KPTI_USAGE") [-q] "
+   fprintf(stderr, "Usage: proccontrol -m (aslr|protmax|trace|trapcap|"
+   "stackgap"KPTI_USAGE") [-q] "
"[-s (enable|disable)] [-p pid | command]\n");
exit(1);
 }
@@ -101,6 +102,8 @@ main(int argc, char *argv[])
mode = MODE_TRACE;
else if (strcmp(optarg, "trapcap") == 0)
mode = MODE_TRAPCAP;
+   else if (strcmp(optarg, "stackgap") == 0)
+   mode = MODE_STACKGAP;
 #ifdef PROC_KPTI_CTL
else if (strcmp(optarg, "kpti") == 0)
mode = MODE_KPTI;
@@ -153,6 +156,9 @@ main(int argc, char *argv[])
case MODE_PROTMAX:
error = procctl(P_PID, pid, PROC_PROTMAX_STATUS, );
break;
+   case MODE_STACKGAP:
+   error = procctl(P_PID, pid, PROC_STACKGAP_STATUS, );
+   break;
 #ifdef PROC_KPTI_CTL
case MODE_KPTI:
error = procctl(P_PID, pid, PROC_KPTI_STATUS, );
@@ -217,6 +223,26 @@ main(int argc, char *argv[])
else
printf(", not active\n");
break;
+   case MODE_STACKGAP:
+   switch (arg & (PROC_STACKGAP_ENABLE |
+   PROC_STACKGAP_DISABLE)) {
+   case PROC_STACKGAP_ENABLE:
+   printf("enabled\n");
+   break;
+   case PROC_STACKGAP_DISABLE:
+   printf("disabled\n");
+   break;
+   }
+   switch (arg & (PROC_STACKGAP_ENABLE_EXEC |
+   PROC_STACKGAP_DISABLE_EXEC)) {
+   case PROC_STACKGAP_ENABLE_EXEC:
+   printf("enabled after exec\n");
+   break;
+   case PROC_STACKGAP_DISABLE_EXEC:
+   printf("disabled after exec\n");
+   break;
+   }
+   break;
 #ifdef PROC_KPTI_CTL
case MODE_KPTI:
switch (arg & ~PROC_KPTI_STATUS_ACTIVE) {
@@ -255,6 +281,12 @@ main(int argc, char *argv[])
arg = enable ? PROC_PROTMAX_FORCE_ENABLE :
PROC_PROTMAX_FORCE_DISABLE;
error = procctl(P_PID, pid, PROC_PROTMAX_CTL, );
+   break;
+   case MODE_STACKGAP:
+   arg = enable ? PROC_STACKGAP_ENABLE_EXEC :
+   (PROC_STACKGAP_DISABLE |
+   PROC_STACKGAP_DISABLE_EXEC);
+   error = procctl(P_PID, pid, PROC_STACKGAP_CTL, );
break;
 #ifdef PROC_KPTI_CTL
case MODE_KPTI:
___
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: r351773 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys sys/vm

2019-09-03 Thread Konstantin Belousov
Author: kib
Date: Tue Sep  3 18:56:25 2019
New Revision: 351773
URL: https://svnweb.freebsd.org/changeset/base/351773

Log:
  Add procctl(PROC_STACKGAP_CTL)
  
  It allows a process to request that stack gap was not applied to its
  stacks, retroactively.  Also it is possible to control the gaps in the
  process after exec.
  
  PR:   239894
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D21352

Modified:
  head/lib/libc/sys/procctl.2
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_procctl.c
  head/sys/sys/proc.h
  head/sys/sys/procctl.h
  head/sys/vm/vm_map.c

Modified: head/lib/libc/sys/procctl.2
==
--- head/lib/libc/sys/procctl.2 Tue Sep  3 18:39:36 2019(r351772)
+++ head/lib/libc/sys/procctl.2 Tue Sep  3 18:56:25 2019(r351773)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 9, 2019
+.Dd August 31, 2019
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -503,6 +503,67 @@ must point to a memory location that can hold a value 
 .Vt int .
 If signal delivery has not been requested, it will contain zero
 on return.
+.It Dv PROC_STACKGAP_CTL
+Controls the stack gaps in the specified process.
+A stack gap is the part of the growth area for a
+.Dv MAP_STACK
+mapped region that is reserved and never filled by memory.
+Instead, the process is guaranteed to receive a
+.Dv SIGSEGV
+signal on accessing pages in the gap.
+Gaps protect against stack overflow corrupting memory adjacent
+to the stack.
+.Pp
+The
+.Fa data
+argument must point to an integer variable containing flags.
+The following flags are allowed:
+.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
+.It Dv PROC_STACKGAP_ENABLE
+This flag is only accepted for consistency with
+.Dv PROC_STACKGAP_STATUS .
+If stack gaps are enabled, the flag is ignored.
+If disabled, the flag causes an
+.Ev EINVAL
+error to be returned.
+After gaps are disabled in a process, they can only be re-enabled when an
+.Xr execve 2
+is performed.
+.It Dv PROC_STACKGAP_DISABLE
+Disable stack gaps for the process.
+For existing stacks, the gap is no longer a reserved part of the growth
+area and can be filled by memory on access.
+.It Dv PROC_STACKGAP_ENABLE_EXEC
+Enable stack gaps for programs started after an
+.Xr execve 2
+by the specified process.
+.It Dv PROC_STACKGAP_DISABLE_EXEC
+Inherit disabled stack gaps state after
+.Xr execve 2 .
+In other words, if the currently executing program has stack gaps disabled,
+they are kept disabled on exec.
+If gaps were enabled, they are kept enabled after exec.
+.El
+.Pp
+The stack gap state is inherited from the parent on
+.Xr fork 2 .
+.It Dv PROC_STACKGAP_STATUS
+Returns the current stack gap state for the specified process.
+.Fa data
+must point to an integer variable, which is used to return a bitmask
+consisting of the following flags:
+.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
+.It Dv PROC_STACKGAP_ENABLE
+Stack gaps are enabled.
+.It Dv PROC_STACKGAP_DISABLE
+Stack gaps are disabled.
+.It Dv PROC_STACKGAP_ENABLE_EXEC
+Stack gaps are enabled in the process after
+.Xr execve 2 .
+.It Dv PROC_STACKGAP_DISABLE_EXEC
+Stack gaps are disabled in the process after
+.Xr execve 2 .
+.El
 .El
 .Sh NOTES
 Disabling tracing on a process should not be considered a security

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Tue Sep  3 18:39:36 2019
(r351772)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Tue Sep  3 18:56:25 2019
(r351773)
@@ -3364,6 +3364,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_
case PROC_ASLR_CTL:
case PROC_PROTMAX_CTL:
case PROC_SPROTECT:
+   case PROC_STACKGAP_CTL:
case PROC_TRACE_CTL:
case PROC_TRAPCAP_CTL:
error = copyin(PTRIN(uap->data), , sizeof(flags));
@@ -3396,6 +3397,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_
break;
case PROC_ASLR_STATUS:
case PROC_PROTMAX_STATUS:
+   case PROC_STACKGAP_STATUS:
case PROC_TRACE_STATUS:
case PROC_TRAPCAP_STATUS:
data = 
@@ -3426,6 +3428,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_
break;
case PROC_ASLR_STATUS:
case PROC_PROTMAX_STATUS:
+   case PROC_STACKGAP_STATUS:
case PROC_TRACE_STATUS:
case PROC_TRAPCAP_STATUS:
if (error == 0)

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Tue Sep  3 18:39:36 2019(r351772)
+++ head/sys/kern/kern_exec.c   Tue Sep  3 18:56:25 2019(r351773)
@@ -745,6 +745,8 @@ interpret:
p->p_flag |= P_EXEC;
if ((p->p_flag2 & 

svn commit: r351771 - in head: release/amd64 tools/boot

2019-09-03 Thread Matt Macy
Author: mmacy
Date: Tue Sep  3 18:37:55 2019
New Revision: 351771
URL: https://svnweb.freebsd.org/changeset/base/351771

Log:
  Use makefs -t msdos in make_esp_file
  
  With this last piece in place, make -C /usr/src/release release.iso is
  finally able to run in a jail. This was not possible before because
  msdosfs cannot be mounted inside a jail.
  
  Submitted by: r...@ixsystems.com
  Reviewed by:  emaste@, imp@, gjb@
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D21385

Modified:
  head/release/amd64/mkisoimages.sh
  head/tools/boot/install-boot.sh

Modified: head/release/amd64/mkisoimages.sh
==
--- head/release/amd64/mkisoimages.sh   Tue Sep  3 18:35:55 2019
(r351770)
+++ head/release/amd64/mkisoimages.sh   Tue Sep  3 18:37:55 2019
(r351771)
@@ -45,7 +45,7 @@ if [ "$1" = "-b" ]; then
# This is highly x86-centric and will be used directly below.
bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot"
 
-   # Make EFI system partition (should be done with makefs in the future)
+   # Make EFI system partition.
# The ISO file is a special case, in that it only has a maximum of
# 800 KB available for the boot code. So make an 800 KB ESP
espfilename=$(mktemp /tmp/efiboot.XX)

Modified: head/tools/boot/install-boot.sh
==
--- head/tools/boot/install-boot.sh Tue Sep  3 18:35:55 2019
(r351770)
+++ head/tools/boot/install-boot.sh Tue Sep  3 18:37:55 2019
(r351771)
@@ -43,7 +43,7 @@ get_uefi_bootname() {
 }
 
 make_esp_file() {
-local file sizekb loader device mntpt fatbits efibootname
+local file sizekb loader device stagedir fatbits efibootname
 
 file=$1
 sizekb=$2
@@ -57,17 +57,17 @@ make_esp_file() {
 fatbits=12
 fi
 
-dd if=/dev/zero of="${file}" bs=1k count="${sizekb}"
-device=$(mdconfig -a -t vnode -f "${file}")
-newfs_msdos -F "${fatbits}" -c 1 -L EFISYS "/dev/${device}" > /dev/null 
2>&1
-mntpt=$(mktemp -d /tmp/stand-test.XX)
-mount -t msdosfs "/dev/${device}" "${mntpt}"
-mkdir -p "${mntpt}/EFI/BOOT"
+stagedir=$(mktemp -d /tmp/stand-test.XX)
+mkdir -p "${stagedir}/EFI/BOOT"
 efibootname=$(get_uefi_bootname)
-cp "${loader}" "${mntpt}/EFI/BOOT/${efibootname}.efi"
-umount "${mntpt}"
-rmdir "${mntpt}"
-mdconfig -d -u "${device}"
+cp "${loader}" "${stagedir}/EFI/BOOT/${efibootname}.efi"
+makefs -t msdos \
+   -o fat_type=${fatbits} \
+   -o sectors_per_cluster=1 \
+   -o volume_label=EFISYS \
+   -s ${sizekb}k \
+   "${file}" "${stagedir}"
+rm -rf "${stagedir}"
 }
 
 make_esp_device() {
___
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: r351770 - head/bin/dd

2019-09-03 Thread Matt Macy
Author: mmacy
Date: Tue Sep  3 18:35:55 2019
New Revision: 351770
URL: https://svnweb.freebsd.org/changeset/base/351770

Log:
  Add conv=fsync flag to dd
  
  The fsync flag performs an fsync(2) on the output file before closing it.
  This will be useful for the ZFS test suite.
  
  Submitted by: r...@ixsystems.com
  Reviewed by:  jilles@, imp@
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/bin/dd/args.c
  head/bin/dd/dd.1
  head/bin/dd/dd.c
  head/bin/dd/dd.h

Modified: head/bin/dd/args.c
==
--- head/bin/dd/args.c  Tue Sep  3 18:32:29 2019(r351769)
+++ head/bin/dd/args.c  Tue Sep  3 18:35:55 2019(r351770)
@@ -320,6 +320,7 @@ static const struct conv {
{ "ascii",  C_ASCII,C_EBCDIC,   e2a_POSIX },
{ "block",  C_BLOCK,C_UNBLOCK,  NULL },
{ "ebcdic", C_EBCDIC,   C_ASCII,a2e_POSIX },
+   { "fsync",  C_FSYNC,0,  NULL },
{ "ibm",C_EBCDIC,   C_ASCII,a2ibm_POSIX },
{ "lcase",  C_LCASE,C_UCASE,NULL },
{ "noerror",C_NOERROR,  0,  NULL },

Modified: head/bin/dd/dd.1
==
--- head/bin/dd/dd.1Tue Sep  3 18:32:29 2019(r351769)
+++ head/bin/dd/dd.1Tue Sep  3 18:35:55 2019(r351770)
@@ -252,6 +252,10 @@ are maps used in historic
 and
 .No pre- Ns Bx 4.3 reno
 systems.
+.It Cm fsync
+Perform an
+.Xr fsync 2
+on the output file before closing it.
 .It Cm lcase
 Transform uppercase characters into lowercase characters.
 .It Cm pareven , parnone , parodd , parset

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cTue Sep  3 18:32:29 2019(r351769)
+++ head/bin/dd/dd.cTue Sep  3 18:35:55 2019(r351770)
@@ -164,6 +164,8 @@ setup(void)
errx(1, "files is not supported for non-tape devices");
 
cap_rights_set(, CAP_FTRUNCATE, CAP_IOCTL, CAP_WRITE);
+   if (ddflags & C_FSYNC)
+   cap_rights_set(, CAP_FSYNC);
if (out.name == NULL) {
/* No way to check for read access here. */
out.fd = STDOUT_FILENO;
@@ -504,6 +506,11 @@ dd_close(void)
if (out.seek_offset > 0 && (out.flags & ISTRUNC)) {
if (ftruncate(out.fd, out.seek_offset) == -1)
err(1, "truncating %s", out.name);
+   }
+
+   if (ddflags & C_FSYNC) {
+   if (fsync(out.fd) == -1)
+   err(1, "fsyncing %s", out.name);
}
 }
 

Modified: head/bin/dd/dd.h
==
--- head/bin/dd/dd.hTue Sep  3 18:32:29 2019(r351769)
+++ head/bin/dd/dd.hTue Sep  3 18:35:55 2019(r351770)
@@ -101,6 +101,7 @@ typedef struct {
 #defineC_NOXFER0x1000
 #defineC_NOINFO0x2000
 #defineC_PROGRESS  0x4000
+#defineC_FSYNC 0x8000
 
 #defineC_PARITY(C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
 
___
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: r351769 - head/usr.bin/grep/tests

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Sep  3 18:32:29 2019
New Revision: 351769
URL: https://svnweb.freebsd.org/changeset/base/351769

Log:
  bsdgrep(1): add some basic tests for some GNU Extension support
  
  These will be expanded later as I come up with good test cases; for now,
  these seem to be enough to trigger bugs in base gnugrep and expose missing
  features in bsdgrep.

Modified:
  head/usr.bin/grep/tests/grep_freebsd_test.sh

Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh
==
--- head/usr.bin/grep/tests/grep_freebsd_test.shTue Sep  3 18:04:45 
2019(r351768)
+++ head/usr.bin/grep/tests/grep_freebsd_test.shTue Sep  3 18:32:29 
2019(r351769)
@@ -82,8 +82,34 @@ rgrep_body()
atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e 
"test" "$(atf_get_srcdir)"
 }
 
+atf_test_case gnuext
+gnuext_body()
+{
+   grep_type
+   _type=$?
+   if [ $_type -eq $GREP_TYPE_BSD ]; then
+   atf_expect_fail "this test requires GNU extensions in regex(3)"
+   elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then
+   atf_expect_fail "\\s and \\S are known to be buggy in base 
gnugrep"
+   fi
+
+   atf_check -o save:grep_alnum.out grep -o '[[:alnum:]]' /COPYRIGHT
+   atf_check -o file:grep_alnum.out grep -o '\w' /COPYRIGHT
+
+   atf_check -o save:grep_nalnum.out grep -o '[^[:alnum:]]' /COPYRIGHT
+   atf_check -o file:grep_nalnum.out grep -o '\W' /COPYRIGHT
+
+   atf_check -o save:grep_space.out grep -o '[[:space:]]' /COPYRIGHT
+   atf_check -o file:grep_space.out grep -o '\s' /COPYRIGHT
+
+   atf_check -o save:grep_nspace.out grep -o '[^[:space:]]' /COPYRIGHT
+   atf_check -o file:grep_nspace.out grep -o '\S' /COPYRIGHT
+
+}
+
 atf_init_test_cases()
 {
atf_add_test_case grep_r_implied
atf_add_test_case rgrep
+   atf_add_test_case gnuext
 }
___
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: r351758 - head/sys/compat/linprocfs

2019-09-03 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep  3 16:33:02 2019
New Revision: 351758
URL: https://svnweb.freebsd.org/changeset/base/351758

Log:
  Make linprocfs(4) report Tgid, Linux ltrace(1) needs it.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Tue Sep  3 16:27:23 2019
(r351757)
+++ head/sys/compat/linprocfs/linprocfs.c   Tue Sep  3 16:33:02 2019
(r351758)
@@ -935,6 +935,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
/*
 * Credentials
 */
+   sbuf_printf(sb, "Tgid:\t%d\n",  p->p_pid);
sbuf_printf(sb, "Pid:\t%d\n",   p->p_pid);
sbuf_printf(sb, "PPid:\t%d\n",  kp.ki_ppid );
sbuf_printf(sb, "TracerPid:\t%d\n", kp.ki_tracer );
___
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: r351673 - in head: lib/libmemstat share/man/man9 sys/cddl/compat/opensolaris/kern sys/kern sys/vm

2019-09-03 Thread Slawa Olhovchenkov
On Tue, Sep 03, 2019 at 10:02:59AM +0300, Andriy Gapon wrote:

> On 02/09/2019 01:22, Mark Johnston wrote:
> > Author: markj
> > Date: Sun Sep  1 22:22:43 2019
> > New Revision: 351673
> > URL: https://svnweb.freebsd.org/changeset/base/351673
> > 
> > Log:
> >   Extend uma_reclaim() to permit different reclamation targets.
> >   
> >   The page daemon periodically invokes uma_reclaim() to reclaim cached
> >   items from each zone when the system is under memory pressure.  This
> >   is important since the size of these caches is unbounded by default.
> >   However it also results in bursts of high latency when allocating from
> >   heavily used zones as threads miss in the per-CPU caches and must
> >   access the keg in order to allocate new items.
> >   
> >   With r340405 we maintain an estimate of each zone's usage of its
> >   (per-NUMA domain) cache of full buckets.  Start making use of this
> >   estimate to avoid reclaiming the entire cache when under memory
> >   pressure.  In particular, introduce TRIM, DRAIN and DRAIN_CPU
> >   verbs for uma_reclaim() and uma_zone_reclaim().  When trimming, only
> >   items in excess of the estimate are reclaimed.  Draining a zone
> >   reclaims all of the cached full buckets (the previous behaviour of
> >   uma_reclaim()), and may further drain the per-CPU caches in extreme
> >   cases.
> >   
> >   Now, when under memory pressure, the page daemon will trim zones
> >   rather than draining them.  As a result, heavily used zones do not incur
> >   bursts of bucket cache misses following reclamation, but large, unused
> >   caches will be reclaimed as before.
> 
> Mark,
> 
> have you considered running UMA_RECLAIM_TRIM periodically, even without a 
> memory
> pressure?
> I think that with such a periodic trimming there will be less need to invoke
> vm_lowmem().
> 
> Also, I think that we would be able to retire (or re-purpose) lowmem_period.
> E.g., the trimming would be done every lowmem_period, but vm_lowmem() would 
> not
> be throttled.
> 
> One example of the throttling of vm_lowmem being bad is its interaction with 
> the
> ZFS ARC.  When there is a spike in memory usage we want the ARC to adapt as
> quickly as possible.  But at present the lowmem_period logic interferes with 
> that.

Some time ago, I sent Mark a patch that implements this logic,
specialy for ARC and mbuf cooperate. Mostly problem I am see at this
work -- very slowly vm_page_free(). May be currenly this is more
speedy...
___
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: r351748 - in head/sys: cddl/contrib/opensolaris/uts/common/fs cddl/contrib/opensolaris/uts/common/fs/zfs kern sys

2019-09-03 Thread Mateusz Guzik
Author: mjg
Date: Tue Sep  3 15:42:11 2019
New Revision: 351748
URL: https://svnweb.freebsd.org/changeset/base/351748

Log:
  vfs: implement usecount implying holdcnt
  
  vnodes have 2 reference counts - holdcnt to keep the vnode itself from getting
  freed and usecount to denote it is actively used.
  
  Previously all operations bumping usecount would also bump holdcnt, which is
  not necessary. We can detect if usecount is already > 1 (in which case holdcnt
  is also > 1) and utilize it to avoid bumping holdcnt on our own. This saves
  on atomic ops.
  
  Reviewed by:  kib
  Tested by:pho (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21471

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/kern/vfs_cache.c
  head/sys/kern/vfs_hash.c
  head/sys/kern/vfs_subr.c
  head/sys/sys/lockmgr.h
  head/sys/sys/vnode.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Tue Sep  3 
15:26:11 2019(r351747)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c Tue Sep  3 
15:42:11 2019(r351748)
@@ -87,7 +87,6 @@ vn_rele_async(vnode_t *vp, taskq_t *taskq)
 {
VERIFY(vp->v_count > 0);
if (refcount_release_if_not_last(>v_usecount)) {
-   vdrop(vp);
return;
}
VERIFY(taskq_dispatch((taskq_t *)taskq,

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cTue Sep 
 3 15:26:11 2019(r351747)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cTue Sep 
 3 15:42:11 2019(r351748)
@@ -1196,6 +1196,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
vnode_t *vp;
sfs_node_t *node;
size_t len;
+   enum vgetstate vs;
int locked;
int error;
 
@@ -1224,7 +1225,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
 * before we can lock the vnode again.
 */
locked = VOP_ISLOCKED(vp);
-   vhold(vp);
+   vs = vget_prep(vp);
vput(vp);
 
/* Look up .zfs/snapshot, our parent. */
@@ -1236,7 +1237,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
bcopy(node->sn_name, ap->a_buf + *ap->a_buflen, len);
}
vfs_unbusy(mp);
-   vget(vp, locked | LK_VNHELD | LK_RETRY, curthread);
+   vget_finish(vp, locked | LK_RETRY, vs);
return (error);
 }
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 
 3 15:26:11 2019(r351747)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 
 3 15:42:11 2019(r351748)
@@ -5916,6 +5916,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap)
vnode_t *vp = ap->a_vp;;
zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
znode_t *zp = VTOZ(vp);
+   enum vgetstate vs;
int ltype;
int error;
 
@@ -5948,10 +5949,10 @@ zfs_vptocnp(struct vop_vptocnp_args *ap)
ZFS_EXIT(zfsvfs);
 
covered_vp = vp->v_mount->mnt_vnodecovered;
-   vhold(covered_vp);
+   vs = vget_prep(covered_vp);
ltype = VOP_ISLOCKED(vp);
VOP_UNLOCK(vp, 0);
-   error = vget(covered_vp, LK_SHARED | LK_VNHELD, curthread);
+   error = vget_finish(covered_vp, LK_SHARED, vs);
if (error == 0) {
error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred,
ap->a_buf, ap->a_buflen);

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Tue Sep  3 15:26:11 2019(r351747)
+++ head/sys/kern/vfs_cache.c   Tue Sep  3 15:42:11 2019(r351748)
@@ -1255,6 +1255,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st
struct rwlock *blp;
struct mtx *dvlp;
uint32_t hash;
+   enum vgetstate vs;
int error, ltype;
 
if (__predict_false(!doingcache)) {
@@ -1369,9 +1370,9 @@ success:
ltype = VOP_ISLOCKED(dvp);
VOP_UNLOCK(dvp, 0);
}
-   vhold(*vpp);
+   vs = vget_prep(*vpp);
cache_lookup_unlock(blp, dvlp);
-   error = vget(*vpp, cnp->cn_lkflags | LK_VNHELD, cnp->cn_thread);
+   error = vget_finish(*vpp, cnp->cn_lkflags, vs);
if (cnp->cn_flags & ISDOTDOT) {
vn_lock(dvp, ltype | LK_RETRY);
  

svn commit: r351747 - head/sys/dev/nvme

2019-09-03 Thread Warner Losh
Author: imp
Date: Tue Sep  3 15:26:11 2019
New Revision: 351747
URL: https://svnweb.freebsd.org/changeset/base/351747

Log:
  Implement nvme suspend / resume for pci attachment
  
  When we suspend, we need to properly shutdown the NVME controller. The
  controller may go into D3 state (or may have the power removed), and
  to properly flush the metadata to non-volatile RAM, we must complete a
  normal shutdown. This consists of deleting the I/O queues and setting
  the shutodown bit. We have to do some extra stuff to make sure we
  reset the software state of the queues as well.
  
  On resume, we have to reset the card twice, for reasons described in
  the attach funcion. Once we've done that, we can restart the card. If
  any of this fails, we'll fail the NVMe card, just like we do when a
  reset fails.
  
  Set is_resetting for the duration of the suspend / resume. This keeps
  the reset taskqueue from running a concurrent reset, and also is
  needed to prevent any hw completions from queueing more I/O to the
  card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to get
  that from the global state of the ctrlr. Wait for any pending reset to
  finish. All queued I/O will get sent to the hardware as part of
  nvme_ctrlr_start(), though the upper layers shouldn't send any
  down. Disabling the qpairs is the other failsafe to ensure all I/O is
  queued.
  
  Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to avoid
  confusion with all the other destroy functions.  It just removes the
  queues in hardware, while the other _destroy_ functions tear down
  driver data structures.
  
  Split parts of the hardware reset function up so that I can
  do part of the reset in suspsend. Split out the software disabling
  of the qpairs into nvme_ctrlr_disable_qpairs.
  
  Finally, fix a couple of spelling errors in comments related to
  this.
  
  Relnotes: Yes
  MFC After: 1 week
  Reviewed by: scottl@ (prior version)
  Differential Revision: https://reviews.freebsd.org/D21493

Modified:
  head/sys/dev/nvme/nvme.c
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_pci.c
  head/sys/dev/nvme/nvme_private.h

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cTue Sep  3 14:55:19 2019(r351746)
+++ head/sys/dev/nvme/nvme.cTue Sep  3 15:26:11 2019(r351747)
@@ -137,9 +137,10 @@ nvme_attach(device_t dev)
}
 
/*
-* Reset controller twice to ensure we do a transition from cc.en==1
-*  to cc.en==0.  This is because we don't really know what status
-*  the controller was left in when boot handed off to OS.
+* Reset controller twice to ensure we do a transition from cc.en==1 to
+* cc.en==0.  This is because we don't really know what status the
+* controller was left in when boot handed off to OS.  Linux doesn't do
+* this, however. If we adopt that policy, see also nvme_ctrlr_resume().
 */
status = nvme_ctrlr_hw_reset(ctrlr);
if (status != 0) {

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Tue Sep  3 14:55:19 2019
(r351746)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Tue Sep  3 15:26:11 2019
(r351747)
@@ -118,8 +118,8 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller 
 
/*
 * Our best estimate for the maximum number of I/Os that we should
-* noramlly have in flight at one time. This should be viewed as a hint,
-* not a hard limit and will need to be revisitted when the upper layers
+* normally have in flight at one time. This should be viewed as a hint,
+* not a hard limit and will need to be revisited when the upper layers
 * of the storage system grows multi-queue support.
 */
ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues * 3 / 4;
@@ -344,10 +344,10 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr)
return (nvme_ctrlr_wait_for_ready(ctrlr, 1));
 }
 
-int
-nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
+static void
+nvme_ctrlr_disable_qpairs(struct nvme_controller *ctrlr)
 {
-   int i, err;
+   int i;
 
nvme_admin_qpair_disable(>adminq);
/*
@@ -359,7 +359,15 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
for (i = 0; i < ctrlr->num_io_queues; i++)
nvme_io_qpair_disable(>ioq[i]);
}
+}
 
+int
+nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
+{
+   int err;
+
+   nvme_ctrlr_disable_qpairs(ctrlr);
+
DELAY(100*1000);
 
err = nvme_ctrlr_disable(ctrlr);
@@ -481,7 +489,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr
 }
 
 static int
-nvme_ctrlr_destroy_qpairs(struct nvme_controller *ctrlr)
+nvme_ctrlr_delete_qpairs(struct nvme_controller *ctrlr)
 {

Re: svn commit: r351729 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2019-09-03 Thread Justin Hibbits
On Tue, 3 Sep 2019 10:20:35 -0400
Shawn Webb  wrote:

> On Tue, Sep 03, 2019 at 07:47:40AM -0400, Shawn Webb wrote:
> > On Tue, Sep 03, 2019 at 11:45:23AM +, Brooks Davis wrote:  
> > > On Tue, Sep 03, 2019 at 07:35:05AM -0400, Shawn Webb wrote:  
> > > > Hey Mateusz,
> > > > 
> > > > On Tue, Sep 03, 2019 at 04:16:31AM +, Mateusz Guzik wrote:  
> > > > > Author: mjg
> > > > > Date: Tue Sep  3 04:16:30 2019
> > > > > New Revision: 351729
> > > > > URL: https://svnweb.freebsd.org/changeset/base/351729
> > > > > 
> > > > > Log:
> > > > >   Add sysctlbyname system call
> > > > >   
> > > > >   Previously userspace would issue one syscall to resolve the
> > > > > sysctl and then another one to actually use it. Do it all in
> > > > > one trip. 
> > > > >   Fallback is provided in case newer libc happens to be
> > > > > running on an older kernel.
> > > > >   
> > > > >   Submitted by:   Pawel Biernacki
> > > > >   Reported by:kib, brooks
> > > > >   Differential Revision:
> > > > > https://reviews.freebsd.org/D17282
> > > > > 
> > > > > Modified:  
> > > > ... snip ...  
> > > > >   head/sys/sys/param.h  
> > > > 
> > > > ... snip ...
> > > >   
> > > > > 
> > > > > Modified: head/sys/sys/param.h
> > > > > ==
> > > > > --- head/sys/sys/param.h  Mon Sep  2 21:57:57
> > > > > 2019  (r351728) +++ head/sys/sys/param.h  Tue Sep
> > > > >  3 04:16:30 2019  (r351729) @@ -60,7 +60,7 @@
> > > > >   *   in the range 5 to 9.
> > > > >   */
> > > > >  #undef __FreeBSD_version
> > > > > -#define __FreeBSD_version 1300044/* Master,
> > > > > propagated to newvers */ +#define __FreeBSD_version
> > > > > 1300045   /* Master, propagated to newvers */  
> > > > 
> > > > To an outsider, it seems that __FreeBSD_version tends to be
> > > > bumped in a separate commit. Am I remembering that right?  
> > > 
> > > It should be bumped in the same commit, but people forget or the
> > > bump they have in their review turns into a no-op because someone
> > > else does a bump in the interim (the latter has bit me several
> > > times).  
> > 
> > Interesting. Thanks for the clarification!  
> 
> One thought for making the version bump a seperate commit is if the
> original commit needed to be reverted, the commit can be reverted
> wholesale (well, from the perspective of __FreeBSD_version) without
> worry of accidentally decrementing the version number to a prior
> value.
> 
> That's my "need-more-caffeine" verbose way of saying "separating the
> version bump from the actual work allows for easier maintenance of the
> version number, helping ensure an always-increasing number."
> 
> Sorry if I sound dry here. My ten-month-old puppy is tiring me out way
> faster than I can tire him out.
> 
> Thanks,
> 

I always thought convention was separate commits to ease MFCs.  The few
times I've bumped __FreeBSD_version I've done it explicitly as a
followup commit for that reason.  Guess I now know better :)

- Justin
___
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: r351743 - head/sys/vm

2019-09-03 Thread Mark Johnston
Author: markj
Date: Tue Sep  3 14:29:58 2019
New Revision: 351743
URL: https://svnweb.freebsd.org/changeset/base/351743

Log:
  Add preliminary support for atomic updates of per-page queue state.
  
  Queue operations on a page use the page lock when updating the page to
  reflect the desired queue state, and the page queue lock when physically
  enqueuing or dequeuing a page.  Multiple pages share a given page lock,
  but queue state is per-page; this false sharing results in heavy lock
  contention.
  
  Take a small step towards the use of atomic_cmpset to synchronize
  updates to per-page queue state by introducing vm_page_pqstate_cmpset()
  and using it in the page daemon.  In the longer term the plan is to stop
  using the page lock to protect page identity and rely only on the object
  and page busy locks.  However, since the page daemon avoids acquiring
  the object lock except when necessary, some synchronization with a
  concurrent free of the page is required.  vm_page_pqstate_cmpset() can
  be used to ensure that queue state updates are successful only if the
  page is not scheduled for a dequeue, which is sufficient for the page
  daemon.
  
  Add vm_page_swapqueue(), which moves a page from one queue to another
  using vm_page_pqstate_cmpset().  Use it in the active queue scan, which
  does not use the object lock.  Modify vm_page_dequeue_deferred() to
  use vm_page_pqstate_cmpset() as well.
  
  Reviewed by:  kib
  Discussed with:   jeff
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21257

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

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Tue Sep  3 13:18:51 2019(r351742)
+++ head/sys/vm/vm_page.c   Tue Sep  3 14:29:58 2019(r351743)
@@ -3130,6 +3130,13 @@ vm_pqbatch_process(struct vm_pagequeue *pq, struct vm_
vm_batchqueue_init(bq);
 }
 
+/*
+ * vm_page_pqbatch_submit: [ internal use only ]
+ *
+ * Enqueue a page in the specified page queue's batched work queue.
+ * The caller must have encoded the requested operation in the page
+ * structure's aflags field.
+ */
 void
 vm_page_pqbatch_submit(vm_page_t m, uint8_t queue)
 {
@@ -3251,17 +3258,26 @@ vm_page_dequeue_deferred(vm_page_t m)
 
if ((queue = vm_page_queue(m)) == PQ_NONE)
return;
-   vm_page_aflag_set(m, PGA_DEQUEUE);
-   vm_page_pqbatch_submit(m, queue);
+
+   /*
+* Set PGA_DEQUEUE if it is not already set to handle a concurrent call
+* to vm_page_dequeue_deferred_free().  In particular, avoid modifying
+* the page's queue state once vm_page_dequeue_deferred_free() has been
+* called.  In the event of a race, two batch queue entries for the page
+* will be created, but the second will have no effect.
+*/
+   if (vm_page_pqstate_cmpset(m, queue, queue, PGA_DEQUEUE, PGA_DEQUEUE))
+   vm_page_pqbatch_submit(m, queue);
 }
 
 /*
  * A variant of vm_page_dequeue_deferred() that does not assert the page
- * lock and is only to be called from vm_page_free_prep().  It is just an
- * open-coded implementation of vm_page_dequeue_deferred().  Because the
- * page is being freed, we can assume that nothing else is scheduling queue
- * operations on this page, so we get for free the mutual exclusion that
- * is otherwise provided by the page lock.
+ * lock and is only to be called from vm_page_free_prep().  Because the
+ * page is being freed, we can assume that nothing other than the page
+ * daemon is scheduling queue operations on this page, so we get for
+ * free the mutual exclusion that is otherwise provided by the page lock.
+ * To handle races, the page daemon must take care to atomically check
+ * for PGA_DEQUEUE when updating queue state.
  */
 static void
 vm_page_dequeue_deferred_free(vm_page_t m)
@@ -3372,6 +3388,42 @@ vm_page_requeue(vm_page_t m)
if ((m->aflags & PGA_REQUEUE) == 0)
vm_page_aflag_set(m, PGA_REQUEUE);
vm_page_pqbatch_submit(m, atomic_load_8(>queue));
+}
+
+/*
+ * vm_page_swapqueue:  [ internal use only ]
+ *
+ * Move the page from one queue to another, or to the tail of its
+ * current queue, in the face of a possible concurrent call to
+ * vm_page_dequeue_deferred_free().
+ */
+void
+vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq)
+{
+   struct vm_pagequeue *pq;
+
+   KASSERT(oldq < PQ_COUNT && newq < PQ_COUNT && oldq != newq,
+   ("vm_page_swapqueue: invalid queues (%d, %d)", oldq, newq));
+   KASSERT((m->oflags & VPO_UNMANAGED) == 0,
+   ("vm_page_swapqueue: page %p is unmanaged", m));
+   vm_page_assert_locked(m);
+
+   /*
+* Atomically update the queue field and set PGA_REQUEUE while
+* ensuring that PGA_DEQUEUE has not been 

Re: svn commit: r351729 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2019-09-03 Thread Shawn Webb
On Tue, Sep 03, 2019 at 09:32:27AM -0500, Justin Hibbits wrote:
> On Tue, 3 Sep 2019 10:20:35 -0400
> Shawn Webb  wrote:
> 
> > On Tue, Sep 03, 2019 at 07:47:40AM -0400, Shawn Webb wrote:
> > > On Tue, Sep 03, 2019 at 11:45:23AM +, Brooks Davis wrote:  
> > > > On Tue, Sep 03, 2019 at 07:35:05AM -0400, Shawn Webb wrote:  
> > > > > Hey Mateusz,
> > > > > 
> > > > > On Tue, Sep 03, 2019 at 04:16:31AM +, Mateusz Guzik wrote:  
> > > > > > Author: mjg
> > > > > > Date: Tue Sep  3 04:16:30 2019
> > > > > > New Revision: 351729
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/351729
> > > > > > 
> > > > > > Log:
> > > > > >   Add sysctlbyname system call
> > > > > >   
> > > > > >   Previously userspace would issue one syscall to resolve the
> > > > > > sysctl and then another one to actually use it. Do it all in
> > > > > > one trip. 
> > > > > >   Fallback is provided in case newer libc happens to be
> > > > > > running on an older kernel.
> > > > > >   
> > > > > >   Submitted by: Pawel Biernacki
> > > > > >   Reported by:  kib, brooks
> > > > > >   Differential Revision:
> > > > > > https://reviews.freebsd.org/D17282
> > > > > > 
> > > > > > Modified:  
> > > > > ... snip ...  
> > > > > >   head/sys/sys/param.h  
> > > > > 
> > > > > ... snip ...
> > > > >   
> > > > > > 
> > > > > > Modified: head/sys/sys/param.h
> > > > > > ==
> > > > > > --- head/sys/sys/param.hMon Sep  2 21:57:57
> > > > > > 2019(r351728) +++ head/sys/sys/param.h  Tue Sep
> > > > > >  3 04:16:30 2019(r351729) @@ -60,7 +60,7 @@
> > > > > >   * in the range 5 to 9.
> > > > > >   */
> > > > > >  #undef __FreeBSD_version
> > > > > > -#define __FreeBSD_version 1300044  /* Master,
> > > > > > propagated to newvers */ +#define __FreeBSD_version
> > > > > > 1300045 /* Master, propagated to newvers */  
> > > > > 
> > > > > To an outsider, it seems that __FreeBSD_version tends to be
> > > > > bumped in a separate commit. Am I remembering that right?  
> > > > 
> > > > It should be bumped in the same commit, but people forget or the
> > > > bump they have in their review turns into a no-op because someone
> > > > else does a bump in the interim (the latter has bit me several
> > > > times).  
> > > 
> > > Interesting. Thanks for the clarification!  
> > 
> > One thought for making the version bump a seperate commit is if the
> > original commit needed to be reverted, the commit can be reverted
> > wholesale (well, from the perspective of __FreeBSD_version) without
> > worry of accidentally decrementing the version number to a prior
> > value.
> > 
> > That's my "need-more-caffeine" verbose way of saying "separating the
> > version bump from the actual work allows for easier maintenance of the
> > version number, helping ensure an always-increasing number."
> > 
> > Sorry if I sound dry here. My ten-month-old puppy is tiring me out way
> > faster than I can tire him out.
> > 
> > Thanks,
> > 
> 
> I always thought convention was separate commits to ease MFCs.  The few
> times I've bumped __FreeBSD_version I've done it explicitly as a
> followup commit for that reason.  Guess I now know better :)

I should also note that I'm looking at this from an outsider's
perspective, which may not reflect the same perspective as an
insider's. :)

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2


signature.asc
Description: PGP signature


svn commit: r346634 - head/sys/dev/cadence

2019-09-03 Thread Ruslan Bukin
Author: br
Date: Wed Apr 24 13:44:30 2019
New Revision: 346634
URL: https://svnweb.freebsd.org/changeset/base/346634

Log:
  Add support for Cadence network controller found in HiFive Unleashed board.
  
  Reviewed by:  markj
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D19798

Modified:
  head/sys/dev/cadence/if_cgem.c

Modified: head/sys/dev/cadence/if_cgem.c
==
--- head/sys/dev/cadence/if_cgem.c  Wed Apr 24 13:41:46 2019
(r346633)
+++ head/sys/dev/cadence/if_cgem.c  Wed Apr 24 13:44:30 2019
(r346634)
@@ -98,6 +98,12 @@ __FBSDID("$FreeBSD$");
 #define CGEM_CKSUM_ASSIST  (CSUM_IP | CSUM_TCP | CSUM_UDP | \
 CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
 
+static struct ofw_compat_data compat_data[] = {
+   { "cadence,gem",1 },
+   { "cdns,macb",  1 },
+   { NULL, 0 },
+};
+
 struct cgem_softc {
if_tifp;
struct mtx  sc_mtx;
@@ -1635,7 +1641,7 @@ cgem_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "cadence,gem"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Cadence CGEM Gigabit Ethernet Interface");


___
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: r351744 - head/share/man/man9

2019-09-03 Thread Mark Johnston
Author: markj
Date: Tue Sep  3 14:39:36 2019
New Revision: 351744
URL: https://svnweb.freebsd.org/changeset/base/351744

Log:
  Revert a portion of r351628 that I did not mean to commit.
  
  Reported by:  mjg
  MFC with: r351628

Modified:
  head/share/man/man9/Makefile

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Sep  3 14:29:58 2019
(r351743)
+++ head/share/man/man9/MakefileTue Sep  3 14:39:36 2019
(r351744)
@@ -2223,9 +2223,7 @@ MLINKS+=vm_map_lookup.9 vm_map_lookup_done.9
 MLINKS+=vm_map_max.9 vm_map_min.9 \
vm_map_max.9 vm_map_pmap.9
 MLINKS+=vm_map_stack.9 vm_map_growstack.9
-MLINKS+=vm_map_wire.9 vm_map_wire_mapped.9 \
-   vm_page_wire.9 vm_page_unwire.9 \
-   vm_page_wire.9 vm_page_unwire_noq.9
+MLINKS+=vm_map_wire.9 vm_map_unwire.9
 MLINKS+=vm_page_bits.9 vm_page_clear_dirty.9 \
vm_page_bits.9 vm_page_dirty.9 \
vm_page_bits.9 vm_page_is_valid.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: r346599 - head/sys/netinet/netdump

2019-09-03 Thread Conrad Meyer
Author: cem
Date: Tue Apr 23 17:05:57 2019
New Revision: 346599
URL: https://svnweb.freebsd.org/changeset/base/346599

Log:
  netdump: Fix !COMPAT_FREEBSD11 unused variable warning
  
  Reported by:  Ralf Wenk 
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/netinet/netdump/netdump_client.c

Modified: head/sys/netinet/netdump/netdump_client.c
==
--- head/sys/netinet/netdump/netdump_client.c   Tue Apr 23 15:11:01 2019
(r346598)
+++ head/sys/netinet/netdump/netdump_client.c   Tue Apr 23 17:05:57 2019
(r346599)
@@ -1140,7 +1140,9 @@ netdump_ioctl(struct cdev *dev __unused, u_long cmd, c
struct netdump_conf *conf;
uint8_t *encryptedkey;
int error;
+#ifdef COMPAT_FREEBSD11
u_int u;
+#endif
 
error = 0;
switch (cmd) {


___
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: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation

2019-09-03 Thread Rodney W. Grimes
> On Mon, Sep 2, 2019 at 11:49 PM Rodney W. Grimes
>  wrote:
> >
> > >
> > > > On Aug 31, 2019, at 16:29, Warner Losh  wrote:
> > > >
> > > >
> > > >
> > > >> On Sat, Aug 31, 2019 at 5:29 PM Conrad Meyer  wrote:
> > > >> Thanks Li-Wen!  Might it be less fragile to have the test fixture
> > > >> create a file, if the test(s) will expect one to be present to read?
> > > >
> > > > Or just use the realpath $0, which you know has to exist :)
> > >
> > > I don?t know if this would work, with other some of the dtrace tests are 
> > > called. Plus, that relies on a FreeBSD utility which doesn?t necessarily 
> > > exist on Linux and I don?t think exists on IllumOS.
> > >
> > > It makes more sense to create a file with mktemp and test for it in the 
> > > loop to make the tests portable over to IllumOS, since that?s where they 
> > > originally came from and can be contributed back to.
> >
> > Agreed, especially if these tests are expected to be portable the
> > assumption of existance of /COPYRIGHT is a mistake/bug.
> 
> Thanks for the inputs.  Indeed, depending on any irrelevant files or
> FreeBSD specified tools both do not sound a good solution.  After
> reading these test cases again, I feel that creating a temp file might
> be slightly over engineering because in the end we also need to take
> care of cleaning, in normal and abnormal exiting cases.  In these
> tests, we only need someone calls open(2) and read(2).
> 
> How about changing them to `cat / > /dev/null` ?

Does it have to be cat?
dd if=/dev/zero count=1 >/dev/null
seems far more portable to me.

Permissions may not allow cat /, it is valid to run chmod 511 /

> Best,
> Li-Wen
> 

-- 
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: r346601 - head/sys/netinet6

2019-09-03 Thread Conrad Meyer
Author: cem
Date: Tue Apr 23 17:18:20 2019
New Revision: 346601
URL: https://svnweb.freebsd.org/changeset/base/346601

Log:
  ip6_randomflowlabel: Avoid blocking if random(4) is not available
  
  If kern.random.initial_seeding.bypass_before_seeding is disabled, random(4)
  and arc4random(9) will block indefinitely until enough entropy is available
  to initially seed Fortuna.
  
  It seems that zero flowids are perfectly valid, so avoid blocking on random
  until initial seeding takes place.
  
  Discussed with:   bz (earlier revision)
  Reviewed by:  thj
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20011

Modified:
  head/sys/netinet6/ip6_id.c

Modified: head/sys/netinet6/ip6_id.c
==
--- head/sys/netinet6/ip6_id.c  Tue Apr 23 17:11:45 2019(r346600)
+++ head/sys/netinet6/ip6_id.c  Tue Apr 23 17:18:20 2019(r346601)
@@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -257,6 +258,16 @@ ip6_randomid(void)
 u_int32_t
 ip6_randomflowlabel(void)
 {
+
+   /*
+* It's ok to emit zero flow labels early, before random is available
+* (seeded).  RFC 6437:
+*
+* "A Flow Label of zero is used to indicate packets that have not been
+* labeled."
+*/
+   if (__predict_false(!is_random_seeded()))
+   return (0);
 
return randomid(_20) & 0xf;
 }


___
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: r346616 - head/tests/sys/opencrypto

2019-09-03 Thread John Baldwin
Author: jhb
Date: Wed Apr 24 00:16:39 2019
New Revision: 346616
URL: https://svnweb.freebsd.org/changeset/base/346616

Log:
  Run the plain SHA digest tests from NIST.
  
  Pass in an explicit digest length to the Crypto constructor since it
  was assuming only sessions with a MAC key would have a MAC.  Passing
  an explicit size allows us to test the full digest in HMAC tests as
  well.
  
  Reviewed by:  cem
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D19884

Modified:
  head/tests/sys/opencrypto/cryptodev.py
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptodev.py
==
--- head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 00:14:37 2019
(r346615)
+++ head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 00:16:39 2019
(r346616)
@@ -151,8 +151,9 @@ class Crypto:
return _findop(crid, '')[1]
 
def __init__(self, cipher=0, key=None, mac=0, mackey=None,
-   crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE):
+   crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE, maclen=None):
self._ses = None
+   self._maclen = maclen
ses = SessionOp2()
ses.cipher = cipher
ses.mac = mac
@@ -168,9 +169,6 @@ class Crypto:
ses.mackeylen = len(mackey)
mk = array.array('B', mackey)
ses.mackey = mk.buffer_info()[0]
-   self._maclen = 16   # parameterize?
-   else:
-   self._maclen = None
 
if not cipher and not mac:
raise ValueError('one of cipher or mac MUST be 
specified.')

Modified: head/tests/sys/opencrypto/cryptotest.py
==
--- head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 00:14:37 2019
(r346615)
+++ head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 00:16:39 2019
(r346616)
@@ -114,7 +114,8 @@ def GenTestCase(cname):
c = 
Crypto(cryptodev.CRYPTO_AES_NIST_GCM_16,
cipherkey,

mac=self._gmacsizes[len(cipherkey)],
-   mackey=cipherkey, crid=crid)
+   mackey=cipherkey, crid=crid,
+   maclen=16)
except EnvironmentError, e:
# Can't test algorithms the 
driver does not support.
if e.errno != errno.EOPNOTSUPP:
@@ -260,11 +261,55 @@ def GenTestCase(cname):
###
@unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' 
% str(cname))
def test_sha(self):
-   # SHA not available in software
-   pass
-   #for i in iglob('SHA1*'):
-   #   self.runSHA(i)
+   for i in katg('shabytetestvectors', 'SHA*Msg.rsp'):
+   self.runSHA(i)
 
+   def runSHA(self, fname):
+   # Skip SHA512_(224|256) tests
+   if fname.find('SHA512_') != -1:
+   return
+
+   for hashlength, lines in cryptodev.KATParser(fname,
+   [ 'Len', 'Msg', 'MD' ]):
+   # E.g., hashlength will be "L=20" (bytes)
+   hashlen = int(hashlength.split("=")[1])
+
+   if hashlen == 20:
+   alg = cryptodev.CRYPTO_SHA1
+   elif hashlen == 28:
+   alg = cryptodev.CRYPTO_SHA2_224
+   elif hashlen == 32:
+   alg = cryptodev.CRYPTO_SHA2_256
+   elif hashlen == 48:
+   alg = cryptodev.CRYPTO_SHA2_384
+   elif hashlen == 64:
+   alg = cryptodev.CRYPTO_SHA2_512
+   else:
+   # Skip unsupported hashes
+   # Slurp remaining input in section
+   for data in lines:
+   continue
+   continue
+
+   for data in lines:
+   msg = 

Re: svn commit: r351729 - in head: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys

2019-09-03 Thread Shawn Webb
On Tue, Sep 03, 2019 at 07:47:40AM -0400, Shawn Webb wrote:
> On Tue, Sep 03, 2019 at 11:45:23AM +, Brooks Davis wrote:
> > On Tue, Sep 03, 2019 at 07:35:05AM -0400, Shawn Webb wrote:
> > > Hey Mateusz,
> > > 
> > > On Tue, Sep 03, 2019 at 04:16:31AM +, Mateusz Guzik wrote:
> > > > Author: mjg
> > > > Date: Tue Sep  3 04:16:30 2019
> > > > New Revision: 351729
> > > > URL: https://svnweb.freebsd.org/changeset/base/351729
> > > > 
> > > > Log:
> > > >   Add sysctlbyname system call
> > > >   
> > > >   Previously userspace would issue one syscall to resolve the sysctl 
> > > > and then
> > > >   another one to actually use it. Do it all in one trip.
> > > >   
> > > >   Fallback is provided in case newer libc happens to be running on an 
> > > > older
> > > >   kernel.
> > > >   
> > > >   Submitted by: Pawel Biernacki
> > > >   Reported by:  kib, brooks
> > > >   Differential Revision:https://reviews.freebsd.org/D17282
> > > > 
> > > > Modified:
> > > ... snip ...
> > > >   head/sys/sys/param.h
> > > 
> > > ... snip ...
> > > 
> > > > 
> > > > Modified: head/sys/sys/param.h
> > > > ==
> > > > --- head/sys/sys/param.hMon Sep  2 21:57:57 2019
> > > > (r351728)
> > > > +++ head/sys/sys/param.hTue Sep  3 04:16:30 2019
> > > > (r351729)
> > > > @@ -60,7 +60,7 @@
> > > >   * in the range 5 to 9.
> > > >   */
> > > >  #undef __FreeBSD_version
> > > > -#define __FreeBSD_version 1300044  /* Master, propagated to 
> > > > newvers */
> > > > +#define __FreeBSD_version 1300045  /* Master, propagated to 
> > > > newvers */
> > > 
> > > To an outsider, it seems that __FreeBSD_version tends to be bumped in
> > > a separate commit. Am I remembering that right?
> > 
> > It should be bumped in the same commit, but people forget or the bump
> > they have in their review turns into a no-op because someone else does a
> > bump in the interim (the latter has bit me several times).
> 
> Interesting. Thanks for the clarification!

One thought for making the version bump a seperate commit is if the
original commit needed to be reverted, the commit can be reverted
wholesale (well, from the perspective of __FreeBSD_version) without
worry of accidentally decrementing the version number to a prior
value.

That's my "need-more-caffeine" verbose way of saying "separating the
version bump from the actual work allows for easier maintenance of the
version number, helping ensure an always-increasing number."

Sorry if I sound dry here. My ten-month-old puppy is tiring me out way
faster than I can tire him out.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
Tor+XMPP+OTR:latt...@is.a.hacker.sx
GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2


signature.asc
Description: PGP signature


Re: svn commit: r346619 - head/sys/powerpc/aim

2019-09-03 Thread Enji Cooper

> On Apr 23, 2019, at 19:51, Justin Hibbits  wrote:
> 
> Author: jhibbits
> Date: Wed Apr 24 02:51:58 2019
> New Revision: 346619
> URL: https://svnweb.freebsd.org/changeset/base/346619
> 
> Log:
>  powerpc: Add a couple missing isyncs
> 
>  mtmsr and mtsr require context synchronizing instructions to follow.  Without
>  a CSI, there's a chance for a machine check exception.  This reportedly does
>  occur on a MPC750 (PowerMac G3).

G3?! Wow... the oldest I’ve used is the G4, back a decade and a half ago :0...
-Enji

___
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: r346628 - head/usr.sbin/pkg

2019-09-03 Thread Colin Percival
Author: cperciva
Date: Wed Apr 24 06:25:21 2019
New Revision: 346628
URL: https://svnweb.freebsd.org/changeset/base/346628

Log:
  Keep two versions of the FreeBSD.conf pkg configuration file; one which
  points at the "latest" branch and one which points at the "quarterly"
  branch.  Install the "latest" version unless overridden via the newly
  added PKGCONFBRANCH variable.
  
  This does not change user-visible behaviour (assuming said vairable is
  not set) but will make it easier to change the defaults in the future --
  on stable branches we will want "latest" on x86 but "quarterly" elsewhere.
  
  Discussed with:   gjb
  MFC after:3 days
  X-MFC:After MFCing this I'll make a direct commit to stable/* 
to
switch non-x86 architectures to "quarterly".

Added:
  head/usr.sbin/pkg/FreeBSD.conf.latest
 - copied unchanged from r346627, head/usr.sbin/pkg/FreeBSD.conf
  head/usr.sbin/pkg/FreeBSD.conf.quarterly
 - copied, changed from r346627, head/usr.sbin/pkg/FreeBSD.conf
Deleted:
  head/usr.sbin/pkg/FreeBSD.conf
Modified:
  head/usr.sbin/pkg/Makefile

Copied: head/usr.sbin/pkg/FreeBSD.conf.latest (from r346627, 
head/usr.sbin/pkg/FreeBSD.conf)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pkg/FreeBSD.conf.latest   Wed Apr 24 06:25:21 2019
(r346628, copy of r346627, head/usr.sbin/pkg/FreeBSD.conf)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+#
+# To disable this repository, instead of modifying or removing this file,
+# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
+#
+#   mkdir -p /usr/local/etc/pkg/repos
+#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
+#
+
+FreeBSD: {
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
+  mirror_type: "srv",
+  signature_type: "fingerprints",
+  fingerprints: "/usr/share/keys/pkg",
+  enabled: yes
+}

Copied and modified: head/usr.sbin/pkg/FreeBSD.conf.quarterly (from r346627, 
head/usr.sbin/pkg/FreeBSD.conf)
==
--- head/usr.sbin/pkg/FreeBSD.conf  Wed Apr 24 05:52:24 2019
(r346627, copy source)
+++ head/usr.sbin/pkg/FreeBSD.conf.quarterlyWed Apr 24 06:25:21 2019
(r346628)
@@ -8,7 +8,7 @@
 #
 
 FreeBSD: {
-  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest;,
+  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly;,
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",

Modified: head/usr.sbin/pkg/Makefile
==
--- head/usr.sbin/pkg/Makefile  Wed Apr 24 05:52:24 2019(r346627)
+++ head/usr.sbin/pkg/Makefile  Wed Apr 24 06:25:21 2019(r346628)
@@ -1,6 +1,8 @@
 # $FreeBSD$
 
-CONFS= FreeBSD.conf
+PKGCONFBRANCH?=latest
+CONFS= FreeBSD.conf.${PKGCONFBRANCH}
+CONFSNAME= FreeBSD.conf
 CONFSDIR=  /etc/pkg
 CONFSMODE= 644
 PROG=  pkg


___
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: r346624 - head/bin/date

2019-09-03 Thread Warner Losh
Author: imp
Date: Wed Apr 24 05:24:10 2019
New Revision: 346624
URL: https://svnweb.freebsd.org/changeset/base/346624

Log:
  Restore the -n flag parsing, but ignore it.
  
  Since D19668 was done, new users of the -n flag have surfaced. Parse
  and ignore it on the command line until they can be updated.
  
  Suggested by: rgrimes (in D19668).

Modified:
  head/bin/date/date.1
  head/bin/date/date.c

Modified: head/bin/date/date.1
==
--- head/bin/date/date.1Wed Apr 24 04:50:03 2019(r346623)
+++ head/bin/date/date.1Wed Apr 24 05:24:10 2019(r346624)
@@ -32,7 +32,7 @@
 .\" @(#)date.1 8.3 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd March 20, 2019
+.Dd April 23, 2019
 .Dt DATE 1
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .Nd display or set date and time
 .Sh SYNOPSIS
 .Nm
-.Op Fl jRu
+.Op Fl jnRu
 .Op Fl r Ar seconds | Ar filename
 .Oo
 .Fl v
@@ -142,6 +142,8 @@ This allows you to use the
 flag in addition to the
 .Cm +
 option to convert one date format to another.
+.It Fl n
+Obsolete flag, accepted and ignored for compatibility.
 .It Fl R
 Use RFC 2822 date and time output format.
 This is equivalent to using

Modified: head/bin/date/date.c
==
--- head/bin/date/date.cWed Apr 24 04:50:03 2019(r346623)
+++ head/bin/date/date.cWed Apr 24 05:24:10 2019(r346624)
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_TIME, "");
rflag = 0;
Iflag = jflag = Rflag = 0;
-   while ((ch = getopt(argc, argv, "f:I::jRr:uv:")) != -1)
+   while ((ch = getopt(argc, argv, "f:I::jnRr:uv:")) != -1)
switch((char)ch) {
case 'f':
fmt = optarg;
@@ -131,6 +131,8 @@ main(int argc, char *argv[])
break;
case 'j':
jflag = 1;  /* don't set time */
+   break;
+   case 'n':
break;
case 'R':   /* RFC 2822 datetime format */
if (Iflag)


___
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: r346630 - in head: sbin/ifconfig share/man/man4 sys/modules/if_gre sys/net sys/netinet sys/netinet6

2019-09-03 Thread Andrey V. Elsukov
Author: ae
Date: Wed Apr 24 09:05:45 2019
New Revision: 346630
URL: https://svnweb.freebsd.org/changeset/base/346630

Log:
  Add GRE-in-UDP encapsulation support as defined in RFC8086.
  
  This GRE-in-UDP encapsulation allows the UDP source port field to be
  used as an entropy field for load-balancing of GRE traffic in transit
  networks. Also most of multiqueue network cards are able distribute
  incoming UDP datagrams to different NIC queues, while very little are
  able do this for GRE packets.
  
  When an administrator enables UDP encapsulation with command
  `ifconfig gre0 udpencap`, the driver creates kernel socket, that binds
  to tunnel source address and after udp_set_kernel_tunneling() starts
  receiving of all UDP packets destined to 4754 port. Each kernel socket
  maintains list of tunnels with different destination addresses. Thus
  when several tunnels use the same source address, they all handled by
  single socket.  The IP[V6]_BINDANY socket option is used to be able bind
  socket to source address even if it is not yet available in the system.
  This may happen on system boot, when gre(4) interface is created before
  source address become available. The encapsulation and sending of packets
  is done directly from gre(4) into ip[6]_output() without using sockets.
  
  Reviewed by:  eugen
  MFC after:1 month
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D19921

Modified:
  head/sbin/ifconfig/ifgre.c
  head/share/man/man4/gre.4
  head/sys/modules/if_gre/Makefile
  head/sys/net/if_gre.c
  head/sys/net/if_gre.h
  head/sys/netinet/ip_gre.c
  head/sys/netinet6/ip6_gre.c

Modified: head/sbin/ifconfig/ifgre.c
==
--- head/sbin/ifconfig/ifgre.c  Wed Apr 24 06:41:52 2019(r346629)
+++ head/sbin/ifconfig/ifgre.c  Wed Apr 24 09:05:45 2019(r346630)
@@ -44,15 +44,16 @@ __FBSDID("$FreeBSD$");
 
 #include "ifconfig.h"
 
-#defineGREBITS "\020\01ENABLE_CSUM\02ENABLE_SEQ"
+#defineGREBITS "\020\01ENABLE_CSUM\02ENABLE_SEQ\03UDPENCAP"
 
 static void gre_status(int s);
 
 static void
 gre_status(int s)
 {
-   uint32_t opts = 0;
+   uint32_t opts, port;
 
+   opts = 0;
ifr.ifr_data = (caddr_t)
if (ioctl(s, GREGKEY, ) == 0)
if (opts != 0)
@@ -60,6 +61,11 @@ gre_status(int s)
opts = 0;
if (ioctl(s, GREGOPTS, ) != 0 || opts == 0)
return;
+
+   port = 0;
+   ifr.ifr_data = (caddr_t)
+   if (ioctl(s, GREGPORT, ) == 0 && port != 0)
+   printf("\tudpport: %u\n", port);
printb("\toptions", opts, GREBITS);
putchar('\n');
 }
@@ -77,6 +83,18 @@ setifgrekey(const char *val, int dummy __unused, int s
 }
 
 static void
+setifgreport(const char *val, int dummy __unused, int s,
+const struct afswtch *afp)
+{
+   uint32_t udpport = strtol(val, NULL, 0);
+
+   strlcpy(ifr.ifr_name, name, sizeof (ifr.ifr_name));
+   ifr.ifr_data = (caddr_t)
+   if (ioctl(s, GRESPORT, (caddr_t)) < 0)
+   warn("ioctl (set udpport)");
+}
+
+static void
 setifgreopts(const char *val, int d, int s, const struct afswtch *afp)
 {
uint32_t opts;
@@ -101,10 +119,13 @@ setifgreopts(const char *val, int d, int s, const stru
 
 static struct cmd gre_cmds[] = {
DEF_CMD_ARG("grekey",   setifgrekey),
+   DEF_CMD_ARG("udpport",  setifgreport),
DEF_CMD("enable_csum", GRE_ENABLE_CSUM, setifgreopts),
DEF_CMD("-enable_csum",-GRE_ENABLE_CSUM,setifgreopts),
DEF_CMD("enable_seq", GRE_ENABLE_SEQ,   setifgreopts),
DEF_CMD("-enable_seq",-GRE_ENABLE_SEQ,  setifgreopts),
+   DEF_CMD("udpencap", GRE_UDPENCAP,   setifgreopts),
+   DEF_CMD("-udpencap",-GRE_UDPENCAP,  setifgreopts),
 };
 static struct afswtch af_gre = {
.af_name= "af_gre",

Modified: head/share/man/man4/gre.4
==
--- head/share/man/man4/gre.4   Wed Apr 24 06:41:52 2019(r346629)
+++ head/share/man/man4/gre.4   Wed Apr 24 09:05:45 2019(r346630)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 2, 2015
+.Dd April 24, 2019
 .Dt GRE 4
 .Os
 .Sh NAME
@@ -89,7 +89,45 @@ A value of 0 disables the key option.
 Enables checksum calculation for outgoing packets.
 .It Ar enable_seq
 Enables use of sequence number field in the GRE header for outgoing packets.
+.It Ar udpencap
+Enables UDP-in-GRE encapsulation (see the
+.Sx GRE-IN-UDP ENCAPSULATION
+Section below for details).
+.It Ar udpport
+Set the source UDP port for outgoing packets.
+A value of 0 disables the persistence of source UDP port for outgoing packets.
+See the
+.Sx GRE-IN-UDP ENCAPSULATION
+Section below for details.
 .El
+.Sh GRE-IN-UDP ENCAPSULATION
+The
+.Nm
+supports GRE in UDP encapsulation as defined in RFC 8086.
+A GRE in UDP tunnel offers the possibility of 

svn commit: r346631 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Wed Apr 24 13:15:56 2019
New Revision: 346631
URL: https://svnweb.freebsd.org/changeset/base/346631

Log:
  Fix some races and screeen clearing in VGLEnd().
  
  The mouse signal SIGUSR2 was not turned off for normal termination and
  in some other cases.  Thus mouse signals arriving after the frame
  buffer was unmapped always caused fatal traps.  The fatal traps occurred
  about 1 time in 5 if the mouse was wiggled while vgl is ending.
  
  The screen switch signal SIGUSR1 was turned off after clearing the
  flag that it sets.  Unlike the mouse signal, this signal is handled
  synchronously, but VGLEnd() does screen clearing which does the
  synchronous handling.  This race is harder to lose.  I think it can
  get vgl into deadlocked state (waiting in the screen switch handler
  with SIGUSR1 to leave that state already turned off).
  
  Turn off the mouse cursor before clearing the screen in VGLEnd().
  Otherwise, clearing is careful to not clear the mouse cursor.  Undrawing
  an active mouse cursor uses a lot of state, so is dangerous for abnormal
  termination, but so is clearing.  Clearing is slow and is usually not
  needed, since the kernel also does it (not quite right).

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Wed Apr 24 09:05:45 2019(r346630)
+++ head/lib/libvgl/main.c  Wed Apr 24 13:15:56 2019(r346631)
@@ -73,11 +73,11 @@ struct vt_mode smode;
 
   if (!VGLInitDone)
 return;
-  VGLInitDone = 0;
+  signal(SIGUSR1, SIG_IGN);
+  signal(SIGUSR2, SIG_IGN);
   VGLSwitchPending = 0;
   VGLAbortPending = 0;
-
-  signal(SIGUSR1, SIG_IGN);
+  VGLMousePointerHide();
 
   if (VGLMem != MAP_FAILED) {
 VGLClear(VGLDisplay, 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: r346620 - head/tests/sys/opencrypto

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Wed Apr 24 04:40:24 2019
New Revision: 346620
URL: https://svnweb.freebsd.org/changeset/base/346620

Log:
  Reapply whitespace style changes from r346443 after recent changes to 
tests/sys/opencrypto
  
  From r346443:
  """
  Replace hard tabs with four-character indentations, per PEP8.
  
  This is being done to separate stylistic changes from the tests from 
functional
  ones, as I accidentally introduced a bug to the tests when I used four-space
  indentation locally.
  
  No functional change.
  """
  
  MFC after:2 months
  Discussed with:   jhb

Modified:
  head/tests/sys/opencrypto/cryptodev.py
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptodev.py
==
--- head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 02:51:58 2019
(r346619)
+++ head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 04:40:24 2019
(r346620)
@@ -35,73 +35,79 @@ import array
 import dpkt
 from fcntl import ioctl
 import os
+import random
 import signal
 from struct import pack as _pack
+import time
 
 from cryptodevh import *
 
 __all__ = [ 'Crypto', 'MismatchError', ]
 
 class FindOp(dpkt.Packet):
-   __byte_order__ = '@'
-   __hdr__ = ( ('crid', 'i', 0),
-   ('name', '32s', 0),
-   )
+__byte_order__ = '@'
+__hdr__ = (
+('crid', 'i',   0),
+('name', '32s', 0),
+)
 
 class SessionOp(dpkt.Packet):
-   __byte_order__ = '@'
-   __hdr__ = ( ('cipher', 'I', 0),
-   ('mac', 'I', 0),
-   ('keylen', 'I', 0),
-   ('key', 'P', 0),
-   ('mackeylen', 'i', 0),
-   ('mackey', 'P', 0),
-   ('ses', 'I', 0),
-   )
+__byte_order__ = '@'
+__hdr__ = (
+('cipher','I', 0),
+('mac',   'I', 0),
+('keylen','I', 0),
+('key',   'P', 0),
+('mackeylen', 'i', 0),
+('mackey','P', 0),
+('ses',   'I', 0),
+)
 
 class SessionOp2(dpkt.Packet):
-   __byte_order__ = '@'
-   __hdr__ = ( ('cipher', 'I', 0),
-   ('mac', 'I', 0),
-   ('keylen', 'I', 0),
-   ('key', 'P', 0),
-   ('mackeylen', 'i', 0),
-   ('mackey', 'P', 0),
-   ('ses', 'I', 0),
-   ('crid', 'i', 0),
-   ('pad0', 'i', 0),
-   ('pad1', 'i', 0),
-   ('pad2', 'i', 0),
-   ('pad3', 'i', 0),
-   )
+__byte_order__ = '@'
+__hdr__ = (
+('cipher','I', 0),
+('mac',   'I', 0),
+('keylen','I', 0),
+('key',   'P', 0),
+('mackeylen', 'i', 0),
+('mackey','P', 0),
+('ses',   'I', 0),
+('crid',  'i', 0),
+('pad0',  'i', 0),
+('pad1',  'i', 0),
+('pad2',  'i', 0),
+('pad3',  'i', 0),
+)
 
 class CryptOp(dpkt.Packet):
-   __byte_order__ = '@'
-   __hdr__ = ( ('ses', 'I', 0),
-   ('op', 'H', 0),
-   ('flags', 'H', 0),
-   ('len', 'I', 0),
-   ('src', 'P', 0),
-   ('dst', 'P', 0),
-   ('mac', 'P', 0),
-   ('iv', 'P', 0),
-   )
+__byte_order__ = '@'
+__hdr__ = (
+('ses',   'I', 0),
+('op','H', 0),
+('flags', 'H', 0),
+('len',   'I', 0),
+('src',   'P', 0),
+('dst',   'P', 0),
+('mac',   'P', 0),
+('iv','P', 0),
+)
 
 class CryptAEAD(dpkt.Packet):
-   __byte_order__ = '@'
-   __hdr__ = (
-   ('ses', 'I', 0),
-   ('op',  'H', 0),
-   ('flags',   'H', 0),
-   ('len', 'I', 0),
-   ('aadlen',  'I', 0),
-   ('ivlen',   'I', 0),
-   ('src', 'P', 0),
-   ('dst', 'P', 0),
-   ('aad', 'P', 0),
-   ('tag', 'P', 0),
-   ('iv',  'P', 0),
-   )
+__byte_order__ = '@'
+__hdr__ = (
+('ses','I', 0),
+('op', 'H', 0),
+('flags',  'H', 0),
+('len','I', 0),
+('aadlen', 'I', 0),
+('ivlen',  'I', 0),
+('src','P', 0),
+('dst','P', 0),
+('aad','P', 0),
+('tag','P', 0),
+('iv', 'P', 0),
+)
 
 # h2py.py can't handle multiarg macros
 CRIOGET = 3221513060
@@ -116,549 +122,546 @@ CIOCFINDDEV = 3223610220
 CIOCCRYPTAEAD = 3225445229
 
 def _getdev():
-   fd = os.open('/dev/crypto', os.O_RDWR)
-   buf = array.array('I', [0])
-   ioctl(fd, CRIOGET, buf, 1)
-   os.close(fd)
+fd = os.open('/dev/crypto', os.O_RDWR)
+buf = array.array('I', [0])
+ioctl(fd, CRIOGET, buf, 1)
+os.close(fd)
 
-   return buf[0]
+return buf[0]
 
 

svn commit: r346639 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Wed Apr 24 15:35:29 2019
New Revision: 346639
URL: https://svnweb.freebsd.org/changeset/base/346639

Log:
  Refactor mouse freezing and fix some minor bugs.
  
  VGLMouseFreeze() now only defers mouse signals and leaves it to higher
  levels to hide and unhide the mouse cursor if necessary.  (It is never
  necessary, but is done to simplify the implementation.  It is slow and
  flashes the cursor.  It is still done for copying bitmaps and clearing.)
  
  VGLMouseUnFreeze() now only undoes 1 level of freezing.  Its old
  optimization to reduce mouse redrawing is too hard to do with unhiding
  in higher levels, and its undoing of multiple levels was a historical
  mistake.
  
  VGLMouseOverlap() determines if a region overlaps the (full) mouse region.
  
  VGLMouseFreezeXY() is the freezing and a precise overlap check combined
  for the special case of writing a single pixel.  This is the single-pixel
  case of the old VGLMouseFreeze() with cleanups.
  
  Fixes:
  - check in more cases that the application didn't pass an invalid VIDBUF
  - check for errors from copying a bitmap to the shadow buffer
  - freeze the mouse before writing to the shadow buffer in all cases.  This
was not done for the case of writing a single pixel (there was a race)
  - don't spell the #defined values for VGLMouseShown as 0, 1 or boolean.

Modified:
  head/lib/libvgl/bitmap.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/simple.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/bitmap.c
==
--- head/lib/libvgl/bitmap.cWed Apr 24 15:02:59 2019(r346638)
+++ head/lib/libvgl/bitmap.cWed Apr 24 15:35:29 2019(r346639)
@@ -214,23 +214,36 @@ int
 VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
  VGLBitmap *dst, int dstx, int dsty, int width, int hight)
 {
-  int error;
+  int error, mouseoverlap;
 
   if (src == VGLDisplay)
 src = 
   if (src->Type != MEMBUF)
 return -1; /* invalid */
   if (dst == VGLDisplay) {
-VGLMouseFreeze(dstx, dsty, width, hight, 0);
-__VGLBitmapCopy(src, srcx, srcy, , dstx, dsty, width, hight);
+VGLMouseFreeze();
+mouseoverlap = VGLMouseOverlap(dstx, dsty, width, hight);
+if (mouseoverlap)
+  VGLMousePointerHide();
+error = __VGLBitmapCopy(src, srcx, srcy, , dstx, dsty,
+width, hight);
+if (error != 0) {
+  if (mouseoverlap)
+VGLMousePointerShow();
+  VGLMouseUnFreeze();
+  return error;
+}
 src = 
 srcx = dstx;
 srcy = dsty;
   } else if (dst->Type != MEMBUF)
 return -1; /* invalid */
   error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight);
-  if (dst == VGLDisplay)
+  if (dst == VGLDisplay) {
+if (mouseoverlap)
+  VGLMousePointerShow();
 VGLMouseUnFreeze();
+  }
   return error;
 }
 

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Wed Apr 24 15:02:59 2019(r346638)
+++ head/lib/libvgl/mouse.c Wed Apr 24 15:35:29 2019(r346639)
@@ -89,7 +89,7 @@ static VGLBitmap VGLMouseStdOrMask = 
 VGLBITMAP_INITIALIZER(MEMBUF, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE, StdOrMask);
 static VGLBitmap *VGLMouseAndMask, *VGLMouseOrMask;
 static int VGLMouseVisible = 0;
-static int VGLMouseShown = 0;
+static int VGLMouseShown = VGL_MOUSEHIDE;
 static int VGLMouseXpos = 0;
 static int VGLMouseYpos = 0;
 static int VGLMouseButtons = 0;
@@ -316,48 +316,47 @@ VGLMouseStatus(int *x, int *y, char *buttons)
   return VGLMouseShown;
 }
 
-int
-VGLMouseFreeze(int x, int y, int width, int hight, u_long color)
+void
+VGLMouseFreeze(void)
 {
-INTOFF();
-if (width > 1 || hight > 1 || (color & 0xc000) == 0) { /* bitmap */
-  if (VGLMouseShown == 1) {
-int overlap;
+  INTOFF();
+}
 
-if (x > VGLMouseXpos)
-  overlap = (VGLMouseXpos + MOUSE_IMG_SIZE) - x;
-else
-  overlap = (x + width) - VGLMouseXpos;
-if (overlap > 0) {
-  if (y > VGLMouseYpos)
-overlap = (VGLMouseYpos + MOUSE_IMG_SIZE) - y;
-  else
-overlap = (y + hight) - VGLMouseYpos;
-  if (overlap > 0)
-VGLMousePointerHide();
-} 
-  }
-}
-else { /* bit */
-  if (VGLMouseShown &&
-  x >= VGLMouseXpos && x < VGLMouseXpos + MOUSE_IMG_SIZE &&
-  y >= VGLMouseYpos && y < VGLMouseYpos + MOUSE_IMG_SIZE) {
-if (color & 0x8000) {  /* Set */
-  if (VGLMouseAndMask->Bitmap 
-[(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)]) {
-return 1;
-  }   
-}   
-  }   
-}
+int
+VGLMouseFreezeXY(int x, int y)
+{
+  INTOFF();
+  if (VGLMouseShown != VGL_MOUSESHOW)
+return 0;
+  if (x >= VGLMouseXpos && x < VGLMouseXpos + MOUSE_IMG_SIZE &&
+  y >= 

Re: svn commit: r346315 - head/lib/libcasper/services/cap_fileargs

2019-09-03 Thread Yoshihiro Ota
Hi Ed and thank you for taking a look.

my svn info says 346593 which is after few other fixes were commited.

I'm on i386 arch.
I haven't done installworld yet after picking up libcasper changes.
'make buildworld' works fine.
'make xdev-build' fails and I tried with both "arm" and "mips" for TARGET and 
TARGET_ARCH.
Both fail same way.
Please check your /usr/include/casper/ca_fileargs.h and I suspect that's where 
you pick up FA_OPEN.

I attached a log file this time.

Regards,
Hiro

On Tue, 23 Apr 2019 09:49:00 -0400
Ed Maste  wrote:

> On Tue, 23 Apr 2019 at 00:07, Yoshihiro Ota  wrote:
> >
> > It looks this change is causing 'make xdev TARGET=mips TARGET_ARCH=mips' to 
> > fail as the
> > following with HEAD checked out under "/usr/obj/freebsd":
> 
> Hello Hiro-san, sorry about that.
> 
> I tried `make xdev TARGET=mips TARGET_ARCH=mips` on HEAD just now (but
> it failed on the install as DESTDIR wasn't set and I ran as non-root).
> Just `make xdev-build` was successful though.
> 
> What version were you trying to build? There were (several) followup
> commits to address issues with the initial commit of cap_fileargs
> lstat support.
% svn info
Path: .
Working Copy Root Path: /usr/src
URL: https://svn0.us-east.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn0.us-east.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 346593
Node Kind: directory
Schedule: normal
Last Changed Author: wma
Last Changed Rev: 346593
Last Changed Date: 2019-04-23 02:36:32 -0400 (Tue, 23 Apr 2019)

% make xdev-build TARGET=mips TARGET_ARCH=mips
mkdir -p /usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr
mtree -deUW -f /usr/src/etc/mtree/BSD.usr.dist  -p 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr >/dev/null
===> lib/clang/libllvmminimal (obj,all,install)
===> usr.bin/clang/llvm-tblgen (obj,all,install)
sh /usr/src/tools/install.sh  -s -o root -g wheel -m 555   llvm-tblgen 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/llvm-tblgen
sh /usr/src/tools/install.sh  -o root -g wheel -m 444  llvm-tblgen.debug 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/lib/debug/usr/bin/llvm-tblgen.debug
===> usr.bin/clang/clang-tblgen (obj,all,install)
sh /usr/src/tools/install.sh  -s -o root -g wheel -m 555   clang-tblgen 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/clang-tblgen
sh /usr/src/tools/install.sh  -o root -g wheel -m 444  clang-tblgen.debug 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/lib/debug/usr/bin/clang-tblgen.debug
===> gnu/usr.bin/gperf (obj,all,install)
sh /usr/src/tools/install.sh  -s -o root -g wheel -m 555   gperf 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/gperf
sh /usr/src/tools/install.sh  -o root -g wheel -m 444  gperf.debug 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/lib/debug/usr/bin/gperf.debug
===> lib/liby (obj,all,install)
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   liby.a 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/lib/
===> usr.bin/yacc (obj,all,install)
sh /usr/src/tools/install.sh  -s -o root -g wheel -m 555   yacc 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/yacc
sh /usr/src/tools/install.sh  -o root -g wheel -m 444  yacc.debug 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/lib/debug/usr/bin/yacc.debug
sh /usr/src/tools/install.sh -l h -o root -g wheel -m 555  
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/yacc 
/usr/obj/usr/src/mips.mips/mips-freebsd/tmp/usr/bin/byacc
===> bin/csh (obj,build-tools)
===> bin/sh (obj,build-tools)
===> lib/ncurses/ncurses (obj,build-tools)
===> lib/ncurses/ncursesw (obj,build-tools)
===> share/syscons/scrnmaps (obj,build-tools)
===> usr.bin/awk (obj,build-tools)
===> lib/libmagic (obj,build-tools)
===> usr.bin/mkesdb_static (obj,build-tools)
===> usr.bin/mkcsmapper_static (obj,build-tools)
===> usr.bin/vi/catalog (obj,build-tools)
===> gnu/usr.bin/cc/cc_tools (obj,build-tools)
===> xdev gnu/usr.bin/binutils (obj,all)
===> gnu/usr.bin/binutils/libiberty (all)
===> gnu/usr.bin/binutils/libbfd (all)
===> gnu/usr.bin/binutils/libopcodes (all)
===> gnu/usr.bin/binutils/doc (all)
===> gnu/usr.bin/binutils/libbinutils (all)
===> gnu/usr.bin/binutils/as (all)
===> gnu/usr.bin/binutils/objdump (all)
===> gnu/usr.bin/binutils/ld (all)
===> xdev lib/libelftc (obj,all)
===> xdev lib/libpe (obj,all)
===> xdev usr.bin/objcopy (obj,all)
===> xdev usr.bin/nm (obj,all)
===> xdev usr.bin/size (obj,all)
===> xdev usr.bin/strings (obj,all)
cc  -O2 -pipe   -DWITH_CASPER -I/usr/src/contrib/elftoolchain/libelftc 
-I/usr/src/contrib/elftoolchain/common -g -MD  -MF.depend.strings.o 
-MTstrings.o -std=gnu99 -Qunused-arguments  -c 
/usr/src/contrib/elftoolchain/strings/strings.c -o strings.o
/usr/src/contrib/elftoolchain/strings/strings.c:198:55: error: use of 
undeclared identifier 'FA_OPEN'
fa = fileargs_init(argc, argv, O_RDONLY, 0, , FA_OPEN);
 ^
1 error generated.
*** Error code 1

Stop.
make[2]: stopped in 

svn commit: r346626 - head/tests/sys/opencrypto

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Wed Apr 24 05:49:48 2019
New Revision: 346626
URL: https://svnweb.freebsd.org/changeset/base/346626

Log:
  Fix typo: `Plen` should be `plen`
  
  MFC after:1 month
  MFC with: r346617
  Reported by:  pylint -E

Modified:
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptotest.py
==
--- head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 05:47:09 2019
(r346625)
+++ head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 05:49:48 2019
(r346626)
@@ -307,7 +307,7 @@ def GenTestCase(cname):
 aad, tag)
 
 payload = data['Payload'].decode('hex')
-Plen = int(data('Plen'))
+plen = int(data('Plen'))
 payload = payload[:plen]
 self.assertEqual(r, payload,
 "Count " + data['Count'] + \


___
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: r346273 - in head/sys: compat/freebsd32 kern

2019-09-03 Thread Dmitry Chagin
вт, 16 апр. 2019 г. в 16:26, Ed Maste :

> Author: emaste
> Date: Tue Apr 16 13:26:31 2019
> New Revision: 346273
> URL: https://svnweb.freebsd.org/changeset/base/346273
>
> Log:
>   correct readlinkat(2) return type
>
>
Hi, Ed
make sysent?



>   r176215 corrected readlink(2)'s return type and the type of the last
>   argument.  readlink(2) was introduced in r177788 after being developed
>   as part of Google Summer of Code 2007; it appears to have inherited the
>   wrong return type.
>
>   Man pages and header files were already ssize_t; update syscalls.master
>   to match.
>
>   PR:   197915
>   Submitted by: Henning Petersen 
>   MFC after:2 weeks
>
> Modified:
>   head/sys/compat/freebsd32/syscalls.master
>   head/sys/kern/syscalls.master
>
> Modified: head/sys/compat/freebsd32/syscalls.master
>
> ==
> --- head/sys/compat/freebsd32/syscalls.master   Tue Apr 16 12:40:49 2019
>   (r346272)
> +++ head/sys/compat/freebsd32/syscalls.master   Tue Apr 16 13:26:31 2019
>   (r346273)
> @@ -963,7 +963,7 @@
> uint32_t dev); }
>  499AUE_OPENAT_RWTC NOPROTO { int openat(int fd, const char *path, \
> int flag, mode_t mode); }
> -500AUE_READLINKAT  NOPROTO { int readlinkat(int fd, const char *path,
> \
> +500AUE_READLINKAT  NOPROTO { ssize_t readlinkat(int fd, const char
> *path, \
> char *buf, size_t bufsize); }
>  501AUE_RENAMEATNOPROTO { int renameat(int oldfd, const char *old,
> \
> int newfd, const char *new); }
>
> Modified: head/sys/kern/syscalls.master
>
> ==
> --- head/sys/kern/syscalls.master   Tue Apr 16 12:40:49 2019
> (r346272)
> +++ head/sys/kern/syscalls.master   Tue Apr 16 13:26:31 2019
> (r346273)
> @@ -2716,7 +2716,7 @@
> );
> }
>  500AUE_READLINKAT  STD {
> -   int readlinkat(
> +   ssize_t readlinkat(
> int fd,
> _In_z_ const char *path,
> _Out_writes_bytes_(bufsize) char *buf,
>
>
___
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: r346643 - head/sys/x86/x86

2019-09-03 Thread Conrad Meyer
Author: cem
Date: Wed Apr 24 18:24:22 2019
New Revision: 346643
URL: https://svnweb.freebsd.org/changeset/base/346643

Log:
  x86: Halt non-BSP CPUs on panic IPI_STOP
  
  We may need the BSP to reboot, but we don't need any AP CPU that isn't the
  panic thread.  Any CPU landing in this routine during panic isn't the panic
  thread, so we can just detect !BSP && panic and shut down the logical core.
  
  The savings can be demonstrated in a bhyve guest with multiple cores; before
  this change, N guest threads would spin at 100% CPU.  After this change,
  only one or two threads spin (depending on if the panicing CPU was the BSP
  or not).
  
  Konstantin points out that this may break any future patches which allow
  switching ddb(4) CPUs after panic and examining CPU-local state that cannot
  be inspected remotely.  In the event that such a mechanism is incorporated,
  this behavior could be made configurable by tunable/sysctl.
  
  Reviewed by:  kib
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20019

Modified:
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/x86/x86/mp_x86.c
==
--- head/sys/x86/x86/mp_x86.c   Wed Apr 24 17:30:50 2019(r346642)
+++ head/sys/x86/x86/mp_x86.c   Wed Apr 24 18:24:22 2019(r346643)
@@ -1406,8 +1406,17 @@ cpustop_handler(void)
CPU_SET_ATOMIC(cpu, _cpus);
 
/* Wait for restart */
-   while (!CPU_ISSET(cpu, _cpus))
-   ia32_pause();
+   while (!CPU_ISSET(cpu, _cpus)) {
+   ia32_pause();
+
+   /*
+* Halt non-BSP CPUs on panic -- we're never going to need them
+* again, and might as well save power / release resources
+* (e.g., overprovisioned VM infrastructure).
+*/
+   while (__predict_false(!IS_BSP() && panicstr != NULL))
+   halt();
+   }
 
cpustop_handler_post(cpu);
 }


___
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: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-09-03 Thread Tycho Nightingale
Author: tychon
Date: Wed Apr 24 20:30:45 2019
New Revision: 346645
URL: https://svnweb.freebsd.org/changeset/base/346645

Log:
  LinuxKPI should use bus_dma(9) to be compatible with an IOMMU
  
  Reviewed by:  hselasky, kib
  Tested by:greg@unrelenting.technology
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D19845

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
  head/sys/compat/linuxkpi/common/include/linux/dmapool.h
  head/sys/compat/linuxkpi/common/include/linux/pci.h
  head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
  head/sys/compat/linuxkpi/common/src/linux_pci.c
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Wed Apr 24 
19:56:02 2019(r346644)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Wed Apr 24 
20:30:45 2019(r346645)
@@ -105,7 +105,7 @@ struct device {
struct class*class;
void(*release)(struct device *dev);
struct kobject  kobj;
-   uint64_t*dma_mask;
+   void*dma_priv;
void*driver_data;
unsigned intirq;
 #defineLINUX_IRQ_INVALID   65535

Modified: head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
==
--- head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Wed Apr 24 
19:56:02 2019(r346644)
+++ head/sys/compat/linuxkpi/common/include/linux/dma-mapping.h Wed Apr 24 
20:30:45 2019(r346645)
@@ -90,6 +90,16 @@ struct dma_map_ops {
 
 #defineDMA_BIT_MASK(n) ((2ULL << ((n) - 1)) - 1ULL)
 
+int linux_dma_tag_init(struct device *dev, u64 mask);
+void *linux_dma_alloc_coherent(struct device *dev, size_t size,
+dma_addr_t *dma_handle, gfp_t flag);
+dma_addr_t linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len);
+void linux_dma_unmap(struct device *dev, dma_addr_t dma_addr, size_t size);
+int linux_dma_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
+int nents, enum dma_data_direction dir, struct dma_attrs *attrs);
+void linux_dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
+int nents, enum dma_data_direction dir, struct dma_attrs *attrs);
+
 static inline int
 dma_supported(struct device *dev, u64 mask)
 {
@@ -102,11 +112,10 @@ static inline int
 dma_set_mask(struct device *dev, u64 dma_mask)
 {
 
-   if (!dev->dma_mask || !dma_supported(dev, dma_mask))
+   if (!dev->dma_priv || !dma_supported(dev, dma_mask))
return -EIO;
 
-   *dev->dma_mask = dma_mask;
-   return (0);
+   return (linux_dma_tag_init(dev, dma_mask));
 }
 
 static inline int
@@ -134,24 +143,7 @@ static inline void *
 dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
 gfp_t flag)
 {
-   vm_paddr_t high;
-   size_t align;
-   void *mem;
-
-   if (dev != NULL && dev->dma_mask)
-   high = *dev->dma_mask;
-   else if (flag & GFP_DMA32)
-   high = BUS_SPACE_MAXADDR_32BIT;
-   else
-   high = BUS_SPACE_MAXADDR;
-   align = PAGE_SIZE << get_order(size);
-   mem = (void *)kmem_alloc_contig(size, flag, 0, high, align, 0,
-   VM_MEMATTR_DEFAULT);
-   if (mem)
-   *dma_handle = vtophys(mem);
-   else
-   *dma_handle = 0;
-   return (mem);
+   return (linux_dma_alloc_coherent(dev, size, dma_handle, flag));
 }
 
 static inline void *
@@ -164,25 +156,27 @@ dma_zalloc_coherent(struct device *dev, size_t size, d
 
 static inline void
 dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
-dma_addr_t dma_handle)
+dma_addr_t dma_addr)
 {
 
+   linux_dma_unmap(dev, dma_addr, size);
kmem_free((vm_offset_t)cpu_addr, size);
 }
 
-/* XXX This only works with no iommu. */
 static inline dma_addr_t
 dma_map_single_attrs(struct device *dev, void *ptr, size_t size,
 enum dma_data_direction dir, struct dma_attrs *attrs)
 {
 
-   return vtophys(ptr);
+   return (linux_dma_map_phys(dev, vtophys(ptr), size));
 }
 
 static inline void
-dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, size_t size,
+dma_unmap_single_attrs(struct device *dev, dma_addr_t dma_addr, size_t size,
 enum dma_data_direction dir, struct dma_attrs *attrs)
 {
+
+   linux_dma_unmap(dev, dma_addr, size);
 }
 
 static inline dma_addr_t
@@ -190,26 +184,23 @@ dma_map_page_attrs(struct device *dev, struct page *pa
 size_t size, enum dma_data_direction dir, unsigned long attrs)
 {
 
-   return (VM_PAGE_TO_PHYS(page) + offset);
+   return (linux_dma_map_phys(dev, VM_PAGE_TO_PHYS(page) + offset, size));
 }
 
 static 

svn commit: r346644 - head/sys/geom

2019-09-03 Thread Alexander Motin
Author: mav
Date: Wed Apr 24 19:56:02 2019
New Revision: 346644
URL: https://svnweb.freebsd.org/changeset/base/346644

Log:
  Call delist_dev() before destroy_dev_sched_cb().
  
  destroy_dev_sched_cb() is excessively asynchronous, and during media change
  retaste new provider may appear sooner then device of the previous one get
  destroyed.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/geom/geom_dev.c

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cWed Apr 24 18:24:22 2019(r346643)
+++ head/sys/geom/geom_dev.cWed Apr 24 19:56:02 2019(r346644)
@@ -863,6 +863,7 @@ g_dev_orphan(struct g_consumer *cp)
(void)clear_dumper(curthread);
 
/* Destroy the struct cdev *so we get no more requests */
+   delist_dev(dev);
destroy_dev_sched_cb(dev, g_dev_callback, cp);
 }
 


___
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: r346615 - head/tests/sys/opencrypto

2019-09-03 Thread John Baldwin
Author: jhb
Date: Wed Apr 24 00:14:37 2019
New Revision: 346615
URL: https://svnweb.freebsd.org/changeset/base/346615

Log:
  Use more descriptive algorithm names in skip messages.
  
  Reviewed by:  cem, ngie
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D19977

Modified:
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptotest.py
==
--- head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 00:10:21 2019
(r346614)
+++ head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 00:14:37 2019
(r346615)
@@ -61,17 +61,17 @@ def GenTestCase(cname):
###
# AES #
###
-   @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' 
% (cname))
+   @unittest.skipIf(cname not in aesmodules, 'skipping AES-XTS on 
%s' % (cname))
def test_xts(self):
for i in katg('XTSTestVectors/format tweak value input 
- data unit seq no', '*.rsp'):
self.runXTS(i, cryptodev.CRYPTO_AES_XTS)
 
-   @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' 
% (cname))
+   @unittest.skipIf(cname not in aesmodules, 'skipping AES-CBC on 
%s' % (cname))
def test_cbc(self):
for i in katg('KAT_AES', 'CBC[GKV]*.rsp'):
self.runCBC(i)
 
-   @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' 
% (cname))
+   @unittest.skipIf(cname not in aesmodules, 'skipping AES-GCM on 
%s' % (cname))
def test_gcm(self):
for i in katg('gcmtestvectors', 'gcmEncrypt*'):
self.runGCM(i, 'ENCRYPT')
@@ -265,7 +265,7 @@ def GenTestCase(cname):
#for i in iglob('SHA1*'):
#   self.runSHA(i)
 
-   @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' 
% str(cname))
+   @unittest.skipIf(cname not in shamodules, 'skipping SHA-HMAC on 
%s' % str(cname))
def test_sha1hmac(self):
for i in katg('hmactestvectors', 'HMAC.rsp'):
self.runSHA1HMAC(i)


___
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: r346315 - head/lib/libcasper/services/cap_fileargs

2019-09-03 Thread Yoshihiro Ota
It looks this change is causing 'make xdev TARGET=mips TARGET_ARCH=mips' to 
fail as the following with HEAD checked out under "/usr/obj/freebsd":

cc  -O2 -pipe   -DWITH_CASPER -I/usr/obj/freebsd/contrib/elftoolchain/libelftc -
I/usr/obj/freebsd/contrib/elftoolchain/common -g -MD  -MF.depend.strings.o 
-MTstrings.o -std=gnu99 -Qunused-arguments  -c 
/usr/obj/freebsd/contrib/elftoolchain/strings/strings.c -o strings.o
/usr/obj/freebsd/contrib/elftoolchain/strings/strings.c:198:55: error: use of 
undeclared identifier 'FA_OPEN'
fa = fileargs_init(argc, argv, O_RDONLY, 0, , FA_OPEN);
 ^
1 error generated.
*** [strings.o] Error code 1


It looks #include  cannot pick up header files from 
"lib/libcasper/services/cap_fileargs"

Hiro

Ed Maste  wrote:

> Author: emaste
> Date: Wed Apr 17 16:02:57 2019
> New Revision: 346315
> URL: https://svnweb.freebsd.org/changeset/base/346315
> 
> Log:
>   cap_fileargs: add fileargs_lstat service
>   
>   Add fileargs_lstat function to cap_fileargs casper service to be able to
>   lstat files while in capability mode.  It can only lstat files given in
>   fileargs_init.
>   
>   Submitted by:   Bora 〓zarslan 
>   Reviewed by:oshogbo, cem (partial)
>   MFC after:  3 weeks
>   Relnotes:   Yes
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D19548
> 
> Modified:
>   head/lib/libcasper/services/cap_fileargs/cap_fileargs.3
>   head/lib/libcasper/services/cap_fileargs/cap_fileargs.c
>   head/lib/libcasper/services/cap_fileargs/cap_fileargs.h
> 
> Modified: head/lib/libcasper/services/cap_fileargs/cap_fileargs.3
> ==
> --- head/lib/libcasper/services/cap_fileargs/cap_fileargs.3   Wed Apr 17 
> 16:00:33
> 2019  (r346314) +++ head/lib/libcasper/services/cap_fileargs/cap_fileargs.3   
> Wed Apr
> 17 16:02:57 2019  (r346315) @@ -24,7 +24,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd November 12, 2018
> +.Dd April 17, 2019
>  .Dt CAP_FILEARGS 3
>  .Os
>  .Sh NAME
> @@ -33,6 +33,7 @@
>  .Nm fileargs_init ,
>  .Nm fileargs_initnv ,
>  .Nm fileargs_free ,
> +.Nm fileargs_lstat ,
>  .Nm fileargs_open ,
>  .Nm fileargs_fopen
>  .Nd "library for handling files in capability mode"
> @@ -43,9 +44,9 @@
>  .In libcasper.h
>  .In casper/cap_fileargs.h
>  .Ft "fileargs_t *"
> -.Fn fileargs_init "int argc" "char *argv[]" "int flags" "mode_t mode" 
> "cap_rights_t *rightsp"
> +.Fn fileargs_init "int argc" "char *argv[]" "int flags" "mode_t mode" 
> "cap_rights_t *rightsp"
> "int operations" .Ft "fileargs_t *"
> -.Fn fileargs_cinit "cap_channel_t *cas" "int argc" "char *argv[]" "int 
> flags" "mode_t mode"
> "cap_rights_t *rightsp" +.Fn fileargs_cinit "cap_channel_t *cas" "int argc" 
> "char *argv[]" "int
> flags" "mode_t mode" "cap_rights_t *rightsp" "int operations" .Ft "fileargs_t 
> *"
>  .Fn fileargs_cinitnv "cap_channel_t *cas" "nvlist_t *limits"
>  .Ft "fileargs_t *"
> @@ -53,6 +54,8 @@
>  .Ft "void"
>  .Fn fileargs_free "fileargs_t *fa"
>  .Ft "int"
> +.Fn fileargs_lstat "fileargs_t *fa" "const char *path" "struct stat *sb"
> +.Ft "int"
>  .Fn fileargs_open "fileargs_t *fa" "const char *name"
>  .Ft "FILE *"
>  .Fn fileargs_fopen "fileargs_t *fa" "const char *name" "const char *mode"
> @@ -97,6 +100,22 @@ The
>  argument contains a list of the capability rights which file should be 
> limited to.
>  For more details of the capability rights see
>  .Xr cap_rights_init 3 .
> +The
> +.Fa operations
> +argument limits the operations that are available using
> +.Nm system.fileargs .
> +.Fa operations
> +is a combination of:
> +.Bl -ohang -offset indent
> +.It FA_OPEN
> +Allow
> +.Fn fileargs_open
> +and
> +.Fn fileargs_fopen .
> +.It FA_LSTAT
> +Allow
> +.Fn fileargs_lstat .
> +.El
>  .Pp
>  The function
>  .Fn fileargs_cinit
> @@ -126,6 +145,11 @@ The function handle
>  .Dv NULL
>  argument.
>  .Pp
> +The function
> +.Fn fileargs_lstat
> +is equivalent to
> +.Xr lstat 2 .
> +.Pp
>  The functions
>  .Fn fileargs_open
>  and
> @@ -165,6 +189,15 @@ must contain the
>  The
>  .Va mode
>  argument tells which what mode file should be created.
> +.It operations (NV_TYPE_NUMBER)
> +The
> +.Va operations
> +limits the usable operations for
> +.Fa system.fileargs .
> +The possible values are explained as
> +.Va operations
> +argument with
> +.Fn fileargs_init .
>  .El
>  .Pp
>  The
> @@ -201,7 +234,7 @@ argv += optind;
>  
>  /* Create capability to the system.fileargs service. */
>  fa = fileargs_init(argc, argv, O_RDONLY, 0,
> -cap_rights_init(, CAP_READ));
> +cap_rights_init(, CAP_READ), FA_OPEN);
>  if (fa == NULL)
>   err(1, "unable to open system.fileargs service");
>  
> @@ -222,6 +255,7 @@ fileargs_free(fa);
>  .Ed
>  .Sh SEE ALSO
>  .Xr cap_enter 2 ,
> +.Xr lstat 2 ,
>  .Xr open 2 ,
>  .Xr cap_rights_init 3 ,
>  .Xr err 3 ,
> 
> Modified: 

svn commit: r346591 - in head: contrib/wpa contrib/wpa/hostapd contrib/wpa/hs20/client contrib/wpa/src/ap contrib/wpa/src/common contrib/wpa/src/crypto contrib/wpa/src/drivers contrib/wpa/src/eap_c...

2019-09-03 Thread Cy Schubert
Author: cy
Date: Tue Apr 23 03:52:43 2019
New Revision: 346591
URL: https://svnweb.freebsd.org/changeset/base/346591

Log:
  MFV r346563:
  
  Update wpa_supplicant/hostapd 2.7 --> 2.8
  
  Upstream documents the following advisories:
  
  - https://w1.fi/security/2019-1/sae-side-channel-attacks.txt
  - https://w1.fi/security/2019-2/eap-pwd-side-channel-attack.txt
  - https://w1.fi/security/2019-3/sae-confirm-missing-state-validation.txt
  - https://w1.fi/security/2019-4/eap-pwd-missing-commit-validation.txt
  - https://w1.fi/security/2019-5/eap-pwd-message-reassembly-issue-\
with-unexpected-fragment.txt
  
  Relnotes: yes
  MFC after:1 week (or less)
  Security: CVE-2019-9494, VU#871675, CVE-2019-9495, CVE-2019-9496,
CVE-2019-9497, CVE-2019-9498, CVE-2019-9499

Added:
  head/contrib/wpa/hostapd/README-MULTI-AP
 - copied unchanged from r346563, vendor/wpa/dist/hostapd/README-MULTI-AP
  head/contrib/wpa/src/common/ocv.c
 - copied unchanged from r346563, vendor/wpa/dist/src/common/ocv.c
  head/contrib/wpa/src/common/ocv.h
 - copied unchanged from r346563, vendor/wpa/dist/src/common/ocv.h
  head/contrib/wpa/src/crypto/sha512.c
 - copied unchanged from r346563, vendor/wpa/dist/src/crypto/sha512.c
  head/contrib/wpa/src/utils/const_time.h
 - copied unchanged from r346563, vendor/wpa/dist/src/utils/const_time.h
  head/contrib/wpa/wpa_supplicant/README-DPP
 - copied unchanged from r346563, vendor/wpa/dist/wpa_supplicant/README-DPP
Deleted:
  head/contrib/wpa/wpa_supplicant/dbus/dbus_old.c
  head/contrib/wpa/wpa_supplicant/dbus/dbus_old.h
  head/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.c
  head/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers.h
  head/contrib/wpa/wpa_supplicant/dbus/dbus_old_handlers_wps.c
  
head/contrib/wpa/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in
  head/contrib/wpa/wpa_supplicant/examples/wpas-test.py
Modified:
  head/contrib/wpa/CONTRIBUTIONS
  head/contrib/wpa/COPYING
  head/contrib/wpa/README
  head/contrib/wpa/hostapd/ChangeLog
  head/contrib/wpa/hostapd/README
  head/contrib/wpa/hostapd/config_file.c
  head/contrib/wpa/hostapd/ctrl_iface.c
  head/contrib/wpa/hostapd/defconfig
  head/contrib/wpa/hostapd/hostapd.conf
  head/contrib/wpa/hostapd/hostapd.wpa_psk
  head/contrib/wpa/hostapd/hostapd_cli.c
  head/contrib/wpa/hostapd/main.c
  head/contrib/wpa/hostapd/wps-ap-nfc.py
  head/contrib/wpa/hs20/client/Makefile
  head/contrib/wpa/hs20/client/est.c
  head/contrib/wpa/hs20/client/osu_client.c
  head/contrib/wpa/src/ap/acs.c
  head/contrib/wpa/src/ap/ap_config.c
  head/contrib/wpa/src/ap/ap_config.h
  head/contrib/wpa/src/ap/ap_drv_ops.h
  head/contrib/wpa/src/ap/authsrv.c
  head/contrib/wpa/src/ap/beacon.c
  head/contrib/wpa/src/ap/ctrl_iface_ap.c
  head/contrib/wpa/src/ap/dfs.c
  head/contrib/wpa/src/ap/dhcp_snoop.c
  head/contrib/wpa/src/ap/dpp_hostapd.c
  head/contrib/wpa/src/ap/dpp_hostapd.h
  head/contrib/wpa/src/ap/drv_callbacks.c
  head/contrib/wpa/src/ap/eap_user_db.c
  head/contrib/wpa/src/ap/fils_hlp.c
  head/contrib/wpa/src/ap/hostapd.c
  head/contrib/wpa/src/ap/hostapd.h
  head/contrib/wpa/src/ap/hs20.c
  head/contrib/wpa/src/ap/hw_features.c
  head/contrib/wpa/src/ap/ieee802_11.c
  head/contrib/wpa/src/ap/ieee802_11.h
  head/contrib/wpa/src/ap/ieee802_11_auth.c
  head/contrib/wpa/src/ap/ieee802_11_he.c
  head/contrib/wpa/src/ap/ieee802_11_shared.c
  head/contrib/wpa/src/ap/ieee802_11_vht.c
  head/contrib/wpa/src/ap/ieee802_1x.c
  head/contrib/wpa/src/ap/neighbor_db.c
  head/contrib/wpa/src/ap/neighbor_db.h
  head/contrib/wpa/src/ap/rrm.c
  head/contrib/wpa/src/ap/sta_info.c
  head/contrib/wpa/src/ap/sta_info.h
  head/contrib/wpa/src/ap/vlan_full.c
  head/contrib/wpa/src/ap/vlan_init.c
  head/contrib/wpa/src/ap/wnm_ap.c
  head/contrib/wpa/src/ap/wpa_auth.c
  head/contrib/wpa/src/ap/wpa_auth.h
  head/contrib/wpa/src/ap/wpa_auth_ft.c
  head/contrib/wpa/src/ap/wpa_auth_glue.c
  head/contrib/wpa/src/ap/wpa_auth_i.h
  head/contrib/wpa/src/ap/wpa_auth_ie.c
  head/contrib/wpa/src/ap/wpa_auth_ie.h
  head/contrib/wpa/src/ap/wps_hostapd.c
  head/contrib/wpa/src/common/common_module_tests.c
  head/contrib/wpa/src/common/defs.h
  head/contrib/wpa/src/common/dpp.c
  head/contrib/wpa/src/common/dpp.h
  head/contrib/wpa/src/common/hw_features_common.c
  head/contrib/wpa/src/common/hw_features_common.h
  head/contrib/wpa/src/common/ieee802_11_common.c
  head/contrib/wpa/src/common/ieee802_11_common.h
  head/contrib/wpa/src/common/ieee802_11_defs.h
  head/contrib/wpa/src/common/qca-vendor.h
  head/contrib/wpa/src/common/sae.c
  head/contrib/wpa/src/common/sae.h
  head/contrib/wpa/src/common/version.h
  head/contrib/wpa/src/common/wpa_common.c
  head/contrib/wpa/src/common/wpa_common.h
  head/contrib/wpa/src/common/wpa_ctrl.c
  head/contrib/wpa/src/crypto/aes-internal-enc.c
  head/contrib/wpa/src/crypto/crypto.h
  head/contrib/wpa/src/crypto/crypto_gnutls.c
  head/contrib/wpa/src/crypto/crypto_internal-modexp.c

svn commit: r346580 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Mon Apr 22 19:31:16 2019
New Revision: 346580
URL: https://svnweb.freebsd.org/changeset/base/346580

Log:
  Fix mouse cursor coloring in depths > 8 (previously, a hack that only
  worked right for white interiors and black borders was used).  Advertise
  this by changing the default colors to a red interior and a white
  border (the same as the kernel default).  Add undocumented env variables
  for changing these colors.  Also change to the larger and better-shaped
  16x10 cursor sometimes used in the kernel.  The kernel choice is
  fancier, but libvgl is closer to supporting the larger cursors needed
  in newer modes.
  
  The (n)and-or logic for the cursor doesn't work right for more than 2
  colors.  The (n)and part only masks out all color bits for the pixel
  under the cursor when all bits are set in the And mask.  With more
  complicated logic, the non-masked bits could be used to implement
  translucent cursors, but they actually just gave strange colors
  (especially in packed and planar modes where the bits are indirect
  through 1 or 2 palettes so it is hard to predict the final color).
  They also gave a bug for writing pixels under the cursor.  The
  non-masked bits under the cursor were not combined in this case.
  
  Drop support for combining with bits under the cursor by making any nonzero
  value in the And mask mean all bits set.
  
  Convert the Or mask (which is represented as a half-initialized 256-color
  bitmap) to a fully initialized bitmap with the correct number of colors.
  The 256-color representation must be as in 3:3:2 direct mode iff the final
  bitmap has more than 256 colors.  The conversion of colors is not very
  efficient, so convert at initialization time.

Modified:
  head/lib/libvgl/bitmap.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/simple.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/bitmap.c
==
--- head/lib/libvgl/bitmap.cMon Apr 22 19:24:21 2019(r346579)
+++ head/lib/libvgl/bitmap.cMon Apr 22 19:31:16 2019(r346580)
@@ -274,3 +274,27 @@ VGLBitmapAllocateBits(VGLBitmap *object)
 return -1;
   return 0;
 }
+
+void
+VGLBitmapCvt(VGLBitmap *src, VGLBitmap *dst)
+{
+  u_long color;
+  int dstpos, i, pb, size, srcpb, srcpos;
+
+  size = src->VXsize * src->VYsize;
+  srcpb = src->PixelBytes;
+  if (srcpb <= 0)
+srcpb = 1;
+  pb = dst->PixelBytes;
+  if (pb == srcpb) {
+bcopy(src->Bitmap, dst->Bitmap, size * pb);
+return;
+  }
+  if (srcpb != 1)
+return;/* not supported */
+  for (srcpos = dstpos = 0; srcpos < size; srcpos++) {
+color = VGLrgb332ToNative(src->Bitmap[srcpos]);
+for (i = 0; i < pb; i++, color >>= 8)
+dst->Bitmap[dstpos++] = color;
+  }
+}

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Mon Apr 22 19:24:21 2019(r346579)
+++ head/lib/libvgl/mouse.c Mon Apr 22 19:31:16 2019(r346580)
@@ -39,7 +39,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "vgl.h"
 
-#define X 0xff
+#define BORDER 0xff/* default border -- light white in rgb 3:3:2 */
+#define INTERIOR 0xa0  /* default interior -- red in rgb 3:3:2 */
+#define X  0xff/* any nonzero in And mask means part of cursor */
+#define B  BORDER
+#define I  INTERIOR
 static byte StdAndMask[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE] = {
X,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
X,X,X,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -49,34 +53,36 @@ static byte StdAndMask[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE] 
X,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0,
X,X,X,X,X,X,X,X,0,0,0,0,0,0,0,0,
X,X,X,X,X,X,X,X,X,0,0,0,0,0,0,0,
+   X,X,X,X,X,X,X,X,X,X,0,0,0,0,0,0,
+   X,X,X,X,X,X,X,X,X,X,0,0,0,0,0,0,
X,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0,
-   0,0,0,X,X,X,X,0,0,0,0,0,0,0,0,0,
-   0,0,0,X,X,X,X,X,0,0,0,0,0,0,0,0,
-   0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,0,
-   0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+   X,X,X,0,X,X,X,X,0,0,0,0,0,0,0,0,
+   X,X,0,0,X,X,X,X,0,0,0,0,0,0,0,0,
+   0,0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,
+   0,0,0,0,0,X,X,X,X,0,0,0,0,0,0,0,
+   0,0,0,0,0,0,X,X,0,0,0,0,0,0,0,0,
 };
 static byte StdOrMask[MOUSE_IMG_SIZE*MOUSE_IMG_SIZE] = {
-   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,X,X,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,X,X,X,0,0,0,0,0,0,0,0,0,0,0,0,
-   0,X,X,X,X,0,0,0,0,0,0,0,0,0,0,0,
-   0,X,X,X,X,X,0,0,0,0,0,0,0,0,0,0,
-   0,X,X,X,X,X,X,0,0,0,0,0,0,0,0,0,
-   0,X,X,0,X,0,0,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,X,X,0,0,0,0,0,0,0,0,0,
-   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-   

svn commit: r346641 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Wed Apr 24 16:03:35 2019
New Revision: 346641
URL: https://svnweb.freebsd.org/changeset/base/346641

Log:
  Avoid hiding and unhiding the mouse cursor when copying bitmaps to the
  screen.  Instead, copy a merged bitmap 1 line at a time.
  
  This fixes flashing of the cursor and is faster in all modes (especially
  in planar modes).

Modified:
  head/lib/libvgl/bitmap.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/bitmap.c
==
--- head/lib/libvgl/bitmap.cWed Apr 24 15:54:18 2019(r346640)
+++ head/lib/libvgl/bitmap.cWed Apr 24 16:03:35 2019(r346641)
@@ -167,8 +167,17 @@ int
 __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
  VGLBitmap *dst, int dstx, int dsty, int width, int hight)
 {
-  int srcline, dstline, yend, yextra, ystep;
-
+  byte *buffer, *p;
+  int mousemerge, srcline, dstline, yend, yextra, ystep;
+  
+  mousemerge = 0;
+  if (hight < 0) {
+hight = -hight;
+mousemerge = (dst == VGLDisplay &&
+ VGLMouseOverlap(dstx, dsty, width, hight));
+if (mousemerge)
+  buffer = alloca(width*src->PixelBytes);
+  }
   if (srcx>src->VXsize || srcy>src->VYsize
|| dstx>dst->VXsize || dsty>dst->VYsize)
 return -1;  
@@ -204,8 +213,13 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
   }
   for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend;
srcline += ystep, dstline += ystep) {
-WriteVerticalLine(dst, dstx, dstline, width, 
-  src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes);
+p = src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes;
+if (mousemerge && VGLMouseOverlap(dstx, dstline, width, 1)) {
+  bcopy(p, buffer, width*src->PixelBytes);
+  p = buffer;
+  VGLMouseMerge(dstx, dstline, width, p);
+}
+WriteVerticalLine(dst, dstx, dstline, width, p);
   }
   return 0;
 }
@@ -214,36 +228,29 @@ int
 VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
  VGLBitmap *dst, int dstx, int dsty, int width, int hight)
 {
-  int error, mouseoverlap;
+  int error;
 
+  if (hight < 0)
+return -1;
   if (src == VGLDisplay)
 src = 
   if (src->Type != MEMBUF)
 return -1; /* invalid */
   if (dst == VGLDisplay) {
 VGLMouseFreeze();
-mouseoverlap = VGLMouseOverlap(dstx, dsty, width, hight);
-if (mouseoverlap)
-  VGLMousePointerHide();
+__VGLBitmapCopy(src, srcx, srcy, , dstx, dsty, width, hight);
 error = __VGLBitmapCopy(src, srcx, srcy, , dstx, dsty,
 width, hight);
-if (error != 0) {
-  if (mouseoverlap)
-VGLMousePointerShow();
-  VGLMouseUnFreeze();
+if (error != 0)
   return error;
-}
 src = 
 srcx = dstx;
 srcy = dsty;
   } else if (dst->Type != MEMBUF)
 return -1; /* invalid */
-  error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight);
-  if (dst == VGLDisplay) {
-if (mouseoverlap)
-  VGLMousePointerShow();
+  error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, -hight);
+  if (dst == VGLDisplay)
 VGLMouseUnFreeze();
-  }
   return error;
 }
 

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Wed Apr 24 15:54:18 2019(r346640)
+++ head/lib/libvgl/mouse.c Wed Apr 24 16:03:35 2019(r346641)
@@ -356,6 +356,25 @@ VGLMouseOverlap(int x, int y, int width, int hight)
 }
 
 void
+VGLMouseMerge(int x, int y, int width, byte *line)
+{
+  int pos, x1, xend, xstart;
+
+  xstart = x;
+  if (xstart < VGLMouseXpos)
+xstart = VGLMouseXpos;
+  xend = x + width;
+  if (xend > VGLMouseXpos + MOUSE_IMG_SIZE)
+xend = VGLMouseXpos + MOUSE_IMG_SIZE;
+  for (x1 = xstart; x1 < xend; x1++) {
+pos = (y - VGLMouseYpos) * MOUSE_IMG_SIZE + x1 - VGLMouseXpos;
+if (VGLMouseAndMask->Bitmap[pos])
+  bcopy(>Bitmap[pos * VGLDisplay->PixelBytes],
+[(x1 - x) * VGLDisplay->PixelBytes], VGLDisplay->PixelBytes);
+  }
+}
+
+void
 VGLMouseUnFreeze()
 {
   INTON();

Modified: head/lib/libvgl/vgl.h
==
--- head/lib/libvgl/vgl.h   Wed Apr 24 15:54:18 2019(r346640)
+++ head/lib/libvgl/vgl.h   Wed Apr 24 16:03:35 2019(r346641)
@@ -136,6 +136,7 @@ void VGLMouseRestore(void);
 int VGLMouseStatus(int *x, int *y, char *buttons);
 void VGLMouseFreeze(void);
 int VGLMouseFreezeXY(int x, int y);
+void VGLMouseMerge(int x, int y, int width, byte *line);
 int VGLMouseOverlap(int x, int y, int width, int hight);
 void VGLMouseUnFreeze(void);
 /* simple.c */


___
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: r346590 - head/sys/powerpc/pseries

2019-09-03 Thread Justin Hibbits
Author: jhibbits
Date: Tue Apr 23 03:19:03 2019
New Revision: 346590
URL: https://svnweb.freebsd.org/changeset/base/346590

Log:
  [PowerPC64] pseries-llan: increment packet output counters on error and 
success
  
  Summary: when using pseries-llan driver, Opkts and Oerrs counters (netstat
  -i) are always zero. This patch adds an small error handling to increment
  these counters.
  
  Submitted by: alfredo.junior_eldorado.org.br
  Differential Revision: https://reviews.freebsd.org/D20009

Modified:
  head/sys/powerpc/pseries/phyp_llan.c

Modified: head/sys/powerpc/pseries/phyp_llan.c
==
--- head/sys/powerpc/pseries/phyp_llan.cTue Apr 23 03:05:26 2019
(r346589)
+++ head/sys/powerpc/pseries/phyp_llan.cTue Apr 23 03:19:03 2019
(r346590)
@@ -425,7 +425,7 @@ llan_send_packet(void *xsc, bus_dma_segment_t *segs, i
 {
struct llan_softc *sc = xsc;
uint64_t bufdescs[6];
-   int i;
+   int i, err;
 
bzero(bufdescs, sizeof(bufdescs));
 
@@ -435,7 +435,7 @@ llan_send_packet(void *xsc, bus_dma_segment_t *segs, i
bufdescs[i] |= segs[i].ds_addr;
}
 
-   phyp_hcall(H_SEND_LOGICAL_LAN, sc->unit, bufdescs[0],
+   err = phyp_hcall(H_SEND_LOGICAL_LAN, sc->unit, bufdescs[0],
bufdescs[1], bufdescs[2], bufdescs[3], bufdescs[4], bufdescs[5], 0);
/*
 * The hypercall returning implies completion -- or that the call will
@@ -443,6 +443,10 @@ llan_send_packet(void *xsc, bus_dma_segment_t *segs, i
 * H_BUSY based on the continuation token in R4. For now, just drop
 * the packet in such cases.
 */
+   if (err == H_SUCCESS)
+   if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1);
+   else
+   if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1);
 }
 
 static void


___
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: r346617 - head/tests/sys/opencrypto

2019-09-03 Thread John Baldwin
Author: jhb
Date: Wed Apr 24 00:23:06 2019
New Revision: 346617
URL: https://svnweb.freebsd.org/changeset/base/346617

Log:
  Test the AES-CCM test vectors from the NIST Known Answer Tests.
  
  The CCM test vectors use a slightly different file format in that
  there are global key-value pairs as well as section key-value pairs
  that need to be used in each test.  In addition, the sections can set
  multiple key-value pairs in the section name.  The CCM KAT parser
  class is an iterator that returns a dictionary once per test where the
  dictionary contains all of the relevant key-value pairs for a given
  test (global, section name, section, test-specific).
  
  Note that all of the CCM decrypt tests use nonce and tag lengths that
  are not supported by OCF (OCF only supports a 12 byte nonce and 16
  byte tag), so none of the decryption vectors are actually tested.
  
  Reviewed by:  ngie
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D19978

Modified:
  head/tests/sys/opencrypto/cryptodev.py
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptodev.py
==
--- head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 00:16:39 2019
(r346616)
+++ head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 00:23:06 2019
(r346617)
@@ -381,6 +381,112 @@ class KATParser:
 
yield values
 
+# The CCM files use a bit of a different syntax that doesn't quite fit
+# the generic KATParser.  In particular, some keys are set globally at
+# the start of the file, and some are set globally at the start of a
+# section.
+class KATCCMParser:
+   def __init__(self, fname):
+   self.fp = open(fname)
+   self._pending = None
+   self.read_globals()
+
+   def read_globals(self):
+   self.global_values = {}
+   while True:
+   line = self.fp.readline()
+   if not line:
+   return
+   if line[0] == '#' or not line.strip():
+   continue
+   if line[0] == '[':
+   self._pending = line
+   return
+
+   try:
+   f, v = line.split(' =')
+   except:
+   print('line:', repr(line))
+   raise
+
+   v = v.strip()
+
+   if f in self.global_values:
+   raise ValueError('already present: %r' % 
repr(f))
+   self.global_values[f] = v
+
+   def read_section_values(self, kwpairs):
+   self.section_values = self.global_values.copy()
+   for pair in kwpairs.split(', '):
+   f, v = pair.split(' = ')
+   if f in self.section_values:
+   raise ValueError('already present: %r' % 
repr(f))
+   self.section_values[f] = v
+
+   while True:
+   line = self.fp.readline()
+   if not line:
+   return
+   if line[0] == '#' or not line.strip():
+   continue
+   if line[0] == '[':
+   self._pending = line
+   return
+
+   try:
+   f, v = line.split(' =')
+   except:
+   print('line:', repr(line))
+   raise
+
+   if f == 'Count':
+   self._pending = line
+   return
+
+   v = v.strip()
+
+   if f in self.section_values:
+   raise ValueError('already present: %r' % 
repr(f))
+   self.section_values[f] = v
+
+   def __iter__(self):
+   while True:
+   if self._pending:
+   line = self._pending
+   self._pending = None
+   else:
+   line = self.fp.readline()
+   if not line:
+   return
+
+   if (line and line[0] == '#') or not line.strip():
+   continue
+
+   if line[0] == '[':
+   section = line[1:].split(']', 1)[0]
+   self.read_section_values(section)
+   continue
+
+   values = self.section_values.copy()
+
+  

Re: Panic with r346530 [Re: svn commit: r346530 - in head/sys: netinet netinet6]

2019-09-03 Thread Hans Petter Selasky

On 4/22/19 3:28 PM, Kristof Provost wrote:

On 22 Apr 2019, at 12:25, Enji Cooper wrote:
Either the sys/netinet/ or sys/netipsec/ tests triggered the panic. 
Not sure which right now.


That looks to be happening during a vnet jail teardown, so it’s likely 
the sys/netipsec or sys/netpfil/pf tests.


I’ve done a quick test with the pf tests, and they provoke this panic:

 panic: mtx_lock() of destroyed mutex @ 
/usr/src/sys/netinet/ip_reass.c:628

 cpuid = 0
 time = 1555939645
 KDB: stack backtrace:
 db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfe0091d68530

 vpanic() at vpanic+0x19d/frame 0xfe0091d68580
 panic() at panic+0x43/frame 0xfe0091d685e0
 __mtx_lock_flags() at __mtx_lock_flags+0x12e/frame 0xfe0091d68630
 ipreass_cleanup() at ipreass_cleanup+0x86/frame 0xfe0091d68670
 if_detach_internal() at if_detach_internal+0x786/frame 
0xfe0091d686f0

 if_detach() at if_detach+0x3d/frame 0xfe0091d68710
 lo_clone_destroy() at lo_clone_destroy+0x16/frame 0xfe0091d68730
 if_clone_destroyif() at if_clone_destroyif+0x21f/frame 
0xfe0091d68780

 if_clone_detach() at if_clone_detach+0xb8/frame 0xfe0091d687b0
 vnet_loif_uninit() at vnet_loif_uninit+0x26/frame 0xfe0091d687d0
 vnet_destroy() at vnet_destroy+0x124/frame 0xfe0091d68800
 prison_deref() at prison_deref+0x29d/frame 0xfe0091d68840
 sys_jail_remove() at sys_jail_remove+0x28f/frame 0xfe0091d68890
 amd64_syscall() at amd64_syscall+0x276/frame 0xfe0091d689b0
 fast_syscall_common() at fast_syscall_common+0x101/frame 
0xfe0091d689b0
 --- syscall (508, FreeBSD ELF64, sys_jail_remove), rip = 
0x80031e12a, rsp = 0x7fffe848, rbp = 0x7fffe8d0 ---

 KDB: enter: panic
 [ thread pid 1223 tid 100501 ]
 Stopped at  kdb_enter+0x3b: movq    $0,kdb_why
 db>

To reproduce:

     kldload pfsync
     cd /usr/tests/sys/netpfil/pf
     sudo kyua test



I'll revert r346530 until further testing has taken place.

Thank you!

--HPS



___
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: r346625 - head/tests/sys/opencrypto

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Wed Apr 24 05:47:09 2019
New Revision: 346625
URL: https://svnweb.freebsd.org/changeset/base/346625

Log:
  Don't leak `fd` when manipulating the device via `_getdev()`
  
  Close the file descriptor when done calling ioctl with a try-finally block so
  it doesn't get leaked.
  
  MFC after:2 months

Modified:
  head/tests/sys/opencrypto/cryptodev.py

Modified: head/tests/sys/opencrypto/cryptodev.py
==
--- head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 05:24:10 2019
(r346624)
+++ head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 05:47:09 2019
(r346625)
@@ -122,10 +122,12 @@ CIOCFINDDEV = 3223610220
 CIOCCRYPTAEAD = 3225445229
 
 def _getdev():
-fd = os.open('/dev/crypto', os.O_RDWR)
 buf = array.array('I', [0])
-ioctl(fd, CRIOGET, buf, 1)
-os.close(fd)
+fd = os.open('/dev/crypto', os.O_RDWR)
+try:
+ioctl(fd, CRIOGET, buf, 1)
+finally:
+os.close(fd)
 
 return buf[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: r346588 - head/lib/libc/powerpc64/string

2019-09-03 Thread Justin Hibbits
Author: jhibbits
Date: Tue Apr 23 02:53:53 2019
New Revision: 346588
URL: https://svnweb.freebsd.org/changeset/base/346588

Log:
  powerpc64: Rewrite strcmp in asm to take advantage of word size
  
  Summary:
  Optimize strcmp for powerpc64.
  Data is loaded by double words and cmpb intruction is used to find '\0'.
  
  Some performance gain rates between the current and the optimized solution:
  
  String size (bytes)   Gain rate
<=8 0.59%
<=161.92%
32  3.02%
64  5.60%
128 10.16%
256 18.05%
512 30.18%
102442.82%
  
  Submitted by: alexandre.yamashita_eldorado.org.br,
leonardo.bianconi_eldorado.org.br
  Differential Revision: https://reviews.freebsd.org/D15220

Added:
  head/lib/libc/powerpc64/string/
  head/lib/libc/powerpc64/string/Makefile.inc   (contents, props changed)
  head/lib/libc/powerpc64/string/strcmp.S   (contents, props changed)

Added: head/lib/libc/powerpc64/string/Makefile.inc
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/powerpc64/string/Makefile.inc Tue Apr 23 02:53:53 2019
(r346588)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+MDSRCS+= \
+   strcmp.S

Added: head/lib/libc/powerpc64/string/strcmp.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/powerpc64/string/strcmp.S Tue Apr 23 02:53:53 2019
(r346588)
@@ -0,0 +1,207 @@
+/*-
+ * Copyright (c) 2018 Instituto de Pesquisas Eldorado
+ * All rights reserved.
+ *
+ * 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
+ * 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
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#if 0
+   RCSID("$NetBSD: strcmp.S,v 1.0 2018/05/10 12:33:02 alexandre Exp $")
+#endif
+
+/* Alignment mask. */
+#define STRCMP_MULTI_ALIGNMENT_BYTES 8
+#define STRCMP_MULTI_ALIGNMENT_MASK (STRCMP_MULTI_ALIGNMENT_BYTES - 1)
+
+ENTRY(strcmp)
+   /* Starting alignment even if aligned, avoiding performance
+* degradation for short strings.
+*/
+   lbz %r5,0(%r3)  /* Load chars. */
+   lbz %r6,0(%r4)
+   cmpd%r5,%r6 /* Check if chars are different. */
+   bne .Lstrcmp_end
+   cmpdi   %r5,0   /* Check if char is zero. */
+   beq .Lstrcmp_end
+
+   /* Checking if addresses can be aligned, otherwise copy by byte */
+   xor %r7,%r3,%r4
+   andi.   %r7,%r7,STRCMP_MULTI_ALIGNMENT_MASK
+   bne .Lstrcmp_compare_by_byte_loop
+
+.Lstrcmp_param1_align_loop:
+   lbzu%r5,1(%r3)  /* Load chars. */
+   lbzu%r6,1(%r4)
+   cmpd%r5,%r6 /* Check if chars are different. */
+   bne .Lstrcmp_end
+   cmpdi   %r5,0   /* Check if char is zero. */
+   beq .Lstrcmp_end
+   andi.   %r7,%r3,STRCMP_MULTI_ALIGNMENT_MASK /* Check alignment. */
+   bne .Lstrcmp_param1_align_loop
+
+.Lstrcmp_param1_aligned:
+   /* If parameter 2 is aligned compare by qword/word,
+* else compare by byte. */
+   andi.   %r7,%r4,STRCMP_MULTI_ALIGNMENT_MASK
+   beq .Lstrcmp_compare_by_word
+   lbz %r5,0(%r3)  /* Load chars. */
+   lbz %r6,0(%r4)
+   cmpd%r5,%r6 /* Check if chars are different. */
+   bne+.Lstrcmp_end
+   cmpdi   %r5,0   /* Check if char is zero. */
+   beq+.Lstrcmp_end
+

Re: svn commit: r346315 - head/lib/libcasper/services/cap_fileargs

2019-09-03 Thread Ed Maste
On Tue, 23 Apr 2019 at 00:07, Yoshihiro Ota  wrote:
>
> It looks this change is causing 'make xdev TARGET=mips TARGET_ARCH=mips' to 
> fail as the following with HEAD checked out under "/usr/obj/freebsd":

Hello Hiro-san, sorry about that.

I tried `make xdev TARGET=mips TARGET_ARCH=mips` on HEAD just now (but
it failed on the install as DESTDIR wasn't set and I ran as non-root).
Just `make xdev-build` was successful though.

What version were you trying to build? There were (several) followup
commits to address issues with the initial commit of cap_fileargs
lstat support.


___
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: r346593 - head/sys/sys

2019-09-03 Thread Wojciech Macek
Author: wma
Date: Tue Apr 23 06:36:32 2019
New Revision: 346593
URL: https://svnweb.freebsd.org/changeset/base/346593

Log:
  This patch offers a workaround to buf_ring reordering
  visible on armv7 and armv8. Similar issue to rS302292.
  
  Obtained from: Semihalf
  Authored by:   Michal Krawczyk 
  Approved by:   wma
  Differential Revision: https://reviews.freebsd.org/D19932

Modified:
  head/sys/sys/buf_ring.h

Modified: head/sys/sys/buf_ring.h
==
--- head/sys/sys/buf_ring.h Tue Apr 23 04:06:26 2019(r346592)
+++ head/sys/sys/buf_ring.h Tue Apr 23 06:36:32 2019(r346593)
@@ -310,14 +310,23 @@ buf_ring_peek_clear_sc(struct buf_ring *br)
if (!mtx_owned(br->br_lock))
panic("lock not held on single consumer dequeue");
 #endif 
-   /*
-* I believe it is safe to not have a memory barrier
-* here because we control cons and tail is worst case
-* a lagging indicator so we worst case we might
-* return NULL immediately after a buffer has been enqueued
-*/
+
if (br->br_cons_head == br->br_prod_tail)
return (NULL);
+
+#if defined(__arm__) || defined(__aarch64__)
+   /*
+* The barrier is required there on ARM and ARM64 to ensure, that
+* br->br_ring[br->br_cons_head] will not be fetched before the above
+* condition is checked.
+* Without the barrier, it is possible, that buffer will be fetched
+* before the enqueue will put mbuf into br, then, in the meantime, the
+* enqueue will update the array and the br_prod_tail, and the
+* conditional check will be true, so we will return previously fetched
+* (and invalid) buffer.
+*/
+   atomic_thread_fence_acq();
+#endif
 
 #ifdef DEBUG_BUFRING
/*


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Enji Cooper

> On Apr 22, 2019, at 1:50 PM, Rodney W. Grimes  
> wrote:

…

> It still does not dis-associate mav's copyright with the All rights reserved 
> clause,
> as it appears as if he did an insert of copyright bewteen the 2, thus giving
> grey assertion by him of that clause.
> 
> Again, please get mav@ to signoff and I am all happy!  Though I would
> like it documented in a commit.

Hi Alexander,
Are you ok with my removing “All rights reserved” from 
share/man/man4/cfiscsi.4 in r346571?
Thank you!
-Enji
___
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: r346633 - head/sys/riscv/riscv

2019-09-03 Thread Ruslan Bukin
Author: br
Date: Wed Apr 24 13:41:46 2019
New Revision: 346633
URL: https://svnweb.freebsd.org/changeset/base/346633

Log:
  Implement pic_pre_ithread(), pic_post_ithread().
  
  Reviewed by:  markj
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D19819

Modified:
  head/sys/riscv/riscv/plic.c

Modified: head/sys/riscv/riscv/plic.c
==
--- head/sys/riscv/riscv/plic.c Wed Apr 24 13:32:04 2019(r346632)
+++ head/sys/riscv/riscv/plic.c Wed Apr 24 13:41:46 2019(r346633)
@@ -249,6 +249,30 @@ plic_attach(device_t dev)
return (intr_pic_claim_root(sc->dev, xref, plic_intr, sc, 0));
 }
 
+static void
+plic_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
+{
+   struct plic_softc *sc;
+   struct plic_irqsrc *src;
+
+   sc = device_get_softc(dev);
+   src = (struct plic_irqsrc *)isrc;
+
+   WR4(sc, PLIC_PRIORITY(src->irq), 0);
+}
+
+static void
+plic_post_ithread(device_t dev, struct intr_irqsrc *isrc)
+{
+   struct plic_softc *sc;
+   struct plic_irqsrc *src;
+
+   sc = device_get_softc(dev);
+   src = (struct plic_irqsrc *)isrc;
+
+   WR4(sc, PLIC_PRIORITY(src->irq), 1);
+}
+
 static device_method_t plic_methods[] = {
DEVMETHOD(device_probe, plic_probe),
DEVMETHOD(device_attach,plic_attach),
@@ -256,6 +280,8 @@ static device_method_t plic_methods[] = {
DEVMETHOD(pic_disable_intr, plic_disable_intr),
DEVMETHOD(pic_enable_intr,  plic_enable_intr),
DEVMETHOD(pic_map_intr, plic_map_intr),
+   DEVMETHOD(pic_pre_ithread,  plic_pre_ithread),
+   DEVMETHOD(pic_post_ithread, plic_post_ithread),
 
DEVMETHOD_END
 };


___
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: r346614 - head/tests/sys/opencrypto

2019-09-03 Thread John Baldwin
Author: jhb
Date: Wed Apr 24 00:10:21 2019
New Revision: 346614
URL: https://svnweb.freebsd.org/changeset/base/346614

Log:
  Skip tests with missing test vectors instead of failing.
  
  This copes more gracefully when older version of the nist-kat package
  are intalled that don't have newer test vectors such as CCM or plain
  SHA.
  
  If the nist-kat package is not installed at all, this still fails with
  an error.
  
  Reviewed by:  cem
  MFC after:1 month
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20034

Modified:
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptotest.py
==
--- head/tests/sys/opencrypto/cryptotest.py Tue Apr 23 22:43:47 2019
(r346613)
+++ head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 00:10:21 2019
(r346614)
@@ -42,7 +42,9 @@ from glob import iglob
 katdir = '/usr/local/share/nist-kat'
 
 def katg(base, glob):
-   assert os.path.exists(os.path.join(katdir, base)), "Please 'pkg install 
nist-kat'"
+   assert os.path.exists(katdir), "Please 'pkg install nist-kat'"
+   if not os.path.exists(os.path.join(katdir, base)):
+   raise unittest.SkipTest("Missing %s test vectors" % (base))
return iglob(os.path.join(katdir, base, glob))
 
 aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ]


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Enji Cooper (yaneurabeya)

> On Apr 22, 2019, at 12:19, Edward Napierala  wrote:
> 
> On Mon, 22 Apr 2019 at 20:01, Rodney W. Grimes
>  wrote:
>> 
>>> Author: ngie
>>> Date: Mon Apr 22 17:52:46 2019
>>> New Revision: 346571
>>> URL: https://svnweb.freebsd.org/changeset/base/346571
>>> 
>>> Log:
>>>  Update the spelling of my name
>>> 
>>>  Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use 
>>> Enji
>>>  instead for clarity.
>>> 
>>>  While here, remove "All Rights Reserved" from copyrights I "own".
> 
> [..]
> 
>>> Modified: head/share/man/man4/cfiscsi.4
>>> ==
>>> --- head/share/man/man4/cfiscsi.4 Mon Apr 22 17:48:10 2019
>>> (r346570)
>>> +++ head/share/man/man4/cfiscsi.4 Mon Apr 22 17:52:46 2019
>>> (r346571)
>>> @@ -1,7 +1,6 @@
>>> .\" Copyright (c) 2013 Edward Tomasz Napierala
>>> .\" Copyright (c) 2015-2017 Alexander Motin 
>>> -.\" Copyright (c) 2017 Ngie Cooper 
>>> -.\" All rights reserved.
>>> +.\" Copyright (c) 2017 Enji Cooper 
>> 
>> We should investiage the history of this All rights reserved,
>> I suspect it actually originally belongs to traz and possibly
>> mav, and not explicity you due to prior habbits.  If you have
>> already done that investigation (ie, you added the line) ignore
>> my comment.  If however you simply added a copyright between
>> the line and some other copyright please restore this line
>> to its prior state.
> 
> FWIW, I'm perfectly fine with this.

The lineage is complicated: trasz@ was the original person that put 
“All rights reserved” in the iscsi.4 copyright, and I based manpage on the 
iscsi.4 manpage, so I thought it was appropriate for me to remove the 
copyright. trasz@ signing off on this resolves the only potential gray area 
with this change.
Thank you though for following up.
-Enji

___
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: r346576 - head/share/mk

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Mon Apr 22 18:40:46 2019
New Revision: 346576
URL: https://svnweb.freebsd.org/changeset/base/346576

Log:
  Fix up CXXSTD support originally added in r345708
  
  r345708 worked for the base system, but unfortunately, caused a lot of
  disruption for third-party packages that relied on C++, since bsd.sys.mk is
  used by applications outside the base system. The defaults picked didn't match
  the compiler's defaults and broke some builds that didn't specify a standard,
  as well as some that overrode the value by setting `-std=gnu++14` (for
  example) manually.
  
  This change takes a more relaxed approach to appending `-std=${CXXSTD}` to
  CXXFLAGS, by only doing so when the value is specified, as opposed to
  overriding the standard set by an end-user. This avoids the need for having
  to bake NOP default into bsd.sys.mk for supported compiler-toolchain
  versions.
  
  In order to make this change possible, add CXXSTD to Makefile snippets which
  relied on the default value (c++11) added in r345708.
  
  MFC after:  2 weeks
  MFC with:   r345708, r346574
  Reviewed by:emaste
  Reported by:jbeich
  Differential Revision: https://reviews.freebsd.org/D19895 (as part of a 
larger change)

Modified:
  head/share/mk/bsd.sys.mk
  head/share/mk/googletest.test.inc.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkMon Apr 22 18:40:24 2019(r346575)
+++ head/share/mk/bsd.sys.mkMon Apr 22 18:40:46 2019(r346576)
@@ -25,17 +25,9 @@ CFLAGS+= -std=iso9899:1999
 CFLAGS+=   -std=${CSTD}
 .endif # CSTD
 
-.if ${COMPILER_FEATURES:Mc++11}
-CXXSTD?=   c++11
-.elif ${COMPILER_TYPE} == "gcc"
-# Prior versions of g++ support C++98 with GNU extensions by default.
-CXXSTD?=   gnu++98
-.else
-# Assume that the compiler supports at least C++98.
-CXXSTD?=   c++98
-.endif
+.if !empty(CXXSTD)
 CXXFLAGS+= -std=${CXXSTD}
-# CXXSTD
+.endif
 
 # -pedantic is problematic because it also imposes namespace restrictions
 #CFLAGS+=  -pedantic

Modified: head/share/mk/googletest.test.inc.mk
==
--- head/share/mk/googletest.test.inc.mkMon Apr 22 18:40:24 2019
(r346575)
+++ head/share/mk/googletest.test.inc.mkMon Apr 22 18:40:46 2019
(r346576)
@@ -9,4 +9,6 @@ GTESTS_CXXFLAGS+= -frtti
 # libgmock's, etc, headers.
 CXXFLAGS+= -I${DESTDIR}${INCLUDEDIR}/private
 
+CXXSTD?=   c++11
+
 NO_WTHREAD_SAFETY=


___
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: r346632 - head/sys/net

2019-09-03 Thread Andrew Gallatin
Author: gallatin
Date: Wed Apr 24 13:32:04 2019
New Revision: 346632
URL: https://svnweb.freebsd.org/changeset/base/346632

Log:
  iflib: Add pfil hooks
  
  As with mlx5en, the idea is to drop unwanted traffic as early
  in receive as possible, before mbufs are allocated and anything
  is passed up the stack.  This can save considerable CPU time
  when a machine is under a flooding style DOS attack.
  
  The major change here is to remove the unneeded abstraction where
  callers of rxd_frag_to_sd() get back a pointer to the mbuf ring, and
  are responsible for NULL'ing that mbuf themselves. Now this happens
  directly in rxd_frag_to_sd(), and it returns an mbuf. This allows us
  to use the decision (and potentially mbuf) returned by the pfil
  hooks. The driver can now recycle mbufs to avoid re-allocation when
  packets are dropped.
  
  Reviewed by:  marius  (shurd and erj also provided feedback)
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D19645

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cWed Apr 24 13:15:56 2019(r346631)
+++ head/sys/net/iflib.cWed Apr 24 13:32:04 2019(r346632)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -432,6 +433,7 @@ struct iflib_rxq {
if_ctx_tifr_ctx;
iflib_fl_t  ifr_fl;
uint64_tifr_rx_irq;
+   struct pfil_head*pfil;
uint16_tifr_id;
uint8_t ifr_lro_enabled;
uint8_t ifr_nfl;
@@ -451,7 +453,6 @@ struct iflib_rxq {
 
 typedef struct if_rxsd {
caddr_t *ifsd_cl;
-   struct mbuf **ifsd_m;
iflib_fl_t ifsd_fl;
qidx_t ifsd_cidx;
 } *if_rxsd_t;
@@ -652,7 +653,6 @@ static int iflib_fast_intrs;
 static int iflib_rx_unavail;
 static int iflib_rx_ctx_inactive;
 static int iflib_rx_if_input;
-static int iflib_rx_mbuf_null;
 static int iflib_rxd_flush;
 
 static int iflib_verbose_debug;
@@ -669,8 +669,6 @@ SYSCTL_INT(_net_iflib, OID_AUTO, rx_ctx_inactive, CTLF
   _rx_ctx_inactive, 0, "# times rxeof called with 
inactive context");
 SYSCTL_INT(_net_iflib, OID_AUTO, rx_if_input, CTLFLAG_RD,
   _rx_if_input, 0, "# times rxeof called if_input");
-SYSCTL_INT(_net_iflib, OID_AUTO, rx_mbuf_null, CTLFLAG_RD,
-  _rx_mbuf_null, 0, "# times rxeof got null mbuf");
 SYSCTL_INT(_net_iflib, OID_AUTO, rxd_flush, CTLFLAG_RD,
 _rxd_flush, 0, "# times rxd_flush called");
 SYSCTL_INT(_net_iflib, OID_AUTO, verbose_debug, CTLFLAG_RW,
@@ -689,7 +687,7 @@ iflib_debug_reset(void)
iflib_task_fn_rxs = iflib_rx_intr_enables = iflib_fast_intrs =
iflib_rx_unavail =
iflib_rx_ctx_inactive = iflib_rx_if_input =
-   iflib_rx_mbuf_null = iflib_rxd_flush = 0;
+   iflib_rxd_flush = 0;
 }
 
 #else
@@ -2002,11 +2000,12 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
bus_dmamap_sync(fl->ifl_buf_tag, sd_map[frag_idx],
BUS_DMASYNC_PREREAD);
 
-   MPASS(sd_m[frag_idx] == NULL);
-   if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) {
-   break;
+   if (sd_m[frag_idx] == NULL) {
+   if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) {
+   break;
+   }
+   sd_m[frag_idx] = m;
}
-   sd_m[frag_idx] = m;
bit_set(fl->ifl_rx_bitmap, frag_idx);
 #if MEMORY_LOGGING
fl->ifl_m_enqueued++;
@@ -2483,13 +2482,15 @@ prefetch_pkts(iflib_fl_t fl, int cidx)
prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]);
 }
 
-static void
-rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int unload, if_rxsd_t sd)
+static struct mbuf *
+rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, bool unload, if_rxsd_t sd,
+int *pf_rv, if_rxd_info_t ri)
 {
-   int flid, cidx;
bus_dmamap_t map;
iflib_fl_t fl;
-   int next;
+   caddr_t payload;
+   struct mbuf *m;
+   int flid, cidx, len, next;
 
map = NULL;
flid = irf->irf_flid;
@@ -2497,7 +2498,7 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int
fl = >ifr_fl[flid];
sd->ifsd_fl = fl;
sd->ifsd_cidx = cidx;
-   sd->ifsd_m = >ifl_sds.ifsd_m[cidx];
+   m = fl->ifl_sds.ifsd_m[cidx];
sd->ifsd_cl = >ifl_sds.ifsd_cl[cidx];
fl->ifl_credits--;
 #if MEMORY_LOGGING
@@ -2513,39 +2514,89 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int
/* not valid assert if bxe really does SGE from non-contiguous elements 
*/
MPASS(fl->ifl_cidx == cidx);
bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD);
+
+   if (rxq->pfil != 

svn commit: r346603 - in head/sys: amd64/linux32 i386/linux

2019-09-03 Thread Dmitry Chagin
Author: dchagin
Date: Tue Apr 23 18:10:46 2019
New Revision: 346603
URL: https://svnweb.freebsd.org/changeset/base/346603

Log:
  Since r339624 HEAD does not need for backslashes in syscalls.master,
  however to make a merge r345471 to the stable add backslashes
  to the syscalls.master.
  
  MFC after:3 days

Modified:
  head/sys/amd64/linux32/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Tue Apr 23 17:28:28 2019
(r346602)
+++ head/sys/amd64/linux32/syscalls.master  Tue Apr 23 18:10:46 2019
(r346603)
@@ -690,7 +690,7 @@
 383AUE_NULLSTD { int linux_statx(l_int dirfd,  
\
const char *pathname, l_uint flags, 
\
l_uint mask, void *statxbuf); }
-384AUE_NULLSTD { int linux_arch_prctl(l_int option,
+384AUE_NULLSTD { int linux_arch_prctl(l_int option,
\
l_ulong arg2); }
 ; Linux 4.18:
 385AUE_NULLSTD { int linux_io_pgetevents(void); }

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Tue Apr 23 17:28:28 2019
(r346602)
+++ head/sys/i386/linux/syscalls.master Tue Apr 23 18:10:46 2019
(r346603)
@@ -698,7 +698,7 @@
 383AUE_NULLSTD { int linux_statx(l_int dirfd,  
\
const char *pathname, l_uint flags, 
\
l_uint mask, void *statxbuf); }
-384AUE_PRCTL   STD { int linux_arch_prctl(l_int option,
+384AUE_PRCTL   STD { int linux_arch_prctl(l_int option,
\
l_ulong arg2); }
 ; Linux 4.18:
 385AUE_NULLSTD { int linux_io_pgetevents(void); }


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Rodney W. Grimes
> On Mon, 22 Apr 2019 at 20:01, Rodney W. Grimes
>  wrote:
> >
> > > Author: ngie
> > > Date: Mon Apr 22 17:52:46 2019
> > > New Revision: 346571
> > > URL: https://svnweb.freebsd.org/changeset/base/346571
> > >
> > > Log:
> > >   Update the spelling of my name
> > >
> > >   Previous spellings of my name (NGie, Ngie) weren't my legal spelling. 
> > > Use Enji
> > >   instead for clarity.
> > >
> > >   While here, remove "All Rights Reserved" from copyrights I "own".
> 
> [..]
> 
> > > Modified: head/share/man/man4/cfiscsi.4
> > > ==
> > > --- head/share/man/man4/cfiscsi.4 Mon Apr 22 17:48:10 2019
> > > (r346570)
> > > +++ head/share/man/man4/cfiscsi.4 Mon Apr 22 17:52:46 2019
> > > (r346571)
> > > @@ -1,7 +1,6 @@
> > >  .\" Copyright (c) 2013 Edward Tomasz Napierala
> > >  .\" Copyright (c) 2015-2017 Alexander Motin 
> > > -.\" Copyright (c) 2017 Ngie Cooper 
> > > -.\" All rights reserved.
> > > +.\" Copyright (c) 2017 Enji Cooper 
> >
> > We should investiage the history of this All rights reserved,
> > I suspect it actually originally belongs to traz and possibly
> > mav, and not explicity you due to prior habbits.  If you have
> > already done that investigation (ie, you added the line) ignore
> > my comment.  If however you simply added a copyright between
> > the line and some other copyright please restore this line
> > to its prior state.
> 
> FWIW, I'm perfectly fine with this.

Ok, thanks, then another step forward would be to get
mav's approval and then make a null commit noting that
all parties agree to the removal of All rights reserved.

This is too important of a detail to leave to an email thread, imho.


-- 
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"


Re: svn commit: r346588 - head/lib/libc/powerpc64/string

2019-09-03 Thread Alexey Dokuchaev
On Tue, Apr 23, 2019 at 02:53:53AM +, Justin Hibbits wrote:
> New Revision: 346588
> URL: https://svnweb.freebsd.org/changeset/base/346588
> 
> Log:
>   powerpc64: Rewrite strcmp in asm to take advantage of word size
> ...
>   Some performance gain rates between the current and the optimized
>   solution:
> 
>   String size (bytes) Gain rate
>   <=8 0.59%
>   <=161.92%
>   32  3.02%
>   64  5.60%
>   128 10.16%
>   256 18.05%
>   512 30.18%
>   102442.82%

Nice!  This should help to speed up buildworld quite a bit.  Would it
be feasible to patch ppc32 in a similar fashion?  Thanks,

./danfe


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Rodney W. Grimes
> > On Apr 22, 2019, at 12:19, Edward Napierala  wrote:
> > 
> > On Mon, 22 Apr 2019 at 20:01, Rodney W. Grimes
> >  wrote:
> >> 
> >>> Author: ngie
> >>> Date: Mon Apr 22 17:52:46 2019
> >>> New Revision: 346571
> >>> URL: https://svnweb.freebsd.org/changeset/base/346571
> >>> 
> >>> Log:
> >>>  Update the spelling of my name
> >>> 
> >>>  Previous spellings of my name (NGie, Ngie) weren't my legal spelling. 
> >>> Use Enji
> >>>  instead for clarity.
> >>> 
> >>>  While here, remove "All Rights Reserved" from copyrights I "own".
> > 
> > [..]
> > 
> >>> Modified: head/share/man/man4/cfiscsi.4
> >>> ==
> >>> --- head/share/man/man4/cfiscsi.4 Mon Apr 22 17:48:10 2019
> >>> (r346570)
> >>> +++ head/share/man/man4/cfiscsi.4 Mon Apr 22 17:52:46 2019
> >>> (r346571)
> >>> @@ -1,7 +1,6 @@
> >>> .\" Copyright (c) 2013 Edward Tomasz Napierala
> >>> .\" Copyright (c) 2015-2017 Alexander Motin 
> >>> -.\" Copyright (c) 2017 Ngie Cooper 
> >>> -.\" All rights reserved.
> >>> +.\" Copyright (c) 2017 Enji Cooper 
> >> 
> >> We should investiage the history of this All rights reserved,
> >> I suspect it actually originally belongs to traz and possibly
> >> mav, and not explicity you due to prior habbits.  If you have
> >> already done that investigation (ie, you added the line) ignore
> >> my comment.  If however you simply added a copyright between
> >> the line and some other copyright please restore this line
> >> to its prior state.
> > 
> > FWIW, I'm perfectly fine with this.
> 
>   The lineage is complicated: trasz@ was the original person that put 
> ?All rights reserved? in the iscsi.4 copyright, and I based manpage on the 
> iscsi.4 manpage, so I thought it was appropriate for me to remove the 
> copyright. trasz@ signing off on this resolves the only potential gray area 
> with this change.
> Thank you though for following up.

It still does not dis-associate mav's copyright with the All rights reserved 
clause,
as it appears as if he did an insert of copyright bewteen the 2, thus giving
grey assertion by him of that clause.

Again, please get mav@ to signoff and I am all happy!  Though I would
like it documented in a commit.

> -Enji
-- 
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: r346594 - head/sbin/camcontrol

2019-09-03 Thread Steven Hartland
Author: smh
Date: Tue Apr 23 07:46:38 2019
New Revision: 346594
URL: https://svnweb.freebsd.org/changeset/base/346594

Log:
  Add ATA power mode support to camcontrol
  
  Add the ability to report ATA device power mode with the cmmand 'powermode'
  to compliment the existing ability to set it using idle, standby and sleep
  commands.
  
  MFC after:2 weeks
  Sponsored by: Multiplay

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Tue Apr 23 06:36:32 2019
(r346593)
+++ head/sbin/camcontrol/camcontrol.8   Tue Apr 23 07:46:38 2019
(r346594)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 12, 2019
+.Dd April 22, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -243,6 +243,10 @@
 .Op device id
 .Op generic args
 .Nm
+.Ic powermode
+.Op device id
+.Op generic args
+.Nm
 .Ic apm
 .Op device id
 .Op generic args
@@ -1388,6 +1392,8 @@ Value 0 disables timer.
 Put ATA device into SLEEP state.
 Note that the only way get device out of
 this state may be reset.
+.It Ic powermode
+Report ATA device power mode.
 .It Ic apm
 It optional parameter
 .Pq Fl l

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Tue Apr 23 06:36:32 2019
(r346593)
+++ head/sbin/camcontrol/camcontrol.c   Tue Apr 23 07:46:38 2019
(r346594)
@@ -109,7 +109,8 @@ typedef enum {
CAM_CMD_ZONE= 0x0026,
CAM_CMD_EPC = 0x0027,
CAM_CMD_TIMESTAMP   = 0x0028,
-   CAM_CMD_MMCSD_CMD   = 0x0029
+   CAM_CMD_MMCSD_CMD   = 0x0029,
+   CAM_CMD_POWER_MODE  = 0x002a,
 } cam_cmdmask;
 
 typedef enum {
@@ -236,6 +237,7 @@ static struct camcontrol_opts option_table[] = {
{"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"},
{"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"},
{"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""},
+   {"powermode", CAM_CMD_POWER_MODE, CAM_ARG_NONE, ""},
{"apm", CAM_CMD_APM, CAM_ARG_NONE, "l:"},
{"aam", CAM_CMD_AAM, CAM_ARG_NONE, "l:"},
{"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:qsy"},
@@ -8885,6 +8887,61 @@ bailout:
 }
 
 static int
+atapm_proc_resp(struct cam_device *device, union ccb *ccb)
+{
+struct ata_res *res;
+
+res = >ataio.res;
+if (res->status & ATA_STATUS_ERROR) {
+if (arglist & CAM_ARG_VERBOSE) {
+cam_error_print(device, ccb, CAM_ESF_ALL,
+CAM_EPF_ALL, stderr);
+printf("error = 0x%02x, sector_count = 0x%04x, "
+   "device = 0x%02x, status = 0x%02x\n",
+   res->error, res->sector_count,
+   res->device, res->status);
+}
+
+return (1);
+}
+
+if (arglist & CAM_ARG_VERBOSE) {
+fprintf(stdout, "%s%d: Raw native check power data:\n",
+device->device_name, device->dev_unit_num);
+/* res is 4 byte aligned */
+dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res));
+
+printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, "
+   "status = 0x%02x\n", res->error, res->sector_count,
+   res->device, res->status);
+}
+
+printf("%s%d: ", device->device_name, device->dev_unit_num);
+switch (res->sector_count) {
+case 0x00:
+   printf("Standby mode\n");
+   break;
+case 0x40:
+   printf("NV Cache Power Mode and the spindle is spun down or spinning 
down\n");
+   break;
+case 0x41:
+   printf("NV Cache Power Mode and the spindle is spun up or spinning 
up\n");
+   break;
+case 0x80:
+   printf("Idle mode\n");
+   break;
+case 0xff:
+   printf("Active or Idle mode\n");
+   break;
+default:
+   printf("Unknown mode 0x%02x\n", res->sector_count);
+   break;
+}
+
+return (0);
+}
+
+static int
 atapm(struct cam_device *device, int argc, char **argv,
 char *combinedopt, int retry_count, int timeout)
 {
@@ -8892,6 +8949,7 @@ atapm(struct cam_device *device, int argc, char **argv
int retval = 0;
int t = -1;
int c;
+   u_int8_t ata_flags = 0;
u_char cmd, sc;
 
ccb = cam_getccb(device);
@@ -8920,6 +8978,10 @@ atapm(struct cam_device *device, int argc, char **argv
cmd = ATA_STANDBY_IMMEDIATE;
else
cmd = ATA_STANDBY_CMD;
+   } else if (strcmp(argv[1], "powermode") == 0) {
+   cmd = ATA_CHECK_POWER_MODE;
+   ata_flags = AP_FLAG_CHK_COND;
+   t = -1;
} else {
cmd = ATA_SLEEP;
t = -1;
@@ -8937,11 +8999,12 @@ atapm(struct cam_device *device, int argc, char **argv
else

svn commit: r346619 - head/sys/powerpc/aim

2019-09-03 Thread Justin Hibbits
Author: jhibbits
Date: Wed Apr 24 02:51:58 2019
New Revision: 346619
URL: https://svnweb.freebsd.org/changeset/base/346619

Log:
  powerpc: Add a couple missing isyncs
  
  mtmsr and mtsr require context synchronizing instructions to follow.  Without
  a CSI, there's a chance for a machine check exception.  This reportedly does
  occur on a MPC750 (PowerMac G3).
  
  Reported by:  Mark Millard

Modified:
  head/sys/powerpc/aim/trap_subr32.S

Modified: head/sys/powerpc/aim/trap_subr32.S
==
--- head/sys/powerpc/aim/trap_subr32.S  Wed Apr 24 01:11:50 2019
(r346618)
+++ head/sys/powerpc/aim/trap_subr32.S  Wed Apr 24 02:51:58 2019
(r346619)
@@ -68,7 +68,7 @@
lwzusr,PM_SR(pmap); \
RESTORE_SRS(pmap,sr) \
/* Restore SR 12 */ \
-   lwz sr,12*4(pmap);  mtsr12,sr
+   lwz sr,12*4(pmap);  mtsr12,sr; isync
 
 /*
  * Kernel SRs are loaded directly from kernel_pmap_
@@ -799,6 +799,7 @@ CNAME(trapexit):
mfmsr   %r3
andi.   %r3,%r3,~PSL_EE@l
mtmsr   %r3
+   isync
 /* Test AST pending: */
lwz %r5,FRAME_SRR1+8(%r1)
mtcr%r5


___
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: r346604 - in head/lib/libsecureboot: . h

2019-09-03 Thread Simon J. Gerraty
Author: sjg
Date: Tue Apr 23 20:25:25 2019
New Revision: 346604
URL: https://svnweb.freebsd.org/changeset/base/346604

Log:
  Allow no_hash to appear in manifest.
  
  sbin/veriexec will ignore entries that have no hash anyway,
  but loader needs to be explicitly told that such files are
  ok to ignore (not verify).
  
  We will report as Unverified depending on verbose level,
  but with no reason - because we are not rejecting the file.
  
  Reviewed by: imp, mindal_semihalf
  Sponsored by:   Juniper Networks
  MFC After: 1 week
  Differential Revision: https://reviews.freebsd.org//D20018

Modified:
  head/lib/libsecureboot/h/libsecureboot.h
  head/lib/libsecureboot/vectx.c
  head/lib/libsecureboot/veopen.c
  head/lib/libsecureboot/verify_file.c

Modified: head/lib/libsecureboot/h/libsecureboot.h
==
--- head/lib/libsecureboot/h/libsecureboot.hTue Apr 23 18:10:46 2019
(r346603)
+++ head/lib/libsecureboot/h/libsecureboot.hTue Apr 23 20:25:25 2019
(r346604)
@@ -86,6 +86,7 @@ ssize_t ve_pcr_get(unsigned char *, size_t);
 #define VEF_VERBOSE1
 
 #define VE_FINGERPRINT_OK  1
+#define VE_FINGERPRINT_IGNORE  2
 /* errors from verify_fd */
 #define VE_FINGERPRINT_NONE-2
 #define VE_FINGERPRINT_WRONG   -3

Modified: head/lib/libsecureboot/vectx.c
==
--- head/lib/libsecureboot/vectx.c  Tue Apr 23 18:10:46 2019
(r346603)
+++ head/lib/libsecureboot/vectx.c  Tue Apr 23 20:25:25 2019
(r346604)
@@ -120,7 +120,10 @@ vectx_open(int fd, const char *path, off_t off, struct
ctx->vec_status = VE_FINGERPRINT_NONE;
ve_error_set("%s: no entry", path);
} else {
-   if (strncmp(cp, "sha256=", 7) == 0) {
+   if (strncmp(cp, "no_hash", 7) == 0) {
+   ctx->vec_status = VE_FINGERPRINT_IGNORE;
+   hashsz = 0;
+   } else if (strncmp(cp, "sha256=", 7) == 0) {
ctx->vec_md = _sha256_vtable;
hashsz = br_sha256_SIZE;
cp += 7;
@@ -150,11 +153,13 @@ vectx_open(int fd, const char *path, off_t off, struct
*error = ctx->vec_status;
ctx->vec_hashsz = hashsz;
ctx->vec_want = cp;
-   ctx->vec_md->init(>vec_ctx.vtable);
+   if (hashsz > 0) {
+   ctx->vec_md->init(>vec_ctx.vtable);
 
-   if (hashsz > 0 && off > 0) {
-   lseek(fd, 0, SEEK_SET);
-   vectx_lseek(ctx, off, SEEK_SET);
+   if (off > 0) {
+   lseek(fd, 0, SEEK_SET);
+   vectx_lseek(ctx, off, SEEK_SET);
+   }
}
return (ctx);
 

Modified: head/lib/libsecureboot/veopen.c
==
--- head/lib/libsecureboot/veopen.c Tue Apr 23 18:10:46 2019
(r346603)
+++ head/lib/libsecureboot/veopen.c Tue Apr 23 20:25:25 2019
(r346604)
@@ -345,7 +345,9 @@ verify_fingerprint(int fd, const char *path, const cha
size_t hlen;
int n;
 
-   if (strncmp(cp, "sha256=", 7) == 0) {
+   if (strncmp(cp, "no_hash", 7) == 0) {
+   return (VE_FINGERPRINT_IGNORE);
+   } else if (strncmp(cp, "sha256=", 7) == 0) {
md = _sha256_vtable;
hlen = br_sha256_SIZE;
cp += 7;
@@ -423,6 +425,7 @@ verify_fd(int fd, const char *path, off_t off, struct 
rc = verify_fingerprint(fd, path, cp, off);
switch (rc) {
case VE_FINGERPRINT_OK:
+   case VE_FINGERPRINT_IGNORE:
case VE_FINGERPRINT_UNKNOWN:
return (rc);
default:

Modified: head/lib/libsecureboot/verify_file.c
==
--- head/lib/libsecureboot/verify_file.cTue Apr 23 18:10:46 2019
(r346603)
+++ head/lib/libsecureboot/verify_file.cTue Apr 23 20:25:25 2019
(r346604)
@@ -343,10 +343,14 @@ verify_file(int fd, const char *filename, off_t off, i
if ((rc = verify_fd(fd, filename, off, )) >= 0) {
if (verbose || severity > VE_WANT) {
 #if defined(VE_DEBUG_LEVEL) && VE_DEBUG_LEVEL > 0
-   printf("Verified %s %llu,%llu\n", filename,
+   printf("%serified %s %llu,%llu\n",
+   (rc == VE_FINGERPRINT_IGNORE) ? "Unv" : "V",
+   filename,
(long long)st.st_dev, (long long)st.st_ino);
 #else
-   printf("Verified %s\n", filename);
+   printf("%serified %s\n",
+   (rc == VE_FINGERPRINT_IGNORE) ? "Unv" : "V",
+   

svn commit: r346568 - head/usr.bin/ar

2019-09-03 Thread Ed Maste
Author: emaste
Date: Mon Apr 22 17:25:00 2019
New Revision: 346568
URL: https://svnweb.freebsd.org/changeset/base/346568

Log:
  ar: test for writing 64-bit format only if symbol count is nonzero
  
  This is a minor simplification; if we do not have any symbols the empty
  symbol table can be in 32-bit format.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/write.c
==
--- head/usr.bin/ar/write.c Mon Apr 22 17:00:30 2019(r346567)
+++ head/usr.bin/ar/write.c Mon Apr 22 17:25:00 2019(r346568)
@@ -656,10 +656,7 @@ write_objs(struct bsdar *bsdar)
 *
 * absolute_offset = htobe32(relative_offset + size_of_pseudo_members)
 */
-
w_sz = sizeof(uint32_t);
-   if (bsdar->s_so_max > UINT32_MAX)
-   w_sz = sizeof(uint64_t);
if (bsdar->s_cnt != 0) {
s_sz = (bsdar->s_cnt + 1) * sizeof(uint32_t) + bsdar->s_sn_sz;
pm_sz = _ARMAG_LEN + (_ARHDR_LEN + s_sz);


___
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: r346595 - head/sys/netinet

2019-09-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Apr 23 10:12:33 2019
New Revision: 346595
URL: https://svnweb.freebsd.org/changeset/base/346595

Log:
  iFix udp_output() lock inconsistency.
  
  In r297225 the initial INP_RLOCK() was replaced by an early
  acquisition of an r- or w-lock depending on input variables
  possibly extending the write locked area for reasons not entirely
  clear but possibly to avoid a later case of unlock and relock
  leading to a possible race condition and possibly in order to
  allow the route cache to work for connected sockets.
  
  Unfortunately the conditions were not 1:1 replicated (probably
  because of the route cache needs). While this would not be a
  problem the legacy IP code compared to IPv6 has an extra case
  when dealing with IP_SENDSRCADDR. In a particular case we were
  holding an exclusive inp lock and acquired the shared udbinfo
  lock (now epoch).
  When then running into an error case, the locking assertions
  on release fired as the udpinfo and inp lock levels did not match.
  
  Break up the special case and in that particular case acquire
  and udpinfo lock depending on the exclusitivity of the inp lock.
  
  MFC After:9 days
  Reported-by:  syzbot+1f5c6800e4f99bdb1...@syzkaller.appspotmail.com
  Reviewed by:  tuexen
  Differential Revision:https://reviews.freebsd.org/D19594

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Tue Apr 23 07:46:38 2019
(r346594)
+++ head/sys/netinet/udp_usrreq.c   Tue Apr 23 10:12:33 2019
(r346595)
@@ -1258,20 +1258,22 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
}
 
/*
-* Depending on whether or not the application has bound or connected
-* the socket, we may have to do varying levels of work.  The optimal
-* case is for a connected UDP socket, as a global lock isn't
-* required at all.
-*
-* In order to decide which we need, we require stability of the
-* inpcb binding, which we ensure by acquiring a read lock on the
-* inpcb.  This doesn't strictly follow the lock order, so we play
-* the trylock and retry game; note that we may end up with more
-* conservative locks than required the second time around, so later
-* assertions have to accept that.  Further analysis of the number of
-* misses under contention is required.
-*
-* XXXRW: Check that hash locking update here is correct.
+* In the old days, depending on whether or not the application had
+* bound or connected the socket, we had to do varying levels of work.
+* The optimal case was for a connected UDP socket, as a global lock
+* wasn't required at all.
+* In order to decide which we need, we required stability of the
+* inpcb binding, which we ensured by acquiring a read lock on the
+* inpcb.  This didn't strictly follow the lock order, so we played
+* the trylock and retry game.
+* With the re-introduction of the route-cache in some cases, we started
+* to acquire an early inp wlock and a possible race during re-lock
+* went away.  With the introduction of epoch(9) some read locking
+* became epoch(9) and the lock-order issues also went away.
+* Due to route-cache we may now hold more conservative locks than
+* otherwise required and have split up the 2nd case in case 2 and 3
+* in order to keep the udpinfo lock level in sync with the inp one
+* for the IP_SENDSRCADDR case below.
 */
pr = inp->inp_socket->so_proto->pr_protocol;
pcbinfo = udp_get_inpcbinfo(pr);
@@ -1279,14 +1281,21 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
(inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) {
INP_HASH_WLOCK(pcbinfo);
unlock_udbinfo = UH_WLOCKED;
-   } else if ((sin != NULL &&
-   (sin->sin_addr.s_addr == INADDR_ANY ||
-   sin->sin_addr.s_addr == INADDR_BROADCAST ||
-   inp->inp_laddr.s_addr == INADDR_ANY ||
-   inp->inp_lport == 0)) ||
-   src.sin_family == AF_INET) {
+   } else if (sin != NULL &&
+   (sin->sin_addr.s_addr == INADDR_ANY ||
+   sin->sin_addr.s_addr == INADDR_BROADCAST ||
+   inp->inp_laddr.s_addr == INADDR_ANY ||
+   inp->inp_lport == 0)) {
INP_HASH_RLOCK_ET(pcbinfo, et);
unlock_udbinfo = UH_RLOCKED;
+   } else if (src.sin_family == AF_INET) {
+   if (unlock_inp == UH_WLOCKED) {
+   INP_HASH_WLOCK(pcbinfo);
+   unlock_udbinfo = UH_WLOCKED;
+   } else {
+   INP_HASH_RLOCK_ET(pcbinfo, et);
+   unlock_udbinfo = 

svn commit: r346618 - head/sys/conf

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Wed Apr 24 01:11:50 2019
New Revision: 346618
URL: https://svnweb.freebsd.org/changeset/base/346618

Log:
  fdt: stop installing FDT_DTS_FILE
  
  r346307 inadvertently started installing FDT_DTS_FILE along with the kernel.
  While this isn't necessarily bad, it was not intended or discussed and it
  actively breaks some current setups that don't anticipate any .dtb being
  installed when it's using static fdt. This change could be reconsidered down
  the line, but it needs to be done with prior discussion.
  
  Fix it by pushing FDT_DTS_FILE build down into the raw dtb.build.mk bits.
  This technically allows modules building DTS to accidentally specify an
  FDT_DTS_FILE that gets built but isn't otherwise useful (since it's not
  installed), but I suspect this isn't a big deal and would get caught with
  any kind of testing -- and perhaps this might end up useful in some other
  way, for example by some module wanting to embed fdt in some other way than
  our current/normal mechanism.
  
  Reported by:  Mori Hiroki 
  MFC after:3 days
  X-MFC-With:   r346307

Modified:
  head/sys/conf/dtb.build.mk
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/dtb.build.mk
==
--- head/sys/conf/dtb.build.mk  Wed Apr 24 00:23:06 2019(r346617)
+++ head/sys/conf/dtb.build.mk  Wed Apr 24 01:11:50 2019(r346618)
@@ -43,7 +43,7 @@ DTBO=${DTSO:T:R:S/$/.dtbo/}
 
 # Add dependencies on the source file so that out-of-tree things can be 
included
 # without any .PATH additions.
-.for _dts in ${DTS}
+.for _dts in ${DTS} ${FDT_DTS_FILE}
 ${_dts:R:T}.dtb: ${_dts}
 .endfor
 

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Apr 24 00:23:06 2019(r346617)
+++ head/sys/conf/kern.post.mk  Wed Apr 24 01:11:50 2019(r346618)
@@ -8,10 +8,7 @@
 # should be defined in the kern.pre.mk so that port makefiles can
 # override or augment them.
 
-.if !empty(FDT_DTS_FILE)
-DTS+=  ${FDT_DTS_FILE}
-.endif
-.if defined(DTS) || defined(DTSO)
+.if defined(DTS) || defined(DTSO) || defined(FDT_DTS_FILE)
 .include "dtb.build.mk"
 
 KERNEL_EXTRA+= ${DTB} ${DTBO}


___
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: r346602 - head/sys/net

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Apr 23 17:28:28 2019
New Revision: 346602
URL: https://svnweb.freebsd.org/changeset/base/346602

Log:
  tun(4): Defer clearing TUN_OPEN until much later
  
  tun destruction will not continue until TUN_OPEN is cleared. There are brief
  moments in tunclose where the mutex is dropped and we've already cleared
  TUN_OPEN, so tun_destroy would be able to proceed while we're in the middle
  of cleaning up the tun still. tun_destroy should be blocked until these
  parts (address/route purges, mostly) are complete.
  
  PR:   233955
  MFC after:2 weeks

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Tue Apr 23 17:18:20 2019(r346601)
+++ head/sys/net/if_tun.c   Tue Apr 23 17:28:28 2019(r346602)
@@ -500,8 +500,6 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
ifp = TUN2IFP(tp);
 
mtx_lock(>tun_mtx);
-   tp->tun_flags &= ~TUN_OPEN;
-   tp->tun_pid = 0;
 
/*
 * junk all pending output
@@ -540,6 +538,8 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
selwakeuppri(>tun_rsel, PZERO + 1);
KNOTE_LOCKED(>tun_rsel.si_note, 0);
TUNDEBUG (ifp, "closed\n");
+   tp->tun_flags &= ~TUN_OPEN;
+   tp->tun_pid = 0;
 
cv_broadcast(>tun_cv);
mtx_unlock(>tun_mtx);


___
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: r346575 - in head/stand/efi: include libefi loader

2019-09-03 Thread Warner Losh
Author: imp
Date: Mon Apr 22 18:40:24 2019
New Revision: 346575
URL: https://svnweb.freebsd.org/changeset/base/346575

Log:
  Create boot_img as a global variable
  
  Get the information from the image that we're booting and store it in
  a global variable. Prefer using this to passing it around. Remove the
  special case for zfs that set the preferred boot handle by having it
  uses this global variable diretly.
  
  Reviewed by: kevans@
  Differential Revision: https://reviews.freebsd.org/D20015

Modified:
  head/stand/efi/include/efi.h
  head/stand/efi/include/efizfs.h
  head/stand/efi/libefi/efizfs.c
  head/stand/efi/loader/main.c

Modified: head/stand/efi/include/efi.h
==
--- head/stand/efi/include/efi.hMon Apr 22 18:38:54 2019
(r346574)
+++ head/stand/efi/include/efi.hMon Apr 22 18:40:24 2019
(r346575)
@@ -62,6 +62,11 @@ Revision History
 #include "efiuga.h"
 
 /*
+ * Global variables
+ */
+extern EFI_LOADED_IMAGE *boot_img;
+
+/*
  * FreeBSD UUID
  */
 #define FREEBSD_BOOT_VAR_GUID \

Modified: head/stand/efi/include/efizfs.h
==
--- head/stand/efi/include/efizfs.h Mon Apr 22 18:38:54 2019
(r346574)
+++ head/stand/efi/include/efizfs.h Mon Apr 22 18:40:24 2019
(r346575)
@@ -50,10 +50,8 @@ void efi_zfs_probe(void);
 EFI_HANDLE efizfs_get_handle_by_guid(uint64_t);
 bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *);
 zfsinfo_list_t *efizfs_get_zfsinfo_list(void);
-void efizfs_set_preferred(EFI_HANDLE);
 
 #else
-#define efizfs_set_preferred(x)
 #define efi_zfs_probe NULL
 #endif
 

Modified: head/stand/efi/libefi/efizfs.c
==
--- head/stand/efi/libefi/efizfs.c  Mon Apr 22 18:38:54 2019
(r346574)
+++ head/stand/efi/libefi/efizfs.c  Mon Apr 22 18:40:24 2019
(r346575)
@@ -45,14 +45,6 @@ static zfsinfo_list_t zfsinfo;
 
 uint64_t pool_guid;
 
-static EFI_HANDLE preferred;
-
-void
-efizfs_set_preferred(EFI_HANDLE h)
-{
-   preferred = h;
-}
-
 zfsinfo_list_t *
 efizfs_get_zfsinfo_list(void)
 {
@@ -122,7 +114,7 @@ efi_zfs_probe(void)
efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit);
if (zfs_probe_dev(devname, ) == 0) {
insert_zfs(pd->pd_handle, guid);
-   if (pd->pd_handle == preferred)
+   if (pd->pd_handle == boot_img->DeviceHandle)
pool_guid = guid;
}
 

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cMon Apr 22 18:38:54 2019
(r346574)
+++ head/stand/efi/loader/main.cMon Apr 22 18:40:24 2019
(r346575)
@@ -88,6 +88,11 @@ static int fail_timeout = 5;
  */
 UINT16 boot_current;
 
+/*
+ * Image that we booted from.
+ */
+EFI_LOADED_IMAGE *boot_img;
+
 static bool
 has_keyboard(void)
 {
@@ -300,7 +305,7 @@ fix_dosisms(char *p)
 
 enum { BOOT_INFO_OK = 0, BAD_CHOICE = 1, NOT_SPECIFIC = 2  };
 static int
-match_boot_info(EFI_LOADED_IMAGE *img __unused, char *boot_info, size_t bisz)
+match_boot_info(char *boot_info, size_t bisz)
 {
uint32_t attr;
uint16_t fplen;
@@ -448,7 +453,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
  * a drop to the OK boot loader prompt is possible.
  */
 static int
-find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, bool is_last,
+find_currdev(bool do_bootmgr, bool is_last,
 char *boot_info, size_t boot_info_sz)
 {
pdinfo_t *dp, *pp;
@@ -481,7 +486,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
 * loader.conf.
 */
if (do_bootmgr) {
-   rv = match_boot_info(img, boot_info, boot_info_sz);
+   rv = match_boot_info(boot_info, boot_info_sz);
switch (rv) {
case BOOT_INFO_OK:  /* We found it */
return (0);
@@ -514,7 +519,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
 * boot protocol to do so. We fail and let UEFI go on to
 * the next candidate.
 */
-   dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle);
+   dp = efiblk_get_pdinfo_by_handle(boot_img->DeviceHandle);
if (dp != NULL) {
text = efi_devpath_name(dp->pd_devpath);
if (text != NULL) {
@@ -553,7 +558,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
 * any of the nodes in that path match one of the enumerated
 * handles. Currently, this handle list is only for netboot.
 */
-   if (efi_handle_lookup(img->DeviceHandle, , , ) == 0) {
+   if (efi_handle_lookup(boot_img->DeviceHandle, , , ) == 
0) {
   

svn commit: r346598 - head/sys/modules

2019-09-03 Thread Ed Maste
Author: emaste
Date: Tue Apr 23 15:11:01 2019
New Revision: 346598
URL: https://svnweb.freebsd.org/changeset/base/346598

Log:
  Enable Mellanox drivers (modules) on AArch64
  
  Tested by Greg V with mlx5en on an Ampere eMAG instance at Packet.com on
  c2.large.arm (with some additional uncommitted PCIe WIP).
  
  PR:   237055
  Submitted by: Greg V 
  Reviewed by:  hselasky
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D19983

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Tue Apr 23 12:29:19 2019(r346597)
+++ head/sys/modules/Makefile   Tue Apr 23 15:11:01 2019(r346598)
@@ -483,7 +483,24 @@ SUBDIR+=   fdt
 SUBDIR+=   linprocfs
 SUBDIR+=   linsysfs
 _ena=  ena
+.if ${MK_OFED} != "no" || defined(ALL_MODULES)
+_ibcore=   ibcore
+_ipoib=ipoib
+_iser= iser
 .endif
+_mlx4= mlx4
+_mlx5= mlx5
+.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
+   defined(ALL_MODULES)
+_mlx4en=   mlx4en
+_mlx5en=   mlx5en
+.endif
+.if ${MK_OFED} != "no" || defined(ALL_MODULES)
+_mthca=mthca
+_mlx4ib=   mlx4ib
+_mlx5ib=   mlx5ib
+.endif
+.endif
 
 .if ${MK_NAND} != "no" || defined(ALL_MODULES)
 _nandfs=   nandfs
@@ -592,15 +609,8 @@ _ep=   ep
 _et=   et
 _exca= exca
 _fe=   fe
-.if ${MK_OFED} != "no" || defined(ALL_MODULES)
-_ibcore=ibcore
-.endif
 _if_ndis=  if_ndis
 _io=   io
-.if ${MK_OFED} != "no" || defined(ALL_MODULES)
-_ipoib= ipoib
-_iser= iser
-.endif
 _ix=   ix
 _ixv=  ixv
 _linux=linux
@@ -672,18 +682,6 @@ _ipwfw=ipwfw
 _iwifw=iwifw
 _iwmfw=iwmfw
 _iwnfw=iwnfw
-.endif
-_mlx4= mlx4
-_mlx5= mlx5
-.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
-   defined(ALL_MODULES)
-_mlx4en=   mlx4en
-_mlx5en=   mlx5en
-.endif
-.if ${MK_OFED} != "no" || defined(ALL_MODULES)
-_mthca=mthca
-_mlx4ib=   mlx4ib
-_mlx5ib=   mlx5ib
 .endif
 _mly=  mly
 _nfe=  nfe


___
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: r346582 - head/usr.bin/ar

2019-09-03 Thread Ed Maste
Author: emaste
Date: Mon Apr 22 19:55:47 2019
New Revision: 346582
URL: https://svnweb.freebsd.org/changeset/base/346582

Log:
  ar: shuffle symbol offsets during conversion for 32-bit ar archives
  
  During processing we maintain symbol offsets in the 64-bit s_so array,
  and when writing the archive convert to 32-bit if no offsets are greater
  than 4GB.  However, this was somewhat inefficient as we looped over the
  array twice: first, converting to big endian and second, writing each
  32-bit value one at a time (and incorrectly so on big-endian platforms).
  
  Instead, when writing a 32-bit archive shuffle convert symbol data to
  big endian (as required by the ar format) and shuffle to the beginning
  of the allocation at the same time.
  
  Also correct emission of the symbol count on big endian platforms.
  
  Further changes are planned, but this should fix powerpc64.
  
  Reported by:  jhibbits, mlinimon
  Reviewed by:  jhibbits, Gerald Aryeetey (earlier)
  Tested by:jhibbits
  MFC after:10 days
  MFC with: r346079
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20007

Modified:
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/write.c
==
--- head/usr.bin/ar/write.c Mon Apr 22 19:36:19 2019(r346581)
+++ head/usr.bin/ar/write.c Mon Apr 22 19:55:47 2019(r346582)
@@ -616,6 +616,7 @@ write_objs(struct bsdar *bsdar)
size_t pm_sz;   /* size of pseudo members */
size_t w_sz;/* size of words in symbol table */
uint64_t nr;
+   uint32_t nr32;
int  i;
 
if (elf_version(EV_CURRENT) == EV_NONE)
@@ -669,15 +670,18 @@ write_objs(struct bsdar *bsdar)
s_sz = (bsdar->s_cnt + 1) * sizeof(uint64_t) +
bsdar->s_sn_sz;
pm_sz += s_sz;
-   }
-
-   for (i = 0; (size_t)i < bsdar->s_cnt; i++) {
-   if (w_sz == sizeof(uint32_t))
+   /* Convert to big-endian. */
+   for (i = 0; (size_t)i < bsdar->s_cnt; i++)
bsdar->s_so[i] =
-   htobe32(bsdar->s_so[i] + pm_sz);
-   else
-   bsdar->s_so[i] =
htobe64(bsdar->s_so[i] + pm_sz);
+   } else {
+   /*
+* Convert to big-endian and shuffle in-place to
+* the front of the allocation. XXX UB
+*/
+   for (i = 0; (size_t)i < bsdar->s_cnt; i++)
+   ((uint32_t *)(bsdar->s_so))[i] =
+   htobe32(bsdar->s_so[i] + pm_sz);
}
}
 
@@ -708,19 +712,14 @@ write_objs(struct bsdar *bsdar)
archive_entry_set_size(entry, (bsdar->s_cnt + 1) * w_sz +
bsdar->s_sn_sz);
AC(archive_write_header(a, entry));
-   if (w_sz == sizeof(uint32_t))
-   nr = (uint64_t)htobe32((uint32_t)bsdar->s_cnt);
-   else
+   if (w_sz == sizeof(uint64_t)) {
nr = htobe64(bsdar->s_cnt);
-   write_data(bsdar, a, , w_sz);
-   if (w_sz == sizeof(uint64_t))
-   write_data(bsdar, a, bsdar->s_so, sizeof(uint64_t) *
-   bsdar->s_cnt);
-   else
-   for (i = 0; (size_t)i < bsdar->s_cnt; i++)
-   write_data(bsdar, a,
-   (uint32_t *)>s_so[i],
-   sizeof(uint32_t));
+   write_data(bsdar, a, , sizeof(nr));
+   } else {
+   nr32 = htobe32((uint32_t)bsdar->s_cnt);
+   write_data(bsdar, a, , sizeof(nr32));
+   }
+   write_data(bsdar, a, bsdar->s_so, w_sz * bsdar->s_cnt);
write_data(bsdar, a, bsdar->s_sn, bsdar->s_sn_sz);
archive_entry_free(entry);
}


___
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: r346627 - head/tests/sys/opencrypto

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Wed Apr 24 05:52:24 2019
New Revision: 346627
URL: https://svnweb.freebsd.org/changeset/base/346627

Log:
  Use `range` instead of `xrange`
  
  `xrange` is a pre-python 2.x compatible idiom. Use `range` instead. The values
  being iterated over are sufficiently small that using range on python 2.x 
won't
  be a noticeable issue.
  
  MFC after:2 months

Modified:
  head/tests/sys/opencrypto/cryptodev.py

Modified: head/tests/sys/opencrypto/cryptodev.py
==
--- head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 05:49:48 2019
(r346626)
+++ head/tests/sys/opencrypto/cryptodev.py  Wed Apr 24 05:52:24 2019
(r346627)
@@ -258,7 +258,7 @@ class Crypto:
 return s, tag.tostring()
 
 def perftest(self, op, size, timeo=3):
-inp = array.array('B', (random.randint(0, 255) for x in xrange(size)))
+inp = array.array('B', (random.randint(0, 255) for x in range(size)))
 out = array.array('B', inp)
 
 # prep ioctl
@@ -273,7 +273,7 @@ class Crypto:
 if self._maclen is not None:
 m = array.array('B', [0] * self._maclen)
 cop.mac = m.buffer_info()[0]
-ivbuf = array.array('B', (random.randint(0, 255) for x in xrange(16)))
+ivbuf = array.array('B', (random.randint(0, 255) for x in range(16)))
 cop.iv = ivbuf.buffer_info()[0]
 
 exit = [ False ]
@@ -503,7 +503,7 @@ if __name__ == '__main__':
 except IOError:
 print('aesni0 not found')
 
-for i in xrange(10):
+for i in range(10):
 try:
 name = Crypto.getcridname(i)
 print('%2d: %r' % (i, repr(name)))
@@ -637,7 +637,7 @@ if __name__ == '__main__':
 print('tag:', tag.encode('hex'))
 assert enctag == tag
 elif False:
-for i in xrange(10):
+for i in range(10):
 c = Crypto(CRYPTO_AES_XTS, 
'1bbfeadf539daedcae33ced497343f3ca1f2474ad932b903997d44707db41382'.decode('hex'))
 data = '52a42bca4e9425a25bbc8c8bf6129dec'.decode('hex')
 ct = '517e602becd066b65fa4f4f56ddfe240'.decode('hex')


___
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: r346544 - head/sys/conf

2019-09-03 Thread Mark Johnston
Author: markj
Date: Mon Apr 22 11:31:13 2019
New Revision: 346544
URL: https://svnweb.freebsd.org/changeset/base/346544

Log:
  Clarify the relationship between INVARIANTS and DIAGNOSTIC a bit.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon Apr 22 11:23:35 2019(r346543)
+++ head/sys/conf/NOTES Mon Apr 22 11:31:13 2019(r346544)
@@ -563,8 +563,10 @@ optionsKASSERT_PANIC_OPTIONAL
 
 #
 # The DIAGNOSTIC option is used to enable extra debugging information
-# from some parts of the kernel.  As this makes everything more noisy,
-# it is disabled by default.
+# and invariants checking.  The added checks are too expensive or noisy
+# for an INVARIANTS kernel and thus are disabled by default.  It is
+# expected that a kernel configured with DIAGNOSTIC will also have the
+# INVARIANTS option enabled.
 #
 optionsDIAGNOSTIC
 


___
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: r346578 - head/lib/libclang_rt

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Mon Apr 22 19:21:35 2019
New Revision: 346578
URL: https://svnweb.freebsd.org/changeset/base/346578

Log:
  Build libclang_rt/profile on all clang-supported architectures
  
  There's no reason why a special case needs to be added specifically for amd64,
  arm, and i386, as the code is written in machine architecture agnostic C/C++.
  
  This will make it possible for all supporting clang architectures to produce
  runtime coverage with `--coverage`.
  
  MFC after:2 weeks
  Reviewed by:  dim
  Differential Revision: https://reviews.freebsd.org/D20003

Modified:
  head/lib/libclang_rt/Makefile

Modified: head/lib/libclang_rt/Makefile
==
--- head/lib/libclang_rt/Makefile   Mon Apr 22 18:43:43 2019
(r346577)
+++ head/lib/libclang_rt/Makefile   Mon Apr 22 19:21:35 2019
(r346578)
@@ -22,9 +22,6 @@ SUBDIR+=  ubsan_standalone
 SUBDIR+=   ubsan_standalone_cxx
 .endif
 
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || \
-${MACHINE_CPUARCH} == "arm"
 SUBDIR+=   profile
-.endif
 
 .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"


Re: svn commit: r346554 - head/sys/netinet

2019-09-03 Thread Bruce Evans

On Mon, 22 Apr 2019, Bjoern A. Zeeb wrote:


On 22 Apr 2019, at 14:20, Bjoern A. Zeeb wrote:

Log:
  Remove some excessive brackets.

  No functional change.


But it includes a stye bug; sorry; I had re-indented the lines to validate 
the change.  Ill remedy this with the follow-up commit which will split 
that block up anyway.


Also, it removes excessive parentheses, not excessive brackets.

I think excessive brackets are just syntax errors.  E.g., a[[i]].

Excessive braces are not syntax errors, but I've never more than single
excessive ones.  E.g.,

if (foo != 0) {
bar();
}

is a common style bug, but

if (foo != 0) {{
bar();
  }}

s unusual.

Bruce


___
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: r346486 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Sun Apr 21 10:33:09 2019
New Revision: 346486
URL: https://svnweb.freebsd.org/changeset/base/346486

Log:
  Fix missing restoring of the mouse cursor position, the border color and the
  blank state after a screen switch.

Modified:
  head/lib/libvgl/main.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/simple.c
  head/lib/libvgl/vgl.h

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Sun Apr 21 09:13:56 2019(r346485)
+++ head/lib/libvgl/main.c  Sun Apr 21 10:33:09 2019(r346486)
@@ -436,6 +436,9 @@ VGLCheckSwitch()
   VGLDisplay->Xsize = VGLModeInfo.vi_width;
   VGLDisplay->Ysize = VGLModeInfo.vi_height;
   VGLSetVScreenSize(VGLDisplay, VGLDisplay->VXsize, VGLDisplay->VYsize);
+  VGLRestoreBlank();
+  VGLRestoreBorder();
+  VGLMouseRestore();
   VGLPanScreen(VGLDisplay, VGLDisplay->Xorigin, VGLDisplay->Yorigin);
   switch (VGLDisplay->Type) {
   case VIDBUF4S:

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Sun Apr 21 09:13:56 2019(r346485)
+++ head/lib/libvgl/mouse.c Sun Apr 21 10:33:09 2019(r346486)
@@ -272,6 +272,22 @@ VGLMouseInit(int mode)
   return 0;
 }
 
+void
+VGLMouseRestore(void)
+{
+  struct mouse_info mouseinfo;
+
+  INTOFF();
+  mouseinfo.operation = MOUSE_GETINFO;
+  if (ioctl(0, CONS_MOUSECTL, ) == 0) {
+mouseinfo.operation = MOUSE_MOVEABS;
+mouseinfo.u.data.x = VGLMouseXpos;
+mouseinfo.u.data.y = VGLMouseYpos;
+ioctl(0, CONS_MOUSECTL, );
+  }
+  INTON();
+}
+
 int
 VGLMouseStatus(int *x, int *y, char *buttons)
 {

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cSun Apr 21 09:13:56 2019(r346485)
+++ head/lib/libvgl/simple.cSun Apr 21 10:33:09 2019(r346486)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "vgl.h"
 
+static int VGLBlank;
+static byte VGLBorderColor;
 static byte VGLSavePaletteRed[256];
 static byte VGLSavePaletteGreen[256];
 static byte VGLSavePaletteBlue[256];
@@ -637,6 +639,12 @@ VGLSetPaletteIndex(byte color, byte red, byte green, b
 }
 
 void
+VGLRestoreBorder(void)
+{
+  VGLSetBorder(VGLBorderColor);
+}
+
+void
 VGLSetBorder(byte color)
 {
   if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0))
@@ -646,11 +654,18 @@ VGLSetBorder(byte color)
   outb(0x3C0,0x11); outb(0x3C0, color); 
   inb(0x3DA);
   outb(0x3C0, 0x20);
+  VGLBorderColor = color;
   if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT)
 ioctl(0, KDDISABIO, 0);
 }
 
 void
+VGLRestoreBlank(void)
+{
+  VGLBlankDisplay(VGLBlank);
+}
+
+void
 VGLBlankDisplay(int blank)
 {
   byte val;
@@ -660,6 +675,7 @@ VGLBlankDisplay(int blank)
   VGLCheckSwitch();
   outb(0x3C4, 0x01); val = inb(0x3C5); outb(0x3C4, 0x01);
   outb(0x3C5, ((blank) ? (val |= 0x20) : (val &= 0xDF)));
+  VGLBlank = blank;
   if (VGLModeInfo.vi_mem_model == V_INFO_MM_DIRECT)
 ioctl(0, KDDISABIO, 0);
 }

Modified: head/lib/libvgl/vgl.h
==
--- head/lib/libvgl/vgl.h   Sun Apr 21 09:13:56 2019(r346485)
+++ head/lib/libvgl/vgl.h   Sun Apr 21 10:33:09 2019(r346486)
@@ -130,6 +130,7 @@ void VGLMouseAction(int dummy);
 void VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);
 void VGLMouseSetStdImage(void);
 int VGLMouseInit(int mode);
+void VGLMouseRestore(void);
 int VGLMouseStatus(int *x, int *y, char *buttons);
 int VGLMouseFreeze(int x, int y, int width, int hight, u_long color);
 void VGLMouseUnFreeze(void);
@@ -142,6 +143,8 @@ void VGLFilledBox(VGLBitmap *object, int x1, int y1, i
 void VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color);
 void VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long 
color);
 void VGLClear(VGLBitmap *object, u_long color);
+void VGLRestoreBlank(void);
+void VGLRestoreBorder(void);
 void VGLRestorePalette(void);
 void VGLSavePalette(void);
 void VGLSetPalette(byte *red, byte *green, byte *blue);


___
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: r346623 - head/tests/sys/opencrypto

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Wed Apr 24 04:50:03 2019
New Revision: 346623
URL: https://svnweb.freebsd.org/changeset/base/346623

Log:
  Chase PEP-3110
  
  Replace `except Environment, e:` with `except Environment as e` for
  compatibility between python 2.x and python 3.x.
  
  While here, fix a bad indentation change from r346620 by reindenting the code
  properly.
  
  MFC after:2 months

Modified:
  head/tests/sys/opencrypto/cryptotest.py

Modified: head/tests/sys/opencrypto/cryptotest.py
==
--- head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 04:45:00 2019
(r346622)
+++ head/tests/sys/opencrypto/cryptotest.py Wed Apr 24 04:50:03 2019
(r346623)
@@ -124,7 +124,7 @@ def GenTestCase(cname):
 mac=self._gmacsizes[len(cipherkey)],
 mackey=cipherkey, crid=crid,
 maclen=16)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test algorithms the driver does not support.
 if e.errno != errno.EOPNOTSUPP:
 raise
@@ -133,7 +133,7 @@ def GenTestCase(cname):
 if mode == 'ENCRYPT':
 try:
 rct, rtag = c.encrypt(pt, iv, aad)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test inputs the driver does not support.
 if e.errno != errno.EINVAL:
 raise
@@ -153,7 +153,7 @@ def GenTestCase(cname):
 else:
 try:
 rpt, rtag = c.decrypt(*args)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test inputs the driver does not 
support.
 if e.errno != errno.EINVAL:
 raise
@@ -221,7 +221,7 @@ def GenTestCase(cname):
 try:
 c = Crypto(meth, cipherkey, crid=crid)
 r = curfun(c, pt, iv)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test hashes the driver does not support.
 if e.errno != errno.EOPNOTSUPP:
 raise
@@ -252,7 +252,7 @@ def GenTestCase(cname):
 mackey=key, maclen=16)
 r, tag = Crypto.encrypt(c, payload,
 nonce, aad)
-except EnvironmentError, e:
+except EnvironmentError as e:
 if e.errno != errno.EOPNOTSUPP:
 raise
 continue
@@ -294,7 +294,7 @@ def GenTestCase(cname):
 key=key,
 mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC,
 mackey=key, maclen=16)
-except EnvironmentError, e:
+except EnvironmentError as e:
 if e.errno != errno.EOPNOTSUPP:
 raise
 continue
@@ -388,13 +388,13 @@ def GenTestCase(cname):
 
 for data in lines:
 msg = data['Msg'].decode('hex')
-msg = msg[:int(data['Len'])]
+msg = msg[:int(data['Len'])]
 md = data['MD'].decode('hex')
 
 try:
 c = Crypto(mac=alg, crid=crid,
 maclen=hashlen)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test hashes the driver does not support.
 if e.errno != errno.EOPNOTSUPP:
 raise
@@ -451,7 +451,7 @@ def GenTestCase(cname):
 try:
 c = Crypto(mac=alg, mackey=key,
 crid=crid, maclen=hashlen)
-except EnvironmentError, e:
+except EnvironmentError as e:
 # Can't test hashes the driver does not support.
 if e.errno != errno.EOPNOTSUPP:
 raise


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Edward Napierala
On Mon, 22 Apr 2019 at 20:01, Rodney W. Grimes
 wrote:
>
> > Author: ngie
> > Date: Mon Apr 22 17:52:46 2019
> > New Revision: 346571
> > URL: https://svnweb.freebsd.org/changeset/base/346571
> >
> > Log:
> >   Update the spelling of my name
> >
> >   Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use 
> > Enji
> >   instead for clarity.
> >
> >   While here, remove "All Rights Reserved" from copyrights I "own".

[..]

> > Modified: head/share/man/man4/cfiscsi.4
> > ==
> > --- head/share/man/man4/cfiscsi.4 Mon Apr 22 17:48:10 2019
> > (r346570)
> > +++ head/share/man/man4/cfiscsi.4 Mon Apr 22 17:52:46 2019
> > (r346571)
> > @@ -1,7 +1,6 @@
> >  .\" Copyright (c) 2013 Edward Tomasz Napierala
> >  .\" Copyright (c) 2015-2017 Alexander Motin 
> > -.\" Copyright (c) 2017 Ngie Cooper 
> > -.\" All rights reserved.
> > +.\" Copyright (c) 2017 Enji Cooper 
>
> We should investiage the history of this All rights reserved,
> I suspect it actually originally belongs to traz and possibly
> mav, and not explicity you due to prior habbits.  If you have
> already done that investigation (ie, you added the line) ignore
> my comment.  If however you simply added a copyright between
> the line and some other copyright please restore this line
> to its prior state.

FWIW, I'm perfectly fine with this.


___
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: r346605 - head/tests/sys/geom/class/mirror

2019-09-03 Thread Olivier Cochard
Author: olivier (ports committer)
Date: Tue Apr 23 21:07:47 2019
New Revision: 346605
URL: https://svnweb.freebsd.org/changeset/base/346605

Log:
  Skip test component_selection:run_latest_genid if gmirror/gnop GEOM classes
  aren't available
  
  PR:   237051
  Reviewed by:  asomers, imp, ngie, emaste (IRC)
  Approved by:  ngie
  MFC after: 1 month
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D19958

Modified:
  head/tests/sys/geom/class/mirror/component_selection.sh

Modified: head/tests/sys/geom/class/mirror/component_selection.sh
==
--- head/tests/sys/geom/class/mirror/component_selection.sh Tue Apr 23 
20:25:25 2019(r346604)
+++ head/tests/sys/geom/class/mirror/component_selection.sh Tue Apr 23 
21:07:47 2019(r346605)
@@ -1,5 +1,9 @@
 # $FreeBSD$
 
+ATF_TEST=true
+class=mirror
+. $(atf_get_srcdir)/conf.sh
+
 atf_test_case run_latest_genid cleanup
 run_latest_genid_head()
 {
@@ -9,7 +13,10 @@ run_latest_genid_head()
 }
 run_latest_genid_body()
 {
-   . $(atf_get_srcdir)/conf.sh
+   geom_atf_test_setup
+   if ! error_message=$(geom_load_class_if_needed nop); then
+   atf_skip "$error_message"
+   fi
 
f1=$(mktemp ${base}.XX)
f2=$(mktemp ${base}.XX)


___
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: r346581 - in head/sys: netinet netinet6

2019-09-03 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Apr 22 19:36:19 2019
New Revision: 346581
URL: https://svnweb.freebsd.org/changeset/base/346581

Log:
  Revert r346530 until further.
  
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/netinet/ip_reass.c
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet/ip_reass.c
==
--- head/sys/netinet/ip_reass.c Mon Apr 22 19:31:16 2019(r346580)
+++ head/sys/netinet/ip_reass.c Mon Apr 22 19:36:19 2019(r346581)
@@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -609,37 +606,6 @@ ipreass_drain(void)
IPQ_UNLOCK(i);
}
 }
-
-/*
- * Drain off all datagram fragments belonging to
- * the given network interface.
- */
-static void
-ipreass_cleanup(void *arg __unused, struct ifnet *ifp)
-{
-   struct ipq *fp, *temp;
-   struct mbuf *m;
-   int i;
-
-   KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
-
-   CURVNET_SET_QUIET(ifp->if_vnet);
-   for (i = 0; i < IPREASS_NHASH; i++) {
-   IPQ_LOCK(i);
-   /* Scan fragment list. */
-   TAILQ_FOREACH_SAFE(fp, _ipq[i].head, ipq_list, temp) {
-   for (m = fp->ipq_frags; m != NULL; m = m->m_nextpkt) {
-   if (m->m_pkthdr.rcvif == ifp) {
-   ipq_drop(_ipq[i], fp);
-   break;
-   }
-   }
-   }
-   IPQ_UNLOCK(i);
-   }
-   CURVNET_RESTORE();
-}
-EVENTHANDLER_DEFINE(ifnet_departure_event, ipreass_cleanup, NULL, 0);
 
 #ifdef VIMAGE
 /*

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Mon Apr 22 19:31:16 2019(r346580)
+++ head/sys/netinet6/frag6.c   Mon Apr 22 19:36:19 2019(r346581)
@@ -82,7 +82,7 @@ static void frag6_deq(struct ip6asfrag *, uint32_t buc
 static void frag6_insque_head(struct ip6q *, struct ip6q *,
 uint32_t bucket);
 static void frag6_remque(struct ip6q *, uint32_t bucket);
-static void frag6_freef(struct ip6q *, uint32_t bucket, bool send_icmp);
+static void frag6_freef(struct ip6q *, uint32_t bucket);
 
 struct ip6qbucket {
struct ip6q ip6q;
@@ -595,7 +595,7 @@ insert:
if (af6->ip6af_off != next) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
-   frag6_freef(q6, hash, true);
+   frag6_freef(q6, hash);
}
IP6Q_UNLOCK(hash);
return IPPROTO_DONE;
@@ -605,7 +605,7 @@ insert:
if (af6->ip6af_up->ip6af_mff) {
if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) {
IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag);
-   frag6_freef(q6, hash, true);
+   frag6_freef(q6, hash);
}
IP6Q_UNLOCK(hash);
return IPPROTO_DONE;
@@ -732,7 +732,7 @@ insert:
  * associated datagrams.
  */
 static void
-frag6_freef(struct ip6q *q6, uint32_t bucket, bool send_icmp)
+frag6_freef(struct ip6q *q6, uint32_t bucket)
 {
struct ip6asfrag *af6, *down6;
 
@@ -749,7 +749,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket, bool sen
 * Return ICMP time exceeded error for the 1st fragment.
 * Just free other fragments.
 */
-   if (af6->ip6af_off == 0 && send_icmp != false) {
+   if (af6->ip6af_off == 0) {
struct ip6_hdr *ip6;
 
/* adjust pointer */
@@ -865,7 +865,7 @@ frag6_slowtimo(void)
IP6STAT_ADD(ip6s_fragtimeout,
q6->ip6q_prev->ip6q_nfrag);
/* XXX in6_ifstat_inc(ifp, 
ifs6_reass_fail) */
-   frag6_freef(q6->ip6q_prev, i, true);
+   frag6_freef(q6->ip6q_prev, i);
}
}
/*
@@ -884,7 +884,7 @@ frag6_slowtimo(void)
IP6STAT_ADD(ip6s_fragoverflow,
q6->ip6q_prev->ip6q_nfrag);
/* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */
-   frag6_freef(head->ip6q_prev, i, true);
+   frag6_freef(head->ip6q_prev, i);
}
IP6Q_UNLOCK(i);
}
@@ -902,7 +902,7 @@ 

svn commit: r346566 - head/lib/libc/stdlib

2019-09-03 Thread Conrad Meyer
Author: cem
Date: Mon Apr 22 16:29:34 2019
New Revision: 346566
URL: https://svnweb.freebsd.org/changeset/base/346566

Log:
  random.3: Remove obsolete BUGS section
  
  Relative performance to rand(3) is sort of irrelevant; they do different 
things
  and a user with sensitivity to RNG performance won't use libc random(3) 
anyway.
  
  The historical note about bad seeding is long obsolete, referring to a 1996 or
  earlier version of FreeBSD.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/stdlib/random.3

Modified: head/lib/libc/stdlib/random.3
==
--- head/lib/libc/stdlib/random.3   Mon Apr 22 16:26:39 2019
(r346565)
+++ head/lib/libc/stdlib/random.3   Mon Apr 22 16:29:34 2019
(r346566)
@@ -28,7 +28,7 @@
 .\" @(#)random.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd April 15, 2019
+.Dd April 22, 2019
 .Dt RANDOM 3
 .Os
 .Sh NAME
@@ -187,11 +187,3 @@ functions appeared in
 .Bx 4.2 .
 .Sh AUTHORS
 .An Earl T. Cohen
-.Sh BUGS
-About 2/3 the speed of
-.Xr rand 3 .
-.Pp
-The historical implementation used to have a very weak seeding; the
-random sequence did not vary much with the seed.
-The current implementation employs a better pseudo-random number
-generator for the initial state calculation.


___
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: r346598 - head/sys/modules

2019-09-03 Thread Rodney W. Grimes
> Author: emaste
> Date: Tue Apr 23 15:11:01 2019
> New Revision: 346598
> URL: https://svnweb.freebsd.org/changeset/base/346598
> 
> Log:
>   Enable Mellanox drivers (modules) on AArch64
>   
>   Tested by Greg V with mlx5en on an Ampere eMAG instance at Packet.com on
>   c2.large.arm (with some additional uncommitted PCIe WIP).
>   
>   PR: 237055
>   Submitted by:   Greg V 
>   Reviewed by:hselasky
>   MFC after:  1 month
>   Differential Revision:  https://reviews.freebsd.org/D19983

Very cool, now how do I get a PCIe slot into a RPI3!!! lol  :-)

This does make some of the newer RockPro64 type boards an
interesting thing to experiment with.

I am hopeing some of that PCIe WIP might include some of the
bits needed or do we already have PCIe slot on RockPro64 code that works?

Thanks for this work Greg!

> Modified:
>   head/sys/modules/Makefile
> 
> Modified: head/sys/modules/Makefile
> ==
> --- head/sys/modules/Makefile Tue Apr 23 12:29:19 2019(r346597)
> +++ head/sys/modules/Makefile Tue Apr 23 15:11:01 2019(r346598)
> @@ -483,7 +483,24 @@ SUBDIR+= fdt
>  SUBDIR+= linprocfs
>  SUBDIR+= linsysfs
>  _ena=ena
> +.if ${MK_OFED} != "no" || defined(ALL_MODULES)
> +_ibcore= ibcore
> +_ipoib=  ipoib
> +_iser=   iser
>  .endif
> +_mlx4=   mlx4
> +_mlx5=   mlx5
> +.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
> + defined(ALL_MODULES)
> +_mlx4en= mlx4en
> +_mlx5en= mlx5en
> +.endif
> +.if ${MK_OFED} != "no" || defined(ALL_MODULES)
> +_mthca=  mthca
> +_mlx4ib= mlx4ib
> +_mlx5ib= mlx5ib
> +.endif
> +.endif
>  
>  .if ${MK_NAND} != "no" || defined(ALL_MODULES)
>  _nandfs= nandfs
> @@ -592,15 +609,8 @@ _ep= ep
>  _et= et
>  _exca=   exca
>  _fe= fe
> -.if ${MK_OFED} != "no" || defined(ALL_MODULES)
> -_ibcore=ibcore
> -.endif
>  _if_ndis=if_ndis
>  _io= io
> -.if ${MK_OFED} != "no" || defined(ALL_MODULES)
> -_ipoib= ipoib
> -_iser=   iser
> -.endif
>  _ix= ix
>  _ixv=ixv
>  _linux=  linux
> @@ -672,18 +682,6 @@ _ipwfw=  ipwfw
>  _iwifw=  iwifw
>  _iwmfw=  iwmfw
>  _iwnfw=  iwnfw
> -.endif
> -_mlx4=   mlx4
> -_mlx5=   mlx5
> -.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \
> - defined(ALL_MODULES)
> -_mlx4en= mlx4en
> -_mlx5en= mlx5en
> -.endif
> -.if ${MK_OFED} != "no" || defined(ALL_MODULES)
> -_mthca=  mthca
> -_mlx4ib= mlx4ib
> -_mlx5ib= mlx5ib
>  .endif
>  _mly=mly
>  _nfe=nfe
> 
> 

-- 
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: r346454 - head/lib/libvgl

2019-09-03 Thread Bruce Evans
Author: bde
Date: Sat Apr 20 20:29:03 2019
New Revision: 346454
URL: https://svnweb.freebsd.org/changeset/base/346454

Log:
  Make libvgl mostly work without superuser privilege in direct modes by
  not doing any unnecessary PIO instructions or refusing to start when the
  i/o privilege needed for these instructions cannot be acquired.
  
  This turns off useless palette management in direct modes.  Palette
  management had no useful effect since the hardware palette is not used
  in these modes.
  
  This transiently acquires i/o privilege if possible as needed to give
  VGLSetBorder() and VGLBlankDisplay() a chance of working.  Neither has
  much chance of working.  I was going to drop support for them in direct
  modes, but found that VGLBlankDisplay() still works with an old graphics
  card on a not so old LCD monitor.
  
  This has some good side effects: reduce glitches for managing the palette
  for screen switches, and speed up and reduce async-signal-unsafeness in
  mouse cursor drawing.

Modified:
  head/lib/libvgl/main.c
  head/lib/libvgl/mouse.c
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Sat Apr 20 17:16:36 2019(r346453)
+++ head/lib/libvgl/main.c  Sat Apr 20 20:29:03 2019(r346454)
@@ -93,7 +93,8 @@ struct vt_mode smode;
 size[2] = VGLOldVInfo.font_size;;
 ioctl(0, KDRASTER, size);
   }
-  ioctl(0, KDDISABIO, 0);
+  if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT)
+ioctl(0, KDDISABIO, 0);
   ioctl(0, KDSETMODE, KD_TEXT);
   smode.mode = VT_AUTO;
   ioctl(0, VT_SETMODE, );
@@ -176,7 +177,7 @@ VGLInit(int mode)
   if (VGLDisplay == NULL)
 return -2;
 
-  if (ioctl(0, KDENABIO, 0)) {
+  if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT && ioctl(0, KDENABIO, 0)) {
 free(VGLDisplay);
 return -3;
   }
@@ -370,7 +371,8 @@ VGLCheckSwitch()
 
 VGLSwitchPending = 0;
 if (VGLOnDisplay) {
-  ioctl(0, KDENABIO, 0);
+  if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT)
+ioctl(0, KDENABIO, 0);
   ioctl(0, KDSETMODE, KD_GRAPHICS);
   ioctl(0, VGLMode, 0);
   VGLCurWindow = 0;
@@ -531,7 +533,8 @@ VGLCheckSwitch()
   munmap(VGLDisplay->Bitmap, VGLAdpInfo.va_window_size);
   ioctl(0, VGLOldMode, 0);
   ioctl(0, KDSETMODE, KD_TEXT);
-  ioctl(0, KDDISABIO, 0);
+  if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT)
+ioctl(0, KDDISABIO, 0);
   ioctl(0, VT_RELDISP, VT_TRUE);
   VGLDisplay->Bitmap = VGLBuf;
   VGLDisplay->Type = MEMBUF;

Modified: head/lib/libvgl/mouse.c
==
--- head/lib/libvgl/mouse.c Sat Apr 20 17:16:36 2019(r346453)
+++ head/lib/libvgl/mouse.c Sat Apr 20 20:29:03 2019(r346454)
@@ -111,10 +111,12 @@ VGLMousePointerShow()
   if (!VGLMouseVisible) {
 INTOFF();
 VGLMouseVisible = 1;
-crtcidx = inb(0x3c4);
-crtcval = inb(0x3c5);
-gdcidx = inb(0x3ce);
-gdcval = inb(0x3cf);
+if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
+  crtcidx = inb(0x3c4);
+  crtcval = inb(0x3c5);
+  gdcidx = inb(0x3ce);
+  gdcval = inb(0x3cf);
+}
 __VGLBitmapCopy(VGLDisplay, VGLMouseXpos, VGLMouseYpos, 
  , 0, 0, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
 bcopy(VGLMouseSave.Bitmap, buffer.Bitmap,
@@ -128,10 +130,12 @@ VGLMousePointerShow()
   }
 __VGLBitmapCopy(, 0, 0, VGLDisplay, 
  VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
-outb(0x3c4, crtcidx);
-outb(0x3c5, crtcval);
-outb(0x3ce, gdcidx);
-outb(0x3cf, gdcval);
+if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
+  outb(0x3c4, crtcidx);
+  outb(0x3c5, crtcval);
+  outb(0x3ce, gdcidx);
+  outb(0x3cf, gdcval);
+}
 INTON();
   }
 }
@@ -144,16 +148,20 @@ VGLMousePointerHide()
   if (VGLMouseVisible) {
 INTOFF();
 VGLMouseVisible = 0;
-crtcidx = inb(0x3c4);
-crtcval = inb(0x3c5);
-gdcidx = inb(0x3ce);
-gdcval = inb(0x3cf);
+if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
+  crtcidx = inb(0x3c4);
+  crtcval = inb(0x3c5);
+  gdcidx = inb(0x3ce);
+  gdcval = inb(0x3cf);
+}
 __VGLBitmapCopy(, 0, 0, VGLDisplay, 
  VGLMouseXpos, VGLMouseYpos, MOUSE_IMG_SIZE, MOUSE_IMG_SIZE);
-outb(0x3c4, crtcidx);
-outb(0x3c5, crtcval);
-outb(0x3ce, gdcidx);
-outb(0x3cf, gdcval);
+if (VGLModeInfo.vi_mem_model != V_INFO_MM_DIRECT) {
+  outb(0x3c4, crtcidx);
+  outb(0x3c5, crtcval);
+  outb(0x3ce, gdcidx);
+  outb(0x3cf, gdcval);
+}
 INTON();
   }
 }

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cSat Apr 20 17:16:36 2019(r346453)
+++ head/lib/libvgl/simple.cSat Apr 20 20:29:03 2019

Re: svn commit: r346530 - in head/sys: netinet netinet6

2019-09-03 Thread Hans Petter Selasky

On 4/22/19 9:52 AM, Enji Cooper wrote:



On Apr 22, 2019, at 12:27 AM, Hans Petter Selasky  wrote:

Author: hselasky
Date: Mon Apr 22 07:27:24 2019
New Revision: 346530
URL: https://svnweb.freebsd.org/changeset/base/346530

Log:
  Fix panic in network stack due to memory use after free in relation to
  fragmented packets.

  When sending IPv4 and IPv6 fragmented packets and a fragment is lost,
  the mbuf making up the fragment will remain in the temporary hashed
  fragment list for a while. If the network interface departs before the
  so-called slow timeout clears the packet, the fragment causes a panic
  when the timeout kicks in due to accessing a freed network interface
  structure.

  Make sure that when a network device is departing, all hashed IPv4 and
  IPv6 fragments belonging to it, get freed.

  Backtrace:
  panic()
  icmp6_reflect()

  hlim = ND_IFINFO(m->m_pkthdr.rcvif)->chlim;
   rcvif->if_afdata[AF_INET6] is NULL.

  icmp6_error()
  frag6_freef()
  frag6_slowtimo()
  pfslowtimo()
  softclock_call_cc()
  softclock()
  ithread_loop()

  Differential Revision:https://reviews.freebsd.org/D19622
  Reviewed by:  bz (network), adrian
  MFC after:1 week
  Sponsored by: Mellanox Technologies


This commit broke the build on mips, etc:

07:36:06
--- ip_reass.o ---

07:36:06
/usr/src/sys/netinet/ip_reass.c:641: error: expected ')' before '(' token

07:36:06 *** [ip_reass.o] Error code 1

EVENTHANDLER_DEFINE looks like it doesn’t work with gcc?


I'm looking into it.

Thank you!

--HPS



___
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: r346572 - in head/lib: libcam/tests libkvm/tests libsbuf/tests

2019-09-03 Thread Enji Cooper
Author: ngie
Date: Mon Apr 22 18:05:33 2019
New Revision: 346572
URL: https://svnweb.freebsd.org/changeset/base/346572

Log:
  Update the spelling of my name (continuation of r346571)
  
  Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use Enji
  instead for clarity.
  
  While here, remove "All Rights Reserved" from copyrights I "own".
  
  MFC after:1 week

Modified:
  head/lib/libcam/tests/libcam_test.c
  head/lib/libkvm/tests/kvm_close_test.c
  head/lib/libkvm/tests/kvm_geterr_test.c
  head/lib/libkvm/tests/kvm_open2_test.c
  head/lib/libkvm/tests/kvm_open_test.c
  head/lib/libkvm/tests/kvm_test_common.c
  head/lib/libkvm/tests/kvm_test_common.h
  head/lib/libsbuf/tests/sbuf_core_test.c
  head/lib/libsbuf/tests/sbuf_stdio_test.c
  head/lib/libsbuf/tests/sbuf_string_test.c
  head/lib/libsbuf/tests/sbuf_test_common.h

Modified: head/lib/libcam/tests/libcam_test.c
==
--- head/lib/libcam/tests/libcam_test.c Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libcam/tests/libcam_test.c Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_close_test.c
==
--- head/lib/libkvm/tests/kvm_close_test.c  Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_close_test.c  Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_geterr_test.c
==
--- head/lib/libkvm/tests/kvm_geterr_test.c Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_geterr_test.c Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_open2_test.c
==
--- head/lib/libkvm/tests/kvm_open2_test.c  Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_open2_test.c  Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_open_test.c
==
--- head/lib/libkvm/tests/kvm_open_test.c   Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_open_test.c   Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_test_common.c
==
--- head/lib/libkvm/tests/kvm_test_common.c Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_test_common.c Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libkvm/tests/kvm_test_common.h
==
--- head/lib/libkvm/tests/kvm_test_common.h Mon Apr 22 17:52:46 2019
(r346571)
+++ head/lib/libkvm/tests/kvm_test_common.h Mon Apr 22 18:05:33 2019
(r346572)
@@ -1,6 +1,5 @@
 /*-
- * Copyright (c) 2017 Ngie Cooper 
- * All rights reserved.
+ * Copyright (c) 2017 Enji Cooper 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/lib/libsbuf/tests/sbuf_core_test.c
==

svn commit: r346596 - head/sys/netinet6

2019-09-03 Thread Konstantin Belousov
Author: kib
Date: Tue Apr 23 12:23:44 2019
New Revision: 346596
URL: https://svnweb.freebsd.org/changeset/base/346596

Log:
  poib: assign link-local address according to RFC
  
  RFC 4391 specifies that the IB interface GID should be re-used as IPv6
  link-local address.  Since the code in in6_get_hw_ifid() ignored
  IFT_INFINIBAND case, ibX interfaces ended up with the local address
  borrowed from some other interface, which is non-compliant.
  
  Use lowest eight bytes from GID for filling the link-local address,
  same as Linux.
  
  Reviewed by:  bz (previous version), ae, hselasky, slavash,
  Sponsored by: Mellanox Technologies
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D20006

Modified:
  head/sys/netinet6/in6_ifattach.c

Modified: head/sys/netinet6/in6_ifattach.c
==
--- head/sys/netinet6/in6_ifattach.cTue Apr 23 10:12:33 2019
(r346595)
+++ head/sys/netinet6/in6_ifattach.cTue Apr 23 12:23:44 2019
(r346596)
@@ -328,6 +328,14 @@ found:
NET_EPOCH_EXIT(et);
return -1;
 
+   case IFT_INFINIBAND:
+   if (addrlen != 20) {
+   NET_EPOCH_EXIT(et);
+   return -1;
+   }
+   bcopy(addr + 12, >s6_addr[8], 8);
+   break;
+
default:
NET_EPOCH_EXIT(et);
return -1;


___
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: r346554 - head/sys/netinet

2019-09-03 Thread Bjoern A. Zeeb

On 22 Apr 2019, at 14:20, Bjoern A. Zeeb wrote:


Author: bz
Date: Mon Apr 22 14:20:49 2019
New Revision: 346554
URL: https://svnweb.freebsd.org/changeset/base/346554

Log:
  Remove some excessive brackets.

  No functional change.


But it includes a stye bug; sorry; I had re-indented the lines to 
validate the change.  I’ll remedy this with the follow-up commit which 
will split that block up anyway.


/bz


___
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: r346571 - in head: share/examples/tests/tests/tap share/man/man4 share/man/man5 share/zoneinfo/tests usr.bin/calendar/calendars usr.bin/du/tests usr.bin/getconf/tests usr.bin/procstat/

2019-09-03 Thread Rodney W. Grimes
> Author: ngie
> Date: Mon Apr 22 17:52:46 2019
> New Revision: 346571
> URL: https://svnweb.freebsd.org/changeset/base/346571
> 
> Log:
>   Update the spelling of my name
>   
>   Previous spellings of my name (NGie, Ngie) weren't my legal spelling. Use 
> Enji
>   instead for clarity.
>   
>   While here, remove "All Rights Reserved" from copyrights I "own".
>   
>   MFC after:  1 week
> 
> Modified:
>   head/share/examples/tests/tests/tap/cp_test.sh
>   head/share/man/man4/cfiscsi.4
>   head/share/man/man5/cd9660.5
>   head/share/zoneinfo/tests/backward_test.sh
>   head/share/zoneinfo/tests/zoneinfo_common.sh
>   head/usr.bin/calendar/calendars/calendar.freebsd
>   head/usr.bin/du/tests/du_test.sh
>   head/usr.bin/getconf/tests/arch_type.c
>   head/usr.bin/procstat/tests/procstat_test.sh
>   head/usr.bin/procstat/tests/while1.c
>   head/usr.sbin/sysrc/sysrc.8
> 
> Modified: head/share/examples/tests/tests/tap/cp_test.sh
> ==
> --- head/share/examples/tests/tests/tap/cp_test.shMon Apr 22 17:48:10 
> 2019(r346570)
> +++ head/share/examples/tests/tests/tap/cp_test.shMon Apr 22 17:52:46 
> 2019(r346571)
> @@ -1,7 +1,6 @@
>  #!/bin/sh
>  #
> -# Copyright (c) 2017 Ngie Cooper 
> -# All rights reserved.
> +# Copyright (c) 2017 Enji Cooper 
>  #
>  # Redistribution and use in source and binary forms, with or without
>  # modification, are permitted provided that the following conditions
> 
> Modified: head/share/man/man4/cfiscsi.4
> ==
> --- head/share/man/man4/cfiscsi.4 Mon Apr 22 17:48:10 2019
> (r346570)
> +++ head/share/man/man4/cfiscsi.4 Mon Apr 22 17:52:46 2019
> (r346571)
> @@ -1,7 +1,6 @@
>  .\" Copyright (c) 2013 Edward Tomasz Napierala
>  .\" Copyright (c) 2015-2017 Alexander Motin 
> -.\" Copyright (c) 2017 Ngie Cooper 
> -.\" All rights reserved.
> +.\" Copyright (c) 2017 Enji Cooper 

We should investiage the history of this All rights reserved,
I suspect it actually originally belongs to traz and possibly
mav, and not explicity you due to prior habbits.  If you have
already done that investigation (ie, you added the line) ignore
my comment.  If however you simply added a copyright between
the line and some other copyright please restore this line
to its prior state.

Thanks,
Rod

>  .\"
>  .\" Redistribution and use in source and binary forms, with or without
>  .\" modification, are permitted provided that the following conditions
> @@ -109,4 +108,4 @@ subsystem was developed by
>  .An Edward Tomasz Napierala Aq Mt tr...@freebsd.org
>  under sponsorship from the FreeBSD Foundation.
>  This manual page was written by
> -.An Ngie Cooper Aq Mt n...@freebsd.org .
> +.An Enji Cooper Aq Mt n...@freebsd.org .
> 
> Modified: head/share/man/man5/cd9660.5
> ==
> --- head/share/man/man5/cd9660.5  Mon Apr 22 17:48:10 2019
> (r346570)
> +++ head/share/man/man5/cd9660.5  Mon Apr 22 17:52:46 2019
> (r346571)
> @@ -1,6 +1,5 @@
>  .\"
> -.\" Copyright (c) 2017 Ngie Cooper
> -.\" All rights reserved.
> +.\" Copyright (c) 2017 Enji Cooper
>  .\"
>  .\" Redistribution and use in source and binary forms, with or without
>  .\" modification, are permitted provided that the following conditions
> @@ -79,4 +78,4 @@ and
>  .An Atsushi Murai Aq Mt amu...@spec.co.jp .
>  .Pp
>  This manual page was written by
> -.An Ngie Cooper Aq Mt n...@freebsd.org .
> +.An Enji Cooper Aq Mt n...@freebsd.org .
> 
> Modified: head/share/zoneinfo/tests/backward_test.sh
> ==
> --- head/share/zoneinfo/tests/backward_test.shMon Apr 22 17:48:10 
> 2019(r346570)
> +++ head/share/zoneinfo/tests/backward_test.shMon Apr 22 17:52:46 
> 2019(r346571)
> @@ -1,6 +1,5 @@
>  #
> -# Copyright (c) 2017 Ngie Cooper 
> -# All rights reserved.
> +# Copyright (c) 2017 Enji Cooper 
>  #
>  # Redistribution and use in source and binary forms, with or without
>  # modification, are permitted provided that the following conditions
> 
> Modified: head/share/zoneinfo/tests/zoneinfo_common.sh
> ==
> --- head/share/zoneinfo/tests/zoneinfo_common.sh  Mon Apr 22 17:48:10 
> 2019(r346570)
> +++ head/share/zoneinfo/tests/zoneinfo_common.sh  Mon Apr 22 17:52:46 
> 2019(r346571)
> @@ -1,7 +1,6 @@
>  #!/bin/sh
>  #
> -# Copyright (c) 2017 Ngie Cooper 
> -# All rights reserved.
> +# Copyright (c) 2017 Enji Cooper 
>  #
>  # Redistribution and use in source and binary forms, with or without
>  # modification, are permitted provided that the following conditions
> 
> Modified: head/usr.bin/calendar/calendars/calendar.freebsd
> 

svn commit: r346573 - head/stand/efi/loader

2019-09-03 Thread Warner Losh
Author: imp
Date: Mon Apr 22 18:33:32 2019
New Revision: 346573
URL: https://svnweb.freebsd.org/changeset/base/346573

Log:
  Move setting of console earlier in boot.
  
  There's no reason we can't setup the console first thing after the
  arch flags are setup. We set it undconditionally to efi. This is a
  good default, and will get us error messages to at least the efi
  console no matter what. This will also prime the pump so that as other
  variables are set, they will take effect and the console will be
  correct as soon as those env vars are set. Also remove the redundant
  setting of the console to efi when we know the console is efi.
  
  Differential Revision: https://reviews.freebsd.org/D20014

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cMon Apr 22 18:05:33 2019
(r346572)
+++ head/stand/efi/loader/main.cMon Apr 22 18:33:32 2019
(r346573)
@@ -765,6 +765,17 @@ main(int argc, CHAR16 *argv[])
 /* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, , (VOID**));
 
+   /*
+* Chicken-and-egg problem; we want to have console output early, but
+* some console attributes may depend on reading from eg. the boot
+* device, which we can't do yet.  We can use printf() etc. once this is
+* done. So, we set it to the efi console, then call console init. This
+* gets us printf early, but also primes the pump for all future console
+* changes to take effect, regardless of where they come from.
+*/
+   setenv("console", "efi", 1);
+   cons_probe();
+
/* Tell ZFS probe code where we booted from, if zfs configured */
efizfs_set_preferred(img->DeviceHandle);
 
@@ -774,15 +785,6 @@ main(int argc, CHAR16 *argv[])
has_kbd = has_keyboard();
 
/*
-* XXX Chicken-and-egg problem; we want to have console output
-* early, but some console attributes may depend on reading from
-* eg. the boot device, which we can't do yet.  We can use
-* printf() etc. once this is done.
-*/
-   setenv("console", "efi", 1);
-   cons_probe();
-
-   /*
 * Initialise the block cache. Set the upper limit.
 */
bcache_init(32768, 512);
@@ -806,17 +808,15 @@ main(int argc, CHAR16 *argv[])
if ((howto & CON_MASK) == 0) {
/* No override, uhowto is controlling and efi cons is 
perfect */
howto = howto | (uhowto & CON_MASK);
-   setenv("console", "efi", 1);
} else if ((howto & CON_MASK) == (uhowto & CON_MASK)) {
/* override matches what UEFI told us, efi console is 
perfect */
-   setenv("console", "efi", 1);
} else if ((uhowto & (CON_MASK)) != 0) {
/*
 * We detected a serial console on ConOut. All possible
 * overrides include serial. We can't really override 
what efi
 * gives us, so we use it knowing it's the best choice.
 */
-   setenv("console", "efi", 1);
+   /* Do nothing */
} else {
/*
 * We detected some kind of serial in the override, but 
ConOut


___
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: r346569 - head/usr.bin/ar

2019-09-03 Thread Ed Maste
Author: emaste
Date: Mon Apr 22 17:29:26 2019
New Revision: 346569
URL: https://svnweb.freebsd.org/changeset/base/346569

Log:
  ar: use array notation to access s_so
  
  This is somewhat more readable than pointer arithmetic.  Also remove an
  unnecessary cast while here.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/write.c
==
--- head/usr.bin/ar/write.c Mon Apr 22 17:25:00 2019(r346568)
+++ head/usr.bin/ar/write.c Mon Apr 22 17:29:26 2019(r346569)
@@ -673,11 +673,11 @@ write_objs(struct bsdar *bsdar)
 
for (i = 0; (size_t)i < bsdar->s_cnt; i++) {
if (w_sz == sizeof(uint32_t))
-   *(bsdar->s_so + i) =
-   htobe32((uint32_t)(*(bsdar->s_so + i)) + 
pm_sz);
+   bsdar->s_so[i] =
+   htobe32(bsdar->s_so[i] + pm_sz);
else
-   *(bsdar->s_so + i) =
-   htobe64(*(bsdar->s_so + i) + pm_sz);
+   bsdar->s_so[i] =
+   htobe64(bsdar->s_so[i] + pm_sz);
}
}
 


___
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: r346550 - head/usr.sbin/bhyve

2019-09-03 Thread Mark Johnston
Author: markj
Date: Mon Apr 22 13:57:52 2019
New Revision: 346550
URL: https://svnweb.freebsd.org/changeset/base/346550

Log:
  Use separate descriptors in bhyve's stdio uart backend.
  
  bhyve was previously using stdin for both reading and writing to the
  console, which made it difficult to redirect console output.  Use
  stdin for reading and stdout for writing.  This makes it easier to use
  bhyve as a backend for syzkaller.
  
  As a side effect, the change fixes a minor bug which would cause bhyve
  to fail with ENOTCAPABLE if configured to use nmdm for com1 and stdio
  for com2.
  
  bhyveload already uses separate descriptors, as does the bvmcons driver.
  
  Reviewed by:  jhb
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19788

Modified:
  head/usr.sbin/bhyve/uart_emul.c

Modified: head/usr.sbin/bhyve/uart_emul.c
==
--- head/usr.sbin/bhyve/uart_emul.c Mon Apr 22 13:55:06 2019
(r346549)
+++ head/usr.sbin/bhyve/uart_emul.c Mon Apr 22 13:57:52 2019
(r346550)
@@ -100,8 +100,8 @@ struct fifo {
 
 struct ttyfd {
boolopened;
-   int fd; /* tty device file descriptor */
-   struct termios tio_orig, tio_new;/* I/O Terminals */
+   int rfd;/* fd for reading */
+   int wfd;/* fd for writing, may be == rfd */
 };
 
 struct uart_softc {
@@ -141,16 +141,15 @@ ttyclose(void)
 static void
 ttyopen(struct ttyfd *tf)
 {
+   struct termios orig, new;
 
-   tcgetattr(tf->fd, >tio_orig);
-
-   tf->tio_new = tf->tio_orig;
-   cfmakeraw(>tio_new);
-   tf->tio_new.c_cflag |= CLOCAL;
-   tcsetattr(tf->fd, TCSANOW, >tio_new);
-
-   if (tf->fd == STDIN_FILENO) {
-   tio_stdio_orig = tf->tio_orig;
+   tcgetattr(tf->rfd, );
+   new = orig;
+   cfmakeraw();
+   new.c_cflag |= CLOCAL;
+   tcsetattr(tf->rfd, TCSANOW, );
+   if (uart_stdio) {
+   tio_stdio_orig = orig;
atexit(ttyclose);
}
 }
@@ -160,7 +159,7 @@ ttyread(struct ttyfd *tf)
 {
unsigned char rb;
 
-   if (read(tf->fd, , 1) == 1)
+   if (read(tf->rfd, , 1) == 1)
return (rb);
else
return (-1);
@@ -170,7 +169,7 @@ static void
 ttywrite(struct ttyfd *tf, unsigned char wb)
 {
 
-   (void)write(tf->fd, , 1);
+   (void)write(tf->wfd, , 1);
 }
 
 static void
@@ -190,7 +189,7 @@ rxfifo_reset(struct uart_softc *sc, int size)
 * Flush any unread input from the tty buffer.
 */
while (1) {
-   nread = read(sc->tty.fd, flushbuf, sizeof(flushbuf));
+   nread = read(sc->tty.rfd, flushbuf, sizeof(flushbuf));
if (nread != sizeof(flushbuf))
break;
}
@@ -277,7 +276,7 @@ uart_opentty(struct uart_softc *sc)
 {
 
ttyopen(>tty);
-   sc->mev = mevent_add(sc->tty.fd, EVF_READ, uart_drain, sc);
+   sc->mev = mevent_add(sc->tty.rfd, EVF_READ, uart_drain, sc);
assert(sc->mev != NULL);
 }
 
@@ -374,7 +373,7 @@ uart_drain(int fd, enum ev_type ev, void *arg)
 
sc = arg;   
 
-   assert(fd == sc->tty.fd);
+   assert(fd == sc->tty.rfd);
assert(ev == EVF_READ);

/*
@@ -637,68 +636,79 @@ uart_init(uart_intr_func_t intr_assert, uart_intr_func
 }
 
 static int
-uart_tty_backend(struct uart_softc *sc, const char *opts)
+uart_stdio_backend(struct uart_softc *sc)
 {
-   int fd;
-   int retval;
+#ifndef WITHOUT_CAPSICUM
+   cap_rights_t rights;
+   cap_ioctl_t cmds[] = { TIOCGETA, TIOCSETA, TIOCGWINSZ };
+#endif
 
-   retval = -1;
+   if (uart_stdio)
+   return (-1);
 
-   fd = open(opts, O_RDWR | O_NONBLOCK);
-   if (fd > 0 && isatty(fd)) {
-   sc->tty.fd = fd;
-   sc->tty.opened = true;
-   retval = 0;
-   }
+   sc->tty.rfd = STDIN_FILENO;
+   sc->tty.wfd = STDOUT_FILENO;
+   sc->tty.opened = true;
 
-   return (retval);
+   if (fcntl(sc->tty.rfd, F_SETFL, O_NONBLOCK) != 0)
+   return (-1);
+   if (fcntl(sc->tty.wfd, F_SETFL, O_NONBLOCK) != 0)
+   return (-1);
+
+#ifndef WITHOUT_CAPSICUM
+   cap_rights_init(, CAP_EVENT, CAP_IOCTL, CAP_READ);
+   if (caph_rights_limit(sc->tty.rfd, ) == -1)
+   errx(EX_OSERR, "Unable to apply rights for sandbox");
+   if (caph_ioctls_limit(sc->tty.rfd, cmds, nitems(cmds)) == -1)
+   errx(EX_OSERR, "Unable to apply rights for sandbox");
+#endif
+
+   uart_stdio = true;
+
+   return (0);
 }
 
-int
-uart_set_backend(struct uart_softc *sc, const char *opts)
+static int
+uart_tty_backend(struct uart_softc *sc, const char *opts)
 {
-   int retval;
 #ifndef 

svn commit: r346600 - head/sys/powerpc/pseries

2019-09-03 Thread Leandro Lupori
Author: luporl
Date: Tue Apr 23 17:11:45 2019
New Revision: 346600
URL: https://svnweb.freebsd.org/changeset/base/346600

Log:
  [PPC64] Fix wrong KASSERT in mphyp_pte_insert()
  
  As mphyp_pte_unset() can also remove PTE entries, and as this can
  happen in parallel with PTEs evicted by mphyp_pte_insert(), there
  is a (rare) chance the PTE being evicted gets removed before
  mphyp_pte_insert() is able to do so. Thus, the KASSERT should
  check wether the result is H_SUCCESS or H_NOT_FOUND, to avoid
  panics if the situation described above occurs.
  
  More details about this issue can be found in PR 237470.
  
  PR:   237470
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D20012

Modified:
  head/sys/powerpc/pseries/mmu_phyp.c

Modified: head/sys/powerpc/pseries/mmu_phyp.c
==
--- head/sys/powerpc/pseries/mmu_phyp.c Tue Apr 23 17:05:57 2019
(r346599)
+++ head/sys/powerpc/pseries/mmu_phyp.c Tue Apr 23 17:11:45 2019
(r346600)
@@ -453,7 +453,7 @@ mphyp_pte_insert(mmu_t mmu, struct pvo_entry *pvo)
evicted.pte_hi & LPTE_AVPN_MASK, 0, , ,
);
moea64_pte_overflow++;
-   KASSERT(result == H_SUCCESS,
+   KASSERT(result == H_SUCCESS || result == H_NOT_FOUND,
("Error evicting page: %d", (int)result));
}
 


___
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"


  1   2   3   4   5   6   7   8   9   >