Re: svn commit: r289759 - in head/sys/arm: arm include

2015-11-04 Thread Svatopluk Kraus
On Tue, Nov 3, 2015 at 8:45 AM, Jason Harmening
 wrote:
>
> On Sun, Nov 1, 2015 at 8:11 AM, Ian Lepore  wrote:
>>
>>
>> It's almost certainly not related to sysinit ordering.  This exception
>> is happening during mmc probing after interrupts are enabled.
>>
>> It appears that the problem is the faulting code is running on one of
>> the very early pre-allocated kernel stacks (perhaps in an interrupt
>> handler on an idle thread stack), and these stacks are not in memory
>> represented in the vm page arrays.  The mmc code is using a 64-byte
>> buffer on the stack and mapping it for DMA.  Normally that causes a
>> bounce for cacheline alignment, but unluckily in this case that buffer
>> on the stack just happened to be aligned to a cacheline boundary and a
>> multiple of the cacheline size, so no bounce.  That causes the new sync
>> logic that is based on keeping vm_page_t pointers and offsets to get a
>> NULL pointer back from PHYS_TO_VM_PAGE when mapping, then it dies at
>> sync time trying to dereference that.  It used to work because the sync
>> logic used to use the vaddr, not a page pointer.
>>
>> Michal was working on a patch yesterday.
>>
>
> Ah, thanks for pointing that out Ian.  I was left scratching my head
> (admittedly on the road and w/o easy access to the code) wondering what on
> earth would be trying to do DMA during SI_SUB_CPU.
>


Using of fictitious pages is not so easy here as in case pointed by
kib@ where they are allocated and freed inside one function. For sync
list sake, they must be allocated when a buffer is loaded and freed
when is unloaded.

Michal uses pmap_kextract() in case when KVA of buffer is not zero in
his proof-of-concept patch:
https://gist.github.com/strejda/d5ca3ed202427a2e0557
When KVA of buffer is not zero, temporary mapping is not used at all,
so vm_page_t array is not needed too.

IMO, buffer's physical address can be saved in sync list to be used
when its KVA is not zero. Thus pmap_kextract() won't be called in
dma_dcache_sync().
___
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: r290373 - head/sys/dev/ofw

2015-11-04 Thread Andreas Tobler
Author: andreast
Date: Wed Nov  4 22:46:30 2015
New Revision: 290373
URL: https://svnweb.freebsd.org/changeset/base/290373

Log:
  Add a compile time switch to distinguish between 7-bit and 8-bit I2C address
  usage. The comment in the code should explain the situation.
  
  Discussed with:ian@

Modified:
  head/sys/dev/ofw/ofw_iicbus.c

Modified: head/sys/dev/ofw/ofw_iicbus.c
==
--- head/sys/dev/ofw/ofw_iicbus.c   Wed Nov  4 19:09:42 2015
(r290372)
+++ head/sys/dev/ofw/ofw_iicbus.c   Wed Nov  4 22:46:30 2015
(r290373)
@@ -148,10 +148,16 @@ ofw_iicbus_attach(device_t dev)
if (dinfo == NULL)
continue;
/*
-* OFW uses 7-bit I2C address format (see ePAPR),
-* but system expect 8-bit.
+* FreeBSD drivers expect I2C addresses to be expressed as
+* 8-bit values.  Apple OFW data contains 8-bit values, but
+* Linux FDT data contains 7-bit values, so shift them up to
+* 8-bit format.
 */
+#ifdef AIM
+   dinfo->opd_dinfo.addr = paddr;
+#else
dinfo->opd_dinfo.addr = paddr << 1;
+#endif
if (ofw_bus_gen_setup_devinfo(>opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
___
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: r289279 - in head/sys: kern vm

2015-11-04 Thread Adrian Chadd
HI,

FYI - this patch did fix my initial issue, but further work in
multi-user mode caused it to still hang. I haven't diagnosed it yet; I
just put back the yield call so bufdaemon could run.

So yeah, we still have some work to do. It hit the same problem; stuck
in a loop calling the path to wakeup bufdaemon, but then not sleeping
on anything.



-adrian


On 2 November 2015 at 14:13, Adrian Chadd  wrote:
> Hi Tijl, and others;
>
> Here's something that Jeff came up with that fixes my problem:
>
> adrian@victoria:~/work/freebsd/head-embedded/src % svn diff sys/kern/
> Index: sys/kern/vfs_bio.c
> ===
> --- sys/kern/vfs_bio.c  (revision 290048)
> +++ sys/kern/vfs_bio.c  (working copy)
> @@ -2910,7 +2910,7 @@
> } while(buf_scan(false) == 0);
>
> if (reserved)
> -   bufspace_release(maxsize);
> +   atomic_subtract_long(, maxsize);
> if (bp != NULL) {
> bp->b_flags |= B_INVAL;
> brelse(bp);
>
>
> Would you/others please try this and see if it improves things? It
> improves things for me on these memory-starved MIPS boards.
>
>
>
> -a
___
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: r290374 - head/sys/dev/filemon

2015-11-04 Thread Bryan Drewery
Author: bdrewery
Date: Wed Nov  4 22:49:34 2015
New Revision: 290374
URL: https://svnweb.freebsd.org/changeset/base/290374

Log:
  Remove unneeded mutex.h include, missed in r287155.
  
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/sys/dev/filemon/filemon.c
==
--- head/sys/dev/filemon/filemon.c  Wed Nov  4 22:46:30 2015
(r290373)
+++ head/sys/dev/filemon/filemon.c  Wed Nov  4 22:49:34 2015
(r290374)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
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: r290252 - in head: . etc/defaults etc/periodic/daily tools/build/mk

2015-11-04 Thread NGie Cooper
On Wed, Nov 4, 2015 at 4:21 PM, Bryan Drewery  wrote:

...

> This seems a bit gratuitous and against POLA.

Unfortunately it was more POLA when the pediodic script was deleted
after it was added to OptionalObsoleteFiles.inc in the last few
months.

I could add a backwards compatible variable when MFCing the change to
avoid breaking POLA on stable/9 and stable/10 though.

Thanks!
-NGie
___
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: r290377 - head/lib/libopenbsd

2015-11-04 Thread Craig Rodrigues
Author: rodrigc
Date: Thu Nov  5 01:29:48 2015
New Revision: 290377
URL: https://svnweb.freebsd.org/changeset/base/290377

Log:
  Add README, similar to the one from libnetbsd.

Added:
  head/lib/libopenbsd/README   (contents, props changed)

Added: head/lib/libopenbsd/README
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libopenbsd/README  Thu Nov  5 01:29:48 2015(r290377)
@@ -0,0 +1,7 @@
+$FreeBSD$
+
+libopenbsd is a thin compatibility layer intended to allow a limited
+set of OpenBSD software to compile as part of the FreeBSD build with
+little or no modifiction.  It is built as a static library and not
+installed for general use.  Likewise, its header files are not
+installed.
___
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: r290379 - head/sys/netinet

2015-11-04 Thread Hiren Panchasara
Author: hiren
Date: Thu Nov  5 02:09:48 2015
New Revision: 290379
URL: https://svnweb.freebsd.org/changeset/base/290379

Log:
  Improve the sysctl node name.
  
  X-MFC with:   r290122
  Sponsored by: Limelight Networks

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Nov  5 01:54:38 2015
(r290378)
+++ head/sys/netinet/tcp_input.cThu Nov  5 02:09:48 2015
(r290379)
@@ -149,7 +149,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop
 "Drop TCP packets with SYN+FIN set");
 
 VNET_DEFINE(int, tcp_do_rfc6675_pipe) = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_pipe, CTLFLAG_VNET | CTLFLAG_RW,
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc6675_pipe, CTLFLAG_VNET | CTLFLAG_RW,
 _NAME(tcp_do_rfc6675_pipe), 0,
 "Use calculated pipe/in-flight bytes per RFC 6675");
 
___
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: r290252 - in head: . etc/defaults etc/periodic/daily tools/build/mk

2015-11-04 Thread Bryan Drewery
On 11/1/15 5:05 PM, Garrett Cooper wrote:
> Author: ngie
> Date: Mon Nov  2 01:05:34 2015
> New Revision: 290252
> URL: https://svnweb.freebsd.org/changeset/base/290252
> 
> Log:
>   Rename etc/periodic/daily/430.status-rwho to 
> periodic/daily/430.status-uptime
>   
>   The command was checking local/remote system uptime, so rename the script to
>   match its function and to avoid confusion
>   
>   The controlling variable in /etc/periodic.conf has been renamed from
>   daily_status_rwho_enable to daily_status_uptime_enable.
>   
>   MFC after: 3 days
>   Reported by: Peter Jeremy 
>   Relnotes: yes
>   Sponsored by: EMC / Isilon Storage Division
> 
> Added:
>   head/etc/periodic/daily/430.status-uptime
>  - copied, changed from r290251, head/etc/periodic/daily/430.status-rwho
> Deleted:
>   head/etc/periodic/daily/430.status-rwho
> Modified:
>   head/ObsoleteFiles.inc
>   head/etc/defaults/periodic.conf
>   head/etc/periodic/daily/Makefile
>   head/tools/build/mk/OptionalObsoleteFiles.inc
> 
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.incMon Nov  2 00:42:31 2015(r290251)
> +++ head/ObsoleteFiles.incMon Nov  2 01:05:34 2015(r290252)
> @@ -38,6 +38,8 @@
>  #   xargs -n1 | sort | uniq -d;
>  # done
>  
> +# 20151101: 430.status-rwho was renamed to 430.status-uptime
> +OLD_FILES+=etc/periodic/daily/430.status-rwho
>  # 20151030: OpenSSL 1.0.2d import
>  OLD_FILES+=usr/share/openssl/man/man3/CMS_set1_signer_certs.3.gz
>  OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_ctrl.3.gz
> 
> Modified: head/etc/defaults/periodic.conf
> ==
> --- head/etc/defaults/periodic.conf   Mon Nov  2 00:42:31 2015
> (r290251)
> +++ head/etc/defaults/periodic.conf   Mon Nov  2 01:05:34 2015
> (r290252)
> @@ -115,8 +115,8 @@ daily_status_network_enable="YES" # Ch
>  daily_status_network_usedns="YES"# DNS lookups are ok
>  daily_status_network_netstat_flags="-d"  # netstat(1) 
> flags
>  
> -# 430.status-rwho
> -daily_status_rwho_enable="YES"   # Check system 
> status
> +# 430.status-uptime
> +daily_status_uptime_enable="YES" # Check system uptime
>  

This seems a bit gratuitous and against POLA.

-- 
Regards,
Bryan Drewery
___
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: r290375 - head/lib/libopenbsd

2015-11-04 Thread Craig Rodrigues
Author: rodrigc
Date: Wed Nov  4 23:52:19 2015
New Revision: 290375
URL: https://svnweb.freebsd.org/changeset/base/290375

Log:
  Import imsg from OpenBSD's libutil.
  
  imsg provides functions for communication between processes
  using sockets.  imsg is used by programs in OpenBSD such as ypldap.

Added:
  head/lib/libopenbsd/imsg-buffer.c   (contents, props changed)
  head/lib/libopenbsd/imsg.c   (contents, props changed)
  head/lib/libopenbsd/imsg.h   (contents, props changed)
  head/lib/libopenbsd/imsg_init.3   (contents, props changed)

Added: head/lib/libopenbsd/imsg-buffer.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libopenbsd/imsg-buffer.c   Wed Nov  4 23:52:19 2015
(r290375)
@@ -0,0 +1,309 @@
+/* $OpenBSD: imsg-buffer.c,v 1.7 2015/07/12 18:40:49 nicm Exp $*/
+
+/*
+ * Copyright (c) 2003, 2004 Henning Brauer 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "imsg.h"
+
+intibuf_realloc(struct ibuf *, size_t);
+void   ibuf_enqueue(struct msgbuf *, struct ibuf *);
+void   ibuf_dequeue(struct msgbuf *, struct ibuf *);
+
+struct ibuf *
+ibuf_open(size_t len)
+{
+   struct ibuf *buf;
+
+   if ((buf = calloc(1, sizeof(struct ibuf))) == NULL)
+   return (NULL);
+   if ((buf->buf = malloc(len)) == NULL) {
+   free(buf);
+   return (NULL);
+   }
+   buf->size = buf->max = len;
+   buf->fd = -1;
+
+   return (buf);
+}
+
+struct ibuf *
+ibuf_dynamic(size_t len, size_t max)
+{
+   struct ibuf *buf;
+
+   if (max < len)
+   return (NULL);
+
+   if ((buf = ibuf_open(len)) == NULL)
+   return (NULL);
+
+   if (max > 0)
+   buf->max = max;
+
+   return (buf);
+}
+
+int
+ibuf_realloc(struct ibuf *buf, size_t len)
+{
+   u_char  *b;
+
+   /* on static buffers max is eq size and so the following fails */
+   if (buf->wpos + len > buf->max) {
+   errno = ERANGE;
+   return (-1);
+   }
+
+   b = realloc(buf->buf, buf->wpos + len);
+   if (b == NULL)
+   return (-1);
+   buf->buf = b;
+   buf->size = buf->wpos + len;
+
+   return (0);
+}
+
+int
+ibuf_add(struct ibuf *buf, const void *data, size_t len)
+{
+   if (buf->wpos + len > buf->size)
+   if (ibuf_realloc(buf, len) == -1)
+   return (-1);
+
+   memcpy(buf->buf + buf->wpos, data, len);
+   buf->wpos += len;
+   return (0);
+}
+
+void *
+ibuf_reserve(struct ibuf *buf, size_t len)
+{
+   void*b;
+
+   if (buf->wpos + len > buf->size)
+   if (ibuf_realloc(buf, len) == -1)
+   return (NULL);
+
+   b = buf->buf + buf->wpos;
+   buf->wpos += len;
+   return (b);
+}
+
+void *
+ibuf_seek(struct ibuf *buf, size_t pos, size_t len)
+{
+   /* only allowed to seek in already written parts */
+   if (pos + len > buf->wpos)
+   return (NULL);
+
+   return (buf->buf + pos);
+}
+
+size_t
+ibuf_size(struct ibuf *buf)
+{
+   return (buf->wpos);
+}
+
+size_t
+ibuf_left(struct ibuf *buf)
+{
+   return (buf->max - buf->wpos);
+}
+
+void
+ibuf_close(struct msgbuf *msgbuf, struct ibuf *buf)
+{
+   ibuf_enqueue(msgbuf, buf);
+}
+
+int
+ibuf_write(struct msgbuf *msgbuf)
+{
+   struct iovec iov[IOV_MAX];
+   struct ibuf *buf;
+   unsigned int i = 0;
+   ssize_t n;
+
+   memset(, 0, sizeof(iov));
+   TAILQ_FOREACH(buf, >bufs, entry) {
+   if (i >= IOV_MAX)
+   break;
+   iov[i].iov_base = buf->buf + buf->rpos;
+   iov[i].iov_len = buf->wpos - buf->rpos;
+   i++;
+   }
+
+again:
+   if ((n = writev(msgbuf->fd, iov, i)) == -1) {
+   if (errno == EINTR)
+   goto again;
+   if (errno == ENOBUFS)
+   errno = EAGAIN;
+   return (-1);
+   }
+
+   if (n == 0) {   /* connection closed */

Re: svn commit: r289759 - in head/sys/arm: arm include

2015-11-04 Thread Jason Harmening
On Wed, Nov 4, 2015 at 2:17 PM, Svatopluk Kraus  wrote:

> On Tue, Nov 3, 2015 at 8:45 AM, Jason Harmening
>  wrote:
> >
> > On Sun, Nov 1, 2015 at 8:11 AM, Ian Lepore  wrote:
> >>
> >>
> >> It's almost certainly not related to sysinit ordering.  This exception
> >> is happening during mmc probing after interrupts are enabled.
> >>
> >> It appears that the problem is the faulting code is running on one of
> >> the very early pre-allocated kernel stacks (perhaps in an interrupt
> >> handler on an idle thread stack), and these stacks are not in memory
> >> represented in the vm page arrays.  The mmc code is using a 64-byte
> >> buffer on the stack and mapping it for DMA.  Normally that causes a
> >> bounce for cacheline alignment, but unluckily in this case that buffer
> >> on the stack just happened to be aligned to a cacheline boundary and a
> >> multiple of the cacheline size, so no bounce.  That causes the new sync
> >> logic that is based on keeping vm_page_t pointers and offsets to get a
> >> NULL pointer back from PHYS_TO_VM_PAGE when mapping, then it dies at
> >> sync time trying to dereference that.  It used to work because the sync
> >> logic used to use the vaddr, not a page pointer.
> >>
> >> Michal was working on a patch yesterday.
> >>
> >
> > Ah, thanks for pointing that out Ian.  I was left scratching my head
> > (admittedly on the road and w/o easy access to the code) wondering what
> on
> > earth would be trying to do DMA during SI_SUB_CPU.
> >
>
>
> Using of fictitious pages is not so easy here as in case pointed by
> kib@ where they are allocated and freed inside one function. For sync
> list sake, they must be allocated when a buffer is loaded and freed
> when is unloaded.
>
> Michal uses pmap_kextract() in case when KVA of buffer is not zero in
> his proof-of-concept patch:
> https://gist.github.com/strejda/d5ca3ed202427a2e0557
> When KVA of buffer is not zero, temporary mapping is not used at all,
> so vm_page_t array is not needed too.
>
> IMO, buffer's physical address can be saved in sync list to be used
> when its KVA is not zero. Thus pmap_kextract() won't be called in
> dma_dcache_sync().
>

I like the idea of storing off the physical address.  If you want to save
space in the sync list, I think you can place busaddr and pages in a union,
using vaddr == 0 to select which field to use.  Some people frown upon use
of unions, though.

Any reason the panics on PHYS_TO_VM_PAGE in load_buffer() and load_phys()
shouldn't be KASSERTs instead?
___
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: r290378 - in head/lib: libnetbsd libopenbsd

2015-11-04 Thread Craig Rodrigues
Author: rodrigc
Date: Thu Nov  5 01:54:38 2015
New Revision: 290378
URL: https://svnweb.freebsd.org/changeset/base/290378

Log:
  Fix spelling error.
  
  Reported by: junovitch

Modified:
  head/lib/libnetbsd/README
  head/lib/libopenbsd/README

Modified: head/lib/libnetbsd/README
==
--- head/lib/libnetbsd/README   Thu Nov  5 01:29:48 2015(r290377)
+++ head/lib/libnetbsd/README   Thu Nov  5 01:54:38 2015(r290378)
@@ -2,6 +2,6 @@ $FreeBSD$
 
 libnetbsd is a thin compatibility layer intended to allow a limited
 set of NetBSD software to compile as part of the FreeBSD build with
-little or no modifiction.  It is built as a static library and not
+little or no modification.  It is built as a static library and not
 installed for general use.  Likewise, its header files are not
 installed.

Modified: head/lib/libopenbsd/README
==
--- head/lib/libopenbsd/README  Thu Nov  5 01:29:48 2015(r290377)
+++ head/lib/libopenbsd/README  Thu Nov  5 01:54:38 2015(r290378)
@@ -2,6 +2,6 @@ $FreeBSD$
 
 libopenbsd is a thin compatibility layer intended to allow a limited
 set of OpenBSD software to compile as part of the FreeBSD build with
-little or no modifiction.  It is built as a static library and not
+little or no modification.  It is built as a static library and not
 installed for general use.  Likewise, its header files are not
 installed.
___
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: r290381 - head/sys/arm/broadcom/bcm2835

2015-11-04 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Nov  5 03:46:54 2015
New Revision: 290381
URL: https://svnweb.freebsd.org/changeset/base/290381

Log:
  Refactor mailbox property API to make it usable for /dev/vcio driver:
  
  - Add bcm2835_mbox_property for generic property request, it accepts
  pointer to prepared property chan message and its size, forwards
  it to MBOX and copies result back
  - Make all bcm2835_mbox_XXX functions that use property channel go
  through bcm2835_mbox_property path. Do not accept device_t as
  an argument, it's not required: all DMA operatiosn should go
  through mbox device, and all API consumers should report errors
  on their side.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
  head/sys/arm/broadcom/bcm2835/bcm283x_dwc_fdt.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Thu Nov  5 03:13:10 2015
(r290380)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Thu Nov  5 03:46:54 2015
(r290381)
@@ -81,7 +81,7 @@ bcm_fb_attach(device_t dev)
 {
char bootargs[2048], *n, *p, *v;
device_t fbd;
-   int fbswap;
+   int fbswap, err;
phandle_t chosen;
struct bcm2835_fb_config fb;
struct bcmsc_softc *sc;
@@ -89,11 +89,13 @@ bcm_fb_attach(device_t dev)
 
sc = device_get_softc(dev);
memset(, 0, sizeof(fb));
-   if (bcm2835_mbox_fb_get_w_h(dev, ) != 0)
+   if (bcm2835_mbox_fb_get_w_h() != 0)
return (ENXIO);
fb.bpp = FB_DEPTH;
-   if (bcm2835_mbox_fb_init(dev, ) != 0)
+   if ((err = bcm2835_mbox_fb_init()) != 0) {
+   device_printf(dev, "bcm2835_mbox_fb_init failed, err=%d\n", 
err);
return (ENXIO);
+   }
 
info = malloc(sizeof(struct fb_info), M_DEVBUF, M_WAITOK | M_ZERO);
info->fb_name = device_get_nameunit(dev);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cThu Nov  5 03:13:10 
2015(r290380)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cThu Nov  5 03:46:54 
2015(r290381)
@@ -360,230 +360,162 @@ bcm2835_mbox_err(device_t dev, bus_addr_
 }
 
 int
-bcm2835_mbox_set_power_state(device_t dev, uint32_t device_id, boolean_t on)
+bcm2835_mbox_property(void *msg, size_t msg_size)
 {
-   struct msg_set_power_state *msg;
+   struct msg_set_power_state *buf;
bus_dma_tag_t msg_tag;
bus_dmamap_t msg_map;
bus_addr_t msg_phys;
uint32_t reg;
device_t mbox;
+   int err;
 
/* get mbox device */
mbox = devclass_get_device(devclass_find("mbox"), 0);
-   if (mbox == NULL) {
-   device_printf(dev, "can't find mbox\n");
+   if (mbox == NULL)
return (ENXIO);
-   }
 
/* Allocate memory for the message */
-   msg = bcm2835_mbox_init_dma(dev, sizeof(*msg), _tag, _map,
+   buf = bcm2835_mbox_init_dma(mbox, msg_size, _tag, _map,
_phys);
-   if (msg == NULL)
+   if (buf == NULL)
return (ENOMEM);
 
-   memset(msg, 0, sizeof(*msg));
-   msg->hdr.buf_size = sizeof(*msg);
-   msg->hdr.code = BCM2835_MBOX_CODE_REQ;
-   msg->tag_hdr.tag = BCM2835_MBOX_TAG_SET_POWER_STATE;
-   msg->tag_hdr.val_buf_size = sizeof(msg->body);
-   msg->tag_hdr.val_len = sizeof(msg->body.req);
-   msg->body.req.device_id = device_id;
-   msg->body.req.state = (on ? BCM2835_MBOX_POWER_ON : 0) |
-   BCM2835_MBOX_POWER_WAIT;
-   msg->end_tag = 0;
+   memcpy(buf, msg, msg_size);
 
bus_dmamap_sync(msg_tag, msg_map,
-   BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+   BUS_DMASYNC_PREWRITE);
 
MBOX_WRITE(mbox, BCM2835_MBOX_CHAN_PROP, (uint32_t)msg_phys);
MBOX_READ(mbox, BCM2835_MBOX_CHAN_PROP, );
 
+   bus_dmamap_sync(msg_tag, msg_map,
+   BUS_DMASYNC_PREREAD);
+
+   memcpy(msg, buf, msg_size);
+
+   err = bcm2835_mbox_err(mbox, msg_phys, reg,
+   (struct bcm2835_mbox_hdr *)msg, msg_size);
+
bus_dmamap_unload(msg_tag, msg_map);
-   bus_dmamem_free(msg_tag, msg, msg_map);
+   bus_dmamem_free(msg_tag, buf, msg_map);
bus_dma_tag_destroy(msg_tag);
 
-   return (0);
+   return (err);
 }
 
 int
-bcm2835_mbox_get_clock_rate(device_t dev, uint32_t clock_id, uint32_t *hz)
+bcm2835_mbox_set_power_state(uint32_t device_id, boolean_t on)
 {
-   struct msg_get_clock_rate *msg;
-   bus_dma_tag_t msg_tag;
-   bus_dmamap_t msg_map;
-   bus_addr_t msg_phys;
-   uint32_t reg;
-   device_t mbox;
-
-   /* get mbox device 

svn commit: r290382 - head/sys/arm/broadcom/bcm2835

2015-11-04 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Nov  5 04:16:03 2015
New Revision: 290382
URL: https://svnweb.freebsd.org/changeset/base/290382

Log:
  Add /dev/vcio, userland access point to VideoCore mailbox property channel
  It's required by some applications in raspberrypi-userland package

Added:
  head/sys/arm/broadcom/bcm2835/bcm2835_vcio.c   (contents, props changed)
Modified:
  head/sys/arm/broadcom/bcm2835/files.bcm283x

Added: head/sys/arm/broadcom/bcm2835/bcm2835_vcio.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_vcio.cThu Nov  5 04:16:03 
2015(r290382)
@@ -0,0 +1,122 @@
+/*-
+ * Copyright (c) 2015 Oleksandr Tymoshenko 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+MALLOC_DECLARE(M_VCIO);
+MALLOC_DEFINE(M_VCIO, "vcio", "VCIO temporary buffers");
+
+static struct cdev *sdev;
+static d_ioctl_t vcio_ioctl;
+
+static struct cdevsw vcio_devsw = {
+   /* version */   .d_version = D_VERSION,
+   /* ioctl */ .d_ioctl = vcio_ioctl,
+};
+
+#define VCIO_IOC_MAGIC 100
+#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *)
+
+int
+vcio_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int mode,
+struct thread *td)
+{
+int error;
+void *ptr;
+uint32_t size;
+uint8_t *property;
+
+error = 0;
+switch(cmd) {
+case IOCTL_MBOX_PROPERTY:
+   memcpy (, arg, sizeof(ptr));
+   error = copyin(ptr, , sizeof(size));
+
+   if (error != 0)
+   break;
+   property = malloc(size, M_VCIO, M_WAITOK);
+   if (property == NULL) {
+   error = ENOMEM;
+   break;
+   }
+
+   error = copyin(ptr, property, size);
+   if (error) {
+   free(property, M_VCIO);
+   break;
+   }
+
+   error = bcm2835_mbox_property(property, size);
+   if (error) {
+   free(property, M_VCIO);
+   break;
+   }
+
+   error = copyout(property, ptr, size);
+   free(property, M_VCIO);
+
+   break;
+default:
+   error = EINVAL;
+   break;
+}
+return (error);
+}
+
+static int
+vcio_load(module_t mod, int cmd, void *arg)
+{
+int  err = 0;
+
+switch (cmd) {
+case MOD_LOAD:
+   sdev = make_dev(_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "vcio");
+   break;
+
+case MOD_UNLOAD:
+   destroy_dev(sdev);
+   break;
+
+default:
+   err = EOPNOTSUPP;
+   break;
+}
+
+return(err);
+}
+
+DEV_MODULE(vcio, vcio_load, NULL);
+MODULE_DEPEND(vcio, mbox, 1, 1, 1);

Modified: head/sys/arm/broadcom/bcm2835/files.bcm283x
==
--- head/sys/arm/broadcom/bcm2835/files.bcm283x Thu Nov  5 03:46:54 2015
(r290381)
+++ head/sys/arm/broadcom/bcm2835/files.bcm283x Thu Nov  5 04:16:03 2015
(r290382)
@@ -12,6 +12,7 @@ arm/broadcom/bcm2835/bcm2835_machdep.c
 arm/broadcom/bcm2835/bcm2835_mbox.cstandard
 arm/broadcom/bcm2835/bcm2835_sdhci.c   optional sdhci
 arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi
+arm/broadcom/bcm2835/bcm2835_vcio.cstandard
 arm/broadcom/bcm2835/bcm2835_wdog.cstandard
 arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r290380 - head/sys/dev/flash

2015-11-04 Thread Adrian Chadd
Author: adrian
Date: Thu Nov  5 03:13:10 2015
New Revision: 290380
URL: https://svnweb.freebsd.org/changeset/base/290380

Log:
  Add support for s25fl256s.  I /think/ it's a 32mb NOR flash part.
  
  This is submitted by a FreeBSD wifi user who has requested they not
  be named.  Thankyou!

Modified:
  head/sys/dev/flash/mx25l.c

Modified: head/sys/dev/flash/mx25l.c
==
--- head/sys/dev/flash/mx25l.c  Thu Nov  5 02:09:48 2015(r290379)
+++ head/sys/dev/flash/mx25l.c  Thu Nov  5 03:13:10 2015(r290380)
@@ -107,6 +107,7 @@ struct mx25l_flash_ident flash_devices[]
{ "s25fl032",   0x01, 0x0215, 64 * 1024, 64, FL_NONE },
{ "s25fl064",   0x01, 0x0216, 64 * 1024, 128, FL_NONE },
{ "s25fl128",   0x01, 0x2018, 64 * 1024, 256, FL_NONE },
+   { "s25fl256s",  0x01, 0x0219, 64 * 1024, 512, FL_NONE },
{ "SST25VF032B", 0xbf, 0x254a, 64 * 1024, 64, FL_ERASE_4K | 
FL_ERASE_32K },
 
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
___
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: r290384 - head/contrib/libexecinfo

2015-11-04 Thread Baptiste Daroussin
Author: bapt
Date: Thu Nov  5 07:43:15 2015
New Revision: 290384
URL: https://svnweb.freebsd.org/changeset/base/290384

Log:
  Fix typo in the function name
  
  Submitted by: Sascha Wildner 
  Obtained from:DragonflyBSD

Modified:
  head/contrib/libexecinfo/backtrace.3

Modified: head/contrib/libexecinfo/backtrace.3
==
--- head/contrib/libexecinfo/backtrace.3Thu Nov  5 07:26:32 2015
(r290383)
+++ head/contrib/libexecinfo/backtrace.3Thu Nov  5 07:43:15 2015
(r290384)
@@ -28,7 +28,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 23, 2013
+.Dd November 3, 2015
 .Dt BACKTRACE 3
 .Os
 .Sh NAME
@@ -47,7 +47,7 @@
 .Ft "char **"
 .Fn backtrace_symbols_fmt "void * const *addrlist" "size_t len" "const char 
*fmt"
 .Ft int
-.Fn backtrace_symbols_fmt_fd "void * const *addrlist" "size_t len" "const char 
*fmt" "int fd"
+.Fn backtrace_symbols_fd_fmt "void * const *addrlist" "size_t len" "const char 
*fmt" "int fd"
 .Sh DESCRIPTION
 The
 .Fn backtrace
@@ -106,7 +106,7 @@ with a format argument of
 The
 .Fn backtrace_symbols_fd
 and
-.Fn backtrace_symbols_fmt_fd
+.Fn backtrace_symbols_fd_fmt
 are similar to the non _fd named functions, only instead of returning
 an array or strings, they print a new-line separated array of strings in
 fd, and return
___
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: r290383 - in head/sys: net netinet

2015-11-04 Thread George V. Neville-Neil
Author: gnn
Date: Thu Nov  5 07:26:32 2015
New Revision: 290383
URL: https://svnweb.freebsd.org/changeset/base/290383

Log:
  Replace the fastforward path with tryforward which does not require a
  sysctl and will always be on. The former split between default and
  fast forwarding is removed by this commit while preserving the ability
  to use all network stack features.
  
  Differential Revision:https://reviews.freebsd.org/D4042
  Reviewed by:  ae, melifaro, olivier, rwatson
  MFC after:1 month
  Sponsored by: Rubicon Communications (Netgate)

Modified:
  head/sys/net/if_arcsubr.c
  head/sys/net/if_ethersubr.c
  head/sys/net/if_fddisubr.c
  head/sys/net/if_fwsubr.c
  head/sys/net/if_iso88025subr.c
  head/sys/netinet/in_var.h
  head/sys/netinet/ip_fastfwd.c
  head/sys/netinet/ip_input.c

Modified: head/sys/net/if_arcsubr.c
==
--- head/sys/net/if_arcsubr.c   Thu Nov  5 04:16:03 2015(r290382)
+++ head/sys/net/if_arcsubr.c   Thu Nov  5 07:26:32 2015(r290383)
@@ -550,15 +550,11 @@ arc_input(struct ifnet *ifp, struct mbuf
 #ifdef INET
case ARCTYPE_IP:
m_adj(m, ARC_HDRNEWLEN);
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 
case ARCTYPE_IP_OLD:
m_adj(m, ARC_HDRLEN);
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Thu Nov  5 04:16:03 2015(r290382)
+++ head/sys/net/if_ethersubr.c Thu Nov  5 07:26:32 2015(r290383)
@@ -722,8 +722,6 @@ ether_demux(struct ifnet *ifp, struct mb
switch (ether_type) {
 #ifdef INET
case ETHERTYPE_IP:
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 

Modified: head/sys/net/if_fddisubr.c
==
--- head/sys/net/if_fddisubr.c  Thu Nov  5 04:16:03 2015(r290382)
+++ head/sys/net/if_fddisubr.c  Thu Nov  5 07:26:32 2015(r290383)
@@ -429,8 +429,6 @@ fddi_input(ifp, m)
switch (type) {
 #ifdef INET
case ETHERTYPE_IP:
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 

Modified: head/sys/net/if_fwsubr.c
==
--- head/sys/net/if_fwsubr.cThu Nov  5 04:16:03 2015(r290382)
+++ head/sys/net/if_fwsubr.cThu Nov  5 07:26:32 2015(r290383)
@@ -605,8 +605,6 @@ firewire_input(struct ifnet *ifp, struct
switch (type) {
 #ifdef INET
case ETHERTYPE_IP:
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 

Modified: head/sys/net/if_iso88025subr.c
==
--- head/sys/net/if_iso88025subr.c  Thu Nov  5 04:16:03 2015
(r290382)
+++ head/sys/net/if_iso88025subr.c  Thu Nov  5 07:26:32 2015
(r290383)
@@ -519,8 +519,6 @@ iso88025_input(ifp, m)
 #ifdef INET
case ETHERTYPE_IP:
th->iso88025_shost[0] &= ~(TR_RII); 
-   if ((m = ip_fastforward(m)) == NULL)
-   return;
isr = NETISR_IP;
break;
 

Modified: head/sys/netinet/in_var.h
==
--- head/sys/netinet/in_var.h   Thu Nov  5 04:16:03 2015(r290382)
+++ head/sys/netinet/in_var.h   Thu Nov  5 07:26:32 2015(r290383)
@@ -380,7 +380,7 @@ int in_scrubprefix(struct in_ifaddr *, u
 void   ip_input(struct mbuf *);
 void   ip_direct_input(struct mbuf *);
 void   in_ifadown(struct ifaddr *ifa, int);
-struct mbuf*ip_fastforward(struct mbuf *);
+struct mbuf*ip_tryforward(struct mbuf *);
 void   *in_domifattach(struct ifnet *);
 void   in_domifdetach(struct ifnet *, void *);
 

Modified: head/sys/netinet/ip_fastfwd.c
==
--- head/sys/netinet/ip_fastfwd.c   Thu Nov  5 04:16:03 2015
(r290382)
+++ head/sys/netinet/ip_fastfwd.c   Thu Nov  5 07:26:32 2015
(r290383)
@@ -108,12 +108,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-static VNET_DEFINE(int, ipfastforward_active);
-#defineV_ipfastforward_active  VNET(ipfastforward_active)
-
-SYSCTL_INT(_net_inet_ip, OID_AUTO, fastforwarding, CTLFLAG_VNET | CTLFLAG_RW,
-

svn commit: r290385 - in stable/10: sbin/camcontrol share/misc

2015-11-04 Thread Garrett Cooper
Author: ngie
Date: Thu Nov  5 07:48:48 2015
New Revision: 290385
URL: https://svnweb.freebsd.org/changeset/base/290385

Log:
  MFC r289913,r289916:
  
  r289913:
  
  Use 't' (bits) not 'i' (bytes) for describing MRIE (aka
  "Method of Reporting Informational Exceptions") in the SCSI mode database as
  the field described in X3T10/94-190 (revision 4; page 2, table 1) [1.] is
  4 bits wide, not 4 bytes wide
  
  1. http://ftp.t10.org/ftp/t10/document.94/94-190r4.pdf
  
  Bug 200619
  Reported by: Michael Baptist 
  Submitted by: Lars Skodje 
  Sponsored by: EMC / Isilon Storage Division
  
  r289916:
  
  Limit RESOLUTION_MAX to INT_MAX, not UINT_MAX (all spelled out) so the
  mode value isn't always clipped to -1 when (resolution * size) == 32, which
  would have been the case with values => {4i,32b,32t}.
  
  This seems to have been broken in r64382.
  
  PR: 200619
  Reported by: Michael Baptist
  Submitted by: Lars Skodje
  Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/sbin/camcontrol/modeedit.c
  stable/10/share/misc/scsi_modes
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/modeedit.c
==
--- stable/10/sbin/camcontrol/modeedit.cThu Nov  5 07:43:15 2015
(r290384)
+++ stable/10/sbin/camcontrol/modeedit.cThu Nov  5 07:48:48 2015
(r290385)
@@ -246,7 +246,7 @@ editentry_set(char *name, char *newvalue
  * currently workaround it (even for int64's), so we have to kludge it.
  */
 #defineRESOLUTION_MAX(size) ((resolution * (size) == 32)?  
\
-   (int)0x: (1 << (resolution * (size))) - 1)
+   INT_MAX: (1 << (resolution * (size))) - 1)
 
assert(newvalue != NULL);
if (*newvalue == '\0')

Modified: stable/10/share/misc/scsi_modes
==
--- stable/10/share/misc/scsi_modes Thu Nov  5 07:43:15 2015
(r290384)
+++ stable/10/share/misc/scsi_modes Thu Nov  5 07:48:48 2015
(r290385)
@@ -106,7 +106,7 @@
{EBACKERR} t1
{LogErr} t1
{Reserved} *t4
-   {MRIE} b4
+   {MRIE} t4
{Interval Timer} i4
{Report Count} i4
 }
___
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: r290371 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 19:05:04 2015
New Revision: 290371
URL: https://svnweb.freebsd.org/changeset/base/290371

Log:
  Fix alignment of AF_LINK address.

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Wed Nov  4 16:59:12 2015(r290370)
+++ head/usr.bin/netstat/if.c   Wed Nov  4 19:05:04 2015(r290371)
@@ -391,8 +391,7 @@ intpr(void (*pfunc)(char *), int af)
sdl->sdl_slen == 0)
xo_emit("{P:  }");
else
-   xo_emit("{:address/%*s}",
-   32 - 3 * sdl->sdl_alen,
+   xo_emit("{:address/%-17.17s} ",
routename(ifa->ifa_addr, 1));
link = true;
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: r290372 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 19:09:42 2015
New Revision: 290372
URL: https://svnweb.freebsd.org/changeset/base/290372

Log:
  Since sa->sa_len doesn't match sizeof(struct sockaddr_dl),
  getnameinfo() fails against sockaddr_dl.  This commit is workaround
  for this problem.

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==
--- head/usr.bin/netstat/route.cWed Nov  4 19:05:04 2015
(r290371)
+++ head/usr.bin/netstat/route.cWed Nov  4 19:09:42 2015
(r290372)
@@ -527,6 +527,10 @@ routename(struct sockaddr *sa, int flags
static char line[NI_MAXHOST];
int error, f;
 
+   /* XXX: sa->sa_len doesn't match sizeof(struct sockaddr_dl) */
+   if (sa->sa_family == AF_LINK)
+   sa->sa_len = sizeof(struct sockaddr_dl);
+
f = (flags) ? NI_NUMERICHOST : 0;
error = getnameinfo(sa, sa->sa_len, line, sizeof(line),
NULL, 0, f);
___
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: r290367 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 14:57:46 2015
New Revision: 290367
URL: https://svnweb.freebsd.org/changeset/base/290367

Log:
  Change to not truncate an interface name when -W option
  is specified.

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Wed Nov  4 14:47:10 2015(r290366)
+++ head/usr.bin/netstat/if.c   Wed Nov  4 14:57:46 2015(r290367)
@@ -271,7 +271,9 @@ intpr(void (*pfunc)(char *), int af)
 {
struct ifaddrs *ifap, *ifa;
struct ifmaddrs *ifmap, *ifma;
-   
+   u_int ifn_len_max = 5, ifn_len;
+   char ifn_hdr_fmt[14], ifn_bdy_fmt[41];
+
if (interval)
return sidewaysintpr();
 
@@ -280,12 +282,28 @@ intpr(void (*pfunc)(char *), int af)
if (aflag && getifmaddrs() != 0)
err(EX_OSERR, "getifmaddrs");
 
+   if (Wflag) {
+   for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+   if (interface != NULL &&
+   strcmp(ifa->ifa_name, interface) != 0)
+   continue;
+   if (af != AF_UNSPEC && ifa->ifa_addr->sa_family != af)
+   continue;
+   ifn_len = strlen(ifa->ifa_name);
+   if ((ifa->ifa_flags & IFF_UP) == 0)
+   ++ifn_len;
+   ifn_len_max = MAX(ifn_len_max, ifn_len);
+   }
+   }
+   snprintf(ifn_hdr_fmt, sizeof(ifn_hdr_fmt), "{T:/%%-%d.%ds}",
+   ifn_len_max, ifn_len_max);
+   snprintf(ifn_bdy_fmt, sizeof(ifn_bdy_fmt),
+   "{etk:name/%%s}{e:flags/0x%%x}{d:/%%-%d.%ds}", ifn_len_max,
+   ifn_len_max);
+
xo_open_list("interface");
if (!pfunc) {
-   if (Wflag)
-   xo_emit("{T:/%-7.7s}", "Name");
-   else
-   xo_emit("{T:/%-5.5s}", "Name");
+   xo_emit(ifn_hdr_fmt, "Name");
xo_emit(" {T:/%5.5s} {T:/%-13.13s} {T:/%-17.17s} {T:/%8.8s} "
"{T:/%5.5s} {T:/%5.5s}",
"Mtu", "Network", "Address", "Ipkts", "Ierrs", "Idrop");
@@ -336,12 +354,7 @@ intpr(void (*pfunc)(char *), int af)
} else
xname = name;
 
-   if (Wflag)
-   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-7.7s}",
-   name, ifa->ifa_flags, xname);
-   else
-   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-5.5s}",
-   name, ifa->ifa_flags, xname);
+   xo_emit(ifn_bdy_fmt, name, ifa->ifa_flags, xname);
 
 #define IFA_MTU(ifa)   (((struct if_data *)(ifa)->ifa_data)->ifi_mtu)
show_stat("lu", 6, "mtu", IFA_MTU(ifa), IFA_MTU(ifa), 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290366 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 14:47:10 2015
New Revision: 290366
URL: https://svnweb.freebsd.org/changeset/base/290366

Log:
  Mask an IPv6 network address.

Modified:
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/route.c
==
--- head/usr.bin/netstat/route.cWed Nov  4 13:59:13 2015
(r290365)
+++ head/usr.bin/netstat/route.cWed Nov  4 14:47:10 2015
(r290366)
@@ -688,9 +688,10 @@ static const char *
 netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask)
 {
static char line[NI_MAXHOST + sizeof("/xxx") - 1];
+   struct sockaddr_in6 addr;
char nline[NI_MAXHOST];
u_char *p, *lim;
-   int masklen, illegal = 0;
+   int masklen, illegal = 0, i;
 
if (mask) {
p = (u_char *)>sin6_addr;
@@ -703,6 +704,12 @@ netname6(struct sockaddr_in6 *sa6, struc
}
if (illegal)
xo_error("illegal prefixlen\n");
+
+   memcpy(, sa6, sizeof(addr));
+   for (i = 0; i < 16; ++i)
+   addr.sin6_addr.s6_addr[i] &=
+   mask->sin6_addr.s6_addr[i];
+   sa6 = 
}
else
masklen = 128;
___
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: r290368 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 15:05:15 2015
New Revision: 290368
URL: https://svnweb.freebsd.org/changeset/base/290368

Log:
  Unify AF_INET case and AF_INET6 case.

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Wed Nov  4 14:57:46 2015(r290367)
+++ head/usr.bin/netstat/if.c   Wed Nov  4 15:05:15 2015(r290368)
@@ -366,22 +366,9 @@ intpr(void (*pfunc)(char *), int af)
xo_emit("{:address/%-15.15s} ", "none");
break;
case AF_INET:
-   if (Wflag) {
-   xo_emit("{t:network/%-13s} ",
-   netname(ifa->ifa_addr, ifa->ifa_netmask));
-   xo_emit("{t:address/%-17s} ",
-   routename(ifa->ifa_addr, numeric_addr));
-   } else {
-   xo_emit("{t:network/%-13.13s} ",
-   netname(ifa->ifa_addr, ifa->ifa_netmask));
-   xo_emit("{t:address/%-17.17s} ",
-   routename(ifa->ifa_addr, numeric_addr));
-   }
-
-   network = true;
-   break;
 #ifdef INET6
case AF_INET6:
+#endif /* INET6 */
if (Wflag) {
xo_emit("{t:network/%-13s} ",
netname(ifa->ifa_addr, ifa->ifa_netmask));
@@ -396,7 +383,6 @@ intpr(void (*pfunc)(char *), int af)
 
network = true;
break;
-#endif /* INET6 */
case AF_LINK:
{
struct sockaddr_dl *sdl;
___
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: r290363 - in releng/9.3: . sys/conf sys/sys sys/vm usr.sbin/ntp usr.sbin/ntp/ntpdc usr.sbin/ntp/ntpq

2015-11-04 Thread Gleb Smirnoff
Author: glebius
Date: Wed Nov  4 11:27:30 2015
New Revision: 290363
URL: https://svnweb.freebsd.org/changeset/base/290363

Log:
  o Fix regressions related to SA-15:25 upgrade of NTP. [1]
  o Fix kqueue write events never fired for files greater 2GB. [2]
  o Fix kpplications exiting due to segmentation violation on a correct
memory address. [3]
  
  PR:   204046 [1]
  PR:   204203 [1]
  Errata Notice:FreeBSD-EN-15:19.kqueue [2]
  Errata Notice:FreeBSD-EN-15:20.vm [3]
  Approved by:  so

Modified:
  releng/9.3/UPDATING
  releng/9.3/sys/conf/newvers.sh
  releng/9.3/sys/sys/vnode.h
  releng/9.3/sys/vm/vm_map.c
  releng/9.3/usr.sbin/ntp/config.h
  releng/9.3/usr.sbin/ntp/ntpdc/Makefile
  releng/9.3/usr.sbin/ntp/ntpq/Makefile
Directory Properties:
  releng/9.3/sys/   (props changed)
  releng/9.3/usr.sbin/ntp/   (props changed)

Modified: releng/9.3/UPDATING
==
--- releng/9.3/UPDATING Wed Nov  4 11:27:21 2015(r290362)
+++ releng/9.3/UPDATING Wed Nov  4 11:27:30 2015(r290363)
@@ -11,6 +11,21 @@ handbook:
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
 
+20151104   p30 FreeBSD-SA-15:25.ntp [revised]
+   FreeBSD-EN-15:19.kqueue
+   FreeBSD-EN-15:20.vm
+
+   Fix regression of ntpq(8) utility exiting due to trap 6 in
+   9.3-RELEASE-p29. [SA-15:25]
+
+   Fix regression in ntpd(8) lacking support for RAWDCF reference
+   clock in 9.3-RELEASE-p29. [SA-15:25]
+
+   Fix kqueue write events never fired for files greater 2GB. [EN-15:19]
+
+   Fix applications exiting due to segmentation violation on a correct
+   memory address. [EN-15:20]
+
 20151026:  p29 FreeBSD-SA-15:25.ntp
 
Fix multiple NTP vulnerabilities. New NTP version is 4.2.8p4.

Modified: releng/9.3/sys/conf/newvers.sh
==
--- releng/9.3/sys/conf/newvers.sh  Wed Nov  4 11:27:21 2015
(r290362)
+++ releng/9.3/sys/conf/newvers.sh  Wed Nov  4 11:27:30 2015
(r290363)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="9.3"
-BRANCH="RELEASE-p29"
+BRANCH="RELEASE-p30"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/9.3/sys/sys/vnode.h
==
--- releng/9.3/sys/sys/vnode.h  Wed Nov  4 11:27:21 2015(r290362)
+++ releng/9.3/sys/sys/vnode.h  Wed Nov  4 11:27:30 2015(r290363)
@@ -768,7 +768,8 @@ voidvop_rename_fail(struct vop_rename_a
 
 #defineVOP_WRITE_PRE(ap)   
\
struct vattr va;\
-   int error, osize, ooffset, noffset; \
+   int error;  \
+   off_t osize, ooffset, noffset;  \
\
osize = ooffset = noffset = 0;  \
if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
@@ -776,7 +777,7 @@ voidvop_rename_fail(struct vop_rename_a
if (error)  \
return (error); \
ooffset = (ap)->a_uio->uio_offset;  \
-   osize = va.va_size; \
+   osize = (off_t)va.va_size;  \
}
 
 #define VOP_WRITE_POST(ap, ret)
\

Modified: releng/9.3/sys/vm/vm_map.c
==
--- releng/9.3/sys/vm/vm_map.c  Wed Nov  4 11:27:21 2015(r290362)
+++ releng/9.3/sys/vm/vm_map.c  Wed Nov  4 11:27:30 2015(r290363)
@@ -3878,12 +3878,10 @@ RetryLookup:;
vm_map_unlock_read(map);
return (KERN_PROTECTION_FAILURE);
}
-   if ((entry->eflags & MAP_ENTRY_USER_WIRED) &&
-   (entry->eflags & MAP_ENTRY_COW) &&
-   (fault_type & VM_PROT_WRITE)) {
-   vm_map_unlock_read(map);
-   return (KERN_PROTECTION_FAILURE);
-   }
+   KASSERT((prot & VM_PROT_WRITE) == 0 || (entry->eflags &
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY)) !=
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY),
+   ("entry %p flags %x", entry, entry->eflags));
if ((fault_typea & VM_PROT_COPY) != 0 &&
(ent

svn commit: r290361 - in releng/10.2: . sys/conf sys/sys sys/vm usr.sbin/ntp

2015-11-04 Thread Gleb Smirnoff
Author: glebius
Date: Wed Nov  4 11:27:13 2015
New Revision: 290361
URL: https://svnweb.freebsd.org/changeset/base/290361

Log:
  o Fix regressions related to SA-15:25 upgrade of NTP. [1]
  o Fix kqueue write events never fired for files greater 2GB. [2]
  o Fix kpplications exiting due to segmentation violation on a correct
memory address. [3]
  
  PR:   204046 [1]
  PR:   204203 [1]
  Errata Notice:FreeBSD-EN-15:19.kqueue [2]
  Errata Notice:FreeBSD-EN-15:20.vm [3]
  Approved by:  so

Modified:
  releng/10.2/UPDATING
  releng/10.2/sys/conf/newvers.sh
  releng/10.2/sys/sys/vnode.h
  releng/10.2/sys/vm/vm_map.c
  releng/10.2/usr.sbin/ntp/config.h
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/UPDATING
==
--- releng/10.2/UPDATINGWed Nov  4 10:42:51 2015(r290360)
+++ releng/10.2/UPDATINGWed Nov  4 11:27:13 2015(r290361)
@@ -16,6 +16,18 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20151104   p7  FreeBSD-SA-15:25.ntp [revised]
+   FreeBSD-EN-15:19.kqueue
+   FreeBSD-EN-15:20.vm
+
+   Fix regression in ntpd(8) lacking support for RAWDCF reference
+   clock in 10.2-RELEASE-p6. [SA-15:25]
+
+   Fix kqueue write events never fired for files greater 2GB. [EN-15:19]
+
+   Fix applications exiting due to segmentation violation on a correct
+   memory address. [EN-15:20.vm]
+
 20151026:  p6  FreeBSD-SA-15:25.ntp
 
Fix multiple NTP vulnerabilities. New NTP version is 4.2.8p4.

Modified: releng/10.2/sys/conf/newvers.sh
==
--- releng/10.2/sys/conf/newvers.sh Wed Nov  4 10:42:51 2015
(r290360)
+++ releng/10.2/sys/conf/newvers.sh Wed Nov  4 11:27:13 2015
(r290361)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.2"
-BRANCH="RELEASE-p6"
+BRANCH="RELEASE-p7"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/10.2/sys/sys/vnode.h
==
--- releng/10.2/sys/sys/vnode.h Wed Nov  4 10:42:51 2015(r290360)
+++ releng/10.2/sys/sys/vnode.h Wed Nov  4 11:27:13 2015(r290361)
@@ -787,7 +787,8 @@ voidvop_rename_fail(struct vop_rename_a
 
 #defineVOP_WRITE_PRE(ap)   
\
struct vattr va;\
-   int error, osize, ooffset, noffset; \
+   int error;  \
+   off_t osize, ooffset, noffset;  \
\
osize = ooffset = noffset = 0;  \
if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
@@ -795,7 +796,7 @@ voidvop_rename_fail(struct vop_rename_a
if (error)  \
return (error); \
ooffset = (ap)->a_uio->uio_offset;  \
-   osize = va.va_size; \
+   osize = (off_t)va.va_size;  \
}
 
 #define VOP_WRITE_POST(ap, ret)
\

Modified: releng/10.2/sys/vm/vm_map.c
==
--- releng/10.2/sys/vm/vm_map.c Wed Nov  4 10:42:51 2015(r290360)
+++ releng/10.2/sys/vm/vm_map.c Wed Nov  4 11:27:13 2015(r290361)
@@ -3988,12 +3988,10 @@ RetryLookup:;
vm_map_unlock_read(map);
return (KERN_PROTECTION_FAILURE);
}
-   if ((entry->eflags & MAP_ENTRY_USER_WIRED) &&
-   (entry->eflags & MAP_ENTRY_COW) &&
-   (fault_type & VM_PROT_WRITE)) {
-   vm_map_unlock_read(map);
-   return (KERN_PROTECTION_FAILURE);
-   }
+   KASSERT((prot & VM_PROT_WRITE) == 0 || (entry->eflags &
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY)) !=
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY),
+   ("entry %p flags %x", entry, entry->eflags));
if ((fault_typea & VM_PROT_COPY) != 0 &&
(entry->max_protection & VM_PROT_WRITE) == 0 &&
(entry->eflags & MAP_ENTRY_COW) == 0) {
@@ -4147,10 +4145,6 @@ vm_map_lookup_locked(vm_map_t *var_map,  
   

svn commit: r290365 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 13:59:13 2015
New Revision: 290365
URL: https://svnweb.freebsd.org/changeset/base/290365

Log:
  Restore an interface name field to left align.

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Wed Nov  4 12:47:27 2015(r290364)
+++ head/usr.bin/netstat/if.c   Wed Nov  4 13:59:13 2015(r290365)
@@ -337,10 +337,10 @@ intpr(void (*pfunc)(char *), int af)
xname = name;
 
if (Wflag)
-   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%7.7s}",
+   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-7.7s}",
name, ifa->ifa_flags, xname);
else
-   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%5.5s}",
+   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-5.5s}",
name, ifa->ifa_flags, xname);
 
 #define IFA_MTU(ifa)   (((struct if_data *)(ifa)->ifa_data)->ifi_mtu)
___
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: r290362 - in releng/10.1: . sys/conf sys/sys sys/vm usr.sbin/ntp

2015-11-04 Thread Gleb Smirnoff
Author: glebius
Date: Wed Nov  4 11:27:21 2015
New Revision: 290362
URL: https://svnweb.freebsd.org/changeset/base/290362

Log:
  o Fix regressions related to SA-15:25 upgrade of NTP. [1]
  o Fix kqueue write events never fired for files greater 2GB. [2]
  o Fix kpplications exiting due to segmentation violation on a correct
memory address. [3]
  
  PR:   204046 [1]
  PR:   204203 [1]
  Errata Notice:FreeBSD-EN-15:19.kqueue [2]
  Errata Notice:FreeBSD-EN-15:20.vm [3]
  Approved by:  so

Modified:
  releng/10.1/UPDATING
  releng/10.1/sys/conf/newvers.sh
  releng/10.1/sys/sys/vnode.h
  releng/10.1/sys/vm/vm_map.c
  releng/10.1/usr.sbin/ntp/config.h
Directory Properties:
  releng/10.1/   (props changed)

Modified: releng/10.1/UPDATING
==
--- releng/10.1/UPDATINGWed Nov  4 11:27:13 2015(r290361)
+++ releng/10.1/UPDATINGWed Nov  4 11:27:21 2015(r290362)
@@ -16,6 +16,18 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20151104   p24 FreeBSD-SA-15:25.ntp [revised]
+   FreeBSD-EN-15:19.kqueue
+   FreeBSD-EN-15:20.vm
+
+   Fix regression in ntpd(8) lacking support for RAWDCF reference
+   clock in 10.1-RELEASE-p23. [SA-15:25.ntp]
+
+   Fix kqueue write events never fired for files greater 2GB. [EN-15:19]
+
+   Fix applications exiting due to segmentation violation on a correct
+   memory address. [EN-15:20]
+
 20151026:  p23 FreeBSD-SA-15:25.ntp
 
Fix multiple NTP vulnerabilities. New NTP version is 4.2.8p4.

Modified: releng/10.1/sys/conf/newvers.sh
==
--- releng/10.1/sys/conf/newvers.sh Wed Nov  4 11:27:13 2015
(r290361)
+++ releng/10.1/sys/conf/newvers.sh Wed Nov  4 11:27:21 2015
(r290362)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.1"
-BRANCH="RELEASE-p23"
+BRANCH="RELEASE-p24"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi

Modified: releng/10.1/sys/sys/vnode.h
==
--- releng/10.1/sys/sys/vnode.h Wed Nov  4 11:27:13 2015(r290361)
+++ releng/10.1/sys/sys/vnode.h Wed Nov  4 11:27:21 2015(r290362)
@@ -781,7 +781,8 @@ voidvop_rename_fail(struct vop_rename_a
 
 #defineVOP_WRITE_PRE(ap)   
\
struct vattr va;\
-   int error, osize, ooffset, noffset; \
+   int error;  \
+   off_t osize, ooffset, noffset;  \
\
osize = ooffset = noffset = 0;  \
if (!VN_KNLIST_EMPTY((ap)->a_vp)) { \
@@ -789,7 +790,7 @@ voidvop_rename_fail(struct vop_rename_a
if (error)  \
return (error); \
ooffset = (ap)->a_uio->uio_offset;  \
-   osize = va.va_size; \
+   osize = (off_t)va.va_size;  \
}
 
 #define VOP_WRITE_POST(ap, ret)
\

Modified: releng/10.1/sys/vm/vm_map.c
==
--- releng/10.1/sys/vm/vm_map.c Wed Nov  4 11:27:13 2015(r290361)
+++ releng/10.1/sys/vm/vm_map.c Wed Nov  4 11:27:21 2015(r290362)
@@ -3976,12 +3976,10 @@ RetryLookup:;
vm_map_unlock_read(map);
return (KERN_PROTECTION_FAILURE);
}
-   if ((entry->eflags & MAP_ENTRY_USER_WIRED) &&
-   (entry->eflags & MAP_ENTRY_COW) &&
-   (fault_type & VM_PROT_WRITE)) {
-   vm_map_unlock_read(map);
-   return (KERN_PROTECTION_FAILURE);
-   }
+   KASSERT((prot & VM_PROT_WRITE) == 0 || (entry->eflags &
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY)) !=
+   (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY),
+   ("entry %p flags %x", entry, entry->eflags));
if ((fault_typea & VM_PROT_COPY) != 0 &&
(entry->max_protection & VM_PROT_WRITE) == 0 &&
(entry->eflags & MAP_ENTRY_COW) == 0) {
@@ -4135,10 +4133,6 @@ vm_map_lookup_locked(vm_map_t *var_map,  
   

svn commit: r290369 - in head/sys/arm: arm include

2015-11-04 Thread Svatopluk Kraus
Author: skra
Date: Wed Nov  4 15:35:22 2015
New Revision: 290369
URL: https://svnweb.freebsd.org/changeset/base/290369

Log:
  Fix comment about unpriviledged instructions.  Now, it matches with
  current state after r289372.
  
  While here, do some style and comment cleanups.  No functional changes.
  
  Approved by:  kib (mentor)

Modified:
  head/sys/arm/arm/trap-v6.c
  head/sys/arm/include/armreg.h

Modified: head/sys/arm/arm/trap-v6.c
==
--- head/sys/arm/arm/trap-v6.c  Wed Nov  4 15:05:15 2015(r290368)
+++ head/sys/arm/arm/trap-v6.c  Wed Nov  4 15:35:22 2015(r290369)
@@ -98,18 +98,18 @@ struct abort {
  *  - Always fatal as we do not know what does it mean.
  * Imprecise External Abort:
  *  - Always fatal, but can be handled somehow in the future.
- *Now, due to PCIe buggy harware, ignored.
+ *Now, due to PCIe buggy hardware, ignored.
  * Precise External Abort:
  *  - Always fatal, but who knows in the future???
  * Debug Event:
  *  - Special handling.
  * External Translation Abort (L1 & L2)
- *  - Always fatal as something is screwed up in page tables or harware.
+ *  - Always fatal as something is screwed up in page tables or hardware.
  * Domain Fault (L1 & L2):
  *  - Always fatal as we do not play game with domains.
  * Alignment Fault:
- *  - Everything should be aligned in kernel including user to kernel and
- *vice versa data copying, so we ignore pcb_onfault, and it's always fatal.
+ *  - Everything should be aligned in kernel with exception of user to kernel
+ *and vice versa data copying, so if pcb_onfault is not set, it's fatal.
  *We generate signal in case of abort from user mode.
  * Instruction cache maintenance:
  *  - According to manual, this is translation fault during cache maintenance
@@ -125,7 +125,7 @@ struct abort {
  * Translation Fault (L1 & L2):
  *  - Standard fault mechanism is held including vm_fault().
  * Permission Fault (L1 & L2):
- *  - Fast harware emulation of modify bits and in other cases, standard
+ *  - Fast hardware emulation of modify bits and in other cases, standard
  *fault mechanism is held including vm_fault().
  */
 
@@ -167,7 +167,6 @@ static const struct abort aborts[] = {
{abort_fatal,   "Undefined Code (0x40F)"}
 };
 
-
 static __inline void
 call_trapsignal(struct thread *td, int sig, int code, vm_offset_t addr)
 {
@@ -195,7 +194,7 @@ call_trapsignal(struct thread *td, int s
  *
  * The imprecise means that we don't know where the abort happened,
  * thus FAR is undefined. The abort should not never fire, but hot
- * plugging or accidental harware failure can be the cause of it.
+ * plugging or accidental hardware failure can be the cause of it.
  * If the abort happens, it can even be on different (thread) context.
  * Without any additional support, the abort is fatal, as we do not
  * know what really happened.
@@ -214,7 +213,9 @@ call_trapsignal(struct thread *td, int s
 static __inline void
 abort_imprecise(struct trapframe *tf, u_int fsr, u_int prefetch, u_int 
usermode)
 {
-   /*   We can got imprecise abort as result of access
+
+   /*
+* XXX - We can got imprecise abort as result of access
 * to not-present PCI/PCIe configuration space.
 */
 #if 0
@@ -245,6 +246,7 @@ static __inline void
 abort_debug(struct trapframe *tf, u_int fsr, u_int prefetch, u_int usermode,
 u_int far)
 {
+
if (usermode) {
struct thread *td;
 
@@ -316,6 +318,18 @@ abort_handler(struct trapframe *tf, int 
return;
}
 
+   /*
+* ARM has a set of unprivileged load and store instructions
+* (LDRT/LDRBT/STRT/STRBT ...) which are supposed to be used in other
+* than user mode and OS should recognize their aborts and behave
+* appropriately. However, there is no way how to do that reasonably
+* in general unless we restrict the handling somehow.
+*
+* For now, these instructions are used only in copyin()/copyout()
+* like functions where usermode buffers are checked in advance that
+* they are not from KVA space. Thus, no action is needed here.
+*/
+
 #ifdef ARM_NEW_PMAP
rv = pmap_fault(PCPU_GET(curpmap), far, fsr, idx, usermode);
if (rv == 0) {
@@ -330,7 +344,6 @@ abort_handler(struct trapframe *tf, int 
/*
 * Now, when we handled imprecise and debug aborts, the rest of
 * aborts should be really related to mapping.
-*
 */
 
PCPU_INC(cnt.v_trap);
@@ -417,7 +430,7 @@ abort_handler(struct trapframe *tf, int 
return;
}
 
-   /* Handle remaining I cache aborts. */
+   /* Handle remaining I-cache aborts. */
if (idx == FAULT_ICACHE) {
if (abort_icache(tf, idx, fsr, far, prefetch, td, ))
goto do_trapsignal;
@@ -434,7 +447,7 @@ 

svn commit: r290370 - head/usr.bin/netstat

2015-11-04 Thread Hajimu UMEMOTO
Author: ume
Date: Wed Nov  4 16:59:12 2015
New Revision: 290370
URL: https://svnweb.freebsd.org/changeset/base/290370

Log:
  Simplify r290367 using asterisk for a field width
  and precision.

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Wed Nov  4 15:35:22 2015(r290369)
+++ head/usr.bin/netstat/if.c   Wed Nov  4 16:59:12 2015(r290370)
@@ -272,7 +272,6 @@ intpr(void (*pfunc)(char *), int af)
struct ifaddrs *ifap, *ifa;
struct ifmaddrs *ifmap, *ifma;
u_int ifn_len_max = 5, ifn_len;
-   char ifn_hdr_fmt[14], ifn_bdy_fmt[41];
 
if (interval)
return sidewaysintpr();
@@ -295,15 +294,10 @@ intpr(void (*pfunc)(char *), int af)
ifn_len_max = MAX(ifn_len_max, ifn_len);
}
}
-   snprintf(ifn_hdr_fmt, sizeof(ifn_hdr_fmt), "{T:/%%-%d.%ds}",
-   ifn_len_max, ifn_len_max);
-   snprintf(ifn_bdy_fmt, sizeof(ifn_bdy_fmt),
-   "{etk:name/%%s}{e:flags/0x%%x}{d:/%%-%d.%ds}", ifn_len_max,
-   ifn_len_max);
 
xo_open_list("interface");
if (!pfunc) {
-   xo_emit(ifn_hdr_fmt, "Name");
+   xo_emit("{T:/%-*.*s}", ifn_len_max, ifn_len_max, "Name");
xo_emit(" {T:/%5.5s} {T:/%-13.13s} {T:/%-17.17s} {T:/%8.8s} "
"{T:/%5.5s} {T:/%5.5s}",
"Mtu", "Network", "Address", "Ipkts", "Ierrs", "Idrop");
@@ -354,7 +348,8 @@ intpr(void (*pfunc)(char *), int af)
} else
xname = name;
 
-   xo_emit(ifn_bdy_fmt, name, ifa->ifa_flags, xname);
+   xo_emit("{etk:name/%s}{e:flags/0x%x}{d:/%-*.*s}",
+   name, ifa->ifa_flags, ifn_len_max, ifn_len_max, xname);
 
 #define IFA_MTU(ifa)   (((struct if_data *)(ifa)->ifa_data)->ifi_mtu)
show_stat("lu", 6, "mtu", IFA_MTU(ifa), IFA_MTU(ifa), 0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r290360 - stable/10/sys/net

2015-11-04 Thread Andrey V. Elsukov
Author: ae
Date: Wed Nov  4 10:42:51 2015
New Revision: 290360
URL: https://svnweb.freebsd.org/changeset/base/290360

Log:
  MFC r290116:
Check the size of data available in mbuf before using it.
  
PR: 202667

Modified:
  stable/10/sys/net/if_gre.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/if_gre.c
==
--- stable/10/sys/net/if_gre.c  Wed Nov  4 10:35:10 2015(r290359)
+++ stable/10/sys/net/if_gre.c  Wed Nov  4 10:42:51 2015(r290360)
@@ -691,6 +691,14 @@ gre_input(struct mbuf **mp, int *offp, i
KASSERT(sc != NULL, ("encap_getarg returned NULL"));
 
ifp = GRE2IFP(sc);
+   hlen = *offp + sizeof(struct grehdr) + 4 * sizeof(uint32_t);
+   if (m->m_pkthdr.len < hlen)
+   goto drop;
+   if (m->m_len < hlen) {
+   m = m_pullup(m, hlen);
+   if (m == NULL)
+   goto drop;
+   }
gh = (struct grehdr *)mtodo(m, *offp);
flags = ntohs(gh->gre_flags);
if (flags & ~GRE_FLAGS_MASK)
___
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"