svn commit: r343769 - head/sys/netinet

2019-02-05 Thread Michael Tuexen
Author: tuexen
Date: Tue Feb  5 10:13:51 2019
New Revision: 343769
URL: https://svnweb.freebsd.org/changeset/base/343769

Log:
  Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
  socketoption.
  
  This was found by running syzkaller.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Tue Feb  5 08:15:19 2019
(r343768)
+++ head/sys/netinet/sctp_usrreq.c  Tue Feb  5 10:13:51 2019
(r343769)
@@ -4654,13 +4654,13 @@ sctp_setopt(struct socket *so, int optname, void *optv
}
for (i = 0; i < strrst->srs_number_streams; i++) {
if ((send_in) &&
-   (strrst->srs_stream_list[i] > 
stcb->asoc.streamincnt)) {
+   (strrst->srs_stream_list[i] >= 
stcb->asoc.streamincnt)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
break;
}
if ((send_out) &&
-   (strrst->srs_stream_list[i] > 
stcb->asoc.streamoutcnt)) {
+   (strrst->srs_stream_list[i] >= 
stcb->asoc.streamoutcnt)) {
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, 
SCTP_FROM_SCTP_USRREQ, EINVAL);
error = EINVAL;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r325728 - head/lib/libkvm

2019-02-05 Thread Bruce Evans

On Mon, 4 Feb 2019, Ed Maste wrote:


On Sat, 11 Nov 2017 at 18:31, Will Andrews  wrote:


Author: will
Date: Sat Nov 11 23:30:58 2017
New Revision: 325728
URL: https://svnweb.freebsd.org/changeset/base/325728

Log:
  libkvm: add kvm_walk_pages API.

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Sat Nov 11 22:50:14 2017(r325727)
+++ head/lib/libkvm/kvm.h   Sat Nov 11 23:30:58 2017(r325728)
@@ -36,6 +36,7 @@
 #include 


Redundant.  sys/types.h already includes this (more than once via nesting),
and it is OK to depend on this, especially since sys/types.h depends on it
much more than this header.


 #include 


Namespace pollution.  Old versions were carefully written to not have this.
They didn't use pollution like u_long, and included only 


 #include 


Namespace pollution.  Old versions have this.  I fixed this in my version
15-20 years ago:

XX Index: kvm.h
XX ===
XX RCS file: /home/ncvs/src/lib/libkvm/kvm.h,v
XX retrieving revision 1.16
XX diff -u -2 -r1.16 kvm.h
XX --- kvm.h13 Oct 2003 04:44:55 -  1.16
XX +++ kvm.h13 Oct 2003 04:46:29 -
XX @@ -40,5 +40,4 @@
XX  #include 
XX  #include 
XX -#include 
XX 
XX  /* Default version symbol. */

XX @@ -59,4 +58,5 @@
XX 
XX  struct kinfo_proc;

XX +struct nlist;
XX  struct proc;


+#include 


Larger, newer namespace pollution.



 /* Default version symbol. */
 #defineVRS_SYM "_version"
@@ -73,7 +74,19 @@ struct kvm_swap {
u_int   ksw_reserved2;
 };

+struct kvm_page {
+   unsigned int version;


This would be a style bug if the namespace pollution is allowed.  'unsigned
int' is spelled u_int in the kernel and in system headers and files.  But
portable ones can't use it.

The struct member name is also namespace pollution and a style bug.
'version' is in the application namespace and is especially likely
to be used in applications, perhaps to #define it.  Old structs in
this header are careful to use a prefix for names.  Unfortunately, the
prefix in the one struct was ksw which is not obviousy related to kvm.
Even the prefix kvm_ is not documented as being reserved in kvm(3).

There was already massive breakage in this area:
- old versions have the struct tags kinfo_proc and proc, and much more in
  the nlist include, but the above fix reduces this to a another struct
  tag.
- the previous version has a private declaration of vm_prot_t to avoid
  the pollution of including vm/vm.h.  This is nonsense now.
- VRS_SYM and VRS_KEY are in the application namespace, and their names
  don't even give a hint that they are for kvm
- member names n_* in struct kvm_nlist gives some of the pollution fixed
  by not including nlist.h
- the type of the struct members in struct kvm_swap rotted from int to
  u_int
- u_int for the name of type of the struct members in struct kvm_swap is
  pollution that is still carefully avoided in old parts of the file
- the struct member names in struct kvm_page are in the apolication
  namespace
- the struct member declarations in struct kvm_page are misformatted.
  They mostly use the pollution u_long, but one uses the verbose "unsigned
  int".  The shorted type names can be formatted better
- SWIF_DEV_PREFIX and LIBKVM_WALK_PAGES_VERSION are in the application
  namespace.  The latter at least gives a hint that it is for vm
- the prototype for kvm_counter_u64_fetch() uses u_long.  Old prototypes
  are more careful
- the declarations for kvm_walk_pages* are misformatted and unsorted.


+   u_long paddr;


Further pollution in the type and struct member names.  Further misformatting

The include of sys/_types.h was apparently changed to sys/types.h to support
using u_long.


This should probably be uin64_t to support cross-debugging cores from
64-bit machines on 32-bit hosts; also for i386 PAE. Or, on IRC jhb
suggested we introduce a kpaddr_t typedef akin to kvaddr_t.


The correct type is vm_paddr_t or maybe a kvm wrapper of this.

kib just changed vm_paddr_t on i386.  I don't like this (it gives another
pessimization of i386) and it depends on a kernel option in my version.
Applications can't use this kernel option so would have to use their own
larger type.  Even uint64_t might be too small.  Hard-coding it is worse
than hard-coding unsigned long.




+   u_long kmap_vaddr;
+   u_long dmap_vaddr;


These two should be kvaddr_t.


Further pollution and style bugs in names, types and formatting.

The implementation of this is another bug.  It is declared in sys/types.h,
so application headers like kvm.h can't use it without including lots of
pollution.  Maybe getting it was the original reason for changing the
included and the pollution and style bugs from using u_long is bitrot.

It is currently hard-coded as __uint64_t.  That works for all supported
arches now, but eventually some typedefs will actu

svn commit: r343770 - head/sys/netinet

2019-02-05 Thread Michael Tuexen
Author: tuexen
Date: Tue Feb  5 10:29:31 2019
New Revision: 343770
URL: https://svnweb.freebsd.org/changeset/base/343770

Log:
  Only reduce the PMTU after the send call. The only way to increase it, is
  via PMTUD.
  
  This fixes an MTU issue reported by Timo Voelker.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Tue Feb  5 10:13:51 2019
(r343769)
+++ head/sys/netinet/sctp_output.c  Tue Feb  5 10:29:31 2019
(r343770)
@@ -4289,10 +4289,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
if (net->port) {
mtu -= sizeof(struct 
udphdr);
}
-   if ((stcb != NULL) && 
(stcb->asoc.smallest_mtu > mtu)) {
-   
sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+   if (mtu < net->mtu) {
+   if ((stcb != NULL) && 
(stcb->asoc.smallest_mtu > mtu)) {
+   
sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+   }
+   net->mtu = mtu;
}
-   net->mtu = mtu;
}
} else if (ro->ro_rt == NULL) {
/* route was freed */
@@ -4647,10 +4649,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp,
if (net->port) {
mtu -= sizeof(struct 
udphdr);
}
-   if ((stcb != NULL) && 
(stcb->asoc.smallest_mtu > mtu)) {
-   
sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+   if (mtu < net->mtu) {
+   if ((stcb != NULL) && 
(stcb->asoc.smallest_mtu > mtu)) {
+   
sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
+   }
+   net->mtu = mtu;
}
-   net->mtu = mtu;
}
} else if (ifp) {
if (ND_IFINFO(ifp)->linkmtu &&
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343772 - head/sys/dev/netmap

2019-02-05 Thread Vincenzo Maffione
Author: vmaffione
Date: Tue Feb  5 12:10:48 2019
New Revision: 343772
URL: https://svnweb.freebsd.org/changeset/base/343772

Log:
  netmap: refactor logging macros and pipes
  
  Changelist:
  - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
and nm_prlim, to avoid possible naming conflicts.
  - Add netmap_krings_mode_commit() helper function and use that
to reduce code duplication.
  - Refactor pipes control code to export some functions that
can be reused by the veth driver (on Linux) and epair(4).
  - Add check to reject API requests with version less than 11.
  - Small code refactoring for the null adapter.
  
  MFC after:1 week

Modified:
  head/sys/dev/netmap/if_ptnet.c
  head/sys/dev/netmap/if_vtnet_netmap.h
  head/sys/dev/netmap/netmap.c
  head/sys/dev/netmap/netmap_bdg.c
  head/sys/dev/netmap/netmap_freebsd.c
  head/sys/dev/netmap/netmap_generic.c
  head/sys/dev/netmap/netmap_kern.h
  head/sys/dev/netmap/netmap_legacy.c
  head/sys/dev/netmap/netmap_mem2.c
  head/sys/dev/netmap/netmap_monitor.c
  head/sys/dev/netmap/netmap_null.c
  head/sys/dev/netmap/netmap_offloadings.c
  head/sys/dev/netmap/netmap_pipe.c
  head/sys/dev/netmap/netmap_vale.c

Modified: head/sys/dev/netmap/if_ptnet.c
==
--- head/sys/dev/netmap/if_ptnet.c  Tue Feb  5 10:33:22 2019
(r343771)
+++ head/sys/dev/netmap/if_ptnet.c  Tue Feb  5 12:10:48 2019
(r343772)
@@ -1151,10 +1151,10 @@ ptnet_sync_from_csb(struct ptnet_softc *sc, struct net
kring->nr_hwtail = kring->rtail =
kring->ring->tail = ktoa->hwtail;
 
-   ND("%d,%d: csb {hc %u h %u c %u ht %u}", t, i,
+   nm_prdis("%d,%d: csb {hc %u h %u c %u ht %u}", t, i,
   ktoa->hwcur, atok->head, atok->cur,
   ktoa->hwtail);
-   ND("%d,%d: kring {hc %u rh %u rc %u h %u c %u ht %u rt %u t 
%u}",
+   nm_prdis("%d,%d: kring {hc %u rh %u rc %u h %u c %u ht %u rt %u 
t %u}",
   t, i, kring->nr_hwcur, kring->rhead, kring->rcur,
   kring->ring->head, kring->ring->cur, kring->nr_hwtail,
   kring->rtail, kring->ring->tail);
@@ -1179,7 +1179,6 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff
struct ptnet_softc *sc = if_getsoftc(ifp);
int native = (na == &sc->ptna->hwup.up);
struct ptnet_queue *pq;
-   enum txrx t;
int ret = 0;
int i;
 
@@ -1194,7 +1193,7 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff
 * in the RX rings, since we will not receive further interrupts
 * until these will be processed. */
if (native && !onoff && na->active_fds == 0) {
-   D("Exit netmap mode, re-enable interrupts");
+   nm_prinf("Exit netmap mode, re-enable interrupts");
for (i = 0; i < sc->num_rings; i++) {
pq = sc->queues + i;
pq->atok->appl_need_kick = 1;
@@ -1230,30 +1229,14 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff
/* If not native, don't call nm_set_native_flags, since we 
don't want
 * to replace if_transmit method, nor set NAF_NETMAP_ON */
if (native) {
-   for_rx_tx(t) {
-   for (i = 0; i <= nma_get_nrings(na, t); i++) {
-   struct netmap_kring *kring = NMR(na, 
t)[i];
-
-   if (nm_kring_pending_on(kring)) {
-   kring->nr_mode = NKR_NETMAP_ON;
-   }
-   }
-   }
+   netmap_krings_mode_commit(na, onoff);
nm_set_native_flags(na);
}
 
} else {
if (native) {
nm_clear_native_flags(na);
-   for_rx_tx(t) {
-   for (i = 0; i <= nma_get_nrings(na, t); i++) {
-   struct netmap_kring *kring = NMR(na, 
t)[i];
-
-   if (nm_kring_pending_off(kring)) {
-   kring->nr_mode = NKR_NETMAP_OFF;
-   }
-   }
-   }
+   netmap_krings_mode_commit(na, onoff);
}
 
if (sc->ptna->backend_users == 0) {
@@ -1728,7 +1711,7 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns
 
if (!PTNET_Q_TRYLOCK(pq)) {
/* We failed to acquire the lock, schedule the taskqueue. */
-   RD(1, "Deferring TX work");
+   nm_prlim(1, "Deferring TX work");
if (may_resched) {

Re: svn commit: r325728 - head/lib/libkvm

2019-02-05 Thread Ed Maste
On Tue, 5 Feb 2019 at 05:17, Bruce Evans  wrote:
>
> On Mon, 4 Feb 2019, Ed Maste wrote:
>
> > On Sat, 11 Nov 2017 at 18:31, Will Andrews  wrote:
> >>
> >> Author: will
> >> Date: Sat Nov 11 23:30:58 2017
> >> New Revision: 325728
> >> URL: https://svnweb.freebsd.org/changeset/base/325728
> >>
> >> Log:
> >>   libkvm: add kvm_walk_pages API.

(Replying here only to the comments on the issues I brought up.)

>>> +   u_long paddr;
>
> Further pollution in the type and struct member names.  Further misformatting
>
> The include of sys/_types.h was apparently changed to sys/types.h to support
> using u_long.

If we change the types then we can presumably revert that part.

> > This should probably be uin64_t to support cross-debugging cores from
> > 64-bit machines on 32-bit hosts; also for i386 PAE. Or, on IRC jhb
> > suggested we introduce a kpaddr_t typedef akin to kvaddr_t.
>
> The correct type is vm_paddr_t or maybe a kvm wrapper of this.

That precludes cross-arch and cross-size use of kvm_walk_pages; kvm
supports this use (see kvm_read2) so it should be a 64-bit kvm
wrapper.

> >> +   u_long kmap_vaddr;
> >> +   u_long dmap_vaddr;
> >
> > These two should be kvaddr_t.
>
> Further pollution and style bugs in names, types and formatting.

Somewhat difficult to change now though... but what about:

struct kvm_page {
u_int kp_version;
kpaddr_t kp_paddr;
kvaddr_t kp_kmap_vaddr;
kvaddr_t kp_dmap_vaddr;
vm_prot_t kp_prot;
off_t kp_offset;
size_t kp_len;
};

> [kvaddr_t] is currently hard-coded as __uint64_t.  That works for all 
> supported
> arches now, but eventually some typedefs will actually be needed for their
> purpose of being implementation-depended and changeable.

Except that these should be MI for cross-debugging.

> >> +   vm_prot_t prot;
> >> +   u_long offset;
> >
> > off_t?
>
> Further pollution and style bugs in names, types and formatting.
>
> Maybe uoff_t.  off_t is 64-bits signed so can't reach most kernel addresses
> on some 64-bit arches like amd64.

I believe the offset here is the offset of the page in the vmcore
file, so off_t should be appropriate.

> >> +   size_t len;
>
> Further pollution and style bugs 1 name and formatting.

Off hand I'm not sure of the appropriate type for a MI size; in
practice now though this len will be page size.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343777 - head/sys/kern

2019-02-05 Thread Bruce Evans
Author: bde
Date: Tue Feb  5 15:34:55 2019
New Revision: 343777
URL: https://svnweb.freebsd.org/changeset/base/343777

Log:
  Fix zapping of static hints and env in init_static_kenv().  Environments
  are terminated by 2 NULs, but only 1 NUL was zapped.  Zapping only 1
  NUL just splits the first string into an empty string and a corrupted
  string.  All other strings in static hints and env remained live early
  in the boot when they were supposed to be disabled.
  
  Support calling init_static_kenv() very early in the boot, so as to
  use the env very early in the boot.  Then the pointer to the loader
  env may change after the first call due to enabling paging or otherwise
  remapping the pointer.  Another call is needed to register the change.
  Don't use the previous pointer in this (or any) later call.
  
  Reviewed by:  kib

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cTue Feb  5 15:05:22 2019
(r343776)
+++ head/sys/kern/kern_environment.cTue Feb  5 15:34:55 2019
(r343777)
@@ -250,7 +250,24 @@ init_static_kenv(char *buf, size_t len)
char *eval;
 
KASSERT(!dynamic_kenv, ("kenv: dynamic_kenv already initialized"));
+
/*
+* We may be called twice, with the second call needed to relocate
+* md_envp after enabling paging.  md_envp is then garbage if it is
+* not null and the relocation will move it.  Discard it so as to
+* not crash using its old value in our first call to kern_getenv().
+*
+* The second call gives the same environment as the first except
+* in silly configurations where the static env disables itself.
+*
+* Other env calls don't handle possibly-garbage pointers, so must
+* not be made between enabling paging and calling here.
+*/
+   md_envp = NULL;
+   md_env_len = 0;
+   md_env_pos = 0;
+
+   /*
 * Give the static environment a chance to disable the loader(8)
 * environment first.  This is done with loader_env.disabled=1.
 *
@@ -275,12 +292,16 @@ init_static_kenv(char *buf, size_t len)
md_env_pos = 0;
 
eval = kern_getenv("static_env.disabled");
-   if (eval != NULL && strcmp(eval, "1") == 0)
-   *kern_envp = '\0';
+   if (eval != NULL && strcmp(eval, "1") == 0) {
+   kern_envp[0] = '\0';
+   kern_envp[1] = '\0';
+   }
}
eval = kern_getenv("static_hints.disabled");
-   if (eval != NULL && strcmp(eval, "1") == 0)
-   *static_hints = '\0';
+   if (eval != NULL && strcmp(eval, "1") == 0) {
+   static_hints[0] = '\0';
+   static_hints[1] = '\0';
+   }
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r325728 - head/lib/libkvm

2019-02-05 Thread Bruce Evans

On Tue, 5 Feb 2019, Ed Maste wrote:


On Tue, 5 Feb 2019 at 05:17, Bruce Evans  wrote:


On Mon, 4 Feb 2019, Ed Maste wrote:


On Sat, 11 Nov 2017 at 18:31, Will Andrews  wrote:


Author: will
Date: Sat Nov 11 23:30:58 2017
New Revision: 325728
URL: https://svnweb.freebsd.org/changeset/base/325728

Log:
  libkvm: add kvm_walk_pages API.


(Replying here only to the comments on the issues I brought up.)


+   u_long paddr;


Further pollution in the type and struct member names.  Further misformatting

The include of sys/_types.h was apparently changed to sys/types.h to support
using u_long.


If we change the types then we can presumably revert that part.


It would need the kva wrapper type in sys/_types.h.

In fact, older, more standard types are already declared there, but with
underscores as needed to have no pollution in there.  sys/types.h and
some other files turn the underscored versions into non-underscored
versions.


This should probably be uin64_t to support cross-debugging cores from
64-bit machines on 32-bit hosts; also for i386 PAE. Or, on IRC jhb
suggested we introduce a kpaddr_t typedef akin to kvaddr_t.


The correct type is vm_paddr_t or maybe a kvm wrapper of this.


That precludes cross-arch and cross-size use of kvm_walk_pages; kvm
supports this use (see kvm_read2) so it should be a 64-bit kvm
wrapper.


kvm or system?  kvaddr_t is system and the corresponding physical address
type should probably be system too.

The name kvaddr_t is not very good.  kva is a good abbreviation, and
kva_ is a good prefix.  kvaddr is not so good for either.  We now want
a physical address type and its matching name is kpaddr_t, but that means
that the prefix is just k.




+   u_long kmap_vaddr;
+   u_long dmap_vaddr;


These two should be kvaddr_t.


Further pollution and style bugs in names, types and formatting.


Somewhat difficult to change now though... but what about:

struct kvm_page {
   u_int kp_version;
   kpaddr_t kp_paddr;
   kvaddr_t kp_kmap_vaddr;
   kvaddr_t kp_dmap_vaddr;
   vm_prot_t kp_prot;
   off_t kp_offset;
   size_t kp_len;
};


This should have tabs after 3 shorter type names.

Signed kp_offset seems wrong.  Apart from it not reaching the top of 64-
bit address spaces, adding unsigned kp_len to it gives an unsigned type.

u_int, vm_prot_t and size_t give sparse packing with binary incompatibilities.
vm_prot_t is 8 bits, so there there is 7 bytes of padding after kp_prot on
amd64 and only 3 bytes on i386.  4 or 0 bytes of padding after kp_version
and kp_len.  This is hard to fix now.  But you already changed the ABI on
i386 by expanding all the u_long's.


[kvaddr_t] is currently hard-coded as __uint64_t.  That works for all supported
arches now, but eventually some typedefs will actually be needed for their
purpose of being implementation-depended and changeable.


Except that these should be MI for cross-debugging.


+   vm_prot_t prot;
+   u_long offset;


off_t?


Further pollution and style bugs in names, types and formatting.

Maybe uoff_t.  off_t is 64-bits signed so can't reach most kernel addresses
on some 64-bit arches like amd64.


I believe the offset here is the offset of the page in the vmcore
file, so off_t should be appropriate.


That is spelled vm_ooffset_t in the kernel.  This was MD in theory
before r313194 2 years ago, but it was always 64 bits signed ad was
made MI to give a consistent ABI.  The MD version had less pollution
than the MI version -- it gave an underscored version that was available
without including .  It was still hard to remember to use
it instead of off_t.  Then it was changed to uint64_t in r341398 for
much the same reason as one of me reasons above -- most uses of it
convert it to an unsigned type (sometimes by unsigned poisoning).

So vm_ooffset_t is appropriate.


+   size_t len;


Further pollution and style bugs 1 name and formatting.


Off hand I'm not sure of the appropriate type for a MI size; in
practice now though this len will be page size.


I also don't like most uses of size_t, especially in ABIs.  Many are
for values that are sure to be small.  Small values can be packed into
uint32_t or smaller.  If the size is unlimited, use uint64_t.  The
address space might be unlimited, but 64 bits for a single (non-sparse)
object is preposterously large.

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


svn commit: r343778 - in head/sys: dev/syscons teken teken/libteken

2019-02-05 Thread Bruce Evans
Author: bde
Date: Tue Feb  5 16:59:29 2019
New Revision: 343778
URL: https://svnweb.freebsd.org/changeset/base/343778

Log:
  My recent fix for programmable function keys in syscons only worked
  when TEKEN_CONS25 is configured.  Fix this by adding a function to
  set the flag that enables the fix and always calling this function
  for syscons.
  
  Expand the man page for teken_set_cons25().  This function is not
  very useful since it can only set but not clear 1 flag.  In practice,
  it is only used when TEKEN_CONS25 is configured and all that does is
  choose the the default emulation for syscons at compile time.

Modified:
  head/sys/dev/syscons/scterm-teken.c
  head/sys/teken/libteken/teken.3
  head/sys/teken/teken.c
  head/sys/teken/teken.h

Modified: head/sys/dev/syscons/scterm-teken.c
==
--- head/sys/dev/syscons/scterm-teken.c Tue Feb  5 15:34:55 2019
(r343777)
+++ head/sys/dev/syscons/scterm-teken.c Tue Feb  5 16:59:29 2019
(r343778)
@@ -144,6 +144,7 @@ scteken_init(scr_stat *scp, void **softc, int code)
 #ifdef TEKEN_CONS25
teken_set_cons25(&ts->ts_teken);
 #endif /* TEKEN_CONS25 */
+   teken_set_cons25keys(&ts->ts_teken);
scteken_sync_internal(scp, ts);
break;
}

Modified: head/sys/teken/libteken/teken.3
==
--- head/sys/teken/libteken/teken.3 Tue Feb  5 15:34:55 2019
(r343777)
+++ head/sys/teken/libteken/teken.3 Tue Feb  5 16:59:29 2019
(r343778)
@@ -66,6 +66,8 @@
 .Fn teken_set_8bit "teken_t *t"
 .Ft void
 .Fn teken_set_cons25 "teken_t *t"
+.Ft void
+.Fn teken_set_cons25keys "teken_t *t"
 .Sh DESCRIPTION
 The
 .Nm
@@ -194,11 +196,24 @@ which can be used to support character sets like CP437
 .Pp
 The
 .Fn teken_set_cons25
-function switches terminal emulation to
+function sets the terminal emulation to
 .Dv cons25 ,
-which is used by versions of
+which was the default for
+.Xr syscons 4
+in versions of
 .Fx
 prior to 9.0.
+This function is only useful for initialization.
+The emulation can be changed at any time using an escape sequence,
+and this function is not used then.
+.Pp
+The
+.Fn teken_set_cons25keys
+function tells the
+.Fn teken_get_sequence
+function to not interpret special keys in
+.Dv cons25
+mode.
 .Sh SEE ALSO
 .Xr ncurses 3 ,
 .Xr termcap 3 ,

Modified: head/sys/teken/teken.c
==
--- head/sys/teken/teken.c  Tue Feb  5 15:34:55 2019(r343777)
+++ head/sys/teken/teken.c  Tue Feb  5 16:59:29 2019(r343778)
@@ -412,7 +412,14 @@ void
 teken_set_cons25(teken_t *t)
 {
 
-   t->t_stateflags |= TS_CONS25 | TS_CONS25KEYS;
+   t->t_stateflags |= TS_CONS25;
+}
+
+void
+teken_set_cons25keys(teken_t *t)
+{
+
+   t->t_stateflags |= TS_CONS25KEYS;
 }
 
 /*

Modified: head/sys/teken/teken.h
==
--- head/sys/teken/teken.h  Tue Feb  5 15:34:55 2019(r343777)
+++ head/sys/teken/teken.h  Tue Feb  5 16:59:29 2019(r343778)
@@ -212,6 +212,7 @@ const char *teken_get_sequence(const teken_t *, unsign
 /* Legacy features. */
 void   teken_set_8bit(teken_t *);
 void   teken_set_cons25(teken_t *);
+void   teken_set_cons25keys(teken_t *);
 
 /* Color conversion. */
 teken_color_t teken_256to16(teken_color_t);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r325728 - head/lib/libkvm

2019-02-05 Thread John Baldwin
On 2/5/19 8:25 AM, Bruce Evans wrote:
> On Tue, 5 Feb 2019, Ed Maste wrote:
> 
>> On Tue, 5 Feb 2019 at 05:17, Bruce Evans  wrote:
>>>
>>> On Mon, 4 Feb 2019, Ed Maste wrote:
 This should probably be uin64_t to support cross-debugging cores from
 64-bit machines on 32-bit hosts; also for i386 PAE. Or, on IRC jhb
 suggested we introduce a kpaddr_t typedef akin to kvaddr_t.
>>>
>>> The correct type is vm_paddr_t or maybe a kvm wrapper of this.
>>
>> That precludes cross-arch and cross-size use of kvm_walk_pages; kvm
>> supports this use (see kvm_read2) so it should be a 64-bit kvm
>> wrapper.
> 
> kvm or system?  kvaddr_t is system and the corresponding physical address
> type should probably be system too.

It only needs to exist for libkvm.  I want to make a 'portable' libkvm that
can be built on non-FreeBSD OS's such as OS X, etc.  That is the last thing
needed to let kgdb run on non-FreeBSD OS's to cross-debug crash dumps.  For
that you would want self-contained types I think such as kvm_vaddr_t and
kvm_paddr_t.  I guess I just reused kvaddr_t because it already existed,
but having dedicated types in kvm.h is probably better long term.

> Signed kp_offset seems wrong.  Apart from it not reaching the top of 64-
> bit address spaces, adding unsigned kp_len to it gives an unsigned type.

kp_offset is the file offset in the vmcore file so that you can directly
use it with pread() or lseek().  In that case, I think off_t is the right
type.  Similarly, the 'len' should stay as size_t since it is intended to
be used as the argument to read()/pread() or a size passed to malloc(), etc.
I don't think vm_ooffset_t is appropriate as it is 1) non-portable and
2) not suitable for userspace APIs.

-- 
John Baldwin


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


svn commit: r343779 - head/sys/dev/vt

2019-02-05 Thread Bruce Evans
Author: bde
Date: Tue Feb  5 17:17:12 2019
New Revision: 343779
URL: https://svnweb.freebsd.org/changeset/base/343779

Log:
  Fix missing translation of old ioctls for KDSETMODE, KDSBORDER and
  CONS_SETWINORG.  After translation, the last 2 are not supported, but
  the first one has incomplete support that is enough to run old versions
  of X.

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Feb  5 16:59:29 2019(r343778)
+++ head/sys/dev/vt/vt_core.c   Tue Feb  5 17:17:12 2019(r343779)
@@ -2114,11 +2114,20 @@ vtterm_ioctl(struct terminal *tm, u_long cmd, caddr_t 
case _IO('K', 8):
cmd = KDMKTONE;
break;
+   case _IO('K', 10):
+   cmd = KDSETMODE;
+   break;
+   case _IO('K', 13):
+   cmd = KDSBORDER;
+   break;
case _IO('K', 63):
cmd = KIOCSOUND;
break;
case _IO('K', 66):
cmd = KDSETLED;
+   break;
+   case _IO('c', 104):
+   cmd = CONS_SETWINORG;
break;
case _IO('c', 110):
cmd = CONS_SETKBD;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r343777 - head/sys/kern

2019-02-05 Thread Kyle Evans
On Tue, Feb 5, 2019 at 9:35 AM Bruce Evans  wrote:
>
> Author: bde
> Date: Tue Feb  5 15:34:55 2019
> New Revision: 343777
> URL: https://svnweb.freebsd.org/changeset/base/343777
>
> Log:
>   Fix zapping of static hints and env in init_static_kenv().  Environments
>   are terminated by 2 NULs, but only 1 NUL was zapped.  Zapping only 1
>   NUL just splits the first string into an empty string and a corrupted
>   string.  All other strings in static hints and env remained live early
>   in the boot when they were supposed to be disabled.
>

I think we need to go another step here. This stuff was functional in
my testing because it was all late enough to happen after static_env
and static_hints were merged into the dynamic kenv (which I've only
now noticed after you fixed this). It looks like our logic for merging
is broken, IMO.

Before I touched it:

- When static_hints did get merged (by toggling of sysctl) it would
stop merging at the first empty string (strlen(cp) == 0) -- introduced
in r240067 -- regardless of whether said empty string was followed by
a second NUL terminator.

- When static_env merged in at SU_SUB_KMEM, it wouldn't merge if
*kern_envp == '\0' but it wouldn't stop at an empty string, instead
carrying the empty string into the dynamic env if my reading is
correct.

I broke the former even further by not merging anything at all if
*static_hints == '\0', and I maintained the latter breakage except
added an additional warning if we ventured upon a malformed entry.

Both of these are inconsistent with how the environments are observed
by kern_getenv or hints consumers before the merging, which will
simply skip over the malformed empty strings until it hits proper
termination. I think the resulting environment should be consistent
with what these consumers would've seen pre-merge, and I think this
should be fixed, if we can.

Thoughts?

Thanks,

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


Re: svn commit: r325728 - head/lib/libkvm

2019-02-05 Thread Brooks Davis
On Tue, Feb 05, 2019 at 09:14:46AM -0800, John Baldwin wrote:
> On 2/5/19 8:25 AM, Bruce Evans wrote:
> > On Tue, 5 Feb 2019, Ed Maste wrote:
> > 
> >> On Tue, 5 Feb 2019 at 05:17, Bruce Evans  wrote:
> >>>
> >>> On Mon, 4 Feb 2019, Ed Maste wrote:
>  This should probably be uin64_t to support cross-debugging cores from
>  64-bit machines on 32-bit hosts; also for i386 PAE. Or, on IRC jhb
>  suggested we introduce a kpaddr_t typedef akin to kvaddr_t.
> >>>
> >>> The correct type is vm_paddr_t or maybe a kvm wrapper of this.
> >>
> >> That precludes cross-arch and cross-size use of kvm_walk_pages; kvm
> >> supports this use (see kvm_read2) so it should be a 64-bit kvm
> >> wrapper.
> > 
> > kvm or system?  kvaddr_t is system and the corresponding physical address
> > type should probably be system too.
> 
> It only needs to exist for libkvm.  I want to make a 'portable' libkvm that
> can be built on non-FreeBSD OS's such as OS X, etc.  That is the last thing
> needed to let kgdb run on non-FreeBSD OS's to cross-debug crash dumps.  For
> that you would want self-contained types I think such as kvm_vaddr_t and
> kvm_paddr_t.  I guess I just reused kvaddr_t because it already existed,
> but having dedicated types in kvm.h is probably better long term.

IIRC, you created kvaddr_t first and I co-opted it for the kernel after
finding a namespace collision when I merged the kvaddr_t from CheriBSD.
Using kvm_ types seems like a good idea for the reaons you hilight.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r343777 - head/sys/kern

2019-02-05 Thread Bruce Evans

On Tue, 5 Feb 2019, Kyle Evans wrote:


On Tue, Feb 5, 2019 at 9:35 AM Bruce Evans  wrote:

...
Log:
  Fix zapping of static hints and env in init_static_kenv().  Environments
  are terminated by 2 NULs, but only 1 NUL was zapped.  Zapping only 1
  NUL just splits the first string into an empty string and a corrupted
  string.  All other strings in static hints and env remained live early
  in the boot when they were supposed to be disabled.


I think we need to go another step here. This stuff was functional in
my testing because it was all late enough to happen after static_env
and static_hints were merged into the dynamic kenv (which I've only
now noticed after you fixed this). It looks like our logic for merging
is broken, IMO.


It was too early to work in hammer_time() and init386() where important
tunables are looked up.  E.g., dynamic kenv needs malloc, but in these
functions even the memory size isn't quite known and it is controlled
by the hw.physmem tunable.

I missed this since I don't use the merging feature and usually duplicate
the static hints in the dynamic hints.


Before I touched it:

- When static_hints did get merged (by toggling of sysctl) it would
stop merging at the first empty string (strlen(cp) == 0) -- introduced
in r240067 -- regardless of whether said empty string was followed by
a second NUL terminator.


I think the syntax of the config file doesn't allow creating empty
strings in the middle, so this worked.


- When static_env merged in at SU_SUB_KMEM, it wouldn't merge if
*kern_envp == '\0' but it wouldn't stop at an empty string, instead
carrying the empty string into the dynamic env if my reading is
correct.

I broke the former even further by not merging anything at all if
*static_hints == '\0', and I maintained the latter breakage except
added an additional warning if we ventured upon a malformed entry.


I thought that the dynamic env initialization dropped the misformatted
static hints and env more intentionally.


Both of these are inconsistent with how the environments are observed
by kern_getenv or hints consumers before the merging, which will
simply skip over the malformed empty strings until it hits proper
termination. I think the resulting environment should be consistent
with what these consumers would've seen pre-merge, and I think this
should be fixed, if we can.


I think we can trust the compile-time hints and envs to not have empty
strings (or even ones not in the form name=value).  Then don't mess them
up by zapping them but instead start with a compile-time initialization
of a pointer to them and zap that.  The pointer can be null and the
hints and env don't even need to exist when they are empty.
_getenv_static() already works right with null pointers.  Hints looks
like it needs more reorganization.

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


svn commit: r343780 - head/sys/amd64/amd64

2019-02-05 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  5 17:49:27 2019
New Revision: 343780
URL: https://svnweb.freebsd.org/changeset/base/343780

Log:
  amd64: clear callee-preserved registers on syscall exit.
  
  %r8, %r10, and on non-KPTI configuration %r9 were not restored on fast
  return from a syscall.
  
  Reviewed by:  markj
  Approved by:  so
  Security: CVE-2019-5595
  Sponsored by: The FreeBSD Foundation
  MFC after:0 minutes

Modified:
  head/sys/amd64/amd64/exception.S

Modified: head/sys/amd64/amd64/exception.S
==
--- head/sys/amd64/amd64/exception.STue Feb  5 17:17:12 2019
(r343779)
+++ head/sys/amd64/amd64/exception.STue Feb  5 17:49:27 2019
(r343780)
@@ -521,12 +521,14 @@ fast_syscall_common:
movqTF_RFLAGS(%rsp),%r11/* original %rflags */
movqTF_RIP(%rsp),%rcx   /* original %rip */
movqTF_RSP(%rsp),%rsp   /* user stack pointer */
+   xorl%r8d,%r8d   /* zero the rest of GPRs */
+   xorl%r10d,%r10d
cmpq$~0,PCPU(UCR3)
je  2f
movqPCPU(UCR3),%r9
movq%r9,%cr3
-   xorl%r9d,%r9d
-2: swapgs
+2: xorl%r9d,%r9d
+   swapgs
sysretq
 
 3: /* AST scheduled. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343784 - head/sys/kern

2019-02-05 Thread Mark Johnston
Author: markj
Date: Tue Feb  5 17:55:08 2019
New Revision: 343784
URL: https://svnweb.freebsd.org/changeset/base/343784

Log:
  Avoid leaking fp references when truncating SCM_RIGHTS control messages.
  
  Reported by:  pho
  Approved by:  so
  MFC after:0 minutes
  Security: CVE-2019-5596
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Tue Feb  5 17:54:09 2019
(r343783)
+++ head/sys/kern/uipc_syscalls.c   Tue Feb  5 17:55:08 2019
(r343784)
@@ -1605,8 +1605,10 @@ m_dispose_extcontrolm(struct mbuf *m)
fd = *fds++;
error = fget(td, fd, &cap_no_rights,
&fp);
-   if (error == 0)
+   if (error == 0) {
fdclose(td, fp, fd);
+   fdrop(fp, td);
+   }
}
}
clen -= datalen;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-02-05 Thread Leandro Lupori
Author: luporl
Date: Tue Feb  5 18:16:14 2019
New Revision: 343791
URL: https://svnweb.freebsd.org/changeset/base/343791

Log:
  [ppc64] llan: fix fatal kernel trap when system is low on memory
  
  When running several builders in parallel, on QEMU, with 8GB of
  memory, a fatal kernel trap (0x300 (data storage interrupt))
  caused by llan driver is sometimes observed, when the system
  starts to run out of swap space.
  
  This happens because, at llan_intr(), a phyp call to add a
  logical LAN buffer is always made when llan_add_rxbuf() fails,
  even if it fails to allocate a new buffer.
  
  PR:   235489
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D19084

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

Modified: head/sys/powerpc/pseries/phyp_llan.c
==
--- head/sys/powerpc/pseries/phyp_llan.cTue Feb  5 18:11:15 2019
(r343790)
+++ head/sys/powerpc/pseries/phyp_llan.cTue Feb  5 18:16:14 2019
(r343791)
@@ -386,8 +386,6 @@ restart:
/* llan_add_rxbuf does DMA sync and unload as well as requeue */
if (llan_add_rxbuf(sc, rx) != 0) {
if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1);
-   phyp_hcall(H_ADD_LOGICAL_LAN_BUFFER, sc->unit,
-   rx->rx_bufdesc);
continue;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343808 - head/sys/i386/i386

2019-02-05 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  5 20:02:16 2019
New Revision: 343808
URL: https://svnweb.freebsd.org/changeset/base/343808

Log:
  Remove pointless initial value for i386 vm.pmap.pat_works sysctl definition.
  
  The OID is served by external data.
  
  Submitted by: bde
  MFC after:3 days

Modified:
  head/sys/i386/i386/pmap_base.c

Modified: head/sys/i386/i386/pmap_base.c
==
--- head/sys/i386/i386/pmap_base.c  Tue Feb  5 19:50:46 2019
(r343807)
+++ head/sys/i386/i386/pmap_base.c  Tue Feb  5 20:02:16 2019
(r343808)
@@ -136,7 +136,7 @@ int i386_pmap_PDRSHIFT;
 
 int pat_works = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RD,
-&pat_works, 1,
+&pat_works, 0,
 "Is page attribute table fully functional?");
 
 int pg_ps_enabled = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343809 - head/sys/i386/i386

2019-02-05 Thread Konstantin Belousov
Author: kib
Date: Tue Feb  5 20:09:31 2019
New Revision: 343809
URL: https://svnweb.freebsd.org/changeset/base/343809

Log:
  Make it possible to override PAE mode on boot.
  
  Initialize the static kenv in pmap_cold() and fetch user opinion on
  vm.pmap.pae_mode tunable if hardware is capable.  Note that the static
  environment is reinitilized in init386() later when paging is enabled.
  
  Reviewed by:  bde
  Discussed with:   kevans
  Sponsored by: The FreeBSD Foundation
  MFC after:2 months

Modified:
  head/sys/i386/i386/pmap_base.c

Modified: head/sys/i386/i386/pmap_base.c
==
--- head/sys/i386/i386/pmap_base.c  Tue Feb  5 20:02:16 2019
(r343808)
+++ head/sys/i386/i386/pmap_base.c  Tue Feb  5 20:09:31 2019
(r343809)
@@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -935,16 +936,19 @@ pmap_kremove(vm_offset_t va)
 
 extern struct pmap_methods pmap_pae_methods, pmap_nopae_methods;
 int pae_mode;
-SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RD,
-&pae_mode, 1,
+SYSCTL_INT(_vm_pmap, OID_AUTO, pae_mode, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
+&pae_mode, 0,
 "PAE");
 
 void
 pmap_cold(void)
 {
 
-   if ((cpu_feature & CPUID_PAE) != 0) {
-   pae_mode = 1;
+   init_static_kenv((char *)bootinfo.bi_envp, 0);
+   pae_mode = (cpu_feature & CPUID_PAE) != 0;
+   if (pae_mode)
+   TUNABLE_INT_FETCH("vm.pmap.pae_mode", &pae_mode);
+   if (pae_mode) {
pmap_methods_ptr = &pmap_pae_methods;
pmap_pae_cold();
} else {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343810 - in head: . share/man/man9 sys/dev/cardbus sys/mips/include

2019-02-05 Thread Warner Losh
Author: imp
Date: Tue Feb  5 21:28:29 2019
New Revision: 343810
URL: https://svnweb.freebsd.org/changeset/base/343810

Log:
  Remove a few stray "All Rights Reserved." declarations on stuff I've
  written.

Modified:
  head/UPDATING
  head/share/man/man9/bus_space.9
  head/sys/dev/cardbus/cardbus.c
  head/sys/mips/include/elf.h

Modified: head/UPDATING
==
--- head/UPDATING   Tue Feb  5 20:09:31 2019(r343809)
+++ head/UPDATING   Tue Feb  5 21:28:29 2019(r343810)
@@ -1936,7 +1936,7 @@ to fetch an UPDATING file from an older FreeBSD releas
 
 Copyright information:
 
-Copyright 1998-2009 M. Warner Losh.  All Rights Reserved.
+Copyright 1998-2009 M. Warner Losh.
 
 Redistribution, publication, translation and use, with or without
 modification, in full or in part, in any form or format of this

Modified: head/share/man/man9/bus_space.9
==
--- head/share/man/man9/bus_space.9 Tue Feb  5 20:09:31 2019
(r343809)
+++ head/share/man/man9/bus_space.9 Tue Feb  5 21:28:29 2019
(r343810)
@@ -1,6 +1,7 @@
 .\" $NetBSD: bus_space.9,v 1.9 1999/03/06 22:09:29 mycroft Exp $
 .\"
-.\" Copyright (c) 2005 M. Warner Losh.  All Rights Reserved.
+.\" Copyright (c) 2005 M. Warner Losh.
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:

Modified: head/sys/dev/cardbus/cardbus.c
==
--- head/sys/dev/cardbus/cardbus.c  Tue Feb  5 20:09:31 2019
(r343809)
+++ head/sys/dev/cardbus/cardbus.c  Tue Feb  5 21:28:29 2019
(r343810)
@@ -1,8 +1,9 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2003-2008 M. Warner Losh.  All Rights Reserved.
  * Copyright (c) 2000,2001 Jonathan Chen.  All rights reserved.
+ *
+ * Copyright (c) 2003-2008 M. Warner Losh.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/sys/mips/include/elf.h
==
--- head/sys/mips/include/elf.h Tue Feb  5 20:09:31 2019(r343809)
+++ head/sys/mips/include/elf.h Tue Feb  5 21:28:29 2019(r343810)
@@ -1,7 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-2-Clause-NetBSD
  *
- * Copyright (c) 2013 M. Warner Losh. All Rights Reserved.
+ * Copyright (c) 2013 M. Warner Losh.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343811 - in head: libexec/talkd share/man/man9 sys/dev/flash sys/dev/mmc sys/dev/pccbb sys/dev/puc sys/dev/sio sys/dev/uart sys/dev/usb/controller sys/dev/wi usr.sbin/dumpcis

2019-02-05 Thread Warner Losh
Author: imp
Date: Tue Feb  5 21:37:34 2019
New Revision: 343811
URL: https://svnweb.freebsd.org/changeset/base/343811

Log:
  Remove All Rights Reserved
  
  Remove the all rights reserved clause from my copyright, and make
  other minor tweaks needed where that might have created ambiguity.

Modified:
  head/libexec/talkd/extern.h
  head/share/man/man9/config_intrhook.9
  head/sys/dev/flash/mx25l.c
  head/sys/dev/flash/n25q.c
  head/sys/dev/mmc/bridge.h
  head/sys/dev/mmc/mmc.c
  head/sys/dev/mmc/mmc_private.h
  head/sys/dev/mmc/mmc_subr.c
  head/sys/dev/mmc/mmc_subr.h
  head/sys/dev/mmc/mmcbrvar.h
  head/sys/dev/mmc/mmcreg.h
  head/sys/dev/mmc/mmcsd.c
  head/sys/dev/mmc/mmcvar.h
  head/sys/dev/pccbb/pccbbdevid.h
  head/sys/dev/puc/puc_pci.c
  head/sys/dev/sio/sio_isa.c
  head/sys/dev/sio/sio_pccard.c
  head/sys/dev/sio/sio_pci.c
  head/sys/dev/sio/sio_puc.c
  head/sys/dev/uart/uart_bus_acpi.c
  head/sys/dev/uart/uart_bus_pccard.c
  head/sys/dev/uart/uart_bus_puc.c
  head/sys/dev/usb/controller/generic_ohci.c
  head/sys/dev/usb/controller/ohci_s3c24x0.c
  head/sys/dev/wi/if_wivar.h
  head/usr.sbin/dumpcis/main.c

Modified: head/libexec/talkd/extern.h
==
--- head/libexec/talkd/extern.h Tue Feb  5 21:28:29 2019(r343810)
+++ head/libexec/talkd/extern.h Tue Feb  5 21:37:34 2019(r343811)
@@ -1,7 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2002 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2002 M. Warner Losh.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/share/man/man9/config_intrhook.9
==
--- head/share/man/man9/config_intrhook.9   Tue Feb  5 21:28:29 2019
(r343810)
+++ head/share/man/man9/config_intrhook.9   Tue Feb  5 21:37:34 2019
(r343811)
@@ -1,5 +1,5 @@
 .\"
-.\" Copyright (C) 2006 M. Warner Losh . All rights reserved.
+.\" Copyright (C) 2006 M. Warner Losh .
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions

Modified: head/sys/dev/flash/mx25l.c
==
--- head/sys/dev/flash/mx25l.c  Tue Feb  5 21:28:29 2019(r343810)
+++ head/sys/dev/flash/mx25l.c  Tue Feb  5 21:37:34 2019(r343811)
@@ -1,7 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2006 M. Warner Losh.
  * Copyright (c) 2009 Oleksandr Tymoshenko.  All rights reserved.
  * Copyright (c) 2018 Ian Lepore.  All rights reserved.
  *

Modified: head/sys/dev/flash/n25q.c
==
--- head/sys/dev/flash/n25q.c   Tue Feb  5 21:28:29 2019(r343810)
+++ head/sys/dev/flash/n25q.c   Tue Feb  5 21:37:34 2019(r343811)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2006 M. Warner Losh.
  * Copyright (c) 2009 Oleksandr Tymoshenko.  All rights reserved.
  * Copyright (c) 2017 Ruslan Bukin 
  * Copyright (c) 2018 Ian Lepore.  All rights reserved.

Modified: head/sys/dev/mmc/bridge.h
==
--- head/sys/dev/mmc/bridge.h   Tue Feb  5 21:28:29 2019(r343810)
+++ head/sys/dev/mmc/bridge.h   Tue Feb  5 21:37:34 2019(r343811)
@@ -1,7 +1,7 @@
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2006 M. Warner Losh.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Tue Feb  5 21:28:29 2019(r343810)
+++ head/sys/dev/mmc/mmc.c  Tue Feb  5 21:37:34 2019(r343811)
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright (c) 2006 Bernd Walter.  All rights reserved.
- * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2006 M. Warner Losh.
  * Copyright (c) 2017 Marius Strobl 
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/mmc/mmc_private.h
==
--- head/sys/dev/mmc/mmc_private.h  Tue Feb  5 21:28:29 2019
(r343810)
+++ head/sys/dev/mmc/mmc_private.h  Tue Feb  5 21:37:34 2019
(r343811)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2006 Bernd Walter.  All rights reserved.
- * Copyright (c) 2006 M. War

svn commit: r343812 - head/sys/dev/usb/controller

2019-02-05 Thread Warner Losh
Author: imp
Date: Tue Feb  5 21:37:45 2019
New Revision: 343812
URL: https://svnweb.freebsd.org/changeset/base/343812

Log:
  Remove obsolete controller
  
  We removed support for the super-old samsung s3 parts, but this is
  a straggler. Remove it too.

Deleted:
  head/sys/dev/usb/controller/ohci_s3c24x0.c
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r342634 - in head/sys: arm/broadcom/bcm2835 arm/nvidia arm/ti dev/sdhci

2019-02-05 Thread Ed Maste
On Sun, 30 Dec 2018 at 18:08, Marius Strobl  wrote:
>
> Author: marius
> Date: Sun Dec 30 23:08:06 2018
> New Revision: 342634
> URL: https://svnweb.freebsd.org/changeset/base/342634
>
> Log:
>   o Don't allocate resources for SDMA in sdhci(4) if the controller or the
...

It seems this change introduced a panic on boot on the Jetson TK1
platform, see PR 235542. Can you please take a look at the PR and
suggest next steps for debugging?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343814 - in head/sys/cam: ata scsi

2019-02-05 Thread Warner Losh
Author: imp
Date: Tue Feb  5 22:53:36 2019
New Revision: 343814
URL: https://svnweb.freebsd.org/changeset/base/343814

Log:
  Add quirk for Sansisk X400 drives
  
  Certain versions of Sandisk x400 firmware can hang under extremely
  heavly load of large I/Os for prolonged periods of time. Newer /
  current versions work fine, and should be used where possible. Where
  not possible, this quirk ensures that I/O requests are limited to 128k
  to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
  only users with custom kernels are at risk on the older firmware.
  Once all known users of the older firmware have upgraded, this quirk
  will be removed.
  
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Feb  5 22:08:49 2019(r343813)
+++ head/sys/cam/ata/ata_da.c   Tue Feb  5 22:53:36 2019(r343814)
@@ -119,7 +119,8 @@ typedef enum {
ADA_Q_NCQ_TRIM_BROKEN   = 0x02,
ADA_Q_LOG_BROKEN= 0x04,
ADA_Q_SMR_DM= 0x08,
-   ADA_Q_NO_TRIM   = 0x10
+   ADA_Q_NO_TRIM   = 0x10,
+   ADA_Q_128KB = 0x20
 } ada_quirks;
 
 #define ADA_Q_BIT_STRING   \
@@ -128,7 +129,8 @@ typedef enum {
"\002NCQ_TRIM_BROKEN"   \
"\003LOG_BROKEN"\
"\004SMR_DM"\
-   "\005NO_TRIM"
+   "\005NO_TRIM"   \
+   "\006128KB"
 
 typedef enum {
ADA_CCB_RAHEAD  = 0x01,
@@ -277,6 +279,11 @@ struct ada_quirk_entry {
 static struct ada_quirk_entry ada_quirk_table[] =
 {
{
+   /* Sandisk X400 */
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SanDisk?SD8SB8U1T00*", 
"X4162000*" },
+   /*quirks*/ADA_Q_128KB
+   },
+   {
/* Hitachi Advanced Format (4k) drives */
{ T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??E3*", "*" 
},
/*quirks*/ADA_Q_4K
@@ -1815,6 +1822,8 @@ adaregister(struct cam_periph *periph, void *arg)
maxio = min(maxio, 65536 * softc->params.secsize);
else/* 28bit ATA command limit */
maxio = min(maxio, 256 * softc->params.secsize);
+   if (softc->quirks & ADA_Q_128KB)
+   maxio = min(maxio, 128 * 1024);
softc->disk->d_maxsize = maxio;
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Feb  5 22:08:49 2019(r343813)
+++ head/sys/cam/scsi/scsi_da.c Tue Feb  5 22:53:36 2019(r343814)
@@ -130,7 +130,8 @@ typedef enum {
DA_Q_NO_UNMAP   = 0x20,
DA_Q_RETRY_BUSY = 0x40,
DA_Q_SMR_DM = 0x80,
-   DA_Q_STRICT_UNMAP   = 0x100
+   DA_Q_STRICT_UNMAP   = 0x100,
+   DA_Q_128KB  = 0x200
 } da_quirks;
 
 #define DA_Q_BIT_STRING\
@@ -143,7 +144,8 @@ typedef enum {
"\006NO_UNMAP"  \
"\007RETRY_BUSY"\
"\010SMR_DM"\
-   "\011STRICT_UNMAP"
+   "\011STRICT_UNMAP"  \
+   "\012128KB"
 
 typedef enum {
DA_CCB_PROBE_RC = 0x01,
@@ -871,6 +873,11 @@ static struct da_quirk_entry da_quirk_table[] =
},
/* ATA/SATA devices over SAS/USB/... */
{
+   /* Sandisk X400 */
+   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SanDisk SD8SB8U1*", "*" },
+   /*quirks*/DA_Q_128KB
+   },
+   {
/* Hitachi Advanced Format (4k) drives */
{ T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??E3*", "*" },
/*quirks*/DA_Q_4K
@@ -2825,6 +2832,8 @@ daregister(struct cam_periph *periph, void *arg)
softc->maxio = MAXPHYS; /* for safety */
else
softc->maxio = cpi.maxio;
+   if (softc->quirks & DA_Q_128KB)
+   softc->maxio = min(softc->maxio, 128 * 1024);
softc->disk->d_maxsize = softc->maxio;
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343815 - head/sys/dev/iwn

2019-02-05 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Feb  6 01:34:14 2019
New Revision: 343815
URL: https://svnweb.freebsd.org/changeset/base/343815

Log:
  iwn(4): plug initialization path vs interrupt handler races
  
  There are few places in interrupt handler where the driver
  lock is dropped; ensure that device is still running before
  processing remaining ring entries.
  
  PR:   192641
  MFC after:5 days

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Tue Feb  5 22:53:36 2019(r343814)
+++ head/sys/dev/iwn/if_iwn.c   Wed Feb  6 01:34:14 2019(r343815)
@@ -3990,6 +3990,7 @@ iwn_notif_intr(struct iwn_softc *sc)
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
uint16_t hw;
+   int is_stopped;
 
bus_dmamap_sync(sc->rxq.stat_dma.tag, sc->rxq.stat_dma.map,
BUS_DMASYNC_POSTREAD);
@@ -4021,6 +4022,11 @@ iwn_notif_intr(struct iwn_softc *sc)
case IWN_MPDU_RX_DONE:
/* An 802.11 frame has been received. */
iwn_rx_done(sc, desc, data);
+
+   is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
+   if (__predict_false(is_stopped))
+   return;
+
break;
 
case IWN_RX_COMPRESSED_BA:
@@ -4061,6 +4067,11 @@ iwn_notif_intr(struct iwn_softc *sc)
IWN_UNLOCK(sc);
ieee80211_beacon_miss(ic);
IWN_LOCK(sc);
+
+   is_stopped = (sc->sc_flags &
+   IWN_FLAG_RUNNING) == 0;
+   if (__predict_false(is_stopped))
+   return;
}
}
break;
@@ -4127,6 +4138,11 @@ iwn_notif_intr(struct iwn_softc *sc)
IWN_UNLOCK(sc);
ieee80211_scan_next(vap);
IWN_LOCK(sc);
+
+   is_stopped = (sc->sc_flags & IWN_FLAG_RUNNING) == 0;
+   if (__predict_false(is_stopped))  
+   return;
+
break;
}
case IWN5000_CALIBRATION_RESULT:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343824 - in head/sys/powerpc: include ofw powerpc

2019-02-05 Thread Justin Hibbits
Author: jhibbits
Date: Wed Feb  6 03:52:14 2019
New Revision: 343824
URL: https://svnweb.freebsd.org/changeset/base/343824

Log:
  powerpc: Bind IRQs to only one interrupt on QorIQ SoCs
  
  The QorIQ SoCs don't actually support multicast interrupts, and the
  references state explicitly that multicast is undefined behavior.  Avoid the
  undefined behavior by binding to only a single CPU, using a quirk to
  determine if this is necessary.
  
  MFC after:3 weeks

Modified:
  head/sys/powerpc/include/openpicvar.h
  head/sys/powerpc/ofw/openpic_ofw.c
  head/sys/powerpc/powerpc/openpic.c

Modified: head/sys/powerpc/include/openpicvar.h
==
--- head/sys/powerpc/include/openpicvar.h   Wed Feb  6 02:35:56 2019
(r343823)
+++ head/sys/powerpc/include/openpicvar.h   Wed Feb  6 03:52:14 2019
(r343824)
@@ -34,6 +34,8 @@
 
 #define OPENPIC_IRQMAX 256 /* h/w allows more */
 
+#defineOPENPIC_QUIRK_SINGLE_BIND   1   /* Bind interrupts to 
only 1 CPU */
+
 /* Names match the macros in openpicreg.h. */
 struct openpic_timer {
uint32_ttcnt;
@@ -55,6 +57,7 @@ struct openpic_softc {
u_int   sc_ncpu;
u_int   sc_nirq;
int sc_psim;
+   u_int   sc_quirks;
 
/* Saved states. */
uint32_tsc_saved_config;

Modified: head/sys/powerpc/ofw/openpic_ofw.c
==
--- head/sys/powerpc/ofw/openpic_ofw.c  Wed Feb  6 02:35:56 2019
(r343823)
+++ head/sys/powerpc/ofw/openpic_ofw.c  Wed Feb  6 03:52:14 2019
(r343824)
@@ -128,14 +128,19 @@ openpic_ofw_probe(device_t dev)
 static int
 openpic_ofw_attach(device_t dev)
 {
+   struct openpic_softc *sc;
phandle_t xref, node;
 
node = ofw_bus_get_node(dev);
+   sc = device_get_softc(dev);
 
if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) == -1 &&
OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 &&
OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1)
xref = node;
+   
+   if (ofw_bus_is_compatible(dev, "fsl,mpic"))
+   sc->sc_quirks = OPENPIC_QUIRK_SINGLE_BIND;
 
return (openpic_common_attach(dev, xref));
 }

Modified: head/sys/powerpc/powerpc/openpic.c
==
--- head/sys/powerpc/powerpc/openpic.c  Wed Feb  6 02:35:56 2019
(r343823)
+++ head/sys/powerpc/powerpc/openpic.c  Wed Feb  6 03:52:14 2019
(r343824)
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -236,6 +237,7 @@ void
 openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **priv __unused)
 {
struct openpic_softc *sc;
+   uint32_t mask;
 
/* If we aren't directly connected to the CPU, this won't work */
if (dev != root_pic)
@@ -247,7 +249,23 @@ openpic_bind(device_t dev, u_int irq, cpuset_t cpumask
 * XXX: openpic_write() is very special and just needs a 32 bits mask.
 * For the moment, just play dirty and get the first half word.
 */
-   openpic_write(sc, OPENPIC_IDEST(irq), cpumask.__bits[0] & 0x);
+   mask = cpumask.__bits[0] & 0x;
+   if (sc->sc_quirks & OPENPIC_QUIRK_SINGLE_BIND) {
+   int i = mftb() % CPU_COUNT(&cpumask);
+   int cpu, ncpu;
+
+   ncpu = 0;
+   CPU_FOREACH(cpu) {
+   if (!(mask & (1 << cpu)))
+   continue;
+   if (ncpu == i)
+   break;
+   ncpu++;
+   }
+   mask &= (1 << cpu);
+   }
+
+   openpic_write(sc, OPENPIC_IDEST(irq), mask);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-02-05 Thread Yuri Pankov
Author: yuripv
Date: Wed Feb  6 03:57:51 2019
New Revision: 343825
URL: https://svnweb.freebsd.org/changeset/base/343825

Log:
  pwm.9: fix markup in interfaces description
  
  Reviewed by:  manu
  Differential revision:https://reviews.freebsd.org/D18830

Modified:
  head/share/man/man9/pwm.9

Modified: head/share/man/man9/pwm.9
==
--- head/share/man/man9/pwm.9   Wed Feb  6 03:52:14 2019(r343824)
+++ head/share/man/man9/pwm.9   Wed Feb  6 03:57:51 2019(r343825)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2018
+.Dd January 12, 2019
 .Dt PWM 9
 .Os
 .Sh NAME
@@ -79,7 +79,7 @@ Get the current flags for the channel.
 Enable the PWM channel.
 .It Fn PWM_CHANNEL_ISENABLED "device_t dev" "int channel" "bool *enable"
 Test if the PWM channel is enabled.
-.It PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
+.It Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
 Get the maximum number of channels supported by the controller.
 .El
 .Sh HISTORY
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343826 - head/usr.sbin/pwm

2019-02-05 Thread Yuri Pankov
Author: yuripv
Date: Wed Feb  6 04:00:37 2019
New Revision: 343826
URL: https://svnweb.freebsd.org/changeset/base/343826

Log:
  pwm.8: fix markup in synopsis, add -f description
  
  Reviewed by:  bcr, manu
  Differential revision:https://reviews.freebsd.org/D18829

Modified:
  head/usr.sbin/pwm/pwm.8

Modified: head/usr.sbin/pwm/pwm.8
==
--- head/usr.sbin/pwm/pwm.8 Wed Feb  6 03:57:51 2019(r343825)
+++ head/usr.sbin/pwm/pwm.8 Wed Feb  6 04:00:37 2019(r343826)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2018
+.Dd January 12, 2019
 .Dt PWM 8
 .Os
 .Sh NAME
@@ -44,20 +44,25 @@
 .Nm
 .Op Fl f Ar device
 .Fl c Ar channel
-.Fl p period
+.Fl p Ar period
 .Nm
 .Op Fl f Ar device
 .Fl c Ar channel
-.Fl d duty
+.Fl d Ar duty
 .Sh DESCRIPTION
 The
 .Nm
 utility can be used to configure pwm controllers.
 .Pp
 The options are as follow:
-.Bl -tag -width ".Fl f Ar device"
+.Bl -tag -width "-c channel"
 .It Fl c Ar channel
 Channel number to operate on
+.It Fl f Ar device
+Device to operate on.
+If not specified,
+.Pa /dev/pwmc0
+is used.
 .It Fl E
 Enable the pwm channel
 .It Fl D
@@ -73,16 +78,19 @@ Configure the duty (in nanoseconds or percentage) of t
 .Bl -bullet
 .It
 Show the configuration of the pwm channel:
-.Pp
+.Bd -literal
 pwm -f /dev/pwmc0 -C
+.Ed
 .It
 Configure a 5 ns period and a 25000 duty cycle:
-.Pp
+.Bd -literal
 pwm -f /dev/pwmc0 -p 5 -d 25000
+.Ed
 .It
 Configure a 50% duty cycle:
-.Pp
+.Bd -literal
 pwm -f /dev/pwmc0 -d 50%
+.Ed
 .El
 .Sh SEE ALSO
 .Xr pwm 9 ,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343827 - head/lib/libcasper/services/cap_syslog

2019-02-05 Thread Jason A. Harmening
Author: jah
Date: Wed Feb  6 04:36:28 2019
New Revision: 343827
URL: https://svnweb.freebsd.org/changeset/base/343827

Log:
  r341692 changed cap_syslog(3) to preserve the stdio descriptors inherited
  from its parent so that LOG_PERROR would work.  However, this caused
  dhclient(8)'s stdio streams to remain open across daemonization, breaking
  the ability to capture its foreground output as done in netconfig_ipv4.
  
  Fix this by reverting r341692 and instead passing the parent's stderr
  descriptor as an argument to cap_openlog() only when LOG_PERROR is specified
  in logopt.
  
  PR:   234514
  Suggested by: markj
  Reported by:  Shawn Webb
  Reviewed by:  markj, oshogbo
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D18989

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

Modified: head/lib/libcasper/services/cap_syslog/cap_syslog.c
==
--- head/lib/libcasper/services/cap_syslog/cap_syslog.c Wed Feb  6 04:00:37 
2019(r343826)
+++ head/lib/libcasper/services/cap_syslog/cap_syslog.c Wed Feb  6 04:36:28 
2019(r343827)
@@ -88,6 +88,9 @@ cap_openlog(cap_channel_t *chan, const char *ident, in
}
nvlist_add_number(nvl, "logopt", logopt);
nvlist_add_number(nvl, "facility", facility);
+   if (logopt & LOG_PERROR) {
+   nvlist_add_descriptor(nvl, "stderr", STDERR_FILENO);
+   }
nvl = cap_xfer_nvlist(chan, nvl);
if (nvl == NULL) {
return;
@@ -131,6 +134,7 @@ cap_setlogmask(cap_channel_t *chan, int maskpri)
  */
 
 static char *LogTag;
+static int prev_stderr = -1;
 
 static void
 slog_vsyslog(const nvlist_t *limits __unused, const nvlist_t *nvlin,
@@ -146,6 +150,8 @@ slog_openlog(const nvlist_t *limits __unused, const nv
 nvlist_t *nvlout __unused)
 {
const char *ident;
+   uint64_t logopt;
+   int stderr_fd;
 
ident = dnvlist_get_string(nvlin, "ident", NULL);
if (ident != NULL) {
@@ -153,8 +159,19 @@ slog_openlog(const nvlist_t *limits __unused, const nv
LogTag = strdup(ident);
}
 
-   openlog(LogTag, nvlist_get_number(nvlin, "logopt"),
-   nvlist_get_number(nvlin, "facility"));
+   logopt = nvlist_get_number(nvlin, "logopt");
+   if (logopt & LOG_PERROR) {
+   stderr_fd = dnvlist_get_descriptor(nvlin, "stderr", -1);
+   if (prev_stderr == -1)
+   prev_stderr = dup(STDERR_FILENO);
+   if (prev_stderr != -1)
+   (void)dup2(stderr_fd, STDERR_FILENO);
+   } else if (prev_stderr != -1) {
+   (void)dup2(prev_stderr, STDERR_FILENO);
+   close(prev_stderr);
+   prev_stderr = -1;
+   }
+   openlog(LogTag, logopt, nvlist_get_number(nvlin, "facility"));
 }
 
 static void
@@ -166,6 +183,12 @@ slog_closelog(const nvlist_t *limits __unused, const n
 
free(LogTag);
LogTag = NULL;
+
+   if (prev_stderr != -1) {
+   (void)dup2(prev_stderr, STDERR_FILENO);
+   close(prev_stderr);
+   prev_stderr = -1;
+   }
 }
 
 static void
@@ -198,4 +221,4 @@ syslog_command(const char *cmd, const nvlist_t *limits
return (0);
 }
 
-CREATE_SERVICE("system.syslog", NULL, syslog_command, CASPER_SERVICE_STDIO);
+CREATE_SERVICE("system.syslog", NULL, syslog_command, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r343828 - head/sys/dts/arm

2019-02-05 Thread Michal Meloun
Author: mmel
Date: Wed Feb  6 06:03:44 2019
New Revision: 343828
URL: https://svnweb.freebsd.org/changeset/base/343828

Log:
  Adapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
  update of devicetree to 4.19 in r340337.
  Our build system doesn't provide dependencies for included DTS files, so
  nobody noticed this issue for long time.
  
  PR:   235362
  MFC after:1 week

Modified:
  head/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts

Modified: head/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts
==
--- head/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts   Wed Feb  6 04:36:28 
2019(r343827)
+++ head/sys/dts/arm/tegra124-jetson-tk1-fbsd.dts   Wed Feb  6 06:03:44 
2019(r343828)
@@ -38,7 +38,7 @@
stdout = &uartd;
};
 
-   memory {
+   memory@8000 {
 /* reg = <0x0 0x8000 0x0 0x8000>; */
reg = <0x0 0x8000 0x0 0x7000>;
};
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"