svn commit: r360110 - stable/11/sys/rpc

2020-04-19 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr 20 01:26:18 2020
New Revision: 360110
URL: https://svnweb.freebsd.org/changeset/base/360110

Log:
  MFC: r359643
  Change the xid for client side krpc over UDP to a global value.
  
  Without this patch, the xid used for the client side krpc requests over
  UDP was initialized for each "connection". A "connection" for UDP is
  rather sketchy and for the kernel NLM a new one is created every 2minutes.
  A problem with client side interoperability with a Netapp server for the NLM
  was reported and it is believed to be caused by reuse of the same xid.
  Although this was never completely diagnosed by the reporter, I could see
  how the same xid might get reused, since it is initialized to a value
  based on the TOD clock every two minutes.
  I suspect initializing the value for every "connection" was inherited from
  userland library code, where having a global xid was not practical.
  However, implementing a global "xid" for the kernel rpc is straightforward
  and will ensure that an xid value is not reused for a long time. This
  patch does that and is hoped it will fix the Netapp interoperability
  problem.
  
  PR:   245022

Modified:
  stable/11/sys/rpc/clnt_dg.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/rpc/clnt_dg.c
==
--- stable/11/sys/rpc/clnt_dg.c Mon Apr 20 01:17:00 2020(r360109)
+++ stable/11/sys/rpc/clnt_dg.c Mon Apr 20 01:26:18 2020(r360110)
@@ -92,6 +92,8 @@ static struct clnt_ops clnt_dg_ops = {
.cl_control =   clnt_dg_control
 };
 
+static volatile uint32_t rpc_xid = 0;
+
 /*
  * A pending RPC request which awaits a reply. Requests which have
  * received their reply will have cr_xid set to zero and cr_mrep to
@@ -191,6 +193,7 @@ clnt_dg_create(
struct __rpc_sockinfo si;
XDR xdrs;
int error;
+   uint32_t newxid;
 
if (svcaddr == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
@@ -243,8 +246,10 @@ clnt_dg_create(
cu->cu_sent = 0;
cu->cu_cwnd_wait = FALSE;
(void) getmicrotime(&now);
-   cu->cu_xid = __RPC_GETXID(&now);
-   call_msg.rm_xid = cu->cu_xid;
+   /* Clip at 28bits so that it will not wrap around. */
+   newxid = __RPC_GETXID(&now) & 0xfff;
+   atomic_cmpset_32(&rpc_xid, 0, newxid);
+   call_msg.rm_xid = atomic_fetchadd_32(&rpc_xid, 1);
call_msg.rm_call.cb_prog = program;
call_msg.rm_call.cb_vers = version;
xdrmem_create(&xdrs, cu->cu_mcallc, MCALL_MSG_SIZE, XDR_ENCODE);
@@ -420,8 +425,7 @@ clnt_dg_call(
 call_again:
mtx_assert(&cs->cs_lock, MA_OWNED);
 
-   cu->cu_xid++;
-   xid = cu->cu_xid;
+   xid = atomic_fetchadd_32(&rpc_xid, 1);
 
 send_again:
mtx_unlock(&cs->cs_lock);
@@ -867,13 +871,13 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
(void) memcpy(&cu->cu_raddr, addr, addr->sa_len);
break;
case CLGET_XID:
-   *(uint32_t *)info = cu->cu_xid;
+   *(uint32_t *)info = atomic_load_32(&rpc_xid);
break;
 
case CLSET_XID:
/* This will set the xid of the NEXT call */
/* decrement by 1 as clnt_dg_call() increments once */
-   cu->cu_xid = *(uint32_t *)info - 1;
+   atomic_store_32(&rpc_xid, *(uint32_t *)info - 1);
break;
 
case CLGET_VERS:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360109 - stable/12/sys/rpc

2020-04-19 Thread Rick Macklem
Author: rmacklem
Date: Mon Apr 20 01:17:00 2020
New Revision: 360109
URL: https://svnweb.freebsd.org/changeset/base/360109

Log:
  MFC: r359643
  Change the xid for client side krpc over UDP to a global value.
  
  Without this patch, the xid used for the client side krpc requests over
  UDP was initialized for each "connection". A "connection" for UDP is
  rather sketchy and for the kernel NLM a new one is created every 2minutes.
  A problem with client side interoperability with a Netapp server for the NLM
  was reported and it is believed to be caused by reuse of the same xid.
  Although this was never completely diagnosed by the reporter, I could see
  how the same xid might get reused, since it is initialized to a value
  based on the TOD clock every two minutes.
  I suspect initializing the value for every "connection" was inherited from
  userland library code, where having a global xid was not practical.
  However, implementing a global "xid" for the kernel rpc is straightforward
  and will ensure that an xid value is not reused for a long time. This
  patch does that and is hoped it will fix the Netapp interoperability
  problem.
  
  PR:   245022

Modified:
  stable/12/sys/rpc/clnt_dg.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/rpc/clnt_dg.c
==
--- stable/12/sys/rpc/clnt_dg.c Mon Apr 20 00:47:28 2020(r360108)
+++ stable/12/sys/rpc/clnt_dg.c Mon Apr 20 01:17:00 2020(r360109)
@@ -94,6 +94,8 @@ static struct clnt_ops clnt_dg_ops = {
.cl_control =   clnt_dg_control
 };
 
+static volatile uint32_t rpc_xid = 0;
+
 /*
  * A pending RPC request which awaits a reply. Requests which have
  * received their reply will have cr_xid set to zero and cr_mrep to
@@ -193,6 +195,7 @@ clnt_dg_create(
struct __rpc_sockinfo si;
XDR xdrs;
int error;
+   uint32_t newxid;
 
if (svcaddr == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
@@ -245,8 +248,10 @@ clnt_dg_create(
cu->cu_sent = 0;
cu->cu_cwnd_wait = FALSE;
(void) getmicrotime(&now);
-   cu->cu_xid = __RPC_GETXID(&now);
-   call_msg.rm_xid = cu->cu_xid;
+   /* Clip at 28bits so that it will not wrap around. */
+   newxid = __RPC_GETXID(&now) & 0xfff;
+   atomic_cmpset_32(&rpc_xid, 0, newxid);
+   call_msg.rm_xid = atomic_fetchadd_32(&rpc_xid, 1);
call_msg.rm_call.cb_prog = program;
call_msg.rm_call.cb_vers = version;
xdrmem_create(&xdrs, cu->cu_mcallc, MCALL_MSG_SIZE, XDR_ENCODE);
@@ -418,8 +423,7 @@ clnt_dg_call(
 call_again:
mtx_assert(&cs->cs_lock, MA_OWNED);
 
-   cu->cu_xid++;
-   xid = cu->cu_xid;
+   xid = atomic_fetchadd_32(&rpc_xid, 1);
 
 send_again:
mtx_unlock(&cs->cs_lock);
@@ -865,13 +869,13 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
(void) memcpy(&cu->cu_raddr, addr, addr->sa_len);
break;
case CLGET_XID:
-   *(uint32_t *)info = cu->cu_xid;
+   *(uint32_t *)info = atomic_load_32(&rpc_xid);
break;
 
case CLSET_XID:
/* This will set the xid of the NEXT call */
/* decrement by 1 as clnt_dg_call() increments once */
-   cu->cu_xid = *(uint32_t *)info - 1;
+   atomic_store_32(&rpc_xid, *(uint32_t *)info - 1);
break;
 
case CLGET_VERS:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360108 - head/tests/sys/kqueue/libkqueue

2020-04-19 Thread Kyle Evans
Author: kevans
Date: Mon Apr 20 00:47:28 2020
New Revision: 360108
URL: https://svnweb.freebsd.org/changeset/base/360108

Log:
  tests: kqueue: fix some issues with now() on ILP32 platforms
  
  There were ultimately two separate problems here:
  - a 32-bit long cannot represent microseconds since 1970 (noted by ian)
  - time_t is 32-bit on i386, so now() was wrong anyways even with the correct
return type.
  
  For the first, just explicitly use a uint64_t for now() and all of the
  callers. For the second, we need to explicitly cast tv_sec to uint64_t
  before it gets multiplied in the SEC_TO_US macro. Casting this instance
  rather than generally in the macro was arbitrarily chosen simply because all
  other uses are converting small relative time values.
  
  The tests now pass on i386, at least; presumably other ILP32 will be fine
  now as well.

Modified:
  head/tests/sys/kqueue/libkqueue/timer.c

Modified: head/tests/sys/kqueue/libkqueue/timer.c
==
--- head/tests/sys/kqueue/libkqueue/timer.c Sun Apr 19 23:53:47 2020
(r360107)
+++ head/tests/sys/kqueue/libkqueue/timer.c Mon Apr 20 00:47:28 2020
(r360108)
@@ -30,13 +30,14 @@
 /* Get the current time with microsecond precision. Used for
  * sub-second timing to make some timer tests run faster.
  */
-static long
+static uint64_t
 now(void)
 {
 struct timeval tv;
 
 gettimeofday(&tv, NULL);
-return SEC_TO_US(tv.tv_sec) + tv.tv_usec;
+/* Promote potentially 32-bit time_t to uint64_t before conversion. */
+return SEC_TO_US((uint64_t)tv.tv_sec) + tv.tv_usec;
 }
 
 /* Sleep for a given number of milliseconds. The timeout is assumed to
@@ -216,7 +217,7 @@ test_abstime(void)
 {
 const char *test_id = "kevent(EVFILT_TIMER, EV_ONESHOT, NOTE_ABSTIME)";
 struct kevent kev;
-long end, start, stop;
+uint64_t end, start, stop;
 const int timeout_sec = 3;
 
 test_begin(test_id);
@@ -252,7 +253,7 @@ test_update(void)
 const char *test_id = "kevent(EVFILT_TIMER (UPDATE), EV_ADD | EV_ONESHOT)";
 struct kevent kev;
 long elapsed;
-long start;
+uint64_t start;
 
 test_begin(test_id);
 
@@ -297,7 +298,7 @@ test_update_equal(void)
 const char *test_id = "kevent(EVFILT_TIMER (UPDATE=), EV_ADD | 
EV_ONESHOT)";
 struct kevent kev;
 long elapsed;
-long start;
+uint64_t start;
 
 test_begin(test_id);
 
@@ -341,7 +342,7 @@ test_update_expired(void)
 const char *test_id = "kevent(EVFILT_TIMER (UPDATE EXP), EV_ADD | 
EV_ONESHOT)";
 struct kevent kev;
 long elapsed;
-long start;
+uint64_t start;
 
 test_begin(test_id);
 
@@ -392,8 +393,7 @@ test_update_periodic(void)
 const char *test_id = "kevent(EVFILT_TIMER (UPDATE), periodic)";
 struct kevent kev;
 long elapsed;
-long start;
-long stop;
+uint64_t start, stop;
 
 test_begin(test_id);
 
@@ -450,8 +450,7 @@ test_update_timing(void)
 int iteration;
 int sleeptime;
 long elapsed;
-long start;
-long stop;
+uint64_t start, stop;
 
 test_begin(test_id);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360078 - in head: sbin/bectl share/man/man8

2020-04-19 Thread Conrad Meyer
There is also mdoc(7), which describes the same thing:

   SEE ALSO
   References other manuals with related topics.  This section should
   exist for most manuals.  Cross-references should conventionally be
   ordered first by section, then alphabetically (ignoring case).

I consult mdoc(7) frequently when writing or editing manual pages.

In addition to 'mandoc -Tlint', there is a tool in ports called 'igor'
which can be used to perform some style checking of manual pages.
Hope that helps!

Regards,
Conrad

On Sun, Apr 19, 2020 at 3:36 AM Mateusz Piotrowski <0...@freebsd.org> wrote:
>
> On 4/18/20 11:11 PM, Yuri Pankov wrote:
> > We don't have the man style guide (that I know of, at least)
> We have style.mdoc(5)!
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Shawn Webb
Thanks, Conrad! I'll test out the change tomorrow after the
HardenedBSD auto-sync scripts run tonight. I'll report back tomorrow.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

On Sun, Apr 19, 2020 at 04:55:37PM -0700, Conrad Meyer wrote:
> Committed in r360107, if you don't mind rebooting to try the patch.  I
> will work on the slightly more complicated additional steps mentioned
> earlier, but those will take a little more time.
> 
> Thanks again,
> Conrad
> 
> On Sun, Apr 19, 2020 at 4:50 PM Conrad Meyer  wrote:
> >
> > https://reviews.freebsd.org/D24507 :-)
> >
> > On Sun, Apr 19, 2020 at 4:45 PM Peter Grehan  wrote:
> > >
> > > > Unless there is an ABI problem, I think we should probably go
> > > > ahead and bump VM_MAX_MEMMAPS
> > >
> > >   That's a reasonable fix - double it (or more) until it's made dynamic.
> > > The VGA code is another (future) client of this, and it would allow
> > > other things like multiple frame buffers.
> > >
> > > later,
> > >
> > > Peter.


signature.asc
Description: PGP signature


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Conrad Meyer
Committed in r360107, if you don't mind rebooting to try the patch.  I
will work on the slightly more complicated additional steps mentioned
earlier, but those will take a little more time.

Thanks again,
Conrad

On Sun, Apr 19, 2020 at 4:50 PM Conrad Meyer  wrote:
>
> https://reviews.freebsd.org/D24507 :-)
>
> On Sun, Apr 19, 2020 at 4:45 PM Peter Grehan  wrote:
> >
> > > Unless there is an ABI problem, I think we should probably go
> > > ahead and bump VM_MAX_MEMMAPS
> >
> >   That's a reasonable fix - double it (or more) until it's made dynamic.
> > The VGA code is another (future) client of this, and it would allow
> > other things like multiple frame buffers.
> >
> > later,
> >
> > Peter.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360107 - head/sys/amd64/vmm

2020-04-19 Thread Conrad Meyer
Author: cem
Date: Sun Apr 19 23:53:47 2020
New Revision: 360107
URL: https://svnweb.freebsd.org/changeset/base/360107

Log:
  vmm(4): Bump VM_MAX_MEMMAPS for vmgenid
  
  As a short term solution for the problem reported by Shawn Webb re: r359950,
  bump the maximum number of memmaps per VM. This structure is 40 bytes, and the
  additional four (fixed array embedded in the struct vm) members increase the
  size of struct vm by 3%.
  
  (The vast majority of struct vm is the embedded struct vcpu array, which
  accounts for 84% of the size -- over 4 kB.)
  
  Reported by:  Shawn Webb 
  Reviewed by:  grehan
  X-MFC-With:   r359950
  Differential Revision:https://reviews.freebsd.org/D24507

Modified:
  head/sys/amd64/vmm/vmm.c

Modified: head/sys/amd64/vmm/vmm.c
==
--- head/sys/amd64/vmm/vmm.cSun Apr 19 21:38:03 2020(r360106)
+++ head/sys/amd64/vmm/vmm.cSun Apr 19 23:53:47 2020(r360107)
@@ -134,7 +134,7 @@ struct mem_map {
int prot;
int flags;
 };
-#defineVM_MAX_MEMMAPS  4
+#defineVM_MAX_MEMMAPS  8
 
 /*
  * Initialization:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Conrad Meyer
https://reviews.freebsd.org/D24507 :-)

On Sun, Apr 19, 2020 at 4:45 PM Peter Grehan  wrote:
>
> > Unless there is an ABI problem, I think we should probably go
> > ahead and bump VM_MAX_MEMMAPS
>
>   That's a reasonable fix - double it (or more) until it's made dynamic.
> The VGA code is another (future) client of this, and it would allow
> other things like multiple frame buffers.
>
> later,
>
> Peter.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Peter Grehan

Unless there is an ABI problem, I think we should probably go
ahead and bump VM_MAX_MEMMAPS


 That's a reasonable fix - double it (or more) until it's made dynamic.
The VGA code is another (future) client of this, and it would allow 
other things like multiple frame buffers.


later,

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


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Conrad Meyer
Thanks!  I believe we're running into VM_MAX_MEMMAPS (4) due to:

1. Low memory (0 through PCI hole)
2. High memory (4GB+)
3. Framebuffer
4. VMgenid's segment
5. EFI firmware's segment

As a temporary workaround, if you do not need any of: >3GB RAM,
framebuffer, or EFI boot, turning off any one of these should free a
segment and allow boot.  Unless there is an ABI problem, I think we
should probably go ahead and bump VM_MAX_MEMMAPS, or make it
dynamically sized.  And as a userspace workaround for the issue that
doesn't require a reboot (or reload of vmm.ko), we could add a knob to
bhyve(8) to disable vmgenid.

Best,
Conrad

On Sun, Apr 19, 2020 at 4:14 PM Shawn Webb  wrote:
>
> This is the full output from bhyve:
>
> fbuf frame buffer base: 0x69191a0 [sz 16777216]
> bhyve: bootrom_alloc: vm_mmap_mapseg: No space left on device
> bhyve: vmgenc_init: bootrom_alloc
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder / Security Engineer
> HardenedBSD
>
> GPG Key ID:  0xFF2E67A277F8E1FA
> GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
> https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
>
> On Sun, Apr 19, 2020 at 04:04:16PM -0700, Conrad Meyer wrote:
> > Hey Shawn,
> >
> > I will take a look. Thanks for the report and especially the repro example.
> > What sort of bad symptoms are you observing (or will it be super obvious
> > when I try this)?
> >
> > Thanks,
> > Conrad
> >
> > On Sun, Apr 19, 2020 at 15:53 Shawn Webb  wrote:
> >
> > > On Wed, Apr 15, 2020 at 02:00:18AM +, Conrad Meyer wrote:
> > > > Author: cem
> > > > Date: Wed Apr 15 02:00:17 2020
> > > > New Revision: 359950
> > > > URL: https://svnweb.freebsd.org/changeset/base/359950
> > > >
> > > > Log:
> > > >   bhyve(8): Add VM Generation Counter ACPI device
> > > >
> > > >   Add an implementatation of the 'Virtual Machine Generation ID' spec to
> > > >   Bhyve.  The spec provides a randomly generated GUID (at bhyve start) 
> > > > in
> > > >   device memory, along with an ACPI device with _CID VM_Gen_Counter and
> > > ADDR
> > > >   evaluating to a Package pointing at that GUID.
> > > >
> > > >   A GPE is defined which Notifies the ACPI Device when the generation
> > > changes
> > > >   (such as when a snapshot is rolled back).  At this time, Bhyve does 
> > > > not
> > > >   support snapshotting, so the GPE is never actually raised.
> > > >
> > > >   Suggested by:   rpokala
> > > >   Discussed with: grehan
> > > >   Differential Revision:  https://reviews.freebsd.org/D23165
> > > >
> > > > Added:
> > > >   head/usr.sbin/bhyve/vmgenc.c   (contents, props changed)
> > > >   head/usr.sbin/bhyve/vmgenc.h   (contents, props changed)
> > > > Modified:
> > > >   head/usr.sbin/bhyve/Makefile
> > > >   head/usr.sbin/bhyve/acpi.c
> > > >   head/usr.sbin/bhyve/acpi.h
> > > >   head/usr.sbin/bhyve/bhyverun.c
> > > >   head/usr.sbin/bhyve/pm.c
> > >
> > > Hey Conrad,
> > >
> > > Something about this commit broke bhyve in UEFI mode. Reverting this
> > > specific change caused bhyve to work again. Here's a sample command:
> > >
> > > /usr/obj/usr/src/amd64.amd64/usr.sbin/bhyve/bhyve \
> > > -c 4 \
> > > -m 16g \
> > > -H \
> > > -A \
> > > -P \
> > > -S \
> > > -g 0 \
> > > -s 0:0,hostbridge \
> > > -s 1:0,lpc \
> > > -s 29,fbuf,tcp=127.0.0.1:5910,w=1024,h=768,wait \
> > > -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
> > > -s 2:0,virtio-net,tap1 \
> > > -s 3:0,virtio-blk,/dev/zvol/rpool/bhyve/hbsd-cross-dso-cfi-01/disk-01 
> > > \
> > > -l com1,/dev/nmdm-hbsd-cross-dso-cfi-01-A \
> > > -s 31:0,ahci-cd,/ISO/HardenedBSD/12-stable_amd64/2020-04-19_disc1.iso 
> > > \
> > > hbsd-cdcfi-01
> > >
> > > Thanks,
> > >
> > > --
> > > Shawn Webb
> > > Cofounder / Security Engineer
> > > HardenedBSD
> > >
> > > GPG Key ID:  0xFF2E67A277F8E1FA
> > > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
> > >
> > > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
> > >
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Shawn Webb
On Mon, Apr 20, 2020 at 02:32:23AM +0300, Yuri Pankov wrote:
> Shawn Webb wrote:
> > This is the full output from bhyve:
> > 
> > fbuf frame buffer base: 0x69191a0 [sz 16777216]
> > bhyve: bootrom_alloc: vm_mmap_mapseg: No space left on device
> > bhyve: vmgenc_init: bootrom_alloc
> 
> I wonder if it's coincidence, and you really didn't have 16G to wire at that
> moment, and after reverting the commit it was there (reboot?) -- I was
> getting the same error well before this change when I had almost all of the
> memory eaten by ZFS ARC, I was looking at r359949 as possible candidate, but
> limiting that memory hog did make the issue disappear.

Good thought, but this was on a fresh reboot on my laptop with 64GB
ECC RAM. At the time bhyve was started, I had 55GB memory free.

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Yuri Pankov

Shawn Webb wrote:

This is the full output from bhyve:

fbuf frame buffer base: 0x69191a0 [sz 16777216]
bhyve: bootrom_alloc: vm_mmap_mapseg: No space left on device
bhyve: vmgenc_init: bootrom_alloc


I wonder if it's coincidence, and you really didn't have 16G to wire at 
that moment, and after reverting the commit it was there (reboot?) -- I 
was getting the same error well before this change when I had almost all 
of the memory eaten by ZFS ARC, I was looking at r359949 as possible 
candidate, but limiting that memory hog did make the issue disappear.

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


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Shawn Webb
This is the full output from bhyve:

fbuf frame buffer base: 0x69191a0 [sz 16777216]
bhyve: bootrom_alloc: vm_mmap_mapseg: No space left on device
bhyve: vmgenc_init: bootrom_alloc

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

On Sun, Apr 19, 2020 at 04:04:16PM -0700, Conrad Meyer wrote:
> Hey Shawn,
> 
> I will take a look. Thanks for the report and especially the repro example.
> What sort of bad symptoms are you observing (or will it be super obvious
> when I try this)?
> 
> Thanks,
> Conrad
> 
> On Sun, Apr 19, 2020 at 15:53 Shawn Webb  wrote:
> 
> > On Wed, Apr 15, 2020 at 02:00:18AM +, Conrad Meyer wrote:
> > > Author: cem
> > > Date: Wed Apr 15 02:00:17 2020
> > > New Revision: 359950
> > > URL: https://svnweb.freebsd.org/changeset/base/359950
> > >
> > > Log:
> > >   bhyve(8): Add VM Generation Counter ACPI device
> > >
> > >   Add an implementatation of the 'Virtual Machine Generation ID' spec to
> > >   Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
> > >   device memory, along with an ACPI device with _CID VM_Gen_Counter and
> > ADDR
> > >   evaluating to a Package pointing at that GUID.
> > >
> > >   A GPE is defined which Notifies the ACPI Device when the generation
> > changes
> > >   (such as when a snapshot is rolled back).  At this time, Bhyve does not
> > >   support snapshotting, so the GPE is never actually raised.
> > >
> > >   Suggested by:   rpokala
> > >   Discussed with: grehan
> > >   Differential Revision:  https://reviews.freebsd.org/D23165
> > >
> > > Added:
> > >   head/usr.sbin/bhyve/vmgenc.c   (contents, props changed)
> > >   head/usr.sbin/bhyve/vmgenc.h   (contents, props changed)
> > > Modified:
> > >   head/usr.sbin/bhyve/Makefile
> > >   head/usr.sbin/bhyve/acpi.c
> > >   head/usr.sbin/bhyve/acpi.h
> > >   head/usr.sbin/bhyve/bhyverun.c
> > >   head/usr.sbin/bhyve/pm.c
> >
> > Hey Conrad,
> >
> > Something about this commit broke bhyve in UEFI mode. Reverting this
> > specific change caused bhyve to work again. Here's a sample command:
> >
> > /usr/obj/usr/src/amd64.amd64/usr.sbin/bhyve/bhyve \
> > -c 4 \
> > -m 16g \
> > -H \
> > -A \
> > -P \
> > -S \
> > -g 0 \
> > -s 0:0,hostbridge \
> > -s 1:0,lpc \
> > -s 29,fbuf,tcp=127.0.0.1:5910,w=1024,h=768,wait \
> > -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
> > -s 2:0,virtio-net,tap1 \
> > -s 3:0,virtio-blk,/dev/zvol/rpool/bhyve/hbsd-cross-dso-cfi-01/disk-01 \
> > -l com1,/dev/nmdm-hbsd-cross-dso-cfi-01-A \
> > -s 31:0,ahci-cd,/ISO/HardenedBSD/12-stable_amd64/2020-04-19_disc1.iso \
> > hbsd-cdcfi-01
> >
> > Thanks,
> >
> > --
> > Shawn Webb
> > Cofounder / Security Engineer
> > HardenedBSD
> >
> > GPG Key ID:  0xFF2E67A277F8E1FA
> > GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
> >
> > https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
> >


signature.asc
Description: PGP signature


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Conrad Meyer
Hey Shawn,

I will take a look. Thanks for the report and especially the repro example.
What sort of bad symptoms are you observing (or will it be super obvious
when I try this)?

Thanks,
Conrad

On Sun, Apr 19, 2020 at 15:53 Shawn Webb  wrote:

> On Wed, Apr 15, 2020 at 02:00:18AM +, Conrad Meyer wrote:
> > Author: cem
> > Date: Wed Apr 15 02:00:17 2020
> > New Revision: 359950
> > URL: https://svnweb.freebsd.org/changeset/base/359950
> >
> > Log:
> >   bhyve(8): Add VM Generation Counter ACPI device
> >
> >   Add an implementatation of the 'Virtual Machine Generation ID' spec to
> >   Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
> >   device memory, along with an ACPI device with _CID VM_Gen_Counter and
> ADDR
> >   evaluating to a Package pointing at that GUID.
> >
> >   A GPE is defined which Notifies the ACPI Device when the generation
> changes
> >   (such as when a snapshot is rolled back).  At this time, Bhyve does not
> >   support snapshotting, so the GPE is never actually raised.
> >
> >   Suggested by:   rpokala
> >   Discussed with: grehan
> >   Differential Revision:  https://reviews.freebsd.org/D23165
> >
> > Added:
> >   head/usr.sbin/bhyve/vmgenc.c   (contents, props changed)
> >   head/usr.sbin/bhyve/vmgenc.h   (contents, props changed)
> > Modified:
> >   head/usr.sbin/bhyve/Makefile
> >   head/usr.sbin/bhyve/acpi.c
> >   head/usr.sbin/bhyve/acpi.h
> >   head/usr.sbin/bhyve/bhyverun.c
> >   head/usr.sbin/bhyve/pm.c
>
> Hey Conrad,
>
> Something about this commit broke bhyve in UEFI mode. Reverting this
> specific change caused bhyve to work again. Here's a sample command:
>
> /usr/obj/usr/src/amd64.amd64/usr.sbin/bhyve/bhyve \
> -c 4 \
> -m 16g \
> -H \
> -A \
> -P \
> -S \
> -g 0 \
> -s 0:0,hostbridge \
> -s 1:0,lpc \
> -s 29,fbuf,tcp=127.0.0.1:5910,w=1024,h=768,wait \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
> -s 2:0,virtio-net,tap1 \
> -s 3:0,virtio-blk,/dev/zvol/rpool/bhyve/hbsd-cross-dso-cfi-01/disk-01 \
> -l com1,/dev/nmdm-hbsd-cross-dso-cfi-01-A \
> -s 31:0,ahci-cd,/ISO/HardenedBSD/12-stable_amd64/2020-04-19_disc1.iso \
> hbsd-cdcfi-01
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder / Security Engineer
> HardenedBSD
>
> GPG Key ID:  0xFF2E67A277F8E1FA
> GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
>
> https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r359950 - head/usr.sbin/bhyve

2020-04-19 Thread Shawn Webb
On Wed, Apr 15, 2020 at 02:00:18AM +, Conrad Meyer wrote:
> Author: cem
> Date: Wed Apr 15 02:00:17 2020
> New Revision: 359950
> URL: https://svnweb.freebsd.org/changeset/base/359950
> 
> Log:
>   bhyve(8): Add VM Generation Counter ACPI device
>   
>   Add an implementatation of the 'Virtual Machine Generation ID' spec to
>   Bhyve.  The spec provides a randomly generated GUID (at bhyve start) in
>   device memory, along with an ACPI device with _CID VM_Gen_Counter and ADDR
>   evaluating to a Package pointing at that GUID.
>   
>   A GPE is defined which Notifies the ACPI Device when the generation changes
>   (such as when a snapshot is rolled back).  At this time, Bhyve does not
>   support snapshotting, so the GPE is never actually raised.
>   
>   Suggested by:   rpokala
>   Discussed with: grehan
>   Differential Revision:  https://reviews.freebsd.org/D23165
> 
> Added:
>   head/usr.sbin/bhyve/vmgenc.c   (contents, props changed)
>   head/usr.sbin/bhyve/vmgenc.h   (contents, props changed)
> Modified:
>   head/usr.sbin/bhyve/Makefile
>   head/usr.sbin/bhyve/acpi.c
>   head/usr.sbin/bhyve/acpi.h
>   head/usr.sbin/bhyve/bhyverun.c
>   head/usr.sbin/bhyve/pm.c

Hey Conrad,

Something about this commit broke bhyve in UEFI mode. Reverting this
specific change caused bhyve to work again. Here's a sample command:

/usr/obj/usr/src/amd64.amd64/usr.sbin/bhyve/bhyve \
-c 4 \
-m 16g \
-H \
-A \
-P \
-S \
-g 0 \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 29,fbuf,tcp=127.0.0.1:5910,w=1024,h=768,wait \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
-s 2:0,virtio-net,tap1 \
-s 3:0,virtio-blk,/dev/zvol/rpool/bhyve/hbsd-cross-dso-cfi-01/disk-01 \
-l com1,/dev/nmdm-hbsd-cross-dso-cfi-01-A \
-s 31:0,ahci-cd,/ISO/HardenedBSD/12-stable_amd64/2020-04-19_disc1.iso \
hbsd-cdcfi-01

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8 AB23 0FB2
https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


svn commit: r360106 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
Author: cy
Date: Sun Apr 19 21:38:03 2020
New Revision: 360106
URL: https://svnweb.freebsd.org/changeset/base/360106

Log:
  Due to popular demand, revert r360102.
  
  Reported by:  many

Modified:
  head/libexec/rc/rc.d/Makefile
  head/share/mk/bsd.opts.mk
  head/share/mk/src.opts.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/libexec/rc/rc.d/Makefile
==
--- head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:53:44 2020
(r360105)
+++ head/libexec/rc/rc.d/Makefile   Sun Apr 19 21:38:03 2020
(r360106)
@@ -242,17 +242,14 @@ CONFS+=   lpd
 .if ${MK_KERBEROS} != "no"
 CONFS+=ipropd_master
 CONFS+=ipropd_slave
-
-DIRS+= VAR_HEMIDAL
-VAR_HEMIDAL=   /var/heimdal
-VAR_HEMIDAL_MODE=  700
-.endif
-
-.if ${MK_KERBEROS_SCRIPTS} != "no"
 _kadmind=  kadmind
 _kdc=  kdc
 _kfd=  kfd
 _kpasswdd= kpasswdd
+
+DIRS+= VAR_HEMIDAL
+VAR_HEMIDAL=   /var/heimdal
+VAR_HEMIDAL_MODE=  700
 .endif
 
 .if ${MK_MAIL} != "no"

Modified: head/share/mk/bsd.opts.mk
==
--- head/share/mk/bsd.opts.mk   Sun Apr 19 17:53:44 2020(r360105)
+++ head/share/mk/bsd.opts.mk   Sun Apr 19 21:38:03 2020(r360106)
@@ -55,7 +55,6 @@ __DEFAULT_YES_OPTIONS = \
 INCLUDES \
 INSTALLLIB \
 KERBEROS \
-KERBEROS_SCRIPTS \
 MAKE_CHECK_USE_SANDBOX \
 MAN \
 MANCOMPRESS \

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Sun Apr 19 17:53:44 2020(r360105)
+++ head/share/mk/src.opts.mk   Sun Apr 19 21:38:03 2020(r360106)
@@ -237,7 +237,6 @@ __DEFAULT_DEPENDENT_OPTIONS= \
 INET \
 INET6 \
 KERBEROS \
-KERBEROS_SCRIPTS \
 KVM \
 NETGRAPH \
 PAM \

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:53:44 
2020(r360105)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 21:38:03 
2020(r360106)
@@ -3152,9 +3152,13 @@ OLD_FILES+=usr/libexec/hprop
 OLD_FILES+=usr/libexec/hpropd
 OLD_FILES+=usr/libexec/ipropd-master
 OLD_FILES+=usr/libexec/ipropd-slave
+OLD_FILES+=usr/libexec/kadmind
 OLD_FILES+=usr/libexec/kcm
+OLD_FILES+=usr/libexec/kdc
 OLD_FILES+=usr/libexec/kdigest
+OLD_FILES+=usr/libexec/kfd
 OLD_FILES+=usr/libexec/kimpersonate
+OLD_FILES+=usr/libexec/kpasswdd
 OLD_FILES+=usr/sbin/kstash
 OLD_FILES+=usr/sbin/ktutil
 OLD_FILES+=usr/sbin/iprop-log
@@ -3874,13 +3878,6 @@ OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
 OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
 OLD_FILES+=usr/share/man/man8/string2key.8.gz
 OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
-.endif
-
-.if ${MK_KERBEROS_SCRIPTS} == no
-OLD_FILES+=usr/libexec/kadmind
-OLD_FILES+=usr/libexec/kdc
-OLD_FILES+=usr/libexec/kfd
-OLD_FILES+=usr/libexec/kpasswdd
 .endif
 
 .if ${MK_KERBEROS_SUPPORT} == no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
In message , Enji Cooper 
writes
:
> 
>
> > On Apr 19, 2020, at 10:01 AM, Cy Schubert  wrote:
> > 
> > Author: cy
> > Date: Sun Apr 19 17:01:21 2020
> > New Revision: 360102
> > URL: https://svnweb.freebsd.org/changeset/base/360102
> > 
> > Log:
> >  Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
> >  instead of MK_KERBEROS. The reason for this change is some users
> >  prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
> >  Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> > 
> >  PR:197337
> >  Reported by:   Adam McDougall 
> >  Reviewed by:   imp
> >  Differential Revision: https://reviews.freebsd.org/D24252
>
>
> Hi Cy,
>   Having excised code like this in the past, I don’t think this is the 
> right approach: a separate slave port should be added that handles the rc.d s
> cript installation, etc, or the scripts should be added to the manifest for t
> he ports.

This will be removed. 

No slave port will be produced.

No additional rc scripts will be added to the port. Patches are welcome.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

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


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


Re: svn commit: r360019 - head/tests/sys/kern

2020-04-19 Thread Enji Cooper

> On Apr 16, 2020, at 1:07 PM, Jonathan T. Looney  wrote:
> 
> Author: jtl
> Date: Thu Apr 16 20:07:34 2020
> New Revision: 360019
> URL: https://svnweb.freebsd.org/changeset/base/360019
> 
> Log:
>  Add a regression test for the changes in r359922 and r359923.
> 
>  Note that the Python code has been tested on both Python 2.7 and 3.7.
> 
>  Reviewed by: olivier
>  MFC after:   2 weeks
>  Sponsored by:Netflix, Inc.

Ugh… I can tell by this commit that I just need to add pytest support 
to kyua >_>…
Thanks,
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Enji Cooper

> On Apr 19, 2020, at 10:01 AM, Cy Schubert  wrote:
> 
> Author: cy
> Date: Sun Apr 19 17:01:21 2020
> New Revision: 360102
> URL: https://svnweb.freebsd.org/changeset/base/360102
> 
> Log:
>  Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
>  instead of MK_KERBEROS. The reason for this change is some users
>  prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
>  Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> 
>  PR:  197337
>  Reported by: Adam McDougall 
>  Reviewed by: imp
>  Differential Revision:   https://reviews.freebsd.org/D24252


Hi Cy,
Having excised code like this in the past, I don’t think this is the 
right approach: a separate slave port should be added that handles the rc.d 
script installation, etc, or the scripts should be added to the manifest for 
the ports.
Thanks,
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
In message 
, Kyle Evans writes:
> On Sun, Apr 19, 2020 at 3:05 PM Cy Schubert  wrote
> :
> >
> > In message  c
> > om>
> > , Kyle Evans writes:
> > > On Sun, Apr 19, 2020 at 12:01 PM Cy Schubert  wrote:
> > > >
> > > > Author: cy
> > > > Date: Sun Apr 19 17:01:21 2020
> > > > New Revision: 360102
> > > > URL: https://svnweb.freebsd.org/changeset/base/360102
> > > >
> > > > Log:
> > > >   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
> > > >   instead of MK_KERBEROS. The reason for this change is some users
> > > >   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
> > > >   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> > > >
> > > >   PR:   197337
> > > >   Reported by:  Adam McDougall 
> > > >   Reviewed by:  imp
> > > >   Differential Revision:https://reviews.freebsd.org/D24252
> > > >
> > > > [... snip ...]
> > > > Modified: head/share/mk/src.opts.mk
> > > > ===
> 
> > > ===
> > > > --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r36010
> 1)
> > > > +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r36010
> 2)
> > > > @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
> > > >  INET \
> > > >  INET6 \
> > > >  KERBEROS \
> > > > +KERBEROS_SCRIPTS \
> > > >  KVM \
> > > >  NETGRAPH \
> > > >  PAM \
> > > >
> > >
> > > This hunk seems to be wrong, looking at more context. It's setting up
> > > a MK_KERBEROS_SCRIPTS_SUPPORT option... I'm  kinda guessing what you
> > > intended is what the other commentary on this has been about --
> > > defaulting KERBEROS_SCRIPTS to ON unless KERBEROS is OFF. Just moving
> > > it up to the __DEFAULT_DEPENDENT_OPTIONS block doesn't seem to do the
> > > trick, though, I guess kerberos is weird.
> >
> > The point is to leave KERBEROS_SCRIPTS on while disabling KERBEROS to allow
> > those who choose not to install Heimdal in base to use one of the ports
> > instead.
> >
> > The other option might be to revert this and install conflicting scripts in
> > ports, which I'm not enamoured with. This would be the source of additional
> > PRs from people who attempt to enable one while not disabling the other. I
> > have no tolerance for those types of PRs, as my coworkers at $JOB can
> > attest to.
> >
>
> The keyword is default; to default it to off if KERBEROS is off, which
> assumes the absence of any user-specified WITH_/WITHOUT_
> KERBEROS_SCRIPTS. As soon as the user specifies one way or the other,
> the relationship is broken.


Sure. I'll make that change tonight.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

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


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


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Kyle Evans
On Sun, Apr 19, 2020 at 3:05 PM Cy Schubert  wrote:
>
> In message  om>
> , Kyle Evans writes:
> > On Sun, Apr 19, 2020 at 12:01 PM Cy Schubert  wrote:
> > >
> > > Author: cy
> > > Date: Sun Apr 19 17:01:21 2020
> > > New Revision: 360102
> > > URL: https://svnweb.freebsd.org/changeset/base/360102
> > >
> > > Log:
> > >   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
> > >   instead of MK_KERBEROS. The reason for this change is some users
> > >   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
> > >   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> > >
> > >   PR:   197337
> > >   Reported by:  Adam McDougall 
> > >   Reviewed by:  imp
> > >   Differential Revision:https://reviews.freebsd.org/D24252
> > >
> > > [... snip ...]
> > > Modified: head/share/mk/src.opts.mk
> > > ===
> > ===
> > > --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> > > +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> > > @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
> > >  INET \
> > >  INET6 \
> > >  KERBEROS \
> > > +KERBEROS_SCRIPTS \
> > >  KVM \
> > >  NETGRAPH \
> > >  PAM \
> > >
> >
> > This hunk seems to be wrong, looking at more context. It's setting up
> > a MK_KERBEROS_SCRIPTS_SUPPORT option... I'm  kinda guessing what you
> > intended is what the other commentary on this has been about --
> > defaulting KERBEROS_SCRIPTS to ON unless KERBEROS is OFF. Just moving
> > it up to the __DEFAULT_DEPENDENT_OPTIONS block doesn't seem to do the
> > trick, though, I guess kerberos is weird.
>
> The point is to leave KERBEROS_SCRIPTS on while disabling KERBEROS to allow
> those who choose not to install Heimdal in base to use one of the ports
> instead.
>
> The other option might be to revert this and install conflicting scripts in
> ports, which I'm not enamoured with. This would be the source of additional
> PRs from people who attempt to enable one while not disabling the other. I
> have no tolerance for those types of PRs, as my coworkers at $JOB can
> attest to.
>

The keyword is default; to default it to off if KERBEROS is off, which
assumes the absence of any user-specified WITH_/WITHOUT_
KERBEROS_SCRIPTS. As soon as the user specifies one way or the other,
the relationship is broken.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
In message 
, Kyle Evans writes:
> On Sun, Apr 19, 2020 at 12:01 PM Cy Schubert  wrote:
> >
> > Author: cy
> > Date: Sun Apr 19 17:01:21 2020
> > New Revision: 360102
> > URL: https://svnweb.freebsd.org/changeset/base/360102
> >
> > Log:
> >   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
> >   instead of MK_KERBEROS. The reason for this change is some users
> >   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
> >   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> >
> >   PR:   197337
> >   Reported by:  Adam McDougall 
> >   Reviewed by:  imp
> >   Differential Revision:https://reviews.freebsd.org/D24252
> >
> > [... snip ...]
> > Modified: head/share/mk/src.opts.mk
> > ===
> ===
> > --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> > +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> > @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
> >  INET \
> >  INET6 \
> >  KERBEROS \
> > +KERBEROS_SCRIPTS \
> >  KVM \
> >  NETGRAPH \
> >  PAM \
> >
>
> This hunk seems to be wrong, looking at more context. It's setting up
> a MK_KERBEROS_SCRIPTS_SUPPORT option... I'm  kinda guessing what you
> intended is what the other commentary on this has been about --
> defaulting KERBEROS_SCRIPTS to ON unless KERBEROS is OFF. Just moving
> it up to the __DEFAULT_DEPENDENT_OPTIONS block doesn't seem to do the
> trick, though, I guess kerberos is weird.

The point is to leave KERBEROS_SCRIPTS on while disabling KERBEROS to allow 
those who choose not to install Heimdal in base to use one of the ports 
instead.

The other option might be to revert this and install conflicting scripts in 
ports, which I'm not enamoured with. This would be the source of additional 
PRs from people who attempt to enable one while not disabling the other. I 
have no tolerance for those types of PRs, as my coworkers at $JOB can 
attest to.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

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


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


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
In message <20200419213718.8c44dced2c4f67c8544f2...@bidouilliste.com>, 
Emmanuel
 Vadot writes:
> -- 
> Emmanuel Vadot 
> On Sun, 19 Apr 2020 12:16:34 -0700
> Conrad Meyer  wrote:
>
> > Hm, some of us just want kerberos to be completed excised.  This
> > change makes WITHOUT_KERBEROS retain portions of kerberos?  That seems
> > unfortunate.
>
>  Agreed,
>  It would be better to default MK_KERBEROS_SCRIPTS to yes and
> explicitly setting it to no when WITHOUT_KERBEROS=yes. One could then
> do WITHOUT_KERBEROS=yes and MK_KERBEROS_SCRIPTS=yes for such weird
> install.
>  BTW, why would one want base script for ports utilities ? Couldn't the
> ports install some rc scripts with same functionnality as the base one ?

IMO that should be a separate port.

In regard to removing kerberos from base entirely. The original suggestion 
by pfg@ to replace Heimdal in base (and taken up by myself), was met with 
significant resistance from a person. The current plan is to make Heimdal 
private, for now, when I get the cycles.

I would like to see the removal of Heimdal from base some day, either 
replacing it with MIT or entirely (relying on ports only). Pkgbase may make 
it politically palatable, providing the ability to move forward toward this 
goal.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  https://FreeBSD.org
NTP:   Web:  https://nwtime.org

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


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


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Kyle Evans
On Sun, Apr 19, 2020 at 12:01 PM Cy Schubert  wrote:
>
> Author: cy
> Date: Sun Apr 19 17:01:21 2020
> New Revision: 360102
> URL: https://svnweb.freebsd.org/changeset/base/360102
>
> Log:
>   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
>   instead of MK_KERBEROS. The reason for this change is some users
>   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
>   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
>
>   PR:   197337
>   Reported by:  Adam McDougall 
>   Reviewed by:  imp
>   Differential Revision:https://reviews.freebsd.org/D24252
>
> [... snip ...]
> Modified: head/share/mk/src.opts.mk
> ==
> --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
>  INET \
>  INET6 \
>  KERBEROS \
> +KERBEROS_SCRIPTS \
>  KVM \
>  NETGRAPH \
>  PAM \
>

This hunk seems to be wrong, looking at more context. It's setting up
a MK_KERBEROS_SCRIPTS_SUPPORT option... I'm  kinda guessing what you
intended is what the other commentary on this has been about --
defaulting KERBEROS_SCRIPTS to ON unless KERBEROS is OFF. Just moving
it up to the __DEFAULT_DEPENDENT_OPTIONS block doesn't seem to do the
trick, though, I guess kerberos is weird.

Thanks,

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


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Emmanuel Vadot
-- 
Emmanuel Vadot 
On Sun, 19 Apr 2020 12:16:34 -0700
Conrad Meyer  wrote:

> Hm, some of us just want kerberos to be completed excised.  This
> change makes WITHOUT_KERBEROS retain portions of kerberos?  That seems
> unfortunate.

 Agreed,
 It would be better to default MK_KERBEROS_SCRIPTS to yes and
explicitly setting it to no when WITHOUT_KERBEROS=yes. One could then
do WITHOUT_KERBEROS=yes and MK_KERBEROS_SCRIPTS=yes for such weird
install.
 BTW, why would one want base script for ports utilities ? Couldn't the
ports install some rc scripts with same functionnality as the base one ?

 Cheers,

> On Sun, Apr 19, 2020 at 10:01 AM Cy Schubert  wrote:
> >
> > Author: cy
> > Date: Sun Apr 19 17:01:21 2020
> > New Revision: 360102
> > URL: https://svnweb.freebsd.org/changeset/base/360102
> >
> > Log:
> >   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
> >   instead of MK_KERBEROS. The reason for this change is some users
> >   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
> >   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
> >
> >   PR:   197337
> >   Reported by:  Adam McDougall 
> >   Reviewed by:  imp
> >   Differential Revision:https://reviews.freebsd.org/D24252
> >
> > Modified:
> >   head/libexec/rc/rc.d/Makefile
> >   head/share/mk/bsd.opts.mk
> >   head/share/mk/src.opts.mk
> >   head/tools/build/mk/OptionalObsoleteFiles.inc
> >
> > Modified: head/libexec/rc/rc.d/Makefile
> > ==
> > --- head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:17 2020
> > (r360101)
> > +++ head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:21 2020
> > (r360102)
> > @@ -242,14 +242,17 @@ CONFS+=   lpd
> >  .if ${MK_KERBEROS} != "no"
> >  CONFS+=ipropd_master
> >  CONFS+=ipropd_slave
> > -_kadmind=  kadmind
> > -_kdc=  kdc
> > -_kfd=  kfd
> > -_kpasswdd= kpasswdd
> >
> >  DIRS+= VAR_HEMIDAL
> >  VAR_HEMIDAL=   /var/heimdal
> >  VAR_HEMIDAL_MODE=  700
> > +.endif
> > +
> > +.if ${MK_KERBEROS_SCRIPTS} != "no"
> > +_kadmind=  kadmind
> > +_kdc=  kdc
> > +_kfd=  kfd
> > +_kpasswdd= kpasswdd
> >  .endif
> >
> >  .if ${MK_MAIL} != "no"
> >
> > Modified: head/share/mk/bsd.opts.mk
> > ==
> > --- head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> > +++ head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> > @@ -55,6 +55,7 @@ __DEFAULT_YES_OPTIONS = \
> >  INCLUDES \
> >  INSTALLLIB \
> >  KERBEROS \
> > +KERBEROS_SCRIPTS \
> >  MAKE_CHECK_USE_SANDBOX \
> >  MAN \
> >  MANCOMPRESS \
> >
> > Modified: head/share/mk/src.opts.mk
> > ==
> > --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> > +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> > @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
> >  INET \
> >  INET6 \
> >  KERBEROS \
> > +KERBEROS_SCRIPTS \
> >  KVM \
> >  NETGRAPH \
> >  PAM \
> >
> > Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
> > ==
> > --- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:17 
> > 2020(r360101)
> > +++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:21 
> > 2020(r360102)
> > @@ -3152,13 +3152,9 @@ OLD_FILES+=usr/libexec/hprop
> >  OLD_FILES+=usr/libexec/hpropd
> >  OLD_FILES+=usr/libexec/ipropd-master
> >  OLD_FILES+=usr/libexec/ipropd-slave
> > -OLD_FILES+=usr/libexec/kadmind
> >  OLD_FILES+=usr/libexec/kcm
> > -OLD_FILES+=usr/libexec/kdc
> >  OLD_FILES+=usr/libexec/kdigest
> > -OLD_FILES+=usr/libexec/kfd
> >  OLD_FILES+=usr/libexec/kimpersonate
> > -OLD_FILES+=usr/libexec/kpasswdd
> >  OLD_FILES+=usr/sbin/kstash
> >  OLD_FILES+=usr/sbin/ktutil
> >  OLD_FILES+=usr/sbin/iprop-log
> > @@ -3878,6 +3874,13 @@ OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
> >  OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
> >  OLD_FILES+=usr/share/man/man8/string2key.8.gz
> >  OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
> > +.endif
> > +
> > +.if ${MK_KERBEROS_SCRIPTS} == no
> > +OLD_FILES+=usr/libexec/kadmind
> > +OLD_FILES+=usr/libexec/kdc
> > +OLD_FILES+=usr/libexec/kfd
> > +OLD_FILES+=usr/libexec/kpasswdd
> >  .endif
> >
> >  .if ${MK_KERBEROS_SUPPORT} == no


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


Re: svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Conrad Meyer
Hm, some of us just want kerberos to be completed excised.  This
change makes WITHOUT_KERBEROS retain portions of kerberos?  That seems
unfortunate.

On Sun, Apr 19, 2020 at 10:01 AM Cy Schubert  wrote:
>
> Author: cy
> Date: Sun Apr 19 17:01:21 2020
> New Revision: 360102
> URL: https://svnweb.freebsd.org/changeset/base/360102
>
> Log:
>   Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
>   instead of MK_KERBEROS. The reason for this change is some users
>   prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
>   Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
>
>   PR:   197337
>   Reported by:  Adam McDougall 
>   Reviewed by:  imp
>   Differential Revision:https://reviews.freebsd.org/D24252
>
> Modified:
>   head/libexec/rc/rc.d/Makefile
>   head/share/mk/bsd.opts.mk
>   head/share/mk/src.opts.mk
>   head/tools/build/mk/OptionalObsoleteFiles.inc
>
> Modified: head/libexec/rc/rc.d/Makefile
> ==
> --- head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:17 2020
> (r360101)
> +++ head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:21 2020
> (r360102)
> @@ -242,14 +242,17 @@ CONFS+=   lpd
>  .if ${MK_KERBEROS} != "no"
>  CONFS+=ipropd_master
>  CONFS+=ipropd_slave
> -_kadmind=  kadmind
> -_kdc=  kdc
> -_kfd=  kfd
> -_kpasswdd= kpasswdd
>
>  DIRS+= VAR_HEMIDAL
>  VAR_HEMIDAL=   /var/heimdal
>  VAR_HEMIDAL_MODE=  700
> +.endif
> +
> +.if ${MK_KERBEROS_SCRIPTS} != "no"
> +_kadmind=  kadmind
> +_kdc=  kdc
> +_kfd=  kfd
> +_kpasswdd= kpasswdd
>  .endif
>
>  .if ${MK_MAIL} != "no"
>
> Modified: head/share/mk/bsd.opts.mk
> ==
> --- head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> +++ head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> @@ -55,6 +55,7 @@ __DEFAULT_YES_OPTIONS = \
>  INCLUDES \
>  INSTALLLIB \
>  KERBEROS \
> +KERBEROS_SCRIPTS \
>  MAKE_CHECK_USE_SANDBOX \
>  MAN \
>  MANCOMPRESS \
>
> Modified: head/share/mk/src.opts.mk
> ==
> --- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
> +++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
> @@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
>  INET \
>  INET6 \
>  KERBEROS \
> +KERBEROS_SCRIPTS \
>  KVM \
>  NETGRAPH \
>  PAM \
>
> Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
> ==
> --- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:17 
> 2020(r360101)
> +++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:21 
> 2020(r360102)
> @@ -3152,13 +3152,9 @@ OLD_FILES+=usr/libexec/hprop
>  OLD_FILES+=usr/libexec/hpropd
>  OLD_FILES+=usr/libexec/ipropd-master
>  OLD_FILES+=usr/libexec/ipropd-slave
> -OLD_FILES+=usr/libexec/kadmind
>  OLD_FILES+=usr/libexec/kcm
> -OLD_FILES+=usr/libexec/kdc
>  OLD_FILES+=usr/libexec/kdigest
> -OLD_FILES+=usr/libexec/kfd
>  OLD_FILES+=usr/libexec/kimpersonate
> -OLD_FILES+=usr/libexec/kpasswdd
>  OLD_FILES+=usr/sbin/kstash
>  OLD_FILES+=usr/sbin/ktutil
>  OLD_FILES+=usr/sbin/iprop-log
> @@ -3878,6 +3874,13 @@ OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
>  OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
>  OLD_FILES+=usr/share/man/man8/string2key.8.gz
>  OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
> +.endif
> +
> +.if ${MK_KERBEROS_SCRIPTS} == no
> +OLD_FILES+=usr/libexec/kadmind
> +OLD_FILES+=usr/libexec/kdc
> +OLD_FILES+=usr/libexec/kfd
> +OLD_FILES+=usr/libexec/kpasswdd
>  .endif
>
>  .if ${MK_KERBEROS_SUPPORT} == no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360105 - head/sys/dev/sound/pci/hda

2020-04-19 Thread Ed Maste
Author: emaste
Date: Sun Apr 19 17:53:44 2020
New Revision: 360105
URL: https://svnweb.freebsd.org/changeset/base/360105

Log:
  snd_hda: whitespace and style(9) cleanups

Modified:
  head/sys/dev/sound/pci/hda/hdac.c
  head/sys/dev/sound/pci/hda/hdacc.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Sun Apr 19 17:28:42 2020
(r360104)
+++ head/sys/dev/sound/pci/hda/hdac.c   Sun Apr 19 17:53:44 2020
(r360105)
@@ -360,8 +360,7 @@ hdac_poll_callback(void *arg)
hdac_unlock(sc);
return;
}
-   callout_reset(&sc->poll_callout, sc->poll_ival,
-   hdac_poll_callback, sc);
+   callout_reset(&sc->poll_callout, sc->poll_ival, hdac_poll_callback, sc);
hdac_unlock(sc);
 
hdac_intr_handler(sc);
@@ -412,7 +411,7 @@ hdac_reset(struct hdac_softc *sc, int wakeup)
if (!(gctl & HDAC_GCTL_CRST))
break;
DELAY(10);
-   } while (--count);
+   } while (--count);
if (gctl & HDAC_GCTL_CRST) {
device_printf(sc->dev, "Unable to put hdac in reset\n");
return (ENXIO);
@@ -446,7 +445,6 @@ hdac_reset(struct hdac_softc *sc, int wakeup)
return (0);
 }
 
-
 /
  * int hdac_get_capabilities(struct hdac_softc *);
  *
@@ -620,11 +618,10 @@ hdac_dma_alloc_fail:
return (result);
 }
 
-
 /
  * void hdac_dma_free(struct hdac_softc *, struct hdac_dma *)
  *
- * Free a struct dhac_dma that has been previously allocated via the
+ * Free a struct hdac_dma that has been previously allocated via the
  * hdac_dma_alloc function.
  /
 static void
@@ -1041,8 +1038,7 @@ hdac_probe(device_t dev)
if (HDA_DEV_MATCH(hdac_devices[i].model, model) &&
class == PCIC_MULTIMEDIA &&
subclass == PCIS_MULTIMEDIA_HDA) {
-   snprintf(desc, sizeof(desc),
-   "%s (0x%04x)",
+   snprintf(desc, sizeof(desc), "%s (0x%04x)",
hdac_devices[i].desc, pci_get_device(dev));
result = BUS_PROBE_GENERIC;
break;
@@ -1700,20 +1696,17 @@ hdac_print_child(device_t dev, device_t child)
int retval;
 
retval = bus_print_child_header(dev, child);
-   retval += printf(" at cad %d",
-   (int)(intptr_t)device_get_ivars(child));
+   retval += printf(" at cad %d", (int)(intptr_t)device_get_ivars(child));
retval += bus_print_child_footer(dev, child);
 
return (retval);
 }
 
 static int
-hdac_child_location_str(device_t dev, device_t child, char *buf,
-size_t buflen)
+hdac_child_location_str(device_t dev, device_t child, char *buf, size_t buflen)
 {
 
-   snprintf(buf, buflen, "cad=%d",
-   (int)(intptr_t)device_get_ivars(child));
+   snprintf(buf, buflen, "cad=%d", (int)(intptr_t)device_get_ivars(child));
return (0);
 }
 
@@ -1724,8 +1717,8 @@ hdac_child_pnpinfo_str_method(device_t dev, device_t c
struct hdac_softc *sc = device_get_softc(dev);
nid_t cad = (uintptr_t)device_get_ivars(child);
 
-   snprintf(buf, buflen, "vendor=0x%04x device=0x%04x revision=0x%02x "
-   "stepping=0x%02x",
+   snprintf(buf, buflen,
+   "vendor=0x%04x device=0x%04x revision=0x%02x stepping=0x%02x",
sc->codecs[cad].vendor_id, sc->codecs[cad].device_id,
sc->codecs[cad].revision_id, sc->codecs[cad].stepping_id);
return (0);
@@ -1901,8 +1894,8 @@ hdac_stream_free(device_t dev, device_t child, int dir
 }
 
 static int
-hdac_stream_start(device_t dev, device_t child,
-int dir, int stream, bus_addr_t buf, int blksz, int blkcnt)
+hdac_stream_start(device_t dev, device_t child, int dir, int stream,
+bus_addr_t buf, int blksz, int blkcnt)
 {
struct hdac_softc *sc = device_get_softc(dev);
struct hdac_bdle *bdle;

Modified: head/sys/dev/sound/pci/hda/hdacc.c
==
--- head/sys/dev/sound/pci/hda/hdacc.c  Sun Apr 19 17:28:42 2020
(r360104)
+++ head/sys/dev/sound/pci/hda/hdacc.c  Sun Apr 19 17:53:44 2020
(r360105)
@@ -434,7 +434,8 @@ hdacc_probe(device_t dev)
int i;
 
id = ((uint32_t)hda_get_vendor_id(dev) << 16) + hda_get_device_id(dev);
-   revid = ((uint32_t)hda_get_revision_id(dev) << 8) + 
hda_get_stepping_id(dev);
+   revid = ((uint32_t)hda_get_revision_id(dev) << 8) +
+   hda_get_stepping_id(dev);
 
for (i = 0; i < nitems(hdacc_codecs); i++) {
if (!HDA_DEV_MATCH(hdacc_codecs[i].id, id))

svn commit: r360104 - head/sys/dev/evdev

2020-04-19 Thread Xin LI
Author: delphij
Date: Sun Apr 19 17:28:42 2020
New Revision: 360104
URL: https://svnweb.freebsd.org/changeset/base/360104

Log:
  Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are removing
  elements in the middle.
  
  This fixes a panic when detaching USB mouse.
  
  PR:   245732
  Reviewed by:  wulf
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D24500

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

Modified: head/sys/dev/evdev/evdev.c
==
--- head/sys/dev/evdev/evdev.c  Sun Apr 19 17:19:29 2020(r360103)
+++ head/sys/dev/evdev/evdev.c  Sun Apr 19 17:28:42 2020(r360104)
@@ -358,7 +358,7 @@ evdev_register_mtx(struct evdev_dev *evdev, struct mtx
 int
 evdev_unregister(struct evdev_dev *evdev)
 {
-   struct evdev_client *client;
+   struct evdev_client *client, *tmp;
int ret;
debugf(evdev, "%s: unregistered evdev provider: %s\n",
evdev->ev_shortname, evdev->ev_name);
@@ -368,7 +368,7 @@ evdev_unregister(struct evdev_dev *evdev)
EVDEV_LOCK(evdev);
evdev->ev_cdev->si_drv1 = NULL;
/* Wake up sleepers */
-   LIST_FOREACH(client, &evdev->ev_clients, ec_link) {
+   LIST_FOREACH_SAFE(client, &evdev->ev_clients, ec_link, tmp) {
evdev_revoke_client(client);
evdev_dispose_client(evdev, client);
EVDEV_CLIENT_LOCKQ(client);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360103 - in stable/12/sys/amd64/vmm: intel io

2020-04-19 Thread Michael Reifenberger
Author: mr
Date: Sun Apr 19 17:19:29 2020
New Revision: 360103
URL: https://svnweb.freebsd.org/changeset/base/360103

Log:
  MFC r358848:
  
  Untangle TPR shadowing and APIC virtualization.
This speeds up Windows guests tremendously.
  
The patch does:
Add a new tuneable 'hw.vmm.vmx.use_tpr_shadowing' to disable TLP shadowing.
Also add 'hw.vmm.vmx.cap.tpr_shadowing' to be able to query if TPR 
shadowing is used.
  
Detach the initialization of TPR shadowing from the initialization of APIC 
virtualization.
APIC virtualization still needs TPR shadowing, but not vice versa.
Any CPU that supports APIC virtualization should also support TPR shadowing.
  
When TPR shadowing is used, the APIC page of each vCPU is written to the 
VMCS_VIRTUAL_APIC field of the VMCS
so that the CPU can write directly to the page without intercept.
  
On vm exit, vlapic_update_ppr() is called to update the PPR.
  
Geänderte Pfade:
   M /head/sys/amd64/vmm/intel/vmx.c M /head/sys/amd64/vmm/io/vlapic.c M
   /head/sys/amd64/vmm/io/vlapic.h
  
  Submitted by: Yamagi Burmeister
  Reviewed by:  grehan
  Differential Revision:https://reviews.freebsd.org/D22942

Modified:
  stable/12/sys/amd64/vmm/intel/vmx.c
  stable/12/sys/amd64/vmm/io/vlapic.c
  stable/12/sys/amd64/vmm/io/vlapic.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/vmm/intel/vmx.c
==
--- stable/12/sys/amd64/vmm/intel/vmx.c Sun Apr 19 17:01:21 2020
(r360102)
+++ stable/12/sys/amd64/vmm/intel/vmx.c Sun Apr 19 17:19:29 2020
(r360103)
@@ -172,6 +172,10 @@ static int cap_invpcid;
 SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, invpcid, CTLFLAG_RD, &cap_invpcid,
 0, "Guests are allowed to use INVPCID");
 
+static int tpr_shadowing;
+SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, tpr_shadowing, CTLFLAG_RD,
+&tpr_shadowing, 0, "TPR shadowing support");
+
 static int virtual_interrupt_delivery;
 SYSCTL_INT(_hw_vmm_vmx_cap, OID_AUTO, virtual_interrupt_delivery, CTLFLAG_RD,
 &virtual_interrupt_delivery, 0, "APICv virtual interrupt delivery 
support");
@@ -627,7 +631,7 @@ vmx_restore(void)
 static int
 vmx_init(int ipinum)
 {
-   int error, use_tpr_shadow;
+   int error;
uint64_t basic, fixed0, fixed1, feature_control;
uint32_t tmp, procbased2_vid_bits;
 
@@ -751,6 +755,24 @@ vmx_init(int ipinum)
&tmp) == 0);
 
/*
+* Check support for TPR shadow.
+*/
+   error = vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS,
+   MSR_VMX_TRUE_PROCBASED_CTLS, PROCBASED_USE_TPR_SHADOW, 0,
+   &tmp);
+   if (error == 0) {
+   tpr_shadowing = 1;
+   TUNABLE_INT_FETCH("hw.vmm.vmx.use_tpr_shadowing",
+   &tpr_shadowing);
+   }
+
+   if (tpr_shadowing) {
+   procbased_ctls |= PROCBASED_USE_TPR_SHADOW;
+   procbased_ctls &= ~PROCBASED_CR8_LOAD_EXITING;
+   procbased_ctls &= ~PROCBASED_CR8_STORE_EXITING;
+   }
+
+   /*
 * Check support for virtual interrupt delivery.
 */
procbased2_vid_bits = (PROCBASED2_VIRTUALIZE_APIC_ACCESSES |
@@ -758,13 +780,9 @@ vmx_init(int ipinum)
PROCBASED2_APIC_REGISTER_VIRTUALIZATION |
PROCBASED2_VIRTUAL_INTERRUPT_DELIVERY);
 
-   use_tpr_shadow = (vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS,
-   MSR_VMX_TRUE_PROCBASED_CTLS, PROCBASED_USE_TPR_SHADOW, 0,
-   &tmp) == 0);
-
error = vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS2, MSR_VMX_PROCBASED_CTLS2,
procbased2_vid_bits, 0, &tmp);
-   if (error == 0 && use_tpr_shadow) {
+   if (error == 0 && tpr_shadowing) {
virtual_interrupt_delivery = 1;
TUNABLE_INT_FETCH("hw.vmm.vmx.use_apic_vid",
&virtual_interrupt_delivery);
@@ -776,13 +794,6 @@ vmx_init(int ipinum)
procbased_ctls2 &= ~PROCBASED2_VIRTUALIZE_X2APIC_MODE;
 
/*
-* No need to emulate accesses to %CR8 if virtual
-* interrupt delivery is enabled.
-*/
-   procbased_ctls &= ~PROCBASED_CR8_LOAD_EXITING;
-   procbased_ctls &= ~PROCBASED_CR8_STORE_EXITING;
-
-   /*
 * Check for Posted Interrupts only if Virtual Interrupt
 * Delivery is enabled.
 */
@@ -1051,10 +1062,13 @@ vmx_vminit(struct vm *vm, pmap_t pmap)
vmx->ctx[i].guest_dr6 = DBREG_DR6_RESERVED1;
error += vmwrite(VMCS_GUEST_DR7, DBREG_DR7_RESERVED1);
 
-   if (virtual_interrupt_delivery) {
-   error += vmwrite(VMCS_APIC_ACCESS, APIC_ACCESS_ADDRESS);
+   if (tpr_shadowing) {
error += vmwrite(VMCS_VIRTUAL_APIC,
vtophys(&vmx->apic_page[i]));
+   }
+
+   

svn commit: r360101 - head/sys/contrib/ipfilter/netinet

2020-04-19 Thread Cy Schubert
Author: cy
Date: Sun Apr 19 17:01:17 2020
New Revision: 360101
URL: https://svnweb.freebsd.org/changeset/base/360101

Log:
  Convert ipfilter to the new routing KPI.
  
  Reviewed by:  melifaro (previous version)

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sun Apr 19 17:01:14 
2020(r360100)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sun Apr 19 17:01:17 
2020(r360101)
@@ -49,6 +49,7 @@ static const char rcsid[] = "@(#)$Id$";
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -698,7 +699,7 @@ ipf_fastroute(m0, mpp, fin, fdp)
int len, off, error = 0, hlen, code;
struct ifnet *ifp, *sifp;
struct sockaddr_in dst;
-   struct nhop4_extended nh4;
+   struct nhop_object *nh;
u_long fibnum = 0;
u_short ip_off;
frdest_t node;
@@ -773,7 +774,9 @@ ipf_fastroute(m0, mpp, fin, fdp)
dst.sin_addr = fdp->fd_ip;
 
fibnum = M_GETFIB(m0);
-   if (fib4_lookup_nh_ext(fibnum, dst.sin_addr, NHR_REF, 0, &nh4) != 0) {
+   NET_EPOCH_ASSERT();
+   nh = fib4_lookup(fibnum, dst.sin_addr, 0, NHR_NONE, 0);
+   if (nh == NULL) {
if (in_localaddr(ip->ip_dst))
error = EHOSTUNREACH;
else
@@ -782,9 +785,9 @@ ipf_fastroute(m0, mpp, fin, fdp)
}
 
if (ifp == NULL)
-   ifp = nh4.nh_ifp;
-   if (nh4.nh_flags & NHF_GATEWAY)
-   dst.sin_addr = nh4.nh_addr;
+   ifp = nh->nh_ifp;
+   if (nh->nh_flags & NHF_GATEWAY)
+   dst.sin_addr = nh->gw4_sa.sin_addr;
 
/*
 * For input packets which are being "fastrouted", they won't
@@ -944,11 +947,13 @@ int
 ipf_verifysrc(fin)
fr_info_t *fin;
 {
-   struct nhop4_basic nh4;
+   struct nhop_object *nh;
 
-   if (fib4_lookup_nh_basic(0, fin->fin_src, 0, 0, &nh4) != 0)
+   NET_EPOCH_ASSERT();
+   nh = fib4_lookup(RT_DEFAULT_FIB, fin->fin_src, 0, NHR_NONE, 0);
+   if (nh == NULL)
return (0);
-   return (fin->fin_ifp == nh4.nh_ifp);
+   return (fin->fin_ifp == nh->nh_ifp);
 }
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360100 - head/sys/contrib/ipfilter/netinet

2020-04-19 Thread Cy Schubert
Author: cy
Date: Sun Apr 19 17:01:14 2020
New Revision: 360100
URL: https://svnweb.freebsd.org/changeset/base/360100

Log:
  fib4_free_nh_ext is an empty function. It does nothing. Don't call it.
  
  MFC after:2 weeks

Modified:
  head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c

Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
==
--- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sun Apr 19 16:30:49 
2020(r360099)
+++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c  Sun Apr 19 17:01:14 
2020(r360100)
@@ -699,7 +699,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
struct ifnet *ifp, *sifp;
struct sockaddr_in dst;
struct nhop4_extended nh4;
-   int has_nhop = 0;
u_long fibnum = 0;
u_short ip_off;
frdest_t node;
@@ -782,7 +781,6 @@ ipf_fastroute(m0, mpp, fin, fdp)
goto bad;
}
 
-   has_nhop = 1;
if (ifp == NULL)
ifp = nh4.nh_ifp;
if (nh4.nh_flags & NHF_GATEWAY)
@@ -925,9 +923,6 @@ done:
V_ipfmain.ipf_frouteok[0]++;
else
V_ipfmain.ipf_frouteok[1]++;
-
-   if (has_nhop)
-   fib4_free_nh_ext(fibnum, &nh4);
 
return 0;
 bad:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360102 - in head: libexec/rc/rc.d share/mk tools/build/mk

2020-04-19 Thread Cy Schubert
Author: cy
Date: Sun Apr 19 17:01:21 2020
New Revision: 360102
URL: https://svnweb.freebsd.org/changeset/base/360102

Log:
  Conditionally install Kerberos rc files based on MK_KERBEROS_SCRIPTS
  instead of MK_KERBEROS. The reason for this change is some users
  prefer to build FreeBSD WITHOUT_KERBEROS, wanting to retain the
  Kerberos rc scripts to start/stop MIT Kerberos or Heimdal from ports.
  
  PR:   197337
  Reported by:  Adam McDougall 
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D24252

Modified:
  head/libexec/rc/rc.d/Makefile
  head/share/mk/bsd.opts.mk
  head/share/mk/src.opts.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/libexec/rc/rc.d/Makefile
==
--- head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:17 2020
(r360101)
+++ head/libexec/rc/rc.d/Makefile   Sun Apr 19 17:01:21 2020
(r360102)
@@ -242,14 +242,17 @@ CONFS+=   lpd
 .if ${MK_KERBEROS} != "no"
 CONFS+=ipropd_master
 CONFS+=ipropd_slave
-_kadmind=  kadmind
-_kdc=  kdc
-_kfd=  kfd
-_kpasswdd= kpasswdd
 
 DIRS+= VAR_HEMIDAL
 VAR_HEMIDAL=   /var/heimdal
 VAR_HEMIDAL_MODE=  700
+.endif
+
+.if ${MK_KERBEROS_SCRIPTS} != "no"
+_kadmind=  kadmind
+_kdc=  kdc
+_kfd=  kfd
+_kpasswdd= kpasswdd
 .endif
 
 .if ${MK_MAIL} != "no"

Modified: head/share/mk/bsd.opts.mk
==
--- head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
+++ head/share/mk/bsd.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
@@ -55,6 +55,7 @@ __DEFAULT_YES_OPTIONS = \
 INCLUDES \
 INSTALLLIB \
 KERBEROS \
+KERBEROS_SCRIPTS \
 MAKE_CHECK_USE_SANDBOX \
 MAN \
 MANCOMPRESS \

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Sun Apr 19 17:01:17 2020(r360101)
+++ head/share/mk/src.opts.mk   Sun Apr 19 17:01:21 2020(r360102)
@@ -237,6 +237,7 @@ __DEFAULT_DEPENDENT_OPTIONS= \
 INET \
 INET6 \
 KERBEROS \
+KERBEROS_SCRIPTS \
 KVM \
 NETGRAPH \
 PAM \

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:17 
2020(r360101)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Sun Apr 19 17:01:21 
2020(r360102)
@@ -3152,13 +3152,9 @@ OLD_FILES+=usr/libexec/hprop
 OLD_FILES+=usr/libexec/hpropd
 OLD_FILES+=usr/libexec/ipropd-master
 OLD_FILES+=usr/libexec/ipropd-slave
-OLD_FILES+=usr/libexec/kadmind
 OLD_FILES+=usr/libexec/kcm
-OLD_FILES+=usr/libexec/kdc
 OLD_FILES+=usr/libexec/kdigest
-OLD_FILES+=usr/libexec/kfd
 OLD_FILES+=usr/libexec/kimpersonate
-OLD_FILES+=usr/libexec/kpasswdd
 OLD_FILES+=usr/sbin/kstash
 OLD_FILES+=usr/sbin/ktutil
 OLD_FILES+=usr/sbin/iprop-log
@@ -3878,6 +3874,13 @@ OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
 OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
 OLD_FILES+=usr/share/man/man8/string2key.8.gz
 OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
+.endif
+
+.if ${MK_KERBEROS_SCRIPTS} == no
+OLD_FILES+=usr/libexec/kadmind
+OLD_FILES+=usr/libexec/kdc
+OLD_FILES+=usr/libexec/kfd
+OLD_FILES+=usr/libexec/kpasswdd
 .endif
 
 .if ${MK_KERBEROS_SUPPORT} == no
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360099 - head/tests/sys/net

2020-04-19 Thread Kristof Provost
Author: kp
Date: Sun Apr 19 16:30:49 2020
New Revision: 360099
URL: https://svnweb.freebsd.org/changeset/base/360099

Log:
  bridge tests: Ensure that bridges in different jails get different MAC 
addresses
  
  We used to have a problem where bridges created in different vnet jails
  would end up having the same mac address. This is now fixed by
  including the jail name as a seed for the mac address generation, but we
  should verify that it doesn't regress.

Modified:
  head/tests/sys/net/if_bridge_test.sh

Modified: head/tests/sys/net/if_bridge_test.sh
==
--- head/tests/sys/net/if_bridge_test.shSun Apr 19 16:10:20 2020
(r360098)
+++ head/tests/sys/net/if_bridge_test.shSun Apr 19 16:30:49 2020
(r360099)
@@ -271,6 +271,44 @@ delete_with_members_cleanup()
vnet_cleanup
 }
 
+atf_test_case "mac_conflict" "cleanup"
+mac_conflict_head()
+{
+   atf_set descr 'Ensure that bridges in different jails get different mac 
addresses'
+   atf_set require.user root
+}
+
+mac_conflict_body()
+{
+   vnet_init
+
+   epair=$(vnet_mkepair)
+
+   # Ensure the bridge module is loaded so jails can use it.
+   tmpbridge=$(vnet_mkbridge)
+
+   vnet_mkjail bridge_mac_conflict_one ${epair}a
+   vnet_mkjail bridge_mac_conflict_two ${epair}b
+
+   jexec bridge_mac_conflict_one ifconfig bridge create
+   jexec bridge_mac_conflict_one ifconfig bridge0 192.0.2.1/24 up \
+   addm ${epair}a
+   jexec bridge_mac_conflict_one ifconfig ${epair}a up
+
+   jexec bridge_mac_conflict_two ifconfig bridge create
+   jexec bridge_mac_conflict_two ifconfig bridge0 192.0.2.2/24 up \
+   addm ${epair}b
+   jexec bridge_mac_conflict_two ifconfig ${epair}b up
+
+   atf_check -s exit:0 -o ignore \
+   jexec bridge_mac_conflict_one ping -c 3 192.0.2.2
+}
+
+mac_conflict_cleanup()
+{
+   vnet_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "bridge_transmit_ipv4_unicast"
@@ -278,4 +316,5 @@ atf_init_test_cases()
atf_add_test_case "static"
atf_add_test_case "span"
atf_add_test_case "delete_with_members"
+   atf_add_test_case "mac_conflict"
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360098 - head/sys/netpfil/pf

2020-04-19 Thread Kristof Provost
Author: kp
Date: Sun Apr 19 16:10:20 2020
New Revision: 360098
URL: https://svnweb.freebsd.org/changeset/base/360098

Log:
  pf: Improve ioctl() input validation
  
  Both DIOCCHANGEADDR and DIOCADDADDR take a struct pf_pooladdr from
  userspace. They failed to validate the dyn pointer contained in its
  struct pf_addr_wrap member structure.
  
  This triggered assertion failures under fuzz testing in
  pfi_dynaddr_setup(). Happily the dyn variable was overruled there, but
  we should verify that it's set to NULL anyway.
  
  Reported-by:  syzbot+93e93150bc29f9b4b...@syzkaller.appspotmail.com
  Reviewed by:  emaste
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24431

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Sun Apr 19 15:37:13 2020
(r360097)
+++ head/sys/netpfil/pf/pf_ioctl.c  Sun Apr 19 16:10:20 2020
(r360098)
@@ -2643,6 +2643,10 @@ DIOCGETSTATES_full:
error = EINVAL;
break;
}
+   if (pp->addr.addr.p.dyn != NULL) {
+   error = EINVAL;
+   break;
+   }
pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK);
bcopy(&pp->addr, pa, sizeof(struct pf_pooladdr));
if (pa->ifname[0])
@@ -2739,6 +2743,10 @@ DIOCGETSTATES_full:
if (pca->addr.addr.type != PF_ADDR_ADDRMASK &&
pca->addr.addr.type != PF_ADDR_DYNIFTL &&
pca->addr.addr.type != PF_ADDR_TABLE) {
+   error = EINVAL;
+   break;
+   }
+   if (pca->addr.addr.p.dyn != NULL) {
error = EINVAL;
break;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360097 - head/sbin/pfctl

2020-04-19 Thread Kristof Provost
Author: kp
Date: Sun Apr 19 15:37:13 2020
New Revision: 360097
URL: https://svnweb.freebsd.org/changeset/base/360097

Log:
  pfctl: Call ifa_load() before ifa_grouplookup()
  
  ifa_grouplookup() uses the data loaded in ifa_load() (through is_a_group()), 
so
  we must call ifa_load() before we can rely on any of the data it populates.
  
  Submitted by: Nick Rogers
  MFC after:1 week
  Sponsored by: RG Nets

Modified:
  head/sbin/pfctl/pfctl_parser.c

Modified: head/sbin/pfctl/pfctl_parser.c
==
--- head/sbin/pfctl/pfctl_parser.c  Sun Apr 19 15:32:14 2020
(r360096)
+++ head/sbin/pfctl/pfctl_parser.c  Sun Apr 19 15:37:13 2020
(r360097)
@@ -1436,14 +1436,15 @@ ifa_lookup(char *ifa_name, int flags)
int  got4 = 0, got6 = 0;
const char   *last_if = NULL;
 
+   /* first load iftab and isgroup_map */
+   if (iftab == NULL)
+   ifa_load();
+
if ((h = ifa_grouplookup(ifa_name, flags)) != NULL)
return (h);
 
if (!strncmp(ifa_name, "self", IFNAMSIZ))
ifa_name = NULL;
-
-   if (iftab == NULL)
-   ifa_load();
 
for (p = iftab; p; p = p->next) {
if (ifa_skip_if(ifa_name, p))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360096 - head/sbin/pfctl

2020-04-19 Thread Kristof Provost
Author: kp
Date: Sun Apr 19 15:32:14 2020
New Revision: 360096
URL: https://svnweb.freebsd.org/changeset/base/360096

Log:
  pfctl: Remove unused variable
  
  Submitted by: Nick Rogers
  MFC after:1 week
  Sponsored by: RG Nets

Modified:
  head/sbin/pfctl/pfctl_parser.c

Modified: head/sbin/pfctl/pfctl_parser.c
==
--- head/sbin/pfctl/pfctl_parser.c  Sun Apr 19 14:25:56 2020
(r360095)
+++ head/sbin/pfctl/pfctl_parser.c  Sun Apr 19 15:32:14 2020
(r360096)
@@ -1370,13 +1370,11 @@ struct node_host *
 ifa_exists(char *ifa_name)
 {
struct node_host*n;
-   int s;
 
if (iftab == NULL)
ifa_load();
 
/* check whether this is a group */
-   s = get_query_socket();
if (is_a_group(ifa_name)) {
/* fake a node_host */
if ((n = calloc(1, sizeof(*n))) == NULL)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360095 - head/usr.sbin/bluetooth/hccontrol

2020-04-19 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Apr 19 14:25:56 2020
New Revision: 360095
URL: https://svnweb.freebsd.org/changeset/base/360095

Log:
  Fix cut and paste off-by-one error in hccontrol(8).
  Make sure strncpy() doesn't write beyond its given buffer.
  
  PR:   245739
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/bluetooth/hccontrol/util.c

Modified: head/usr.sbin/bluetooth/hccontrol/util.c
==
--- head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 14:22:21 2020
(r360094)
+++ head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 14:25:56 2020
(r360095)
@@ -134,6 +134,7 @@ hci_hmode2str(int mode, char *buffer, int size)
int n;
 
memset(buffer, 0, size);
+   size--;
for (n = 0; n < SIZE(t); n++) {
int len = strlen(buffer);
 
@@ -347,6 +348,7 @@ hci_features2str(uint8_t *features, char *buffer, int 
 
memset(buffer, 0, size);
len1 = 0;
+   size--;
 
for (n = 0; n < SIZE(t); n++) {
for (i = 0; i < SIZE(t[n]); i++) {
@@ -460,6 +462,7 @@ hci_le_features2str(uint8_t *features, char *buffer, i
 
memset(buffer, 0, size);
len1 = 0;
+   size--;
 
for (n = 0; n < SIZE(t); n++) {
for (i = 0; i < SIZE(t[n]); i++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-19 Thread Shawn Webb
On Sun, Apr 19, 2020 at 04:19:06PM +0200, Kristof Provost wrote:
> On 19 Apr 2020, at 15:33, Ronald Klop wrote:
> > On Sat, 18 Apr 2020 09:50:30 +0200, Kristof Provost 
> > wrote:
> > 
> > > Author: kp
> > > Date: Sat Apr 18 07:50:30 2020
> > > New Revision: 360068
> > > URL: https://svnweb.freebsd.org/changeset/base/360068
> > > 
> > > Log:
> > >   ethersubr: Make the mac address generation more robust
> > >  If we create two (vnet) jails and create a bridge interface in each
> > > we end up
> > >   with the same mac address on both bridge interfaces.
> > >   These very often conflicts, resulting in same mac address in both
> > > jails.
> > >  Mitigate this problem by including the jail name in the mac address.
> > >  Reviewed by: kevans, melifaro
> > >   MFC after:  1 week
> > >   Differential Revision:  https://reviews.freebsd.org/D24383
> > > 
> > > Modified:
> > >   head/sys/kern/kern_jail.c
> > >   head/sys/net/if_ethersubr.c
> > >   head/sys/sys/jail.h
> > > 
> > > Modified: head/sys/kern/kern_jail.c
> > > ==
> > > --- head/sys/kern/kern_jail.c Sat Apr 18 03:14:16 2020
> > > (r360067)
> > > +++ head/sys/kern/kern_jail.c Sat Apr 18 07:50:30 2020
> > > (r360068)
> > > @@ -2920,6 +2920,15 @@ getcredhostid(struct ucred *cred, unsigned
> > > long *hosti
> > >   mtx_unlock(&cred->cr_prison->pr_mtx);
> > >  }
> > > +void
> > > +getjailname(struct ucred *cred, char *name, size_t len)
> > > +{
> > > +
> > > + mtx_lock(&cred->cr_prison->pr_mtx);
> > > + strlcpy(name, cred->cr_prison->pr_name, len);
> > > + mtx_unlock(&cred->cr_prison->pr_mtx);
> > > +}
> > > +
> > >  #ifdef VIMAGE
> > >  /*
> > >   * Determine whether the prison represented by cred owns
> > > 
> > > Modified: head/sys/net/if_ethersubr.c
> > > ==
> > > --- head/sys/net/if_ethersubr.c   Sat Apr 18 03:14:16 2020
> > > (r360067)
> > > +++ head/sys/net/if_ethersubr.c   Sat Apr 18 07:50:30 2020
> > > (r360068)
> > > @@ -1419,27 +1419,39 @@ ether_8021q_frame(struct mbuf **mp, struct
> > > ifnet *ife,
> > > /*
> > >   * Allocate an address from the FreeBSD Foundation OUI.  This uses a
> > > - * cryptographic hash function on the containing jail's UUID and
> > > the interface
> > > - * name to attempt to provide a unique but stable address.
> > > Pseudo-interfaces
> > > - * which require a MAC address should use this function to allocate
> > > - * non-locally-administered addresses.
> > > + * cryptographic hash function on the containing jail's name, UUID
> > > and the
> > > + * interface name to attempt to provide a unique but stable address.
> > > + * Pseudo-interfaces which require a MAC address should use this
> > > function to
> > > + * allocate non-locally-administered addresses.
> > >   */
> > >  void
> > >  ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr)
> > >  {
> > > -#define  ETHER_GEN_ADDR_BUFSIZ   HOSTUUIDLEN + IFNAMSIZ + 2
> > >   SHA1_CTX ctx;
> > > - char buf[ETHER_GEN_ADDR_BUFSIZ];
> > > + char *buf;
> > >   char uuid[HOSTUUIDLEN + 1];
> > >   uint64_t addr;
> > >   int i, sz;
> > >   char digest[SHA1_RESULTLEN];
> > > + char jailname[MAXHOSTNAMELEN];
> > >   getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid));
> > > - sz = snprintf(buf, ETHER_GEN_ADDR_BUFSIZ, "%s-%s", uuid,
> > > ifp->if_xname);
> > > + /* If each (vnet) jail would also have a unique hostuuid this
> > > would not
> > > +  * be necessary. */
> > > + getjailname(curthread->td_ucred, jailname, sizeof(jailname));
> > > + sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
> > > + jailname);
> > > + if (sz < 0) {
> > > + /* Fall back to a random mac address. */
> > 
> > 
> > I was wondering if it would be valuable to give this fall back something
> > like:
> > 
> >printf("%s: unable to create fixed mac address; using random
> > mac address", if_name(ifp));
> > 
> > This will only be printed in rare circumstances. But in that case will
> > provide valuable information.
> > 
> That would potentially be valuable, yes. On the other hand, we traditionally
> don???t sprinkle a lot of printf()s around in the kernel. This is extremely
> unlikely to happen, and if it does odds are attaching the interface will
> fail at an earlier or later point, you may struggle to pass packets and run
> into any number of other issues.
> It???s also possible to diagnose absent the printf(), because the MAC
> address will be locally administered rather than within the FreeBSD OUI.
> 
> So, in short: not a bad idea. You can argue it both ways, and I find myself
> (weakly) on the opposite side.

Would displaying the message only when verbose boot mode is enabled be
a suitable compromise?

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

GPG Key ID:  0xFF2E67A277F8E1FA
GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9  3633 C85B 0AF8

svn commit: r360094 - head/usr.sbin/bluetooth/hccontrol

2020-04-19 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Apr 19 14:22:21 2020
New Revision: 360094
URL: https://svnweb.freebsd.org/changeset/base/360094

Log:
  Improve printing of le features in hccontrol(8).
  
  Submitted by: Marc Veldman 
  PR:   245739
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/usr.sbin/bluetooth/hccontrol/hccontrol.h
  head/usr.sbin/bluetooth/hccontrol/le.c
  head/usr.sbin/bluetooth/hccontrol/util.c

Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h
==
--- head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Sun Apr 19 10:50:29 
2020(r360093)
+++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h   Sun Apr 19 14:22:21 
2020(r360094)
@@ -73,6 +73,7 @@ char const *  hci_ver2str (int);
 char const *   hci_lmpver2str  (int);
 char const *   hci_manufacturer2str(int);
 char const *   hci_features2str(uint8_t *, char *, int);
+char const *   hci_le_features2str (uint8_t *, char *, int);
 char const *   hci_cc2str  (int);
 char const *   hci_con_state2str   (int);
 char const *   hci_status2str  (int);

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Sun Apr 19 10:50:29 2020
(r360093)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Sun Apr 19 14:22:21 2020
(r360094)
@@ -225,18 +225,37 @@ static int
 le_read_local_supported_features(int s, int argc ,char *argv[])
 {
ng_hci_le_read_local_supported_features_rp rp;
-   int e;
int n = sizeof(rp);
 
-   e = hci_simple_request(s,
+   union {
+   uint64_t raw;
+   uint8_t octets[8];
+   } le_features;
+
+   char buffer[2048];
+
+   if (hci_simple_request(s,
NG_HCI_OPCODE(NG_HCI_OGF_LE,
NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), 
-   (void *)&rp, &n);
+   (void *)&rp, &n) == ERROR)
+   return (ERROR);
 
-   printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status,
-  (uintmax_t) rp.le_features);
+   if (rp.status != 0x00) {
+   fprintf(stdout, "Status: %s [%#02x]\n", 
+   hci_status2str(rp.status), rp.status);
+   return (FAILED);
+   }
 
-   return 0;
+   le_features.raw = rp.le_features;
+
+   fprintf(stdout, "LE Features: ");
+   for(int i = 0; i < 8; i++)
+fprintf(stdout, " %#02x", le_features.octets[i]);
+   fprintf(stdout, "\n%s\n", hci_le_features2str(le_features.octets, 
+   buffer, sizeof(buffer)));
+   fprintf(stdout, "\n");
+
+   return OK;
 }
 
 static int

Modified: head/usr.sbin/bluetooth/hccontrol/util.c
==
--- head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 10:50:29 2020
(r360093)
+++ head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 14:22:21 2020
(r360094)
@@ -371,6 +371,119 @@ done:
 } /* hci_features2str */
 
 char const *
+hci_le_features2str(uint8_t *features, char *buffer, int size)
+{
+   static char const * const t[][8] = {
+   { /* byte 0 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 1 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 2 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 3 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 4 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 5 */
+   /* 0 */ " ",
+   /* 1 */ " ",
+   /* 2 */ " ",
+   /* 3 */ " ",
+   /* 4 */ " ",
+   /* 5 */ " ",
+   /* 6 */ " ",
+   /* 7 */ " "
+   },
+   { /* byte 6 */
+   /* 0 */ " ",
+   /* 1 */ " ",

Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-19 Thread Kristof Provost

On 19 Apr 2020, at 15:33, Ronald Klop wrote:
On Sat, 18 Apr 2020 09:50:30 +0200, Kristof Provost  
wrote:



Author: kp
Date: Sat Apr 18 07:50:30 2020
New Revision: 360068
URL: https://svnweb.freebsd.org/changeset/base/360068

Log:
  ethersubr: Make the mac address generation more robust
 If we create two (vnet) jails and create a bridge interface in each 
we end up

  with the same mac address on both bridge interfaces.
  These very often conflicts, resulting in same mac address in both 
jails.

 Mitigate this problem by including the jail name in the mac address.
 Reviewed by:   kevans, melifaro
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24383

Modified:
  head/sys/kern/kern_jail.c
  head/sys/net/if_ethersubr.c
  head/sys/sys/jail.h

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sat Apr 18 03:14:16 2020(r360067)
+++ head/sys/kern/kern_jail.c   Sat Apr 18 07:50:30 2020(r360068)
@@ -2920,6 +2920,15 @@ getcredhostid(struct ucred *cred, unsigned 
long *hosti

mtx_unlock(&cred->cr_prison->pr_mtx);
 }
+void
+getjailname(struct ucred *cred, char *name, size_t len)
+{
+
+   mtx_lock(&cred->cr_prison->pr_mtx);
+   strlcpy(name, cred->cr_prison->pr_name, len);
+   mtx_unlock(&cred->cr_prison->pr_mtx);
+}
+
 #ifdef VIMAGE
 /*
  * Determine whether the prison represented by cred owns

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Sat Apr 18 03:14:16 2020(r360067)
+++ head/sys/net/if_ethersubr.c Sat Apr 18 07:50:30 2020(r360068)
@@ -1419,27 +1419,39 @@ ether_8021q_frame(struct mbuf **mp, struct 
ifnet *ife,

/*
  * Allocate an address from the FreeBSD Foundation OUI.  This uses a
- * cryptographic hash function on the containing jail's UUID and the 
interface
- * name to attempt to provide a unique but stable address.  
Pseudo-interfaces

- * which require a MAC address should use this function to allocate
- * non-locally-administered addresses.
+ * cryptographic hash function on the containing jail's name, UUID 
and the

+ * interface name to attempt to provide a unique but stable address.
+ * Pseudo-interfaces which require a MAC address should use this 
function to

+ * allocate non-locally-administered addresses.
  */
 void
 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr)
 {
-#defineETHER_GEN_ADDR_BUFSIZ   HOSTUUIDLEN + IFNAMSIZ + 2
SHA1_CTX ctx;
-   char buf[ETHER_GEN_ADDR_BUFSIZ];
+   char *buf;
char uuid[HOSTUUIDLEN + 1];
uint64_t addr;
int i, sz;
char digest[SHA1_RESULTLEN];
+   char jailname[MAXHOSTNAMELEN];
getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid));
-	sz = snprintf(buf, ETHER_GEN_ADDR_BUFSIZ, "%s-%s", uuid, 
ifp->if_xname);
+	/* If each (vnet) jail would also have a unique hostuuid this would 
not

+* be necessary. */
+   getjailname(curthread->td_ucred, jailname, sizeof(jailname));
+   sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
+   jailname);
+   if (sz < 0) {
+   /* Fall back to a random mac address. */



I was wondering if it would be valuable to give this fall back 
something like:


   printf("%s: unable to create fixed mac address; using 
random mac address", if_name(ifp));


This will only be printed in rare circumstances. But in that case will 
provide valuable information.


That would potentially be valuable, yes. On the other hand, we 
traditionally don’t sprinkle a lot of printf()s around in the kernel. 
This is extremely unlikely to happen, and if it does odds are attaching 
the interface will fail at an earlier or later point, you may struggle 
to pass packets and run into any number of other issues.
It’s also possible to diagnose absent the printf(), because the MAC 
address will be locally administered rather than within the FreeBSD OUI.


So, in short: not a bad idea. You can argue it both ways, and I find 
myself (weakly) on the opposite side.


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


Re: svn commit: r360068 - in head/sys: kern net sys

2020-04-19 Thread Ronald Klop

Nice feature. A question below.


On Sat, 18 Apr 2020 09:50:30 +0200, Kristof Provost  wrote:


Author: kp
Date: Sat Apr 18 07:50:30 2020
New Revision: 360068
URL: https://svnweb.freebsd.org/changeset/base/360068

Log:
  ethersubr: Make the mac address generation more robust
 If we create two (vnet) jails and create a bridge interface in each we  
end up

  with the same mac address on both bridge interfaces.
  These very often conflicts, resulting in same mac address in both  
jails.

 Mitigate this problem by including the jail name in the mac address.
 Reviewed by:   kevans, melifaro
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D24383

Modified:
  head/sys/kern/kern_jail.c
  head/sys/net/if_ethersubr.c
  head/sys/sys/jail.h

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sat Apr 18 03:14:16 2020(r360067)
+++ head/sys/kern/kern_jail.c   Sat Apr 18 07:50:30 2020(r360068)
@@ -2920,6 +2920,15 @@ getcredhostid(struct ucred *cred, unsigned long  
*hosti

mtx_unlock(&cred->cr_prison->pr_mtx);
 }
+void
+getjailname(struct ucred *cred, char *name, size_t len)
+{
+
+   mtx_lock(&cred->cr_prison->pr_mtx);
+   strlcpy(name, cred->cr_prison->pr_name, len);
+   mtx_unlock(&cred->cr_prison->pr_mtx);
+}
+
 #ifdef VIMAGE
 /*
  * Determine whether the prison represented by cred owns

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Sat Apr 18 03:14:16 2020(r360067)
+++ head/sys/net/if_ethersubr.c Sat Apr 18 07:50:30 2020(r360068)
@@ -1419,27 +1419,39 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet  
*ife,

/*
  * Allocate an address from the FreeBSD Foundation OUI.  This uses a
- * cryptographic hash function on the containing jail's UUID and the  
interface
- * name to attempt to provide a unique but stable address.   
Pseudo-interfaces

- * which require a MAC address should use this function to allocate
- * non-locally-administered addresses.
+ * cryptographic hash function on the containing jail's name, UUID and  
the

+ * interface name to attempt to provide a unique but stable address.
+ * Pseudo-interfaces which require a MAC address should use this  
function to

+ * allocate non-locally-administered addresses.
  */
 void
 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr)
 {
-#defineETHER_GEN_ADDR_BUFSIZ   HOSTUUIDLEN + IFNAMSIZ + 2
SHA1_CTX ctx;
-   char buf[ETHER_GEN_ADDR_BUFSIZ];
+   char *buf;
char uuid[HOSTUUIDLEN + 1];
uint64_t addr;
int i, sz;
char digest[SHA1_RESULTLEN];
+   char jailname[MAXHOSTNAMELEN];
getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid));
-	sz = snprintf(buf, ETHER_GEN_ADDR_BUFSIZ, "%s-%s", uuid,  
ifp->if_xname);

+   /* If each (vnet) jail would also have a unique hostuuid this would not
+* be necessary. */
+   getjailname(curthread->td_ucred, jailname, sizeof(jailname));
+   sz = asprintf(&buf, M_TEMP, "%s-%s-%s", uuid, if_name(ifp),
+   jailname);
+   if (sz < 0) {
+   /* Fall back to a random mac address. */



I was wondering if it would be valuable to give this fall back something  
like:


   printf("%s: unable to create fixed mac address; using random  
mac address", if_name(ifp));


This will only be printed in rare circumstances. But in that case will  
provide valuable information.


Regards,

Ronald.



+   arc4rand(hwaddr, sizeof(*hwaddr), 0);
+   hwaddr->octet[0] = 0x02;
+   return;
+   }
+
SHA1Init(&ctx);
SHA1Update(&ctx, buf, sz);
SHA1Final(digest, &ctx);
+   free(buf, M_TEMP);
addr = ((digest[0] << 16) | (digest[1] << 8) | digest[2]) &
OUI_FREEBSD_GENERATED_MASK;

Modified: head/sys/sys/jail.h
==
--- head/sys/sys/jail.h Sat Apr 18 03:14:16 2020(r360067)
+++ head/sys/sys/jail.h Sat Apr 18 07:50:30 2020(r360068)
@@ -382,6 +382,7 @@ void getcredhostname(struct ucred *, char *, size_t);
 void getcreddomainname(struct ucred *, char *, size_t);
 void getcredhostuuid(struct ucred *, char *, size_t);
 void getcredhostid(struct ucred *, unsigned long *);
+void getjailname(struct ucred *cred, char *name, size_t len);
 void prison0_init(void);
 int prison_allow(struct ucred *, unsigned);
 int prison_check(struct ucred *cred1, struct ucred *cred2);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo

Re: svn commit: r360078 - in head: sbin/bectl share/man/man8

2020-04-19 Thread Yuri Pankov

Mateusz Piotrowski wrote:

On 4/18/20 11:11 PM, Yuri Pankov wrote:

We don't have the man style guide (that I know of, at least)

We have style.mdoc(5)!


Now I know, thanks.

May be it would make sense to reference it from style(9) as it's where I 
was looking, and SEE ALSO already lists style.Makefile and style.lua?

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


svn commit: r360093 - head/release/arm64

2020-04-19 Thread Emmanuel Vadot
Author: manu
Date: Sun Apr 19 10:50:29 2020
New Revision: 360093
URL: https://svnweb.freebsd.org/changeset/base/360093

Log:
  release: arm64: Remove DTSO for Allwinner boards
  
  Both SID and THS dts node are now in the main dts and the DTSO have
  been removed in r359935
  
  MFC after:2 month
  X-MFC-With:   r359935

Modified:
  head/release/arm64/PINE64-LTS.conf
  head/release/arm64/PINE64.conf
  head/release/arm64/PINEBOOK.conf

Modified: head/release/arm64/PINE64-LTS.conf
==
--- head/release/arm64/PINE64-LTS.conf  Sun Apr 19 10:24:15 2020
(r360092)
+++ head/release/arm64/PINE64-LTS.conf  Sun Apr 19 10:50:29 2020
(r360093)
@@ -14,7 +14,7 @@ KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
 PART_SCHEME="MBR"
-FDT_OVERLAYS="sun50i-a64-sid,sun50i-a64-ths,sun50i-a64-timer,sun50i-a64-opp"
+FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINE64-LTS"
 
 arm_install_uboot() {

Modified: head/release/arm64/PINE64.conf
==
--- head/release/arm64/PINE64.conf  Sun Apr 19 10:24:15 2020
(r360092)
+++ head/release/arm64/PINE64.conf  Sun Apr 19 10:50:29 2020
(r360093)
@@ -14,7 +14,7 @@ KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
 PART_SCHEME="MBR"
-FDT_OVERLAYS="sun50i-a64-sid,sun50i-a64-ths,sun50i-a64-timer,sun50i-a64-opp"
+FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINE64"
 
 arm_install_uboot() {

Modified: head/release/arm64/PINEBOOK.conf
==
--- head/release/arm64/PINEBOOK.confSun Apr 19 10:24:15 2020
(r360092)
+++ head/release/arm64/PINEBOOK.confSun Apr 19 10:50:29 2020
(r360093)
@@ -14,7 +14,7 @@ KERNEL="GENERIC"
 MD_ARGS="-x 63 -y 255"
 NODOC=1
 PART_SCHEME="MBR"
-FDT_OVERLAYS="sun50i-a64-sid,sun50i-a64-ths,sun50i-a64-timer,sun50i-a64-opp"
+FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp"
 export BOARDNAME="PINEBOOK"
 
 arm_install_uboot() {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r360078 - in head: sbin/bectl share/man/man8

2020-04-19 Thread Mateusz Piotrowski

On 4/18/20 11:11 PM, Yuri Pankov wrote:

We don't have the man style guide (that I know of, at least)

We have style.mdoc(5)!
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r360092 - in head: sys/netgraph/bluetooth/hci usr.sbin/bluetooth/hccontrol

2020-04-19 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Apr 19 10:24:15 2020
New Revision: 360092
URL: https://svnweb.freebsd.org/changeset/base/360092

Log:
  Bring HCI error messages up-to-date.
  See Bluetooth v5.6 core specification Vol.1 Part F: Controller error codes.
  
  Submitted by: Marc Veldman 
  PR:   245737
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/netgraph/bluetooth/hci/ng_hci_misc.c
  head/usr.sbin/bluetooth/hccontrol/util.c

Modified: head/sys/netgraph/bluetooth/hci/ng_hci_misc.c
==
--- head/sys/netgraph/bluetooth/hci/ng_hci_misc.c   Sun Apr 19 09:28:59 
2020(r360091)
+++ head/sys/netgraph/bluetooth/hci/ng_hci_misc.c   Sun Apr 19 10:24:15 
2020(r360092)
@@ -491,7 +491,35 @@ ng_hci_str_error(u_int16_t code)
/* 0x26 */ "Unit key used",
/* 0x27 */ "QoS is not supported",
/* 0x28 */ "Instant passed",
-   /* 0x29 */ "Paring with unit key not supported",
+   /* 0x29 */ "Pairing with unit key not supported",
+   /* 0x2a */ "Different Transaction Collision",
+   /* 0x2b */ "Unknown error (Reserved for future use)",
+   /* 0x2c */ "QoS Unacceptable Parameter",
+   /* 0x2d */ "QoS Rejected",
+   /* 0x2e */ "Channel Classification Not Supported",
+   /* 0x2f */ "Insufficient Security",
+   /* 0x30 */ "Parameter Out Of Mandatory Range",
+   /* 0x31 */ "Unknown error (Reserved for future use)",
+   /* 0x32 */ "Role Switch Pending",
+   /* 0x33 */ "Unknown error (Reserved for future use)",
+   /* 0x34 */ "Reserved Slot Violation",
+   /* 0x35 */ "Role Switch Failed",
+   /* 0x36 */ "Extended Inquiry Response Too Large",
+   /* 0x37 */ "Secure Simple Pairing Not Supported By Host",
+   /* 0x38 */ "Host Busy - Pairing",
+   /* 0x39 */ "Connection Rejected due to No Suitable Channel Found",
+   /* 0x3a */ "Controller Busy",
+   /* 0x3b */ "Unacceptable Connection Parameters",
+   /* 0x3c */ "Advertising Timeout",
+   /* 0x3d */ "Connection Terminated due to MIC Failure",
+   /* 0x3e */ "Connection Failed to be Established / Synchronization 
Timeout",
+   /* 0x3f */ "MAC Connection Failed",
+   /* 0x40 */ "Coarse Clock Adjustment Rejected but Will Try to Adjust 
Using Clock Dragging",
+   /* 0x41 */ "Type0 Submap Not Defined",
+   /* 0x42 */ "Unknown Advertising Identifier",
+   /* 0x43 */ "Limit Reached",
+   /* 0x44 */ "Operation Cancelled by Host",
+   /* 0x45 */ "Packet Too Long",
/* SHOULD ALWAYS BE LAST */ "Unknown error"
};
 

Modified: head/usr.sbin/bluetooth/hccontrol/util.c
==
--- head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 09:28:59 2020
(r360091)
+++ head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 19 10:24:15 2020
(r360092)
@@ -439,7 +439,35 @@ hci_status2str(int status)
/* 0x26 */ "Unit key used",
/* 0x27 */ "QoS is not supported",
/* 0x28 */ "Instant passed",
-   /* 0x29 */ "Pairing with unit key not supported"
+   /* 0x29 */ "Pairing with unit key not supported",
+   /* 0x2a */ "Different Transaction Collision",
+   /* 0x2b */ "Unknown error (Reserved for future use)",
+   /* 0x2c */ "QoS Unacceptable Parameter",
+   /* 0x2d */ "QoS Rejected",
+   /* 0x2e */ "Channel Classification Not Supported",
+   /* 0x2f */ "Insufficient Security",
+   /* 0x30 */ "Parameter Out Of Mandatory Range",
+   /* 0x31 */ "Unknown error (Reserved for future use)",
+   /* 0x32 */ "Role Switch Pending",
+   /* 0x33 */ "Unknown error (Reserved for future use)",
+   /* 0x34 */ "Reserved Slot Violation",
+   /* 0x35 */ "Role Switch Failed",
+   /* 0x36 */ "Extended Inquiry Response Too Large",
+   /* 0x37 */ "Secure Simple Pairing Not Supported By Host",
+   /* 0x38 */ "Host Busy - Pairing",
+   /* 0x39 */ "Connection Rejected due to No Suitable Channel 
Found",
+   /* 0x3a */ "Controller Busy",
+   /* 0x3b */ "Unacceptable Connection Parameters",
+   /* 0x3c */ "Advertising Timeout",
+   /* 0x3d */ "Connection Terminated due to MIC Failure",
+   /* 0x3e */ "Connection Failed to be Established / 
Synchronization Timeout",
+   /* 0x3f */ "MAC Connection Failed",
+   /* 0x40 */ "Coarse Clock Adjustment Rejected but Will Try to 
Adjust Using Clock Dragging",
+   /* 0x41 */ "Type0 Submap Not Defined",
+   /* 0x42 */ "Unknown Advertising Identifier",
+   /* 0x43 */ "Limit Reached",
+   /* 0x44 */ "Operation Cancelled by Host",
+   /* 0x45 */ "P

svn commit: r360091 - in head/libexec/rtld-elf: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv

2020-04-19 Thread Konstantin Belousov
Author: kib
Date: Sun Apr 19 09:28:59 2020
New Revision: 360091
URL: https://svnweb.freebsd.org/changeset/base/360091

Log:
  Align initial-exec TLS segments to the p_vaddr % align.
  
  This is continuation of D21163/r359634, which handled the alignment
  for global mode.
  
  Non-x86 arches are not handled, maintainers are welcomed.
  
  Tested by:emaste
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D24366

Modified:
  head/libexec/rtld-elf/aarch64/rtld_machdep.h
  head/libexec/rtld-elf/amd64/reloc.c
  head/libexec/rtld-elf/amd64/rtld_machdep.h
  head/libexec/rtld-elf/arm/rtld_machdep.h
  head/libexec/rtld-elf/i386/reloc.c
  head/libexec/rtld-elf/i386/rtld_machdep.h
  head/libexec/rtld-elf/mips/rtld_machdep.h
  head/libexec/rtld-elf/powerpc/rtld_machdep.h
  head/libexec/rtld-elf/powerpc64/rtld_machdep.h
  head/libexec/rtld-elf/riscv/rtld_machdep.h
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/aarch64/rtld_machdep.h
==
--- head/libexec/rtld-elf/aarch64/rtld_machdep.hSun Apr 19 07:27:12 
2020(r360090)
+++ head/libexec/rtld-elf/aarch64/rtld_machdep.hSun Apr 19 09:28:59 
2020(r360091)
@@ -72,9 +72,9 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr targe
 
 #defineround(size, align)  \
(((size) + (align) - 1) & ~((align) - 1))
-#definecalculate_first_tls_offset(size, align) \
+#definecalculate_first_tls_offset(size, align, offset) \
round(16, align)
-#definecalculate_tls_offset(prev_offset, prev_size, size, align) \
+#definecalculate_tls_offset(prev_offset, prev_size, size, align, 
offset) \
round(prev_offset + prev_size, align)
 #definecalculate_tls_end(off, size)((off) + (size))
 #define calculate_tls_post_size(align) \

Modified: head/libexec/rtld-elf/amd64/reloc.c
==
--- head/libexec/rtld-elf/amd64/reloc.c Sun Apr 19 07:27:12 2020
(r360090)
+++ head/libexec/rtld-elf/amd64/reloc.c Sun Apr 19 09:28:59 2020
(r360091)
@@ -552,3 +552,33 @@ void *__tls_get_addr(tls_index *ti)
 
 return tls_get_addr_common(&segbase[1], ti->ti_module, ti->ti_offset);
 }
+
+size_t
+calculate_first_tls_offset(size_t size, size_t align, size_t offset)
+{
+   size_t res;
+
+   res = roundup(size, align);
+   offset &= align - 1;
+   if (offset != 0)
+   res += align - offset;
+   return (res);
+}
+
+size_t
+calculate_tls_offset(size_t prev_offset, size_t prev_size __unused, size_t 
size,
+size_t align, size_t offset)
+{
+   size_t res;
+
+   res = roundup(prev_offset + size, align);
+   offset &= align - 1;
+   if (offset != 0)
+   res += align - offset;
+   return (res);
+}
+size_t
+calculate_tls_end(size_t off, size_t size __unused)
+{
+   return (off);
+}

Modified: head/libexec/rtld-elf/amd64/rtld_machdep.h
==
--- head/libexec/rtld-elf/amd64/rtld_machdep.h  Sun Apr 19 07:27:12 2020
(r360090)
+++ head/libexec/rtld-elf/amd64/rtld_machdep.h  Sun Apr 19 09:28:59 2020
(r360091)
@@ -61,14 +61,6 @@ extern uint32_t cpu_stdext_feature2;
(((Elf_Addr (*)(uint32_t, uint32_t, uint32_t, uint32_t))ptr)( \
cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2))
 
-#define round(size, align) \
-   (((size) + (align) - 1) & ~((align) - 1))
-#define calculate_first_tls_offset(size, align) \
-   round(size, align)
-#define calculate_tls_offset(prev_offset, prev_size, size, align) \
-   round((prev_offset) + (size), align)
-#define calculate_tls_end(off, size)   (off)
-
 typedef struct {
 unsigned long ti_module;
 unsigned long ti_offset;
@@ -81,4 +73,8 @@ void *__tls_get_addr(tls_index *ti) __exported;
 
 #define md_abi_variant_hook(x)
 
+size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset);
+size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size,
+size_t align, size_t offset);
+size_t calculate_tls_end(size_t off, size_t size);
 #endif

Modified: head/libexec/rtld-elf/arm/rtld_machdep.h
==
--- head/libexec/rtld-elf/arm/rtld_machdep.hSun Apr 19 07:27:12 2020
(r360090)
+++ head/libexec/rtld-elf/arm/rtld_machdep.hSun Apr 19 09:28:59 2020
(r360091)
@@ -64,9 +64,9 @@ typedef struct {
 
 #define round(size, align) \
 (((size) + (align) - 1) & ~((align) - 1))
-#define calculate_first_tls_offset(size, align) \
+#define calculate_first_tls_offset(size, align, offset)\
 round(8, align)
-#define calculate_tls_offset(prev_offset, prev_size, size, align) \
+#define calculate_tls_offs

svn commit: r360090 - head/sys/netinet6

2020-04-19 Thread Alexander V. Chernikov
Author: melifaro
Date: Sun Apr 19 07:27:12 2020
New Revision: 360090
URL: https://svnweb.freebsd.org/changeset/base/360090

Log:
  Fix lookup key generation in fib6_check_urpf().
  
  The version introduced in r359823 assumed D23051
   had been in tree already. As this is not the case yet,
   revert to sockaddr.

Modified:
  head/sys/netinet6/in6_fib.c

Modified: head/sys/netinet6/in6_fib.c
==
--- head/sys/netinet6/in6_fib.c Sun Apr 19 02:49:05 2020(r360089)
+++ head/sys/netinet6/in6_fib.c Sun Apr 19 07:27:12 2020(r360090)
@@ -362,7 +362,7 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr
struct rib_head *rh;
struct radix_node *rn;
struct rtentry *rt;
-   struct in6_addr addr;
+   struct sockaddr_in6 sin6;
int ret;
 
KASSERT((fibnum < rt_numfibs), ("fib6_check_urpf: bad fibnum"));
@@ -370,13 +370,18 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr
if (rh == NULL)
return (0);
 
-   addr = *dst6;
+   /* TODO: radix changes */
+   /* Prepare lookup key */
+   memset(&sin6, 0, sizeof(sin6));
+   sin6.sin6_len = sizeof(struct sockaddr_in6);
+   sin6.sin6_addr = *dst6;
+
/* Assume scopeid is valid and embed it directly */
if (IN6_IS_SCOPE_LINKLOCAL(dst6))
-   addr.s6_addr16[1] = htons(scopeid & 0x);
+   sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0x);
 
RIB_RLOCK(rh);
-   rn = rh->rnh_matchaddr((void *)&addr, &rh->head);
+   rn = rh->rnh_matchaddr((void *)&sin6, &rh->head);
if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) {
rt = RNTORT(rn);
 #ifdef RADIX_MPATH
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"