svn commit: r309707 - head/sys/net80211

2016-12-07 Thread Adrian Chadd
Author: adrian
Date: Thu Dec  8 07:57:16 2016
New Revision: 309707
URL: https://svnweb.freebsd.org/changeset/base/309707

Log:
  [net80211] add a field for storing a 64 bit TSC.

Modified:
  head/sys/net80211/ieee80211_freebsd.h

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Thu Dec  8 07:56:25 2016
(r309706)
+++ head/sys/net80211/ieee80211_freebsd.h   Thu Dec  8 07:57:16 2016
(r309707)
@@ -731,11 +731,13 @@ int   ieee80211_get_toa_params(struct mbuf
 #defineIEEE80211_F_SURVEY_TIME 0x0001
 #defineIEEE80211_F_SURVEY_TIME_BUSY0x0002
 #defineIEEE80211_F_SURVEY_NOISE_DBM0x0004
+#defineIEEE80211_F_SURVEY_TSC  0x0008
 struct ieee80211_channel_survey {
uint32_t s_flags;
uint32_t s_time;
uint32_t s_time_busy;
-   int s_noise;
+   int32_t s_noise;
+   uint64_t s_tsc;
 };
 
 #endif /* _KERNEL */
___
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: r309706 - head/sys/net80211

2016-12-07 Thread Adrian Chadd
Author: adrian
Date: Thu Dec  8 07:56:25 2016
New Revision: 309706
URL: https://svnweb.freebsd.org/changeset/base/309706

Log:
  [net80211] begin fleshing out support for channel survey information to be
  pushed back up into net80211.

Modified:
  head/sys/net80211/ieee80211_freebsd.h

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Thu Dec  8 05:37:39 2016
(r309705)
+++ head/sys/net80211/ieee80211_freebsd.h   Thu Dec  8 07:56:25 2016
(r309706)
@@ -727,6 +727,17 @@ intieee80211_add_toa_params(struct mbuf
const struct ieee80211_toa_params *p);
 intieee80211_get_toa_params(struct mbuf *m,
struct ieee80211_toa_params *p);
+
+#defineIEEE80211_F_SURVEY_TIME 0x0001
+#defineIEEE80211_F_SURVEY_TIME_BUSY0x0002
+#defineIEEE80211_F_SURVEY_NOISE_DBM0x0004
+struct ieee80211_channel_survey {
+   uint32_t s_flags;
+   uint32_t s_time;
+   uint32_t s_time_busy;
+   int s_noise;
+};
+
 #endif /* _KERNEL */
 
 /*
___
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: r309705 - in head/sys/dev/hyperv: include utilities vmbus

2016-12-07 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Dec  8 05:37:39 2016
New Revision: 309705
URL: https://svnweb.freebsd.org/changeset/base/309705

Log:
  hyperv/timesync: Support "sent TC" to improve accuracy.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8723

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/vmbus_icreg.h
  head/sys/dev/hyperv/vmbus/hyperv_reg.h
  head/sys/dev/hyperv/vmbus/hyperv_var.h
  head/sys/dev/hyperv/vmbus/vmbus_et.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hThu Dec  8 05:15:00 2016
(r309704)
+++ head/sys/dev/hyperv/include/hyperv.hThu Dec  8 05:37:39 2016
(r309705)
@@ -36,6 +36,23 @@
 #include 
 #include 
 
+#define MSR_HV_TIME_REF_COUNT  0x4020
+
+#define CPUID_HV_MSR_TIME_REFCNT   0x0002  /* MSR_HV_TIME_REF_COUNT */
+#define CPUID_HV_MSR_SYNIC 0x0004  /* MSRs for SynIC */
+#define CPUID_HV_MSR_SYNTIMER  0x0008  /* MSRs for SynTimer */
+#define CPUID_HV_MSR_APIC  0x0010  /* MSR_HV_{EOI,ICR,TPR} */
+#define CPUID_HV_MSR_HYPERCALL 0x0020  /* MSR_HV_GUEST_OS_ID
+* MSR_HV_HYPERCALL */
+#define CPUID_HV_MSR_VP_INDEX  0x0040  /* MSR_HV_VP_INDEX */
+#define CPUID_HV_MSR_GUEST_IDLE0x0400  /* MSR_HV_GUEST_IDLE */
+
+#ifndef NANOSEC
+#define NANOSEC10ULL
+#endif
+#define HYPERV_TIMER_NS_FACTOR 100ULL
+#define HYPERV_TIMER_FREQ  (NANOSEC / HYPERV_TIMER_NS_FACTOR)
+
 struct hyperv_guid {
uint8_t hv_guid[16];
 } __packed;
@@ -44,4 +61,6 @@ struct hyperv_guid {
 
 inthyperv_guid2str(const struct hyperv_guid *, char *, size_t);
 
+extern u_int   hyperv_features;/* CPUID_HV_MSR_ */
+
 #endif  /* _HYPERV_H_ */

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Thu Dec  8 05:15:00 2016
(r309704)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Thu Dec  8 05:37:39 2016
(r309705)
@@ -46,10 +46,14 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_TIMESYNC_FWVER   \
VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0)
 
-#define VMBUS_TIMESYNC_MSGVER_MAJOR3
+#define VMBUS_TIMESYNC_MSGVER_MAJOR4
 #define VMBUS_TIMESYNC_MSGVER  \
VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0)
 
+#define VMBUS_TIMESYNC_DORTT(sc)   \
+   ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \
+(hyperv_features & CPUID_HV_MSR_TIME_REFCNT))
+
 static const struct vmbus_ic_desc vmbus_timesync_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -81,12 +85,16 @@ SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sam
 _ts_sample_verbose, 0, "Increase sample request verbosity.");
 
 static void
-vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint8_t tsflags)
+vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint64_t sent_tc,
+uint8_t tsflags)
 {
struct timespec vm_ts;
-   uint64_t hv_ns, vm_ns;
+   uint64_t hv_ns, vm_ns, rtt = 0;
+
+   if (VMBUS_TIMESYNC_DORTT(sc))
+   rtt = rdmsr(MSR_HV_TIME_REF_COUNT) - sent_tc;
 
-   hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE) * VMBUS_ICMSG_TS_FACTOR;
+   hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE + rtt) * HYPERV_TIMER_NS_FACTOR;
nanotime(_ts);
vm_ns = (vm_ts.tv_sec * NANOSEC) + vm_ts.tv_nsec;
 
@@ -174,6 +182,8 @@ vmbus_timesync_cb(struct vmbus_channel *
VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER);
if (error)
return;
+   if (VMBUS_TIMESYNC_DORTT(sc))
+   device_printf(sc->ic_dev, "RTT\n");
break;
 
case VMBUS_ICMSG_TYPE_TIMESYNC:
@@ -183,7 +193,8 @@ vmbus_timesync_cb(struct vmbus_channel *
return;
}
msg = data;
-   vmbus_timesync(sc, msg->ic_hvtime, msg->ic_tsflags);
+   vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc,
+   msg->ic_tsflags);
break;
 
default:

Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h
==
--- head/sys/dev/hyperv/utilities/vmbus_icreg.h Thu Dec  8 05:15:00 2016
(r309704)
+++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Thu Dec  8 05:37:39 2016
(r309705)
@@ -114,18 +114,13 @@ struct vmbus_icmsg_timesync {
struct vmbus_icmsg_hdr  ic_hdr;
uint64_tic_hvtime;
uint64_tic_vmtime;
-   uint64_tic_rtt;
+   uint64_t

svn commit: r309704 - head/sys/dev/hyperv/vmbus

2016-12-07 Thread Sepherosa Ziehau
Author: sephe
Date: Thu Dec  8 05:15:00 2016
New Revision: 309704
URL: https://svnweb.freebsd.org/changeset/base/309704

Log:
  hyperv/vmbus: Utilize vmbus_chan_run_task()
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8686

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Thu Dec  8 04:29:29 2016
(r309703)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Thu Dec  8 05:15:00 2016
(r309704)
@@ -772,8 +772,7 @@ vmbus_chan_clear_chmap(struct vmbus_chan
struct task chmap_task;
 
TASK_INIT(_task, 0, vmbus_chan_clrchmap_task, chan);
-   taskqueue_enqueue(chan->ch_tq, _task);
-   taskqueue_drain(chan->ch_tq, _task);
+   vmbus_chan_run_task(chan, _task);
 }
 
 static void
___
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: r309676 - in head: bin/ps lib/libkvm sys/compat/freebsd32 sys/kern sys/sys usr.bin/procstat usr.bin/top

2016-12-07 Thread Bruce Evans

On Wed, 7 Dec 2016, Eric van Gyzen wrote:


Log:
 Export the whole thread name in kinfo_proc

 kinfo_proc::ki_tdname is three characters shorter than
 thread::td_name.  Add a ki_moretdname field for these three
 extra characters.  Add the new field to kinfo_proc32, as well.
 Update all in-tree consumers to read the new field and assemble
 the full name, except for lldb's HostThreadFreeBSD.cpp, which
 I will handle separately.  Bump __FreeBSD_version.


tdname stuff was very badly implemented.  It abuses the ki_ocomm
field for ki_tdname.  ki_ocomm was reserved for the old command
name to support old applications.  It should have been populated
with an intelligently abbreviated copy of ki_comm, so that old
applications which don't know about the ki_comm renaming see a
useful name.  It was actually populated by blindly truncating
p_comm.  This was good enough in most cases.  Then when thread
support was added, ki_ocomm was broken copying td_name to it.
For the non-threaded case, this makes no difference, but for
the threaded case this breaks ki_ocomm for old applications and
it doesn't even work right for the threaded case since ki_ocomm
is too short.  This is the problem that you are partly fixing now.

ki_ocomm should have remained as the truncated ki_comm.  ki_comm
should have been modified to contain an intelligently abbreviated
copy of the command and thread names, so that not so old applications
see any extra info in the thread name.  A new field was needed for
the thread name, and perhaps for the previous (non-mixed) command
name, so that applications can see the raw names p_comm and td_name
if the understand threads.

Renaming ki_comm was rather gratuitous.  It was only expanded from
16+1 to 19+1 bytes.  This was done mainly because 16+1 gives either
misalgnment or wastes space.  The latter occurred for p_comm[] in
struct proc.  So we expanded to 19+1 but no more to get a slightly
longer name at no cost in struct proc.  But there was a large cost
for using this.  ac_comm[] in struct acct still has size 16+0 (it
is not NUL-terminated).  And the expansion didn't just work in user.h
since the ki_comm[16+1] was packed there.  The expansion was done
cleanly by keeping renaming the old field but renaming it to
ki_ocomm[16+1], and adding a new field ki_comm[19+1].  Then abusing
ki_ocomm made a mess.

ki_ocomm and OCOMMLEN are under a bogus BURN_BRIDGES ifdef in user.h.
This doesn't even break the ABI.  It only breaks the API, but that is
less important and can be done in the head branch without any ifdefs
(just after you update all uses of the API in src).  The ABI was broken
by abusing ki_ocomm.

There is also much ugliness and loss of info by combining ki_comm and
ki_tdname unintelligently and and then truncating.  The combined length
of 19+16 (now +3 more) is too wide for most displays.  The
unintelligences also adds excessive markup like '[]{}:' characters,
giving lengths of 40+.  Then blind truncation tends to lost the most
useful info at the end.

Your 'more' field instead of renaming again not as clean or wasteful of
space as renaming again, but it is less invasive.


Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Wed Dec  7 14:35:05 2016(r309675)
+++ head/bin/ps/print.c Wed Dec  7 15:04:22 2016(r309676)
@@ -120,11 +120,12 @@ command(KINFO *k, VARENT *ve)
if (cflag) {
/* If it is the last field, then don't pad */
if (STAILQ_NEXT(ve, next_ve) == NULL) {
-   asprintf(, "%s%s%s%s",
+   asprintf(, "%s%s%s%s%s",
k->ki_d.prefix ? k->ki_d.prefix : "",
k->ki_p->ki_comm,
(showthreads && k->ki_p->ki_numthreads > 1) ? "/" : 
"",
-   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "");
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "",
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_moretdname : "");


This expands the style bugs by copying a too-long line and expanding it
further.

With intelligent combination, you couldn't do it in a big printf() arg
list.

FreeBSD cluster machines seem to have stopped showing system processes
(even idle) in ps and top, so I can't easily see many bad  messes from
unintelligent combination or debug things related to system load.  Locally,
I get for top -SH:

  PID USERNAME PRI NICE   SIZERES STATE   C   TIMEWCPU COMMAND
   10 root 155 ki31 0K64K CPU33   1:59 100.27% idle{idle: cpu3}
   10 root 155 ki31 0K64K CPU55   1:59 100.27% idle{idle: cpu5}
   10 root 155 ki31 0K64K CPU66   1:59 100.27% idle{idle: cpu6}
   10 root 155 ki31 0K64K CPU77   1:59 100.27% idle{idle: cpu7}
   10 root 155 ki31 0K64K CPU2

Re: svn commit: r309658 - head/sys/vm

2016-12-07 Thread Warner Losh
On Wed, Dec 7, 2016 at 8:36 PM, Gleb Smirnoff  wrote:
> On Thu, Dec 08, 2016 at 01:07:06PM +1100, Bruce Evans wrote:
> B> >> M> +#ifndef BURN_BRIDGES
> B> >> M> +/*
> B> >> M> + * Provide compatibility sysctls for the benefit of old utilities 
> which exit
> B> >> M> + * with an error if they cannot be found.
> B> >> M> + */
> B> >> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
> B> >> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> B> >> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
> B> >> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> B> >> M> +#endif
> B> >>
> B> >> IMHO, there should be some garbage collecting timeout for them. I'd 
> suggest to
> B> >> delete them from head after stable/12 branch is forked.
> B> >
> B> > Other places define #if BURN_BRUDGES < 120 to make this automatic.
> B>
> B> The correct ifdef is something like '#if COMPAT_FREEBSD12' to make this
> B> non-automatic.  Support for this option should of course be removed some
> B> time after the support for COMPAT_43 option.  That is only 25-30 years old.
>
> By the way, can anyone explain me why do we still have COMPAT_43 option?
>
> I also bet $100 against $10 that it is broken in head in many aspects,
> since there is no regression suite for it and since nobody uses it.

I'd say that we don't know what is or isn't used if it's working. We
only know it isn't working if it fails in a spectacular way for a
popular program (cf sbrk and emacs).

I'd also say those are about the odds I'd give for all the rest.

Warner
___
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: r309703 - in head/sys: amd64/amd64 arm64/arm64 i386/i386 vm

2016-12-07 Thread Alan Cox
Author: alc
Date: Thu Dec  8 04:29:29 2016
New Revision: 309703
URL: https://svnweb.freebsd.org/changeset/base/309703

Log:
  Previously, vm_radix_remove() would panic if the radix trie didn't
  contain a vm_page_t at the specified index.  However, with this
  change, vm_radix_remove() no longer panics.  Instead, it returns NULL
  if there is no vm_page_t at the specified index.  Otherwise, it
  returns the vm_page_t.  The motivation for this change is that it
  simplifies the use of radix tries in the amd64, arm64, and i386 pmap
  implementations.  Instead of performing a lookup before every remove,
  the pmap can simply perform the remove.
  
  Reviewed by:  kib, markj
  Differential Revision:https://reviews.freebsd.org/D8708

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/arm64/arm64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_radix.c
  head/sys/vm/vm_radix.h

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Dec  8 01:07:00 2016(r309702)
+++ head/sys/amd64/amd64/pmap.c Thu Dec  8 04:29:29 2016(r309703)
@@ -614,7 +614,6 @@ static vm_page_t pmap_enter_quick_locked
 static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte);
 static int pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte);
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
-static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask);
 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
 struct rwlock **lockp);
@@ -625,7 +624,7 @@ static int pmap_remove_pde(pmap_t pmap, 
 struct spglist *free, struct rwlock **lockp);
 static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva,
 pd_entry_t ptepde, struct spglist *free, struct rwlock **lockp);
-static void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte);
+static vm_page_t pmap_remove_pt_page(pmap_t pmap, vm_offset_t va);
 static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde,
 struct spglist *free);
 static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va,
@@ -2209,29 +2208,17 @@ pmap_insert_pt_page(pmap_t pmap, vm_page
 }
 
 /*
- * Looks for a page table page mapping the specified virtual address in the
- * specified pmap's collection of idle page table pages.  Returns NULL if there
- * is no page table page corresponding to the specified virtual address.
+ * Removes the page table page mapping the specified virtual address from the
+ * specified pmap's collection of idle page table pages, and returns it.
+ * Otherwise, returns NULL if there is no page table page corresponding to the
+ * specified virtual address.
  */
 static __inline vm_page_t
-pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va)
+pmap_remove_pt_page(pmap_t pmap, vm_offset_t va)
 {
 
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   return (vm_radix_lookup(>pm_root, pmap_pde_pindex(va)));
-}
-
-/*
- * Removes the specified page table page from the specified pmap's collection
- * of idle page table pages.  The specified page table page must be a member of
- * the pmap's collection.
- */
-static __inline void
-pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte)
-{
-
-   PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   vm_radix_remove(>pm_root, mpte->pindex);
+   return (vm_radix_remove(>pm_root, pmap_pde_pindex(va)));
 }
 
 /*
@@ -3450,10 +3437,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_e
oldpde = *pde;
KASSERT((oldpde & (PG_PS | PG_V)) == (PG_PS | PG_V),
("pmap_demote_pde: oldpde is missing PG_PS and/or PG_V"));
-   if ((oldpde & PG_A) != 0 && (mpte = pmap_lookup_pt_page(pmap, va)) !=
-   NULL)
-   pmap_remove_pt_page(pmap, mpte);
-   else {
+   if ((oldpde & PG_A) == 0 || (mpte = pmap_remove_pt_page(pmap, va)) ==
+   NULL) {
KASSERT((oldpde & PG_W) == 0,
("pmap_demote_pde: page table page for a wired mapping"
" is missing"));
@@ -3567,11 +3552,10 @@ pmap_remove_kernel_pde(pmap_t pmap, pd_e
 
KASSERT(pmap == kernel_pmap, ("pmap %p is not kernel_pmap", pmap));
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-   mpte = pmap_lookup_pt_page(pmap, va);
+   mpte = pmap_remove_pt_page(pmap, va);
if (mpte == NULL)
panic("pmap_remove_kernel_pde: Missing pt page.");
 
-   pmap_remove_pt_page(pmap, mpte);
mptepa = VM_PAGE_TO_PHYS(mpte);
newpde = mptepa | X86_PG_M | X86_PG_A | X86_PG_RW | X86_PG_V;
 
@@ -3646,9 +3630,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
if (pmap == kernel_pmap) {
pmap_remove_kernel_pde(pmap, pdq, sva);
} else {
-   mpte = pmap_lookup_pt_page(pmap, sva);
+   mpte = pmap_remove_pt_page(pmap, sva);
if (mpte != NULL) {
-  

Re: svn commit: r309658 - head/sys/vm

2016-12-07 Thread Gleb Smirnoff
On Thu, Dec 08, 2016 at 01:07:06PM +1100, Bruce Evans wrote:
B> >> M> +#ifndef BURN_BRIDGES
B> >> M> +/*
B> >> M> + * Provide compatibility sysctls for the benefit of old utilities 
which exit
B> >> M> + * with an error if they cannot be found.
B> >> M> + */
B> >> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
B> >> M> +(u_int *)NULL, 0, "Dummy for compatibility");
B> >> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
B> >> M> +(u_int *)NULL, 0, "Dummy for compatibility");
B> >> M> +#endif
B> >>
B> >> IMHO, there should be some garbage collecting timeout for them. I'd 
suggest to
B> >> delete them from head after stable/12 branch is forked.
B> >
B> > Other places define #if BURN_BRUDGES < 120 to make this automatic.
B> 
B> The correct ifdef is something like '#if COMPAT_FREEBSD12' to make this
B> non-automatic.  Support for this option should of course be removed some
B> time after the support for COMPAT_43 option.  That is only 25-30 years old.

By the way, can anyone explain me why do we still have COMPAT_43 option?

I also bet $100 against $10 that it is broken in head in many aspects,
since there is no regression suite for it and since nobody uses it.

-- 
Totus tuus, Glebius.
___
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: r309658 - head/sys/vm

2016-12-07 Thread Bruce Evans

On Wed, 7 Dec 2016, Warner Losh wrote:


On Wed, Dec 7, 2016 at 2:26 PM, Gleb Smirnoff  wrote:

On Tue, Dec 06, 2016 at 10:52:45PM +, Mark Johnston wrote:
M> Author: markj
M> Date: Tue Dec  6 22:52:45 2016
M> New Revision: 309658
M> URL: https://svnweb.freebsd.org/changeset/base/309658
M>
M> Log:
M>   Provide dummy sysctls for v_cache_count and v_tcached.
M>
M>   Some utilities (notably top(1)) exit if any of their input sysctls don't
M>   exist, and the removal of the above-mentioned PG_CACHE-related sysctls
M>   makes it difficult to run such utilities on different versions of the
M>   kernel without recompiling.
M>
M>   Requested by:  bde
M>
M> Modified:
M>   head/sys/vm/vm_meter.c
M>
M> Modified: head/sys/vm/vm_meter.c
M> 
==
M> --- head/sys/vm/vm_meter.c   Tue Dec  6 22:48:28 2016(r309657)
M> +++ head/sys/vm/vm_meter.c   Tue Dec  6 22:52:45 2016(r309658)
M> @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec
M>  VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()");
M>  VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()");
M>  VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel");
M> +
M> +#ifndef BURN_BRIDGES
M> +/*
M> + * Provide compatibility sysctls for the benefit of old utilities which exit
M> + * with an error if they cannot be found.
M> + */
M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> +#endif

IMHO, there should be some garbage collecting timeout for them. I'd suggest to
delete them from head after stable/12 branch is forked.


Other places define #if BURN_BRUDGES < 120 to make this automatic.


The correct ifdef is something like '#if COMPAT_FREEBSD12' to make this
non-automatic.  Support for this option should of course be removed some
time after the support for COMPAT_43 option.  That is only 25-30 years old.

FreeBSD never imported the rather large COMPAT_42 support from 4.4BSD-Lite
(except for TCP_COMPAT_42) since it never supported the arches that needed
it, but it still had 1 COMPAT_42 ifdef in udp_usrreq.c until 2002.  That
ifdef was garbage since the option was not supported (not in conf/options).
It was for a sysctl too, but less needed since it was only for the default
value.

Bruce
___
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: r309394 - head/sys/netpfil/pf

2016-12-07 Thread Marcel Moolenaar

> On Dec 7, 2016, at 1:08 PM, Gleb Smirnoff  > wrote:
> 
>  Marcel,
> 
>  thanks for the fixes. While the problem with the first chunk
> in pfsync_sendout() is obvious, the problem you are fixing in th
> second chunk in the pfsync_delete_state() is not clear to me.
> Can you please explain what scenario are you fixing there?

State updates may be pending for state being deleted. This
means that the state is still sitting on either the PFSYNC_S_UPD
or PFSYNC_S_UPD_C queues. What pfsync(4) does in that case is
simply remove the state from those queues and add it to the
PFSYNC_S_DEL queue.

But, pf(4) has already dropped the reference count for state
that’s deleted and the only reference is by pfsync(4) by virtue
of being on the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. When the
state gets dequeued from those queues, the reference count drops
to 0 and the state is deleted (read: memory freed). But the same
state is subsequently added to the PFSYNC_S_DEL queue — i.e.
after the memory was freed.

HTH,

-- 
Marcel Moolenaar
mar...@xcllnt.net 

___
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: r309702 - in stable/10/contrib/libarchive: libarchive tar/test

2016-12-07 Thread Martin Matuska
Author: mm
Date: Thu Dec  8 01:07:00 2016
New Revision: 309702
URL: https://svnweb.freebsd.org/changeset/base/309702

Log:
  Partial MFC r309300:
  
  Apply fix for libarchive issue #821:
"tar -P" cannot extract hardlinks through symlinks
  
  PR:   213255
  Reported by:  Tijl Coosemans 

Modified:
  stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c
  stable/10/contrib/libarchive/tar/test/test_symlink_dir.c

Modified: stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c
==
--- stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c  Thu Dec 
 8 01:06:09 2016(r309701)
+++ stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c  Thu Dec 
 8 01:07:00 2016(r309702)
@@ -336,14 +336,19 @@ struct archive_write_disk {
 
 #define HFS_BLOCKS(s)  ((s) >> 12)
 
-static int check_symlinks_fsobj(char *path, int *error_number, struct 
archive_string *error_string, int flags);
+static voidfsobj_error(int *, struct archive_string *, int, const char *,
+   const char *);
+static int check_symlinks_fsobj(char *, int *, struct archive_string *,
+   int);
 static int check_symlinks(struct archive_write_disk *);
 static int create_filesystem_object(struct archive_write_disk *);
-static struct fixup_entry *current_fixup(struct archive_write_disk *, const 
char *pathname);
+static struct fixup_entry *current_fixup(struct archive_write_disk *,
+   const char *pathname);
 #if defined(HAVE_FCHDIR) && defined(PATH_MAX)
 static voidedit_deep_directories(struct archive_write_disk *ad);
 #endif
-static int cleanup_pathname_fsobj(char *path, int *error_number, struct 
archive_string *error_string, int flags);
+static int cleanup_pathname_fsobj(char *, int *, struct archive_string *,
+   int);
 static int cleanup_pathname(struct archive_write_disk *);
 static int create_dir(struct archive_write_disk *, char *);
 static int create_parent_dir(struct archive_write_disk *, char *);
@@ -374,11 +379,14 @@ static struct archive_vtable *archive_wr
 
 static int _archive_write_disk_close(struct archive *);
 static int _archive_write_disk_free(struct archive *);
-static int _archive_write_disk_header(struct archive *, struct 
archive_entry *);
+static int _archive_write_disk_header(struct archive *,
+   struct archive_entry *);
 static int64_t _archive_write_disk_filter_bytes(struct archive *, int);
 static int _archive_write_disk_finish_entry(struct archive *);
-static ssize_t _archive_write_disk_data(struct archive *, const void *, 
size_t);
-static ssize_t _archive_write_disk_data_block(struct archive *, const void *, 
size_t, int64_t);
+static ssize_t _archive_write_disk_data(struct archive *, const void *,
+   size_t);
+static ssize_t _archive_write_disk_data_block(struct archive *, const void *,
+   size_t, int64_t);
 
 static int
 lazy_stat(struct archive_write_disk *a)
@@ -649,7 +657,8 @@ _archive_write_disk_header(struct archiv
if (a->restore_pwd >= 0) {
r = fchdir(a->restore_pwd);
if (r != 0) {
-   archive_set_error(>archive, errno, "chdir() 
failure");
+   archive_set_error(>archive, errno,
+   "chdir() failure");
ret = ARCHIVE_FATAL;
}
close(a->restore_pwd);
@@ -697,7 +706,8 @@ _archive_write_disk_header(struct archiv
}
if (archive_entry_birthtime_is_set(entry)) {
fe->birthtime = archive_entry_birthtime(entry);
-   fe->birthtime_nanos = 
archive_entry_birthtime_nsec(entry);
+   fe->birthtime_nanos = archive_entry_birthtime_nsec(
+   entry);
} else {
/* If birthtime is unset, use mtime. */
fe->birthtime = fe->mtime;
@@ -723,7 +733,8 @@ _archive_write_disk_header(struct archiv
return (ARCHIVE_FATAL);
fe->mac_metadata = malloc(metadata_size);
if (fe->mac_metadata != NULL) {
-   memcpy(fe->mac_metadata, metadata, 
metadata_size);
+   memcpy(fe->mac_metadata, metadata,
+   metadata_size);
fe->mac_metadata_size = metadata_size;
fe->fixup |= TODO_MAC_METADATA;
}
@@ -1480,7 +1491,8 @@ _archive_write_disk_data_block(struct ar
return (r);
if ((size_t)r < size) {
archive_set_error(>archive, 0,
-   "Too much data: Truncating file at %ju bytes", 

svn commit: r309701 - in stable/11/contrib/libarchive: libarchive tar/test

2016-12-07 Thread Martin Matuska
Author: mm
Date: Thu Dec  8 01:06:09 2016
New Revision: 309701
URL: https://svnweb.freebsd.org/changeset/base/309701

Log:
  Partial MFC r309300:
  
  Apply fix for libarchive issue #821:
"tar -P" cannot extract hardlinks through symlinks
  
  PR:   213255
  Reported by:  Tijl Coosemans 

Modified:
  stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c
  stable/11/contrib/libarchive/tar/test/test_symlink_dir.c

Modified: stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c
==
--- stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c  Wed Dec 
 7 23:38:18 2016(r309700)
+++ stable/11/contrib/libarchive/libarchive/archive_write_disk_posix.c  Thu Dec 
 8 01:06:09 2016(r309701)
@@ -336,14 +336,19 @@ struct archive_write_disk {
 
 #define HFS_BLOCKS(s)  ((s) >> 12)
 
-static int check_symlinks_fsobj(char *path, int *error_number, struct 
archive_string *error_string, int flags);
+static voidfsobj_error(int *, struct archive_string *, int, const char *,
+   const char *);
+static int check_symlinks_fsobj(char *, int *, struct archive_string *,
+   int);
 static int check_symlinks(struct archive_write_disk *);
 static int create_filesystem_object(struct archive_write_disk *);
-static struct fixup_entry *current_fixup(struct archive_write_disk *, const 
char *pathname);
+static struct fixup_entry *current_fixup(struct archive_write_disk *,
+   const char *pathname);
 #if defined(HAVE_FCHDIR) && defined(PATH_MAX)
 static voidedit_deep_directories(struct archive_write_disk *ad);
 #endif
-static int cleanup_pathname_fsobj(char *path, int *error_number, struct 
archive_string *error_string, int flags);
+static int cleanup_pathname_fsobj(char *, int *, struct archive_string *,
+   int);
 static int cleanup_pathname(struct archive_write_disk *);
 static int create_dir(struct archive_write_disk *, char *);
 static int create_parent_dir(struct archive_write_disk *, char *);
@@ -374,11 +379,14 @@ static struct archive_vtable *archive_wr
 
 static int _archive_write_disk_close(struct archive *);
 static int _archive_write_disk_free(struct archive *);
-static int _archive_write_disk_header(struct archive *, struct 
archive_entry *);
+static int _archive_write_disk_header(struct archive *,
+   struct archive_entry *);
 static int64_t _archive_write_disk_filter_bytes(struct archive *, int);
 static int _archive_write_disk_finish_entry(struct archive *);
-static ssize_t _archive_write_disk_data(struct archive *, const void *, 
size_t);
-static ssize_t _archive_write_disk_data_block(struct archive *, const void *, 
size_t, int64_t);
+static ssize_t _archive_write_disk_data(struct archive *, const void *,
+   size_t);
+static ssize_t _archive_write_disk_data_block(struct archive *, const void *,
+   size_t, int64_t);
 
 static int
 lazy_stat(struct archive_write_disk *a)
@@ -649,7 +657,8 @@ _archive_write_disk_header(struct archiv
if (a->restore_pwd >= 0) {
r = fchdir(a->restore_pwd);
if (r != 0) {
-   archive_set_error(>archive, errno, "chdir() 
failure");
+   archive_set_error(>archive, errno,
+   "chdir() failure");
ret = ARCHIVE_FATAL;
}
close(a->restore_pwd);
@@ -697,7 +706,8 @@ _archive_write_disk_header(struct archiv
}
if (archive_entry_birthtime_is_set(entry)) {
fe->birthtime = archive_entry_birthtime(entry);
-   fe->birthtime_nanos = 
archive_entry_birthtime_nsec(entry);
+   fe->birthtime_nanos = archive_entry_birthtime_nsec(
+   entry);
} else {
/* If birthtime is unset, use mtime. */
fe->birthtime = fe->mtime;
@@ -723,7 +733,8 @@ _archive_write_disk_header(struct archiv
return (ARCHIVE_FATAL);
fe->mac_metadata = malloc(metadata_size);
if (fe->mac_metadata != NULL) {
-   memcpy(fe->mac_metadata, metadata, 
metadata_size);
+   memcpy(fe->mac_metadata, metadata,
+   metadata_size);
fe->mac_metadata_size = metadata_size;
fe->fixup |= TODO_MAC_METADATA;
}
@@ -1480,7 +1491,8 @@ _archive_write_disk_data_block(struct ar
return (r);
if ((size_t)r < size) {
archive_set_error(>archive, 0,
-   "Too much data: Truncating file at %ju bytes", 

Re: svn commit: r309394 - head/sys/netpfil/pf

2016-12-07 Thread Marcel Moolenaar

> On Dec 7, 2016, at 1:08 PM, Gleb Smirnoff  > wrote:
> 
>  Marcel,
> 
>  thanks for the fixes. While the problem with the first chunk
> in pfsync_sendout() is obvious, the problem you are fixing in th
> second chunk in the pfsync_delete_state() is not clear to me.
> Can you please explain what scenario are you fixing there?

State updates may be pending for state being deleted. This
means that the state is still sitting on either the PFSYNC_S_UPD
or PFSYNC_S_UPD_C queues. What pfsync(4) does in that case is
simply remove the state from those queues and add it to the
PFSYNC_S_DEL queue.

But, pf(4) has already dropped the reference count for state
that’s deleted and the only reference is by pfsync(4) by virtue
of being on the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. When the
state gets dequeued from those queues, the reference count drops
to 0 and the state is deleted (read: memory freed). But the same
state is subsequently added to the PFSYNC_S_DEL queue — i.e.
after the memory was freed.

HTH,

-- 
Marcel Moolenaar
mar...@xcllnt.net 

___
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: r309700 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n

2016-12-07 Thread Mark Johnston
Author: markj
Date: Wed Dec  7 23:38:18 2016
New Revision: 309700
URL: https://svnweb.freebsd.org/changeset/base/309700

Log:
  Use the correct path to date(1).
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh 
Wed Dec  7 23:37:51 2016(r309699)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh 
Wed Dec  7 23:38:18 2016(r309700)
@@ -45,7 +45,7 @@ EOF
 spinny()
 {
while true; do
-   /usr/bin/date > /dev/null
+   /bin/date > /dev/null
done
 }
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh  
Wed Dec  7 23:37:51 2016(r309699)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh  
Wed Dec  7 23:38:18 2016(r309700)
@@ -45,7 +45,7 @@ EOF
 spinny()
 {
while true; do
-   /usr/bin/date > /dev/null
+   /bin/date > /dev/null
done
 }
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh  
Wed Dec  7 23:37:51 2016(r309699)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh  
Wed Dec  7 23:38:18 2016(r309700)
@@ -45,7 +45,7 @@ EOF
 spinny()
 {
while true; do
-   /usr/bin/date > /dev/null
+   /bin/date > /dev/null
done
 }
 
___
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: r309699 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid

2016-12-07 Thread Mark Johnston
Author: markj
Date: Wed Dec  7 23:37:51 2016
New Revision: 309699
URL: https://svnweb.freebsd.org/changeset/base/309699

Log:
  Use the native data model instead of forcing ILP32 in tst.provregex3.ksh.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh 
Wed Dec  7 23:36:15 2016(r309698)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh 
Wed Dec  7 23:37:51 2016(r309699)
@@ -56,7 +56,7 @@ prov.h: prov.d
$dtrace -h -s prov.d
 
 prov.o: prov.d main.o
-   $dtrace -G -32 -s prov.d main.o
+   $dtrace -G -s prov.d main.o
 EOF
 
 cat > prov.d 

svn commit: r309698 - head/cddl/usr.sbin/dtrace/tests/tools

2016-12-07 Thread Mark Johnston
Author: markj
Date: Wed Dec  7 23:36:15 2016
New Revision: 309698
URL: https://svnweb.freebsd.org/changeset/base/309698

Log:
  Run DTrace test scripts with "tst" set to the test script file name.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh

Modified: head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh
==
--- head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh  Wed Dec  7 23:35:15 
2016(r309697)
+++ head/cddl/usr.sbin/dtrace/tests/tools/dtest.sh  Wed Dec  7 23:36:15 
2016(r309698)
@@ -70,7 +70,7 @@ runtest()
 err.*.ksh|tst.*.ksh)
 expr "$TFILE" : 'err.*' >/dev/null && exstatus=1
 
-ksh "$TFILE" /usr/sbin/dtrace >$STDOUT 2>$STDERR
+tst=$TFILE ksh "$TFILE" /usr/sbin/dtrace >$STDOUT 2>$STDERR
 status=$?
 
 if [ $status -ne $exstatus ]; then
___
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: r309697 - in releng/9.3: . lib/libc/net sys/conf

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:35:15 2016
New Revision: 309697
URL: https://svnweb.freebsd.org/changeset/base/309697

Log:
  Merge r309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 
  Approved by:  so

Modified:
  releng/9.3/UPDATING
  releng/9.3/lib/libc/net/linkaddr.c
  releng/9.3/sys/conf/newvers.sh
Directory Properties:
  releng/9.3/   (props changed)
  releng/9.3/lib/libc/   (props changed)

Modified: releng/9.3/UPDATING
==
--- releng/9.3/UPDATING Wed Dec  7 23:34:06 2016(r309696)
+++ releng/9.3/UPDATING Wed Dec  7 23:35:15 2016(r309697)
@@ -11,6 +11,10 @@ handbook:
 Items affecting the ports and packages system can be found in
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
 
+20161208   p52 FreeBSD-SA-16:37.libc [revised]
+
+   Fix regressions introduced by SA-16:37.libc.
+
 20161206   p51 FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-EN-16:19.tzcode

Modified: releng/9.3/lib/libc/net/linkaddr.c
==
--- releng/9.3/lib/libc/net/linkaddr.c  Wed Dec  7 23:34:06 2016
(r309696)
+++ releng/9.3/lib/libc/net/linkaddr.c  Wed Dec  7 23:35:15 2016
(r309697)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 0;

Modified: releng/9.3/sys/conf/newvers.sh
==
--- releng/9.3/sys/conf/newvers.sh  Wed Dec  7 23:34:06 2016
(r309696)
+++ releng/9.3/sys/conf/newvers.sh  Wed Dec  7 23:35:15 2016
(r309697)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="9.3"
-BRANCH="RELEASE-p51"
+BRANCH="RELEASE-p52"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r309695 - head/sys/net80211

2016-12-07 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Dec  7 23:33:59 2016
New Revision: 309695
URL: https://svnweb.freebsd.org/changeset/base/309695

Log:
  net80211: remove obsolete comment.
  
  The described LOR should be fixed in r302283.

Modified:
  head/sys/net80211/ieee80211_superg.c

Modified: head/sys/net80211/ieee80211_superg.c
==
--- head/sys/net80211/ieee80211_superg.cWed Dec  7 23:32:42 2016
(r309694)
+++ head/sys/net80211/ieee80211_superg.cWed Dec  7 23:33:59 2016
(r309695)
@@ -909,12 +909,6 @@ ieee80211_ff_node_init(struct ieee80211_
ieee80211_ff_node_cleanup(ni);
 }
 
-/*
- * Note: this comlock acquisition LORs with the node lock:
- *
- * 1: sta_join1 -> NODE_LOCK -> node_free -> node_cleanup -> ff_node_cleanup 
-> COM_LOCK
- * 2: TBD
- */
 void
 ieee80211_ff_node_cleanup(struct ieee80211_node *ni)
 {
___
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: r309696 - in releng/10.1: . lib/libc/net sys/conf

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:34:06 2016
New Revision: 309696
URL: https://svnweb.freebsd.org/changeset/base/309696

Log:
  Merge r309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 
  Approved by:  so

Modified:
  releng/10.1/UPDATING
  releng/10.1/lib/libc/net/linkaddr.c
  releng/10.1/sys/conf/newvers.sh
Directory Properties:
  releng/10.1/   (props changed)

Modified: releng/10.1/UPDATING
==
--- releng/10.1/UPDATINGWed Dec  7 23:33:59 2016(r309695)
+++ releng/10.1/UPDATINGWed Dec  7 23:34:06 2016(r309696)
@@ -16,6 +16,10 @@ 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.
 
+20161208   p44 FreeBSD-SA-16:37.libc [revised]
+
+   Fix regressions introduced by SA-16:37.libc.
+
 20161206   p43 FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-SA-16:38.bhyve

Modified: releng/10.1/lib/libc/net/linkaddr.c
==
--- releng/10.1/lib/libc/net/linkaddr.c Wed Dec  7 23:33:59 2016
(r309695)
+++ releng/10.1/lib/libc/net/linkaddr.c Wed Dec  7 23:34:06 2016
(r309696)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 0;

Modified: releng/10.1/sys/conf/newvers.sh
==
--- releng/10.1/sys/conf/newvers.sh Wed Dec  7 23:33:59 2016
(r309695)
+++ releng/10.1/sys/conf/newvers.sh Wed Dec  7 23:34:06 2016
(r309696)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.1"
-BRANCH="RELEASE-p43"
+BRANCH="RELEASE-p44"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r309694 - in releng/10.2: . lib/libc/net sys/conf

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:32:42 2016
New Revision: 309694
URL: https://svnweb.freebsd.org/changeset/base/309694

Log:
  Merge r309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 
  Approved by:  so

Modified:
  releng/10.2/UPDATING
  releng/10.2/lib/libc/net/linkaddr.c
  releng/10.2/sys/conf/newvers.sh
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/UPDATING
==
--- releng/10.2/UPDATINGWed Dec  7 23:31:07 2016(r309693)
+++ releng/10.2/UPDATINGWed Dec  7 23:32:42 2016(r309694)
@@ -16,6 +16,10 @@ 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.
 
+20161208   p27 FreeBSD-SA-16:37.libc [revised]
+
+   Fix regressions introduced by SA-16:37.libc.
+
 20161206   p26 FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-SA-16:38.bhyve

Modified: releng/10.2/lib/libc/net/linkaddr.c
==
--- releng/10.2/lib/libc/net/linkaddr.c Wed Dec  7 23:31:07 2016
(r309693)
+++ releng/10.2/lib/libc/net/linkaddr.c Wed Dec  7 23:32:42 2016
(r309694)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 0;

Modified: releng/10.2/sys/conf/newvers.sh
==
--- releng/10.2/sys/conf/newvers.sh Wed Dec  7 23:31:07 2016
(r309693)
+++ releng/10.2/sys/conf/newvers.sh Wed Dec  7 23:32:42 2016
(r309694)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.2"
-BRANCH="RELEASE-p26"
+BRANCH="RELEASE-p27"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r309693 - in releng/10.3: . lib/libc/net sys/conf

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:31:07 2016
New Revision: 309693
URL: https://svnweb.freebsd.org/changeset/base/309693

Log:
  Merge r309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 
  Approved by:  so

Modified:
  releng/10.3/UPDATING
  releng/10.3/lib/libc/net/linkaddr.c
  releng/10.3/sys/conf/newvers.sh
Directory Properties:
  releng/10.3/   (props changed)

Modified: releng/10.3/UPDATING
==
--- releng/10.3/UPDATINGWed Dec  7 23:29:42 2016(r309692)
+++ releng/10.3/UPDATINGWed Dec  7 23:31:07 2016(r309693)
@@ -16,6 +16,10 @@ 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.
 
+20161208   p14 FreeBSD-SA-16:37.libc [revised]
+
+   Fix regressions introduced by SA-16:37.libc.
+
 20161206   p13 FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-SA-16:38.bhyve

Modified: releng/10.3/lib/libc/net/linkaddr.c
==
--- releng/10.3/lib/libc/net/linkaddr.c Wed Dec  7 23:29:42 2016
(r309692)
+++ releng/10.3/lib/libc/net/linkaddr.c Wed Dec  7 23:31:07 2016
(r309693)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 0;

Modified: releng/10.3/sys/conf/newvers.sh
==
--- releng/10.3/sys/conf/newvers.sh Wed Dec  7 23:29:42 2016
(r309692)
+++ releng/10.3/sys/conf/newvers.sh Wed Dec  7 23:31:07 2016
(r309693)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.3"
-BRANCH="RELEASE-p13"
+BRANCH="RELEASE-p14"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r309692 - in releng/11.0: . lib/libc/net sys/conf

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:29:42 2016
New Revision: 309692
URL: https://svnweb.freebsd.org/changeset/base/309692

Log:
  Merge r309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 
  Approved by:  so

Modified:
  releng/11.0/UPDATING
  releng/11.0/lib/libc/net/linkaddr.c
  releng/11.0/sys/conf/newvers.sh
Directory Properties:
  releng/11.0/   (props changed)

Modified: releng/11.0/UPDATING
==
--- releng/11.0/UPDATINGWed Dec  7 23:20:50 2016(r309691)
+++ releng/11.0/UPDATINGWed Dec  7 23:29:42 2016(r309692)
@@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20161208   p5  FreeBSD-SA-16:37.libc [revised]
+
+   Fix regressions introduced by SA-16:37.libc.
+
 20161206   p4  FreeBSD-SA-16:36.telnetd
FreeBSD-SA-16:37.libc
FreeBSD-SA-16:38.bhyve

Modified: releng/11.0/lib/libc/net/linkaddr.c
==
--- releng/11.0/lib/libc/net/linkaddr.c Wed Dec  7 23:20:50 2016
(r309691)
+++ releng/11.0/lib/libc/net/linkaddr.c Wed Dec  7 23:29:42 2016
(r309692)
@@ -125,7 +125,7 @@ link_ntoa(const struct sockaddr_dl *sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -142,11 +142,11 @@ link_ntoa(const struct sockaddr_dl *sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -154,15 +154,14 @@ link_ntoa(const struct sockaddr_dl *sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 0;

Modified: releng/11.0/sys/conf/newvers.sh
==
--- releng/11.0/sys/conf/newvers.sh Wed Dec  7 23:20:50 2016
(r309691)
+++ releng/11.0/sys/conf/newvers.sh Wed Dec  7 23:29:42 2016
(r309692)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="11.0"
-BRANCH="RELEASE-p4"
+BRANCH="RELEASE-p5"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
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: r309690 - stable/10/lib/libc/net

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:20:26 2016
New Revision: 309690
URL: https://svnweb.freebsd.org/changeset/base/309690

Log:
  Merge rr309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 

Modified:
  stable/10/lib/libc/net/linkaddr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/net/linkaddr.c
==
--- stable/10/lib/libc/net/linkaddr.c   Wed Dec  7 23:19:46 2016
(r309689)
+++ stable/10/lib/libc/net/linkaddr.c   Wed Dec  7 23:20:26 2016
(r309690)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 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: r309691 - stable/9/lib/libc/net

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:20:50 2016
New Revision: 309691
URL: https://svnweb.freebsd.org/changeset/base/309691

Log:
  Merge rr309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 

Modified:
  stable/9/lib/libc/net/linkaddr.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/net/linkaddr.c
==
--- stable/9/lib/libc/net/linkaddr.cWed Dec  7 23:20:26 2016
(r309690)
+++ stable/9/lib/libc/net/linkaddr.cWed Dec  7 23:20:50 2016
(r309691)
@@ -128,7 +128,7 @@ link_ntoa(sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -145,11 +145,11 @@ link_ntoa(sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -157,15 +157,14 @@ link_ntoa(sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 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: r309689 - stable/11/lib/libc/net

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:19:46 2016
New Revision: 309689
URL: https://svnweb.freebsd.org/changeset/base/309689

Log:
  Merge rr309688: address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 

Modified:
  stable/11/lib/libc/net/linkaddr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/net/linkaddr.c
==
--- stable/11/lib/libc/net/linkaddr.c   Wed Dec  7 23:18:00 2016
(r309688)
+++ stable/11/lib/libc/net/linkaddr.c   Wed Dec  7 23:19:46 2016
(r309689)
@@ -125,7 +125,7 @@ link_ntoa(const struct sockaddr_dl *sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -142,11 +142,11 @@ link_ntoa(const struct sockaddr_dl *sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -154,15 +154,14 @@ link_ntoa(const struct sockaddr_dl *sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 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: r309688 - head/lib/libc/net

2016-12-07 Thread Gleb Smirnoff
Author: glebius
Date: Wed Dec  7 23:18:00 2016
New Revision: 309688
URL: https://svnweb.freebsd.org/changeset/base/309688

Log:
  Address regressions in SA-16:37.libc.
  
  PR:   215105
  Submitted by: 

Modified:
  head/lib/libc/net/linkaddr.c

Modified: head/lib/libc/net/linkaddr.c
==
--- head/lib/libc/net/linkaddr.cWed Dec  7 22:52:12 2016
(r309687)
+++ head/lib/libc/net/linkaddr.cWed Dec  7 23:18:00 2016
(r309688)
@@ -125,7 +125,7 @@ link_ntoa(const struct sockaddr_dl *sdl)
static char obuf[64];
_Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
char *out;
-   const char *in, *inlim;
+   const u_char *in, *inlim;
int namelen, i, rem;
 
namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
@@ -142,11 +142,11 @@ link_ntoa(const struct sockaddr_dl *sdl)
}
}
 
-   in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
+   in = (const u_char *)sdl->sdl_data + sdl->sdl_nlen;
inlim = in + sdl->sdl_alen;
 
while (in < inlim && rem > 1) {
-   if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
+   if (in != (const u_char *)sdl->sdl_data + sdl->sdl_nlen) {
*out++ = '.';
rem--;
}
@@ -154,15 +154,14 @@ link_ntoa(const struct sockaddr_dl *sdl)
if (i > 0xf) {
if (rem < 3)
break;
+   *out++ = hexlist[i >> 4];
*out++ = hexlist[i & 0xf];
-   i >>= 4;
-   *out++ = hexlist[i];
rem -= 2;
} else {
if (rem < 2)
break;
*out++ = hexlist[i];
-   rem++;
+   rem--;
}
}
*out = 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: r309687 - head/sys/dev/usb/wlan

2016-12-07 Thread Gavin Atkinson
Author: gavin
Date: Wed Dec  7 22:52:12 2016
New Revision: 309687
URL: https://svnweb.freebsd.org/changeset/base/309687

Log:
  Switch if_run.c to use a bitmap for debug levels rather than arbitrary
  values. This more closely matches other wifi drivers in the tree.
  The bitmap levels have been based closely on other drivers (primarily
  [u]rtwn(4)) in the hope that one day these can be unified into a shared
  wifi-debug framework.
  
  This is the first step of several pieces of work I'm planning on doing
  with the run(4) driver. I may well adjust and refine some of the debug
  bitmaps at a later date.
  
  Reviewed by:  adrian, avos
  Differential Revision:https://reviews.freebsd.org/D8704

Modified:
  head/sys/dev/usb/wlan/if_run.c

Modified: head/sys/dev/usb/wlan/if_run.c
==
--- head/sys/dev/usb/wlan/if_run.c  Wed Dec  7 22:16:07 2016
(r309686)
+++ head/sys/dev/usb/wlan/if_run.c  Wed Dec  7 22:52:12 2016
(r309687)
@@ -86,6 +86,35 @@ int run_debug = 0;
 static SYSCTL_NODE(_hw_usb, OID_AUTO, run, CTLFLAG_RW, 0, "USB run");
 SYSCTL_INT(_hw_usb_run, OID_AUTO, debug, CTLFLAG_RWTUN, _debug, 0,
 "run debug level");
+
+enum {
+   RUN_DEBUG_XMIT  = 0x0001,   /* basic xmit operation */
+   RUN_DEBUG_XMIT_DESC = 0x0002,   /* xmit descriptors */
+   RUN_DEBUG_RECV  = 0x0004,   /* basic recv operation */
+   RUN_DEBUG_RECV_DESC = 0x0008,   /* recv descriptors */
+   RUN_DEBUG_STATE = 0x0010,   /* 802.11 state transitions */
+   RUN_DEBUG_RATE  = 0x0020,   /* rate adaptation */
+   RUN_DEBUG_USB   = 0x0040,   /* usb requests */
+   RUN_DEBUG_FIRMWARE  = 0x0080,   /* firmware(9) loading debug */
+   RUN_DEBUG_BEACON= 0x0100,   /* beacon handling */
+   RUN_DEBUG_INTR  = 0x0200,   /* ISR */
+   RUN_DEBUG_TEMP  = 0x0400,   /* temperature calibration */
+   RUN_DEBUG_ROM   = 0x0800,   /* various ROM info */
+   RUN_DEBUG_KEY   = 0x1000,   /* crypto keys management */
+   RUN_DEBUG_TXPWR = 0x2000,   /* dump Tx power values */
+   RUN_DEBUG_RSSI  = 0x4000,   /* dump RSSI lookups */
+   RUN_DEBUG_RESET = 0x8000,   /* initialization progress */
+   RUN_DEBUG_CALIB = 0x0001,   /* calibration progress */
+   RUN_DEBUG_CMD   = 0x0001,   /* command queue */
+   RUN_DEBUG_ANY   = 0x
+};
+
+#define RUN_DPRINTF(_sc, _m, ...) do { \
+   if (run_debug & (_m))   \
+   device_printf((_sc)->sc_dev, __VA_ARGS__);  \
+} while(0)
+#else
+#define RUN_DPRINTF(_sc, _m, ...)  do { (void) _sc; } while (0)
 #endif
 
 #defineIEEE80211_HAS_ADDR4(wh) IEEE80211_IS_DSTODS(wh)
@@ -980,7 +1009,7 @@ run_vap_create(struct ieee80211com *ic, 
if (opmode == IEEE80211_M_HOSTAP)
sc->cmdq_run = RUN_CMDQ_GO;
 
-   DPRINTF("rvp_id=%d bmap=%x rvp_cnt=%d\n",
+   RUN_DPRINTF(sc, RUN_DEBUG_STATE, "rvp_id=%d bmap=%x rvp_cnt=%d\n",
rvp->rvp_id, sc->rvp_bmap, sc->rvp_cnt);
 
return (vap);
@@ -1012,7 +1041,8 @@ run_vap_delete(struct ieee80211vap *vap)
run_set_region_4(sc, RT2860_BCN_BASE(rvp_id), 0, 512);
--sc->rvp_cnt;
 
-   DPRINTF("vap=%p rvp_id=%d bmap=%x rvp_cnt=%d\n",
+   RUN_DPRINTF(sc, RUN_DEBUG_STATE,
+   "vap=%p rvp_id=%d bmap=%x rvp_cnt=%d\n",
vap, rvp_id, sc->rvp_bmap, sc->rvp_cnt);
 
RUN_UNLOCK(sc);
@@ -1040,7 +1070,8 @@ run_cmdq_cb(void *arg, int pending)
RUN_LOCK(sc);
for (i = sc->cmdq_exec; sc->cmdq[i].func && pending;
i = sc->cmdq_exec, pending--) {
-   DPRINTFN(6, "cmdq_exec=%d pending=%d\n", i, pending);
+   RUN_DPRINTF(sc, RUN_DEBUG_CMD, "cmdq_exec=%d pending=%d\n",
+   i, pending);
if (sc->cmdq_run == RUN_CMDQ_GO) {
/*
 * If arg0 is NULL, callback func needs more
@@ -1226,7 +1257,8 @@ run_do_request(struct run_softc *sc,
req, data, 0, NULL, 250 /* ms */);
if (err == 0)
break;
-   DPRINTFN(1, "Control request failed, %s (retrying)\n",
+   RUN_DPRINTF(sc, RUN_DEBUG_USB,
+   "Control request failed, %s (retrying)\n",
usbd_errstr(err));
run_delay(sc, 10);
}
@@ -1702,7 +1734,8 @@ run_get_txpower(struct run_softc *sc)
if (sc->txpow2[i] < 0 || sc->txpow2[i] > 31)
sc->txpow2[i] = 5;
}
-   DPRINTF("chan %d: power1=%d, power2=%d\n",
+   RUN_DPRINTF(sc, RUN_DEBUG_TXPWR,
+   "chan %d: power1=%d, 

Re: svn commit: r309658 - head/sys/vm

2016-12-07 Thread Gleb Smirnoff
On Wed, Dec 07, 2016 at 02:15:49PM -0800, Mark Johnston wrote:
M> On Wed, Dec 07, 2016 at 01:26:47PM -0800, Gleb Smirnoff wrote:
M> > On Tue, Dec 06, 2016 at 10:52:45PM +, Mark Johnston wrote:
M> > M> Author: markj
M> > M> Date: Tue Dec  6 22:52:45 2016
M> > M> New Revision: 309658
M> > M> URL: https://svnweb.freebsd.org/changeset/base/309658
M> > M> 
M> > M> Log:
M> > M>   Provide dummy sysctls for v_cache_count and v_tcached.
M> > M>   
M> > M>   Some utilities (notably top(1)) exit if any of their input sysctls 
don't
M> > M>   exist, and the removal of the above-mentioned PG_CACHE-related sysctls
M> > M>   makes it difficult to run such utilities on different versions of the
M> > M>   kernel without recompiling.
M> > M>   
M> > M>   Requested by: bde
M> > M> 
M> > M> Modified:
M> > M>   head/sys/vm/vm_meter.c
M> > M> 
M> > M> Modified: head/sys/vm/vm_meter.c
M> > M> 
==
M> > M> --- head/sys/vm/vm_meter.c  Tue Dec  6 22:48:28 2016
(r309657)
M> > M> +++ head/sys/vm/vm_meter.c  Tue Dec  6 22:52:45 2016
(r309658)
M> > M> @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec
M> > M>  VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()");
M> > M>  VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()");
M> > M>  VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel");
M> > M> +
M> > M> +#ifndef BURN_BRIDGES
M> > M> +/*
M> > M> + * Provide compatibility sysctls for the benefit of old utilities 
which exit
M> > M> + * with an error if they cannot be found.
M> > M> + */
M> > M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
M> > M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> > M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
M> > M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> > M> +#endif
M> > 
M> > IMHO, there should be some garbage collecting timeout for them. I'd 
suggest to
M> > delete them from head after stable/12 branch is forked.
M> 
M> The intent was to improve compatibility with old userlands, not just to
M> help bridge the transition from 11.0 to 12.0. In general I'm all for
M> removing cruft, but these sysctls are unobtrusive and I don't see any
M> reason to remove them in a specific time frame provided that nothing
M> else breaks compatibility for top(1) (and vmstat(8)). Please feel free
M> to add a timeout if you still disagree, though.

I'm fine with a bigger timeout. 13, 14 or 15. Anything but
the infinity :)

-- 
Totus tuus, Glebius.
___
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: r309686 - in head/sys: dev/ath dev/mwl dev/rtwn dev/usb/wlan net80211

2016-12-07 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Dec  7 22:16:07 2016
New Revision: 309686
URL: https://svnweb.freebsd.org/changeset/base/309686

Log:
  net80211 + drivers: convert to ieee80211_crypto_get_key_wepidx().
  
  Proposed by:  adrian

Modified:
  head/sys/dev/ath/if_ath_keycache.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/rtwn/if_rtwn_cam.c
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/net80211/ieee80211_crypto.c

Modified: head/sys/dev/ath/if_ath_keycache.c
==
--- head/sys/dev/ath/if_ath_keycache.c  Wed Dec  7 22:01:09 2016
(r309685)
+++ head/sys/dev/ath/if_ath_keycache.c  Wed Dec  7 22:16:07 2016
(r309686)
@@ -449,7 +449,8 @@ ath_key_alloc(struct ieee80211vap *vap, 
 * have no way to check if they've already
 * been allocated.
 */
-   *keyix = *rxkeyix = k - vap->iv_nw_keys;
+   *keyix = *rxkeyix =
+   ieee80211_crypto_get_key_wepidx(vap, k);
return 1;
}
/*

Modified: head/sys/dev/mwl/if_mwl.c
==
--- head/sys/dev/mwl/if_mwl.c   Wed Dec  7 22:01:09 2016(r309685)
+++ head/sys/dev/mwl/if_mwl.c   Wed Dec  7 22:16:07 2016(r309686)
@@ -1529,7 +1529,7 @@ mwl_key_alloc(struct ieee80211vap *vap, 
return 0;
}
/* give the caller what they requested */
-   *keyix = *rxkeyix = k - vap->iv_nw_keys;
+   *keyix = *rxkeyix = ieee80211_crypto_get_key_wepidx(vap, k);
} else {
/*
 * Firmware handles key allocation.

Modified: head/sys/dev/rtwn/if_rtwn_cam.c
==
--- head/sys/dev/rtwn/if_rtwn_cam.c Wed Dec  7 22:01:09 2016
(r309685)
+++ head/sys/dev/rtwn/if_rtwn_cam.c Wed Dec  7 22:16:07 2016
(r309686)
@@ -118,7 +118,11 @@ rtwn_key_alloc(struct ieee80211vap *vap,
 
if (>iv_nw_keys[0] <= k &&
k < >iv_nw_keys[IEEE80211_WEP_NKID]) {
+#if __FreeBSD_version > 1200018
+   *keyix = ieee80211_crypto_get_key_wepidx(vap, k);
+#else
*keyix = k - vap->iv_nw_keys;
+#endif
if (sc->sc_hwcrypto != RTWN_CRYPTO_FULL)
k->wk_flags |= IEEE80211_KEY_SWCRYPT;
else {

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Wed Dec  7 22:01:09 2016
(r309685)
+++ head/sys/dev/usb/wlan/if_rsu.c  Wed Dec  7 22:16:07 2016
(r309686)
@@ -1428,7 +1428,7 @@ rsu_key_alloc(struct ieee80211vap *vap, 
 
if (>iv_nw_keys[0] <= k &&
k < >iv_nw_keys[IEEE80211_WEP_NKID]) {
-   *keyix = k - vap->iv_nw_keys;
+   *keyix = ieee80211_crypto_get_key_wepidx(vap, k);
} else {
if (vap->iv_opmode != IEEE80211_M_STA) {
*keyix = 0;

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Wed Dec  7 22:01:09 2016
(r309685)
+++ head/sys/dev/usb/wlan/if_rum.c  Wed Dec  7 22:16:07 2016
(r309686)
@@ -3046,7 +3046,7 @@ rum_key_alloc(struct ieee80211vap *vap, 
} else
*keyix = 0;
} else {
-   *keyix = k - vap->iv_nw_keys;
+   *keyix = ieee80211_crypto_get_key_wepidx(vap, k);
}
*rxkeyix = *keyix;
return 1;

Modified: head/sys/net80211/ieee80211_crypto.c
==
--- head/sys/net80211/ieee80211_crypto.cWed Dec  7 22:01:09 2016
(r309685)
+++ head/sys/net80211/ieee80211_crypto.cWed Dec  7 22:16:07 2016
(r309686)
@@ -78,7 +78,7 @@ null_key_alloc(struct ieee80211vap *vap,
return 0;
*keyix = 0; /* NB: use key index 0 for ucast key */
} else {
-   *keyix = k - vap->iv_nw_keys;
+   *keyix = ieee80211_crypto_get_key_wepidx(vap, k);
}
*rxkeyix = IEEE80211_KEYIX_NONE;/* XXX maybe *keyix? */
return 1;
___
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: r309658 - head/sys/vm

2016-12-07 Thread Mark Johnston
On Wed, Dec 07, 2016 at 01:26:47PM -0800, Gleb Smirnoff wrote:
> On Tue, Dec 06, 2016 at 10:52:45PM +, Mark Johnston wrote:
> M> Author: markj
> M> Date: Tue Dec  6 22:52:45 2016
> M> New Revision: 309658
> M> URL: https://svnweb.freebsd.org/changeset/base/309658
> M> 
> M> Log:
> M>   Provide dummy sysctls for v_cache_count and v_tcached.
> M>   
> M>   Some utilities (notably top(1)) exit if any of their input sysctls don't
> M>   exist, and the removal of the above-mentioned PG_CACHE-related sysctls
> M>   makes it difficult to run such utilities on different versions of the
> M>   kernel without recompiling.
> M>   
> M>   Requested by:bde
> M> 
> M> Modified:
> M>   head/sys/vm/vm_meter.c
> M> 
> M> Modified: head/sys/vm/vm_meter.c
> M> 
> ==
> M> --- head/sys/vm/vm_meter.c Tue Dec  6 22:48:28 2016(r309657)
> M> +++ head/sys/vm/vm_meter.c Tue Dec  6 22:52:45 2016(r309658)
> M> @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec
> M>  VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()");
> M>  VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()");
> M>  VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel");
> M> +
> M> +#ifndef BURN_BRIDGES
> M> +/*
> M> + * Provide compatibility sysctls for the benefit of old utilities which 
> exit
> M> + * with an error if they cannot be found.
> M> + */
> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> M> +#endif
> 
> IMHO, there should be some garbage collecting timeout for them. I'd suggest to
> delete them from head after stable/12 branch is forked.

The intent was to improve compatibility with old userlands, not just to
help bridge the transition from 11.0 to 12.0. In general I'm all for
removing cruft, but these sysctls are unobtrusive and I don't see any
reason to remove them in a specific time frame provided that nothing
else breaks compatibility for top(1) (and vmstat(8)). Please feel free
to add a timeout if you still disagree, though.
___
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: r309685 - head/sys/netinet

2016-12-07 Thread Michael Tuexen
Author: tuexen
Date: Wed Dec  7 22:01:09 2016
New Revision: 309685
URL: https://svnweb.freebsd.org/changeset/base/309685

Log:
  Silence a warning produced by newer versions of gcc.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Dec  7 21:47:14 2016
(r309684)
+++ head/sys/netinet/sctp_output.c  Wed Dec  7 22:01:09 2016
(r309685)
@@ -10350,8 +10350,10 @@ sctp_fill_in_rest:
 */
if (asoc->idata_supported) {
strseq_m = (struct sctp_strseq_mid *)fwdtsn;
+   strseq = NULL;
} else {
strseq = (struct sctp_strseq *)fwdtsn;
+   strseq_m = NULL;
}
/*-
 * Now populate the strseq list. This is done blindly
___
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: r309684 - head/sbin/nvmecontrol

2016-12-07 Thread Warner Losh
Author: imp
Date: Wed Dec  7 21:47:14 2016
New Revision: 309684
URL: https://svnweb.freebsd.org/changeset/base/309684

Log:
  Fix Typo

Modified:
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Wed Dec  7 21:24:49 2016
(r309683)
+++ head/sbin/nvmecontrol/logpage.c Wed Dec  7 21:47:14 2016
(r309684)
@@ -113,7 +113,7 @@ uint128_to_str(uint128_t u, char *buf, s
return end;
 }
 
-/* "fMissing" from endian.h */
+/* "Missing" from endian.h */
 static __inline uint64_t
 le48dec(const void *pp)
 {
___
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: r309658 - head/sys/vm

2016-12-07 Thread Warner Losh
On Wed, Dec 7, 2016 at 2:26 PM, Gleb Smirnoff  wrote:
> On Tue, Dec 06, 2016 at 10:52:45PM +, Mark Johnston wrote:
> M> Author: markj
> M> Date: Tue Dec  6 22:52:45 2016
> M> New Revision: 309658
> M> URL: https://svnweb.freebsd.org/changeset/base/309658
> M>
> M> Log:
> M>   Provide dummy sysctls for v_cache_count and v_tcached.
> M>
> M>   Some utilities (notably top(1)) exit if any of their input sysctls don't
> M>   exist, and the removal of the above-mentioned PG_CACHE-related sysctls
> M>   makes it difficult to run such utilities on different versions of the
> M>   kernel without recompiling.
> M>
> M>   Requested by:  bde
> M>
> M> Modified:
> M>   head/sys/vm/vm_meter.c
> M>
> M> Modified: head/sys/vm/vm_meter.c
> M> 
> ==
> M> --- head/sys/vm/vm_meter.c   Tue Dec  6 22:48:28 2016(r309657)
> M> +++ head/sys/vm/vm_meter.c   Tue Dec  6 22:52:45 2016(r309658)
> M> @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec
> M>  VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()");
> M>  VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()");
> M>  VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel");
> M> +
> M> +#ifndef BURN_BRIDGES
> M> +/*
> M> + * Provide compatibility sysctls for the benefit of old utilities which 
> exit
> M> + * with an error if they cannot be found.
> M> + */
> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
> M> +(u_int *)NULL, 0, "Dummy for compatibility");
> M> +#endif
>
> IMHO, there should be some garbage collecting timeout for them. I'd suggest to
> delete them from head after stable/12 branch is forked.

Other places define #if BURN_BRUDGES < 120 to make this automatic.

Warner
___
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: r309667 - head/sys/net80211

2016-12-07 Thread Adrian Chadd
gr :(


-a


On 6 December 2016 at 22:29, Xin LI  wrote:
> Author: delphij
> Date: Wed Dec  7 06:29:01 2016
> New Revision: 309667
> URL: https://svnweb.freebsd.org/changeset/base/309667
>
> Log:
>   Fix typo.
>
> Modified:
>   head/sys/net80211/ieee80211_crypto.c
>
> Modified: head/sys/net80211/ieee80211_crypto.c
> ==
> --- head/sys/net80211/ieee80211_crypto.cWed Dec  7 04:23:08 2016  
>   (r309666)
> +++ head/sys/net80211/ieee80211_crypto.cWed Dec  7 06:29:01 2016  
>   (r309667)
> @@ -534,7 +534,7 @@ ieee80211_crypto_get_key_wepidx(const st
> if (k >= >iv_nw_keys[0] &&
> k <  >iv_nw_keys[IEEE80211_WEP_NKID])
> return (k - vap->iv_nw_keys);
> -   return (-1):
> +   return (-1);
>  }
>
>  /*
>
___
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: r309658 - head/sys/vm

2016-12-07 Thread Gleb Smirnoff
On Tue, Dec 06, 2016 at 10:52:45PM +, Mark Johnston wrote:
M> Author: markj
M> Date: Tue Dec  6 22:52:45 2016
M> New Revision: 309658
M> URL: https://svnweb.freebsd.org/changeset/base/309658
M> 
M> Log:
M>   Provide dummy sysctls for v_cache_count and v_tcached.
M>   
M>   Some utilities (notably top(1)) exit if any of their input sysctls don't
M>   exist, and the removal of the above-mentioned PG_CACHE-related sysctls
M>   makes it difficult to run such utilities on different versions of the
M>   kernel without recompiling.
M>   
M>   Requested by:  bde
M> 
M> Modified:
M>   head/sys/vm/vm_meter.c
M> 
M> Modified: head/sys/vm/vm_meter.c
M> 
==
M> --- head/sys/vm/vm_meter.c   Tue Dec  6 22:48:28 2016(r309657)
M> +++ head/sys/vm/vm_meter.c   Tue Dec  6 22:52:45 2016(r309658)
M> @@ -314,3 +314,14 @@ VM_STATS_VM(v_forkpages, "VM pages affec
M>  VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()");
M>  VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()");
M>  VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel");
M> +
M> +#ifndef BURN_BRIDGES
M> +/*
M> + * Provide compatibility sysctls for the benefit of old utilities which exit
M> + * with an error if they cannot be found.
M> + */
M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_cache_count, CTLFLAG_RD,
M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> +SYSCTL_UINT(_vm_stats_vm, OID_AUTO, v_tcached, CTLFLAG_RD,
M> +(u_int *)NULL, 0, "Dummy for compatibility");
M> +#endif

IMHO, there should be some garbage collecting timeout for them. I'd suggest to
delete them from head after stable/12 branch is forked.

-- 
Totus tuus, Glebius.
___
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: r309683 - head/lib/libc/net

2016-12-07 Thread Michael Tuexen
Author: tuexen
Date: Wed Dec  7 21:24:49 2016
New Revision: 309683
URL: https://svnweb.freebsd.org/changeset/base/309683

Log:
  Fix a bug in sctp_sendmsgx(), where the sid provided by the user
  was hot honored.
  
  MFC after:3 days

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Wed Dec  7 19:30:59 2016
(r309682)
+++ head/lib/libc/net/sctp_sys_calls.c  Wed Dec  7 21:24:49 2016
(r309683)
@@ -797,7 +797,7 @@ sctp_sendmsgx(int sd,
memset((void *), 0, sizeof(struct sctp_sndrcvinfo));
sinfo.sinfo_ppid = ppid;
sinfo.sinfo_flags = flags;
-   sinfo.sinfo_ssn = stream_no;
+   sinfo.sinfo_stream = stream_no;
sinfo.sinfo_timetolive = timetolive;
sinfo.sinfo_context = context;
return (sctp_sendx(sd, msg, len, addrs, addrcnt, , 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"


Re: svn commit: r309394 - head/sys/netpfil/pf

2016-12-07 Thread Gleb Smirnoff
  Marcel,

  thanks for the fixes. While the problem with the first chunk
in pfsync_sendout() is obvious, the problem you are fixing in th
second chunk in the pfsync_delete_state() is not clear to me.
Can you please explain what scenario are you fixing there?

On Fri, Dec 02, 2016 at 06:15:59AM +, Marcel Moolenaar wrote:
M> Author: marcel
M> Date: Fri Dec  2 06:15:59 2016
M> New Revision: 309394
M> URL: https://svnweb.freebsd.org/changeset/base/309394
M> 
M> Log:
M>   Fix use-after-free bugs in pfsync(4)
M>   
M>   Use after free happens for state that is deleted. The reference
M>   count is what prevents the state from being freed. When the
M>   state is dequeued, the reference count is dropped and the memory
M>   freed. We can't dereference the next pointer or re-queue the
M>   state.
M>   
M>   MFC after: 1 week
M>   Differential Revision: https://reviews.freebsd.org/D8671
M> 
M> Modified:
M>   head/sys/netpfil/pf/if_pfsync.c
M> 
M> Modified: head/sys/netpfil/pf/if_pfsync.c
M> 
==
M> --- head/sys/netpfil/pf/if_pfsync.c  Fri Dec  2 06:07:27 2016
(r309393)
M> +++ head/sys/netpfil/pf/if_pfsync.c  Fri Dec  2 06:15:59 2016
(r309394)
M> @@ -1509,7 +1509,7 @@ pfsync_sendout(int schedswi)
M>  struct ip *ip;
M>  struct pfsync_header *ph;
M>  struct pfsync_subheader *subh;
M> -struct pf_state *st;
M> +struct pf_state *st, *st_next;
M>  struct pfsync_upd_req_item *ur;
M>  int offset;
M>  int q, count = 0;
M> @@ -1559,7 +1559,7 @@ pfsync_sendout(int schedswi)
M>  offset += sizeof(*subh);
M>  
M>  count = 0;
M> -TAILQ_FOREACH(st, >sc_qs[q], sync_list) {
M> +TAILQ_FOREACH_SAFE(st, >sc_qs[q], sync_list, st_next) {
M>  KASSERT(st->sync_state == q,
M>  ("%s: st->sync_state == q",
M>  __func__));
M> @@ -1931,6 +1931,8 @@ pfsync_delete_state(struct pf_state *st)
M>  if (sc->sc_len == PFSYNC_MINPKT)
M>  callout_reset(>sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif);
M>  
M> +pf_ref_state(st);
M> +
M>  switch (st->sync_state) {
M>  case PFSYNC_S_INS:
M>  /* We never got to tell the world so just forget about it. */
M> @@ -1950,6 +1952,9 @@ pfsync_delete_state(struct pf_state *st)
M>  default:
M>  panic("%s: unexpected sync state %d", __func__, st->sync_state);
M>  }
M> +
M> +pf_release_state(st);
M> +
M>  PFSYNC_UNLOCK(sc);
M>  }
M>  
M> ___
M> svn-src-all@freebsd.org mailing list
M> https://lists.freebsd.org/mailman/listinfo/svn-src-all
M> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

-- 
Totus tuus, Glebius.
___
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: r309143 - head/sys/libkern

2016-12-07 Thread Gleb Smirnoff
On Fri, Nov 25, 2016 at 05:00:10PM +0100, Mateusz Guzik wrote:
M> On Fri, Nov 25, 2016 at 01:49:33PM +, Fabien Thomas wrote:
M> > Author: fabient
M> > Date: Fri Nov 25 13:49:33 2016
M> > New Revision: 309143
M> > URL: https://svnweb.freebsd.org/changeset/base/309143
M> > 
M> > Log:
M> >   In a dual processor system (2*6 cores) during IPSec throughput tests,
M> >   we see a lot of contention on the arc4 lock, used to generate the IV
M> >   of the ESP output packets.
M> >   
M> >   The idea of this patch is to split this mutex in order to reduce the
M> >   contention on this lock.
M> >   
M> > +MALLOC_DEFINE(M_ARC4RANDOM, "arc4random", "arc4random structures");
M> >  
M> > -static u_int8_t arc4_randbyte(void);
M> > +struct arc4_s {
M> > +  u_int8_t i, j;
M> > +  int numruns;
M> > +  u_int8_t sbox[256];
M> > +  time_t t_reseed;
M> > +
M> > +  struct mtx mtx;
M> > +};
M> > +
M> 
M> Why is the lock at the end? Right now you got false sharing with the
M> next entry.
M> 
M> That said, I suggest:
M> 1. moving thelock to the beginning
M> 2. annotating the struct with __aligned(CACHE_LINE_SIZE)

It could be even better not to allocate them with regular malloc at all,
but to put them into the per cpu areas. I haven't tried, but looks like
the DPCPU mechanism defined in sys/pcpu.h would fit that well.

-- 
Totus tuus, Glebius.
___
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: r309682 - head/sys/netinet

2016-12-07 Thread Michael Tuexen
Author: tuexen
Date: Wed Dec  7 19:30:59 2016
New Revision: 309682
URL: https://svnweb.freebsd.org/changeset/base/309682

Log:
  Cleanup the names of SSN, SID, TSN, FSN, PPID and MID.
  
  This made a couple of bugs visible in handling SSN wrap-arounds
  when using DATA chunks. Now bulk transfer seems to work fine...
  This fixes the issue reported in
  https://github.com/sctplab/usrsctp/issues/111
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_indata.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_ss_functions.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctp_var.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_cc_functions.c
==
--- head/sys/netinet/sctp_cc_functions.cWed Dec  7 19:01:38 2016
(r309681)
+++ head/sys/netinet/sctp_cc_functions.cWed Dec  7 19:30:59 2016
(r309682)
@@ -205,7 +205,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc
/* Mark end of the window */
asoc->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   asoc->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   asoc->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
/*
@@ -218,7 +218,7 @@ sctp_cwnd_update_after_fr(struct sctp_tc
/* Mark end of the window */
net->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   net->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   net->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
@@ -1698,7 +1698,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp
/* Mark end of the window */
asoc->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   asoc->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   asoc->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
/*
@@ -1711,7 +1711,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp
/* Mark end of the window */
net->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   net->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   net->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,
@@ -2228,7 +2228,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc
/* Mark end of the window */
asoc->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   asoc->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   asoc->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
/*
@@ -2241,7 +2241,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc
/* Mark end of the window */
net->fast_recovery_tsn = 
asoc->sending_seq - 1;
} else {
-   net->fast_recovery_tsn = 
lchk->rec.data.TSN_seq - 1;
+   net->fast_recovery_tsn = 
lchk->rec.data.tsn - 1;
}
 
sctp_timer_stop(SCTP_TIMER_TYPE_SEND,

Modified: head/sys/netinet/sctp_constants.h
==
--- head/sys/netinet/sctp_constants.h   Wed Dec  7 19:01:38 2016
(r309681)
+++ head/sys/netinet/sctp_constants.h   Wed Dec  7 19:30:59 2016
(r309682)
@@ -898,8 +898,9 @@ __FBSDID("$FreeBSD$");
 #define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b)
 #define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b)
 #define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b)
-#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, 
(uint16_t)b) : 

svn commit: r309681 - stable/9/release/doc/share/xml

2016-12-07 Thread Glen Barber
Author: gjb
Date: Wed Dec  7 19:01:38 2016
New Revision: 309681
URL: https://svnweb.freebsd.org/changeset/base/309681

Log:
  Fix whitespace nit, not functional changes.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/release/doc/share/xml/security.xml

Modified: stable/9/release/doc/share/xml/security.xml
==
--- stable/9/release/doc/share/xml/security.xml Wed Dec  7 18:55:55 2016
(r309680)
+++ stable/9/release/doc/share/xml/security.xml Wed Dec  7 19:01:38 2016
(r309681)
@@ -527,7 +527,6 @@
6December2016
 buffer overflow
   
-
 
   
 
___
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: r309680 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml 9/release/doc/share/xml

2016-12-07 Thread Glen Barber
Author: gjb
Date: Wed Dec  7 18:55:55 2016
New Revision: 309680
URL: https://svnweb.freebsd.org/changeset/base/309680

Log:
  Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/release/doc/share/xml/errata.xml
  stable/10/release/doc/share/xml/security.xml

Changes in other areas also in this revision:
Modified:
  stable/11/release/doc/share/xml/errata.xml
  stable/11/release/doc/share/xml/security.xml
  stable/9/release/doc/share/xml/errata.xml
  stable/9/release/doc/share/xml/security.xml

Modified: stable/10/release/doc/share/xml/errata.xml
==
--- stable/10/release/doc/share/xml/errata.xml  Wed Dec  7 18:33:40 2016
(r309679)
+++ stable/10/release/doc/share/xml/errata.xml  Wed Dec  7 18:55:55 2016
(r309680)
@@ -111,6 +111,22 @@
25October2016
Several virtual memory issues
   
+
+  
+   FreeBSD-EN-16:19.tzcode
+   6December2016
+   Fix warnings about invalid timezone
+   abbreviations
+  
+
+  
+   FreeBSD-EN-16:20.tzdata
+   6December2016
+   Update timezone database
+   information
+  
 
   
 

Modified: stable/10/release/doc/share/xml/security.xml
==
--- stable/10/release/doc/share/xml/security.xmlWed Dec  7 18:33:40 
2016(r309679)
+++ stable/10/release/doc/share/xml/security.xmlWed Dec  7 18:55:55 
2016(r309680)
@@ -147,6 +147,29 @@
Remote Denial of Service
vulnerability
   
+
+  
+   FreeBSD-SA-16:36.telnetd
+   6December2016
+   Possible  argument
+   injection
+  
+
+  
+   FreeBSD-SA-16:37.libc
+   6December2016
+buffer overflow
+  
+
+  
+   FreeBSD-SA-16:38.bhyve
+   6December2016
+   Possible escape from  virtual
+ machine
+  
 
   
 
___
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: r309680 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml 9/release/doc/share/xml

2016-12-07 Thread Glen Barber
Author: gjb
Date: Wed Dec  7 18:55:55 2016
New Revision: 309680
URL: https://svnweb.freebsd.org/changeset/base/309680

Log:
  Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/share/xml/errata.xml
  stable/11/release/doc/share/xml/security.xml

Changes in other areas also in this revision:
Modified:
  stable/10/release/doc/share/xml/errata.xml
  stable/10/release/doc/share/xml/security.xml
  stable/9/release/doc/share/xml/errata.xml
  stable/9/release/doc/share/xml/security.xml

Modified: stable/11/release/doc/share/xml/errata.xml
==
--- stable/11/release/doc/share/xml/errata.xml  Wed Dec  7 18:33:40 2016
(r309679)
+++ stable/11/release/doc/share/xml/errata.xml  Wed Dec  7 18:55:55 2016
(r309680)
@@ -24,6 +24,30 @@
25October2016
Loader may hang during boot
   
+
+  
+   FreeBSD-EN-16:19.tzcode
+   6December2016
+   Fix warnings about invalid timezone
+   abbreviations
+  
+
+  
+   FreeBSD-EN-16:20.tzdata
+   6December2016
+   Update timezone database
+   information
+  
+
+  
+   FreeBSD-EN-16:21.localedef
+   6December2016
+   Fix incorrectly defined unicode
+   characters
+  
 
   
 

Modified: stable/11/release/doc/share/xml/security.xml
==
--- stable/11/release/doc/share/xml/security.xmlWed Dec  7 18:33:40 
2016(r309679)
+++ stable/11/release/doc/share/xml/security.xmlWed Dec  7 18:55:55 
2016(r309680)
@@ -32,6 +32,29 @@
Remote Denial of Service
vulnerability
   
+
+  
+   FreeBSD-SA-16:36.telnetd
+   6December2016
+   Possible  argument
+   injection
+  
+
+  
+   FreeBSD-SA-16:37.libc
+   6December2016
+buffer overflow
+  
+
+  
+   FreeBSD-SA-16:38.bhyve
+   6December2016
+   Possible escape from  virtual
+ machine
+  
 
   
 
___
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: r309680 - in stable: 10/release/doc/share/xml 11/release/doc/share/xml 9/release/doc/share/xml

2016-12-07 Thread Glen Barber
Author: gjb
Date: Wed Dec  7 18:55:55 2016
New Revision: 309680
URL: https://svnweb.freebsd.org/changeset/base/309680

Log:
  Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/release/doc/share/xml/errata.xml
  stable/9/release/doc/share/xml/security.xml

Changes in other areas also in this revision:
Modified:
  stable/10/release/doc/share/xml/errata.xml
  stable/10/release/doc/share/xml/security.xml
  stable/11/release/doc/share/xml/errata.xml
  stable/11/release/doc/share/xml/security.xml

Modified: stable/9/release/doc/share/xml/errata.xml
==
--- stable/9/release/doc/share/xml/errata.xml   Wed Dec  7 18:33:40 2016
(r309679)
+++ stable/9/release/doc/share/xml/errata.xml   Wed Dec  7 18:55:55 2016
(r309680)
@@ -162,6 +162,22 @@
Fix  support of
11.0-RELEASE
   
+
+  
+   FreeBSD-EN-16:19.tzcode
+   6December2016
+   Fix warnings about invalid timezone
+   abbreviations
+  
+
+  
+   FreeBSD-EN-16:20.tzdata
+   6December2016
+   Update timezone database
+   information
+  
 
   
 

Modified: stable/9/release/doc/share/xml/security.xml
==
--- stable/9/release/doc/share/xml/security.xml Wed Dec  7 18:33:40 2016
(r309679)
+++ stable/9/release/doc/share/xml/security.xml Wed Dec  7 18:55:55 2016
(r309680)
@@ -512,6 +512,22 @@
Remote Denial of Service
vulnerability
   
+
+  
+   FreeBSD-SA-16:36.telnetd
+   6December2016
+   Possible  argument
+   injection
+  
+
+  
+   FreeBSD-SA-16:37.libc
+   6December2016
+buffer overflow
+  
+
 
   
 
___
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: r309679 - head/contrib/elftoolchain/readelf

2016-12-07 Thread Conrad E. Meyer
Author: cem
Date: Wed Dec  7 18:33:40 2016
New Revision: 309679
URL: https://svnweb.freebsd.org/changeset/base/309679

Log:
  readelf(1) -S: Include zero index and match binutils' no-name
  
  Include the SHN_UNDEF (zero) index special section in extended-attribute
  ELF files, like GNU binutils' readelf.
  
  Additionally, print "" for sections without names, like GNU
  binutils.
  
  Reviewed by:  kaiw@
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D8707

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==
--- head/contrib/elftoolchain/readelf/readelf.c Wed Dec  7 16:12:27 2016
(r309678)
+++ head/contrib/elftoolchain/readelf/readelf.c Wed Dec  7 18:33:40 2016
(r309679)
@@ -6557,13 +6557,14 @@ load_sections(struct readelf *re)
}
if ((name = elf_strptr(re->elf, shstrndx, sh.sh_name)) == NULL) 
{
(void) elf_errno();
-   name = "ERROR";
+   name = "";
}
if ((ndx = elf_ndxscn(scn)) == SHN_UNDEF) {
-   if ((elferr = elf_errno()) != 0)
+   if ((elferr = elf_errno()) != 0) {
warnx("elf_ndxscn failed: %s",
elf_errmsg(elferr));
-   continue;
+   continue;
+   }
}
if (ndx >= re->shnum) {
warnx("section index of '%s' out of range", name);
___
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: r309678 - in head/sys: kern sys

2016-12-07 Thread Robert Watson
Author: rwatson
Date: Wed Dec  7 16:12:27 2016
New Revision: 309678
URL: https://svnweb.freebsd.org/changeset/base/309678

Log:
  Regnerate system-call definitions following r309677 correcting a whitespace
  glitch in syscalls.master.

Modified:
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Wed Dec  7 16:11:55 2016(r309677)
+++ head/sys/kern/init_sysent.c Wed Dec  7 16:12:27 2016(r309678)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 304395 2016-08-18 
10:50:40Z gnn 
+ * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 
16:11:55Z rwatson
  */
 
 #include "opt_compat.h"

Modified: head/sys/kern/syscalls.c
==
--- head/sys/kern/syscalls.cWed Dec  7 16:11:55 2016(r309677)
+++ head/sys/kern/syscalls.cWed Dec  7 16:12:27 2016(r309678)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 304395 2016-08-18 
10:50:40Z gnn 
+ * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 
16:11:55Z rwatson
  */
 
 const char *syscallnames[] = {

Modified: head/sys/sys/syscall.h
==
--- head/sys/sys/syscall.h  Wed Dec  7 16:11:55 2016(r309677)
+++ head/sys/sys/syscall.h  Wed Dec  7 16:12:27 2016(r309678)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 304395 2016-08-18 
10:50:40Z gnn 
+ * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 
16:11:55Z rwatson
  */
 
 #defineSYS_syscall 0

Modified: head/sys/sys/syscall.mk
==
--- head/sys/sys/syscall.mk Wed Dec  7 16:11:55 2016(r309677)
+++ head/sys/sys/syscall.mk Wed Dec  7 16:12:27 2016(r309678)
@@ -1,7 +1,7 @@
 # FreeBSD system call object files.
 # DO NOT EDIT-- this file is automatically generated.
 # $FreeBSD$
-# created from FreeBSD: head/sys/kern/syscalls.master 304395 2016-08-18 
10:50:40Z gnn 
+# created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 
16:11:55Z rwatson
 MIASM =  \
syscall.o \
exit.o \

Modified: head/sys/sys/sysproto.h
==
--- head/sys/sys/sysproto.h Wed Dec  7 16:11:55 2016(r309677)
+++ head/sys/sys/sysproto.h Wed Dec  7 16:12:27 2016(r309678)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/kern/syscalls.master 304395 2016-08-18 
10:50:40Z gnn 
+ * created from FreeBSD: head/sys/kern/syscalls.master 309677 2016-12-07 
16:11:55Z rwatson
  */
 
 #ifndef _SYS_SYSPROTO_H_
___
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: r309677 - head/sys/kern

2016-12-07 Thread Robert Watson
Author: rwatson
Date: Wed Dec  7 16:11:55 2016
New Revision: 309677
URL: https://svnweb.freebsd.org/changeset/base/309677

Log:
  Replace spaces with tabs in definition of SCTP system calls, for consistency
  with the remainder of the syscalls.master file.  This problem does not occur
  in the freebsd32 version of the same system calls.

Modified:
  head/sys/kern/syscalls.master

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Wed Dec  7 15:04:22 2016
(r309676)
+++ head/sys/kern/syscalls.master   Wed Dec  7 16:11:55 2016
(r309677)
@@ -838,13 +838,13 @@
 469AUE_NULLUNIMPL  __getpath_fromfd
 470AUE_NULLUNIMPL  __getpath_fromaddr
 471AUE_NULLNOSTD   { int sctp_peeloff(int sd, uint32_t name); }
-472 AUE_NULLNOSTD  { int sctp_generic_sendmsg(int sd, caddr_t msg, 
int mlen, \
-   caddr_t to, __socklen_t tolen, \
+472AUE_NULLNOSTD   { int sctp_generic_sendmsg(int sd, caddr_t msg, 
int mlen, \
+   caddr_t to, __socklen_t tolen, \
struct sctp_sndrcvinfo *sinfo, int flags); }
-473 AUE_NULLNOSTD  { int sctp_generic_sendmsg_iov(int sd, struct 
iovec *iov, int iovlen, \
-   caddr_t to, __socklen_t tolen, \
+473AUE_NULLNOSTD   { int sctp_generic_sendmsg_iov(int sd, struct 
iovec *iov, int iovlen, \
+   caddr_t to, __socklen_t tolen, \
struct sctp_sndrcvinfo *sinfo, int flags); }
-474 AUE_NULLNOSTD  { int sctp_generic_recvmsg(int sd, struct iovec 
*iov, int iovlen, \
+474AUE_NULLNOSTD   { int sctp_generic_recvmsg(int sd, struct iovec 
*iov, int iovlen, \
struct sockaddr * from, __socklen_t 
*fromlenaddr, \
struct sctp_sndrcvinfo *sinfo, int 
*msg_flags); }
 475AUE_PREAD   STD { ssize_t pread(int fd, void *buf, \
___
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: r309676 - in head: bin/ps lib/libkvm sys/compat/freebsd32 sys/kern sys/sys usr.bin/procstat usr.bin/top

2016-12-07 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Dec  7 15:04:22 2016
New Revision: 309676
URL: https://svnweb.freebsd.org/changeset/base/309676

Log:
  Export the whole thread name in kinfo_proc
  
  kinfo_proc::ki_tdname is three characters shorter than
  thread::td_name.  Add a ki_moretdname field for these three
  extra characters.  Add the new field to kinfo_proc32, as well.
  Update all in-tree consumers to read the new field and assemble
  the full name, except for lldb's HostThreadFreeBSD.cpp, which
  I will handle separately.  Bump __FreeBSD_version.
  
  Reviewed by:  kib
  MFC after:1 week
  Relnotes: yes
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D8722

Modified:
  head/bin/ps/print.c
  head/lib/libkvm/kvm_proc.c
  head/sys/compat/freebsd32/freebsd32.h
  head/sys/kern/kern_proc.c
  head/sys/sys/param.h
  head/sys/sys/user.h
  head/usr.bin/procstat/procstat.c
  head/usr.bin/procstat/procstat.h
  head/usr.bin/procstat/procstat_cs.c
  head/usr.bin/procstat/procstat_kstack.c
  head/usr.bin/procstat/procstat_threads.c
  head/usr.bin/top/machine.c

Modified: head/bin/ps/print.c
==
--- head/bin/ps/print.c Wed Dec  7 14:35:05 2016(r309675)
+++ head/bin/ps/print.c Wed Dec  7 15:04:22 2016(r309676)
@@ -120,11 +120,12 @@ command(KINFO *k, VARENT *ve)
if (cflag) {
/* If it is the last field, then don't pad */
if (STAILQ_NEXT(ve, next_ve) == NULL) {
-   asprintf(, "%s%s%s%s",
+   asprintf(, "%s%s%s%s%s",
k->ki_d.prefix ? k->ki_d.prefix : "",
k->ki_p->ki_comm,
(showthreads && k->ki_p->ki_numthreads > 1) ? "/" : 
"",
-   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "");
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "",
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_moretdname : "");
} else
str = strdup(k->ki_p->ki_comm);
 
@@ -172,14 +173,16 @@ ucomm(KINFO *k, VARENT *ve)
char *str;
 
if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */
-   asprintf(, "%s%s%s%s",
+   asprintf(, "%s%s%s%s%s",
k->ki_d.prefix ? k->ki_d.prefix : "",
k->ki_p->ki_comm,
(showthreads && k->ki_p->ki_numthreads > 1) ? "/" : "",
-   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "");
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_tdname : "",
+   (showthreads && k->ki_p->ki_numthreads > 1) ? 
k->ki_p->ki_moretdname : "");
} else {
if (showthreads && k->ki_p->ki_numthreads > 1)
-   asprintf(, "%s/%s", k->ki_p->ki_comm, 
k->ki_p->ki_tdname);
+   asprintf(, "%s/%s%s", k->ki_p->ki_comm,
+   k->ki_p->ki_tdname, k->ki_p->ki_moretdname);
else
str = strdup(k->ki_p->ki_comm);
}
@@ -192,7 +195,8 @@ tdnam(KINFO *k, VARENT *ve __unused)
char *str;
 
if (showthreads && k->ki_p->ki_numthreads > 1)
-   str = strdup(k->ki_p->ki_tdname);
+   asprintf(, "%s%s", k->ki_p->ki_tdname,
+   k->ki_p->ki_moretdname);
else
str = strdup("  ");
 

Modified: head/lib/libkvm/kvm_proc.c
==
--- head/lib/libkvm/kvm_proc.c  Wed Dec  7 14:35:05 2016(r309675)
+++ head/lib/libkvm/kvm_proc.c  Wed Dec  7 15:04:22 2016(r309676)
@@ -426,8 +426,6 @@ nopgrp:
kp->ki_pri.pri_native = mtd.td_base_pri;
kp->ki_lastcpu = mtd.td_lastcpu;
kp->ki_wchan = mtd.td_wchan;
-   if (mtd.td_name[0] != 0)
-   strlcpy(kp->ki_tdname, mtd.td_name, MAXCOMLEN);
kp->ki_oncpu = mtd.td_oncpu;
if (mtd.td_name[0] != '\0')
strlcpy(kp->ki_tdname, mtd.td_name, 
sizeof(kp->ki_tdname));

Modified: head/sys/compat/freebsd32/freebsd32.h
==
--- head/sys/compat/freebsd32/freebsd32.h   Wed Dec  7 14:35:05 2016
(r309675)
+++ head/sys/compat/freebsd32/freebsd32.h   Wed Dec  7 15:04:22 2016
(r309676)
@@ -315,7 +315,8 @@ struct kinfo_proc32 {
charki_comm[COMMLEN+1];
charki_emul[KI_EMULNAMELEN+1];
charki_loginclass[LOGINCLASSLEN+1];
-   charki_sparestrings[50];
+   charki_moretdname[MAXCOMLEN-TDNAMLEN+1];
+   char

Re: svn commit: r309639 - head/lib/libc/net

2016-12-07 Thread Shawn Webb
On Tue, Dec 06, 2016 at 06:50:34PM +, Gleb Smirnoff wrote:
> Author: glebius
> Date: Tue Dec  6 18:50:33 2016
> New Revision: 309639
> URL: https://svnweb.freebsd.org/changeset/base/309639
> 
> Log:
>   Fix possible buffer overflow(s) in link_ntoa(3).
>   
>   A specially crafted sockaddr_dl argument can trigger a static buffer 
> overflow
>   in the libc library, with possibility to rewrite with arbitrary data 
> following
>   static buffers that belong to other library functions.
>   
>   Reviewed by:kib
>   Security:   FreeBSD-SA-16:37.libc
> 
> Modified:
>   head/lib/libc/net/linkaddr.c
> 
> Modified: head/lib/libc/net/linkaddr.c
> ==
> --- head/lib/libc/net/linkaddr.c  Tue Dec  6 18:50:22 2016
> (r309638)
> +++ head/lib/libc/net/linkaddr.c  Tue Dec  6 18:50:33 2016
> (r309639)
> @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -122,31 +123,47 @@ char *
>  link_ntoa(const struct sockaddr_dl *sdl)
>  {
>   static char obuf[64];
> - char *out = obuf;
> - int i;
> - u_char *in = (u_char *)LLADDR(sdl);
> - u_char *inlim = in + sdl->sdl_alen;
> - int firsttime = 1;
> -
> - if (sdl->sdl_nlen) {
> - bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen);
> - out += sdl->sdl_nlen;
> - if (sdl->sdl_alen)
> + _Static_assert(sizeof(obuf) >= IFNAMSIZ + 20, "obuf is too small");
> + char *out;
> + const char *in, *inlim;
> + int namelen, i, rem;
> +
> + namelen = (sdl->sdl_nlen <= IFNAMSIZ) ? sdl->sdl_nlen : IFNAMSIZ;
> +
> + out = obuf;
> + rem = sizeof(obuf);
> + if (namelen > 0) {
> + bcopy(sdl->sdl_data, out, namelen);
> + out += namelen;
> + rem -= namelen;
> + if (sdl->sdl_alen > 0) {
>   *out++ = ':';
> + rem--;
> + }
>   }
> - while (in < inlim) {
> - if (firsttime)
> - firsttime = 0;
> - else
> +
> + in = (const char *)sdl->sdl_data + sdl->sdl_nlen;
> + inlim = in + sdl->sdl_alen;
> +
> + while (in < inlim && rem > 1) {
> + if (in != (const char *)sdl->sdl_data + sdl->sdl_nlen) {
>   *out++ = '.';
> + rem--;
> + }
>   i = *in++;
>   if (i > 0xf) {
> - out[1] = hexlist[i & 0xf];
> + if (rem < 3)
> + break;
> + *out++ = hexlist[i & 0xf];
>   i >>= 4;
> - out[0] = hexlist[i];
> - out += 2;
> - } else
>   *out++ = hexlist[i];
> + rem -= 2;
> + } else {
> + if (rem < 2)
> + break;
> + *out++ = hexlist[i];
> + rem++;

rem++ is incorrect. It should be rem--. HardenedBSD has a fix here:

https://github.com/HardenedBSD/hardenedBSD/commit/fb823297fbced336b6beeeb624e2dc65b67aa0eb

> + }
>   }
>   *out = 0;
>   return (obuf);

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


svn commit: r309675 - head/sys/arm64/arm64

2016-12-07 Thread Andrew Turner
Author: andrew
Date: Wed Dec  7 14:35:05 2016
New Revision: 309675
URL: https://svnweb.freebsd.org/changeset/base/309675

Log:
  Add ACPI support to the arm64 mp code. We use the Multiple APIC Description
  Table to find the CPUs to find the CPUs to start. Currently we assume PSCI,
  however this assumption is shared with the FDT code.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Wed Dec  7 14:24:53 2016
(r309674)
+++ head/sys/arm64/arm64/mp_machdep.c   Wed Dec  7 14:35:05 2016
(r309675)
@@ -28,6 +28,7 @@
  *
  */
 
+#include "opt_acpi.h"
 #include "opt_kstack_pages.h"
 #include "opt_platform.h"
 
@@ -59,6 +60,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+#ifdef DEV_ACPI
+#include 
+#include 
+#endif
+
 #ifdef FDT
 #include 
 #include 
@@ -106,14 +112,12 @@ struct pcb stoppcbs[MAXCPU];
 
 static device_t cpu_list[MAXCPU];
 
-#ifdef FDT
 /*
  * Not all systems boot from the first CPU in the device tree. To work around
  * this we need to find which CPU we have booted from so when we later
  * enable the secondary CPUs we skip this one.
  */
 static int cpu0 = -1;
-#endif
 
 void mpentry(unsigned long cpuid);
 void init_secondary(uint64_t);
@@ -416,11 +420,9 @@ cpu_mp_probe(void)
return (1);
 }
 
-#ifdef FDT
-static boolean_t
-cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
+static bool
+start_cpu(u_int id, uint64_t target_cpu)
 {
-   uint64_t target_cpu;
struct pcpu *pcpup;
vm_paddr_t pa;
u_int cpuid;
@@ -428,13 +430,13 @@ cpu_init_fdt(u_int id, phandle_t node, u
 
/* Check we are able to start this cpu */
if (id > mp_maxid)
-   return (0);
+   return (false);
 
KASSERT(id < MAXCPU, ("Too many CPUs"));
 
/* We are already running on cpu 0 */
if (id == cpu0)
-   return (1);
+   return (true);
 
/*
 * Rotate the CPU IDs to put the boot CPU as CPU 0. We keep the other
@@ -454,12 +456,6 @@ cpu_init_fdt(u_int id, phandle_t node, u
M_WAITOK | M_ZERO);
dpcpu_init(dpcpu[cpuid - 1], cpuid);
 
-   target_cpu = reg[0];
-   if (addr_size == 2) {
-   target_cpu <<= 32;
-   target_cpu |= reg[1];
-   }
-
printf("Starting CPU %u (%lx)\n", cpuid, target_cpu);
pa = pmap_extract(kernel_pmap, (vm_offset_t)mpentry);
 
@@ -482,7 +478,67 @@ cpu_init_fdt(u_int id, phandle_t node, u
} else
CPU_SET(cpuid, _cpus);
 
-   return (1);
+   return (true);
+}
+
+#ifdef DEV_ACPI
+static void
+madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
+{
+   ACPI_MADT_GENERIC_INTERRUPT *intr;
+   u_int *cpuid;
+
+   switch(entry->Type) {
+   case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+   intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry;
+   cpuid = arg;
+
+   start_cpu((*cpuid), intr->ArmMpidr);
+   (*cpuid)++;
+   break;
+   default:
+   break;
+   }
+}
+
+static void
+cpu_init_acpi(void)
+{
+   ACPI_TABLE_MADT *madt;
+   vm_paddr_t physaddr;
+   u_int cpuid;
+
+   physaddr = acpi_find_table(ACPI_SIG_MADT);
+   if (physaddr == 0)
+   return;
+
+   madt = acpi_map_table(physaddr, ACPI_SIG_MADT);
+   if (madt == NULL) {
+   printf("Unable to map the MADT, not starting APs\n");
+   return;
+   }
+
+   cpuid = 0;
+   acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
+   madt_handler, );
+
+   acpi_unmap_table(madt);
+}
+#endif
+
+#ifdef FDT
+static boolean_t
+cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
+{
+   uint64_t target_cpu;
+
+   target_cpu = reg[0];
+   if (addr_size == 2) {
+   target_cpu <<= 32;
+   target_cpu |= reg[1];
+   }
+
+   return (start_cpu(id, target_cpu) ? TRUE : FALSE);
 }
 #endif
 
@@ -496,6 +552,12 @@ cpu_mp_start(void)
CPU_SET(0, _cpus);
 
switch(arm64_bus_method) {
+#ifdef DEV_ACPI
+   case ARM64_BUS_ACPI:
+   KASSERT(cpu0 >= 0, ("Current CPU was not found"));
+   cpu_init_acpi();
+   break;
+#endif
 #ifdef FDT
case ARM64_BUS_FDT:
KASSERT(cpu0 >= 0, ("Current CPU was not found"));
@@ -513,6 +575,56 @@ cpu_mp_announce(void)
 {
 }
 
+#ifdef DEV_ACPI
+static void
+cpu_count_acpi_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
+{
+   ACPI_MADT_GENERIC_INTERRUPT *intr;
+   u_int *cores = arg;
+   uint64_t mpidr_reg;
+
+   switch(entry->Type) {
+   case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
+   intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry;
+

svn commit: r309674 - in head/sys: conf dev/psci

2016-12-07 Thread Andrew Turner
Author: andrew
Date: Wed Dec  7 14:24:53 2016
New Revision: 309674
URL: https://svnweb.freebsd.org/changeset/base/309674

Log:
  Add ACPI support to the PSCI driver. This checks the Fixed ACPI Description
  Table to find if the hardware supports PSCI, and if so what method the
  kernel should use to interact with it.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files.arm64
  head/sys/dev/psci/psci.c

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Wed Dec  7 13:19:19 2016(r309673)
+++ head/sys/conf/files.arm64   Wed Dec  7 14:24:53 2016(r309674)
@@ -156,7 +156,7 @@ dev/ofw/ofw_cpu.c   optionalfdt
 dev/ofw/ofwpci.c   optionalfdt pci
 dev/pci/pci_host_generic.c optionalpci
 dev/pci/pci_host_generic_fdt.c optionalpci fdt
-dev/psci/psci.coptionalpsci fdt
+dev/psci/psci.coptionalpsci
 dev/psci/psci_arm64.S  optionalpsci
 dev/uart/uart_cpu_arm64.c  optionaluart
 dev/uart/uart_dev_pl011.c  optionaluart pl011

Modified: head/sys/dev/psci/psci.c
==
--- head/sys/dev/psci/psci.cWed Dec  7 13:19:19 2016(r309673)
+++ head/sys/dev/psci/psci.cWed Dec  7 14:24:53 2016(r309674)
@@ -43,6 +43,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_acpi.h"
+#include "opt_platform.h"
+
 #include 
 #include 
 #include 
@@ -52,11 +55,19 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
+
+#ifdef DEV_ACPI
+#include 
+#include 
+#endif
 
+#ifdef FDT
 #include 
 #include 
 #include 
 #include 
+#endif
 
 #include 
 
@@ -67,43 +78,60 @@ struct psci_softc {
uint32_tpsci_fnids[PSCI_FN_MAX];
 };
 
+#ifdef FDT
 static int psci_v0_1_init(device_t dev);
+#endif
 static int psci_v0_2_init(device_t dev);
 
 struct psci_softc *psci_softc = NULL;
 
+#ifdef __arm__
+#defineUSE_ACPI0
+#defineUSE_FDT 1
+#elif defined(__aarch64__)
+#defineUSE_ACPI(arm64_bus_method == ARM64_BUS_ACPI)
+#defineUSE_FDT (arm64_bus_method == ARM64_BUS_FDT)
+#else
+#error Unknown architecture
+#endif
+
+#ifdef FDT
 static struct ofw_compat_data compat_data[] = {
{"arm,psci-0.2",(uintptr_t)psci_v0_2_init},
{"arm,psci",(uintptr_t)psci_v0_1_init},
{NULL,  0}
 };
+#endif
 
-static int psci_probe(device_t dev);
-static int psci_attach(device_t dev);
+static int psci_attach(device_t, psci_initfn_t);
 static void psci_shutdown(void *, int);
 
-static device_method_t psci_methods[] = {
-   DEVMETHOD(device_probe, psci_probe),
-   DEVMETHOD(device_attach,psci_attach),
+#ifdef FDT
+static int psci_fdt_probe(device_t dev);
+static int psci_fdt_attach(device_t dev);
+
+static device_method_t psci_fdt_methods[] = {
+   DEVMETHOD(device_probe, psci_fdt_probe),
+   DEVMETHOD(device_attach,psci_fdt_attach),
 
DEVMETHOD_END
 };
 
-static driver_t psci_driver = {
+static driver_t psci_fdt_driver = {
"psci",
-   psci_methods,
+   psci_fdt_methods,
sizeof(struct psci_softc),
 };
 
-static devclass_t psci_devclass;
+static devclass_t psci_fdt_devclass;
 
-EARLY_DRIVER_MODULE(psci, simplebus, psci_driver, psci_devclass, 0, 0,
+EARLY_DRIVER_MODULE(psci, simplebus, psci_fdt_driver, psci_fdt_devclass, 0, 0,
 BUS_PASS_CPU + BUS_PASS_ORDER_FIRST);
-EARLY_DRIVER_MODULE(psci, ofwbus, psci_driver, psci_devclass, 0, 0,
+EARLY_DRIVER_MODULE(psci, ofwbus, psci_fdt_driver, psci_fdt_devclass, 0, 0,
 BUS_PASS_CPU + BUS_PASS_ORDER_FIRST);
 
 static psci_callfn_t
-psci_get_callfn(phandle_t node)
+psci_fdt_get_callfn(phandle_t node)
 {
char method[16];
 
@@ -121,7 +149,7 @@ psci_get_callfn(phandle_t node)
 }
 
 static int
-psci_probe(device_t dev)
+psci_fdt_probe(device_t dev)
 {
const struct ofw_compat_data *ocd;
 
@@ -138,25 +166,144 @@ psci_probe(device_t dev)
 }
 
 static int
-psci_attach(device_t dev)
+psci_fdt_attach(device_t dev)
 {
struct psci_softc *sc = device_get_softc(dev);
const struct ofw_compat_data *ocd;
psci_initfn_t psci_init;
phandle_t node;
 
-   if (psci_softc != NULL)
-   return (ENXIO);
-
ocd = ofw_bus_search_compatible(dev, compat_data);
psci_init = (psci_initfn_t)ocd->ocd_data;
-   KASSERT(psci_init != NULL, ("PSCI init function cannot be NULL"));
 
node = ofw_bus_get_node(dev);
-   sc->psci_call = psci_get_callfn(node);
+   sc->psci_call = psci_fdt_get_callfn(node);
+
+   return (psci_attach(dev, psci_init));
+}
+#endif
+
+#ifdef DEV_ACPI
+static void psci_acpi_identify(driver_t *, device_t);
+static int 

svn commit: r309673 - head/sys/dev/sound/pci

2016-12-07 Thread Ruslan Bukin
Author: br
Date: Wed Dec  7 13:19:19 2016
New Revision: 309673
URL: https://svnweb.freebsd.org/changeset/base/309673

Log:
  Style fix.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/sound/pci/hdspe-pcm.c
  head/sys/dev/sound/pci/hdspe.c

Modified: head/sys/dev/sound/pci/hdspe-pcm.c
==
--- head/sys/dev/sound/pci/hdspe-pcm.c  Wed Dec  7 09:40:06 2016
(r309672)
+++ head/sys/dev/sound/pci/hdspe-pcm.c  Wed Dec  7 13:19:19 2016
(r309673)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2012 Ruslan Bukin 
+ * Copyright (c) 2012-2016 Ruslan Bukin 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -83,10 +83,14 @@ static int
 hdspe_hw_mixer(struct sc_chinfo *ch, unsigned int dst,
 unsigned int src, unsigned short data)
 {
-   struct sc_pcminfo *scp = ch->parent;
-   struct sc_info *sc = scp->sc;
-   int offs = 0;
+   struct sc_pcminfo *scp;
+   struct sc_info *sc;
+   int offs;
 
+   scp = ch->parent;
+   sc = scp->sc;
+
+   offs = 0;
if (ch->dir == PCMDIR_PLAY)
offs = 64;
 
@@ -94,7 +98,7 @@ hdspe_hw_mixer(struct sc_chinfo *ch, uns
((offs + src + 128 * dst) * sizeof(uint32_t)),
data & 0x);
 
-   return 0;
+   return (0);
 };
 
 static int
@@ -106,18 +110,20 @@ hdspechan_setgain(struct sc_chinfo *ch)
hdspe_hw_mixer(ch, ch->rslot, ch->rslot,
ch->rvol * HDSPE_MAX_GAIN / 100);
 
-   return 0;
+   return (0);
 }
 
 static int
 hdspemixer_init(struct snd_mixer *m)
 {
-   struct sc_pcminfo *scp = mix_getdevinfo(m);
-   struct sc_info *sc = scp->sc;
+   struct sc_pcminfo *scp;
+   struct sc_info *sc;
int mask;
 
+   scp = mix_getdevinfo(m);
+   sc = scp->sc;
if (sc == NULL)
-   return -1;
+   return (-1);
 
mask = SOUND_MASK_PCM;
 
@@ -132,20 +138,22 @@ hdspemixer_init(struct snd_mixer *m)
mix_setdevs(m, mask);
snd_mtxunlock(sc->lock);
 
-   return 0;
+   return (0);
 }
 
 static int
 hdspemixer_set(struct snd_mixer *m, unsigned dev,
 unsigned left, unsigned right)
 {
-   struct sc_pcminfo *scp = mix_getdevinfo(m);
+   struct sc_pcminfo *scp;
struct sc_chinfo *ch;
int i;
 
+   scp = mix_getdevinfo(m);
+
 #if 0
device_printf(scp->dev, "hdspemixer_set() %d %d\n",
-   left,right);
+   left, right);
 #endif
 
for (i = 0; i < scp->chnum; i++) {
@@ -159,7 +167,7 @@ hdspemixer_set(struct snd_mixer *m, unsi
}
}
 
-   return 0;
+   return (0);
 }
 
 static kobj_method_t hdspemixer_methods[] = {
@@ -172,10 +180,13 @@ MIXER_DECLARE(hdspemixer);
 static void
 hdspechan_enable(struct sc_chinfo *ch, int value)
 {
-   struct sc_pcminfo *scp = ch->parent;
-   struct sc_info *sc = scp->sc;
+   struct sc_pcminfo *scp;
+   struct sc_info *sc;
int reg;
 
+   scp = ch->parent;
+   sc = scp->sc;
+
if (ch->dir == PCMDIR_PLAY)
reg = HDSPE_OUT_ENABLE_BASE;
else
@@ -192,8 +203,10 @@ hdspe_running(struct sc_info *sc)
 {
struct sc_pcminfo *scp;
struct sc_chinfo *ch;
-   int i, j, devcount, err;
device_t *devlist;
+   int devcount;
+   int i, j;
+   int err;
 
if ((err = device_get_children(sc->dev, , )) != 0)
goto bad;
@@ -208,15 +221,17 @@ hdspe_running(struct sc_info *sc)
}
 
free(devlist, M_TEMP);
-   return 0;
+
+   return (0);
 bad:
 
 #if 0
-   device_printf(sc->dev,"hdspe is running\n");
+   device_printf(sc->dev, "hdspe is running\n");
 #endif
 
free(devlist, M_TEMP);
-   return 1;
+
+   return (1);
 }
 
 static void
@@ -242,12 +257,16 @@ hdspe_stop_audio(struct sc_info *sc)
 static void
 buffer_copy(struct sc_chinfo *ch)
 {
-   struct sc_pcminfo *scp = ch->parent;
-   struct sc_info *sc = scp->sc;
-   int length,src,dst;
+   struct sc_pcminfo *scp;
+   struct sc_info *sc;
int ssize, dsize;
+   int src, dst;
+   int length;
int i;
 
+   scp = ch->parent;
+   sc = scp->sc;
+
length = sndbuf_getready(ch->buffer) /
(4 /* Bytes per sample. */ * 2 /* channels */);
 
@@ -289,10 +308,15 @@ buffer_copy(struct sc_chinfo *ch)
 }
 
 static int
-clean(struct sc_chinfo *ch){
-   struct sc_pcminfo *scp = ch->parent;
-   struct sc_info *sc = scp->sc;
-   uint32_t *buf = sc->rbuf;
+clean(struct sc_chinfo *ch)
+{
+   struct sc_pcminfo *scp;
+   struct sc_info *sc;
+   uint32_t *buf;
+
+   scp = ch->parent;
+   sc = scp->sc;
+   buf = sc->rbuf;
 
if (ch->dir == PCMDIR_PLAY) {
buf = sc->pbuf;
@@ -301,20 +325,23 @@ clean(struct sc_chinfo *ch){
bzero(buf + 

svn commit: r309670 - head/sys/dev/hyperv/vmbus

2016-12-07 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec  7 08:12:02 2016
New Revision: 309670
URL: https://svnweb.freebsd.org/changeset/base/309670

Log:
  hyperv/vmbus: Use pause if possible.
  
  This makes booting on Hyper-V w/ small # of vCPUs work properly.
  
  Reported by:  Hongxiong Xian , Hongjiang Zhang 

  MFC after:1 week
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Dec  7 07:27:47 2016
(r309669)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c  Wed Dec  7 08:12:02 2016
(r309670)
@@ -67,7 +67,7 @@ static void   vmbus_chan_set_chmap(struc
 static voidvmbus_chan_clear_chmap(struct vmbus_channel *);
 static voidvmbus_chan_detach(struct vmbus_channel *);
 static boolvmbus_chan_wait_revoke(
-   const struct vmbus_channel *);
+   const struct vmbus_channel *, bool);
 
 static voidvmbus_chan_ins_prilist(struct vmbus_softc *,
struct vmbus_channel *);
@@ -478,14 +478,14 @@ vmbus_chan_open_br(struct vmbus_channel 
msg = vmbus_msghc_poll_result(sc, mh);
if (msg != NULL)
break;
-   DELAY(1000);
+   pause("rchopen", 1);
}
 #undef REVOKE_LINGER
if (msg == NULL)
vmbus_msghc_exec_cancel(sc, mh);
break;
}
-   DELAY(1000);
+   pause("chopen", 1);
}
if (msg != NULL) {
status = ((const struct vmbus_chanmsg_chopen_resp *)
@@ -658,7 +658,7 @@ vmbus_chan_gpadl_connect(struct vmbus_ch
 }
 
 static bool
-vmbus_chan_wait_revoke(const struct vmbus_channel *chan)
+vmbus_chan_wait_revoke(const struct vmbus_channel *chan, bool can_sleep)
 {
 #define WAIT_COUNT 200 /* 200ms */
 
@@ -667,8 +667,10 @@ vmbus_chan_wait_revoke(const struct vmbu
for (i = 0; i < WAIT_COUNT; ++i) {
if (vmbus_chan_is_revoked(chan))
return (true);
-   /* Not sure about the context; use busy-wait. */
-   DELAY(1000);
+   if (can_sleep)
+   pause("wchrev", 1);
+   else
+   DELAY(1000);
}
return (false);
 
@@ -705,7 +707,7 @@ vmbus_chan_gpadl_disconnect(struct vmbus
if (error) {
vmbus_msghc_put(sc, mh);
 
-   if (vmbus_chan_wait_revoke(chan)) {
+   if (vmbus_chan_wait_revoke(chan, true)) {
/*
 * Error is benign; this channel is revoked,
 * so this GPADL will not be touched anymore.
___
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"