]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoCorrect locking annotation for p_comm.
John Baldwin [Wed, 6 Jul 2016 18:55:46 +0000 (18:55 +0000)]
Correct locking annotation for p_comm.

p_comm is changed during exec, it is not read-only after fork.

Pointed out by: rwatson
Approved by: re (gjb, kib)
MFC after: 1 week

8 years agoAdd variable declaration missing in r302372.
Nathan Whitehorn [Wed, 6 Jul 2016 17:46:49 +0000 (17:46 +0000)]
Add variable declaration missing in r302372.

Submitted by: andrew
Approved by: re (gjb, kib)

8 years agoRemove the old pre-INTRNG arm64 interrupt framework. GENERIC was switched
Andrew Turner [Wed, 6 Jul 2016 16:20:10 +0000 (16:20 +0000)]
Remove the old pre-INTRNG arm64 interrupt framework. GENERIC was switched
to INTRNG in r301565 with the old code no longer being built by default with
no reports of issues on any supported hardware.

Approved by: re (gjb)
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoThe TCPPCAP debugging feature caches recently-used mbufs for use in
Jonathan T. Looney [Wed, 6 Jul 2016 16:17:13 +0000 (16:17 +0000)]
The TCPPCAP debugging feature caches recently-used mbufs for use in
debugging TCP connections. This commit provides a mechanism to free those
mbufs when the system is under memory pressure.

Because this will result in lost debugging information, the behavior is
controllable by a sysctl. The default setting is to free the mbufs.

Reviewed by: gnn
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6931
Input from: novice_techie.com

8 years agoFix CTASSERT issue in a more clean way
Enji Cooper [Wed, 6 Jul 2016 16:02:15 +0000 (16:02 +0000)]
Fix CTASSERT issue in a more clean way

- Replace all CTASSERT macro instances with static_assert's.
- Remove the WRAPPED_CTASSERT macro; it's now an unnecessary obfuscation.
- Localize all static_assert's to the structures being tested.
- Sort some headers per-style(9).

Approved by: re (hrs)
Differential Revision: https://reviews.freebsd.org/D7130
MFC after: 1 week
X-MFC with: r302364
Reviewed by: ed, grehan (maintainer)
Submitted by: ed
Sponsored by: EMC / Isilon Storage Division

8 years agoReplace a number of conflations of mp_ncpus and mp_maxid with either
Nathan Whitehorn [Wed, 6 Jul 2016 14:09:49 +0000 (14:09 +0000)]
Replace a number of conflations of mp_ncpus and mp_maxid with either
mp_maxid or CPU_FOREACH() as appropriate. This fixes a number of places in
the kernel that assumed CPU IDs are dense in [0, mp_ncpus) and would try,
for example, to run tasks on CPUs that did not exist or to allocate too
few buffers on systems with sparse CPU IDs in which there are holes in the
range and mp_maxid > mp_ncpus. Such circumstances generally occur on
systems with SMT, but on which SMT is disabled. This patch restores system
operation at least on POWER8 systems configured in this way.

There are a number of other places in the kernel with potential problems
in these situations, but where sparse CPU IDs are not currently known
to occur, mostly in the ARM machine-dependent code. These will be fixed
in a follow-up commit after the stable/11 branch.

PR: kern/210106
Reviewed by: jhb
Approved by: re (glebius)

8 years agoFix regression issue with XHCI on 32-bit ARMv7 Armada-38x. Make sure
Hans Petter Selasky [Wed, 6 Jul 2016 10:57:04 +0000 (10:57 +0000)]
Fix regression issue with XHCI on 32-bit ARMv7 Armada-38x. Make sure
"struct xhci_dev_ctx_addr" fits into a single 4K page until further.

Approved by: re (hrs)
MFC after: 1 week

8 years agoOnly set the ipfilter running state to 'not running' if we are
Bjoern A. Zeeb [Wed, 6 Jul 2016 10:29:29 +0000 (10:29 +0000)]
Only set the ipfilter running state to 'not running' if we are
doing the teardown.  ipf_destroy_all() may free ipfmain in case
of ipf_dynamic_softc being true, thus we are avoiding a possible
memory modified after free as well.

Reported by: Coverity
Coverity CID: 1357320
Approved by: re (hrs)
MFC after: 10 days

8 years agoFix gcc warning
Enji Cooper [Wed, 6 Jul 2016 05:17:56 +0000 (05:17 +0000)]
Fix gcc warning

Remove -Wunused-but-set-variable (`mopt`).

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
X-MFC with: r302332
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc build errors with SSE 4.2 detection and gcc warnings
Enji Cooper [Wed, 6 Jul 2016 05:17:07 +0000 (05:17 +0000)]
Fix gcc build errors with SSE 4.2 detection and gcc warnings

- Remove -Wunused-but-set-variable's (`len`, etc).
- Replace clang-specific tests in sse42_supported(..) with generic,
  FreeBSD-supported CPU feature tests, using macros and functions
  from machine/cpufunc.h and machine/specialreg.h . The previous method
  for determining SSE4.2 availability was only compatible with clang.
- Sort #includes per style(9).

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
X-MFC with: r302332
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 05:11:39 +0000 (05:11 +0000)]
Fix gcc warnings

Remove unused function (`fifo_available`)

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
X-MFC with: r302332
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 05:09:13 +0000 (05:09 +0000)]
Fix gcc warnings

- Put parentheses around bitwise OR'ed values in the `FIELD_COPY(..)` and
  `FIELD_REPLACE(..)` macros to mute warning from gcc 4.2.1.
- Remove -Wunused-but-set-variable's (`setup_addr`, `status_addr`).

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
X-MFC with: r302332
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 05:05:03 +0000 (05:05 +0000)]
Fix gcc warnings

Remove -Wunused-but-set-variable (`error`). Cast calls with
`(void)` to note that the return value is explicitly ignored.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 05:02:59 +0000 (05:02 +0000)]
Fix gcc warnings

Add `WRAPPED_CTASSERT` macro by annotating CTASSERTs with __unused
to deal with -Wunused-local-typedefs warnings from gcc 4.8+.
All other compilers (clang, etc) use CTASSERT as-is. A more generic
solution for this issue will be proposed after ^/stable/11 is forked.

Consolidate all CTASSERTs under one block instead of inlining them in
functions.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 04:58:42 +0000 (04:58 +0000)]
Fix gcc warnings

Put cfl/prdt under AHCI_DEBUG #defines as they are only used in
those cases.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoFix gcc warnings
Enji Cooper [Wed, 6 Jul 2016 04:56:45 +0000 (04:56 +0000)]
Fix gcc warnings

- Remove -Wunused-but-set-variable (newcpu)
- Always return VMEXIT_CONTINUE as the code always set retval to that value.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7119
MFC after: 1 week
Reported by: Jenkins
Reviewed by: grehan (maintainer)
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd myself to the src committers graph.
Eric Badger [Wed, 6 Jul 2016 03:23:07 +0000 (03:23 +0000)]
Add myself to the src committers graph.

Approved by: re (gjb), kib (mentor)

8 years agoCorrect a manual page reference.
Glen Barber [Tue, 5 Jul 2016 23:03:57 +0000 (23:03 +0000)]
Correct a manual page reference.

Approved by: re (kib)
Sponsored by: The FreeBSD Foundation

8 years agoRemove incorrect attributes from posix_memalign(3) declaration.
Pedro F. Giffuni [Tue, 5 Jul 2016 22:30:29 +0000 (22:30 +0000)]
Remove incorrect attributes from posix_memalign(3) declaration.

Both __alloc_align and __alloc_size can't be used when the function
returns a pointer to memory. This fixes breakage when building with
clang 3.4:

In file included from /usr/src/svn/usr.sbin/bhyve/atkbdc.c:40:
/usr/include/stdlib.h:176:6: error: '__alloc_size__' attribute only
applies to functions that return a pointer [-Werror,-Wignored-attributes]

Pointed out by: ngie, cem
Approved by: re (gjb)

8 years agoDocument r302221, file has been updated to version 5.28
Steven Kreuzer [Tue, 5 Jul 2016 22:07:41 +0000 (22:07 +0000)]
Document r302221, file has been updated to version 5.28

Approved by: re (gjb, implicit, relnotes)

8 years agoRemove reference to casperd
Steven Kreuzer [Tue, 5 Jul 2016 21:57:25 +0000 (21:57 +0000)]
Remove reference to casperd

Reported by: bapt
Approved by: re (gjb, implicit, relnotes)

8 years agoDocument 300207, Support for Shingled Magnetic Recording (SMR) drives.
Steven Kreuzer [Tue, 5 Jul 2016 20:56:52 +0000 (20:56 +0000)]
Document 300207, Support for Shingled Magnetic Recording (SMR) drives.

Approved by: re (gjb, implicit, relnotes)

8 years agoioat(4): Block asynchronous work during HW reset
Conrad Meyer [Tue, 5 Jul 2016 20:53:32 +0000 (20:53 +0000)]
ioat(4): Block asynchronous work during HW reset

Fix the race between ioat_reset_hw and ioat_process_events.

HW reset isn't protected by a lock because it can sleep for a long time
(40.1 ms).  This resulted in a race where we would process bogus parts
of the descriptor ring as if it had completed.  This looked like
duplicate completions on old events, if your ring had looped at least
once.

Block callout and interrupt work while reset runs so the completion end
of things does not observe indeterminate state and process invalid parts
of the ring.

Start the channel with a manually implemented ioat_null() to keep other
submitters quiesced while we wait for the channel to start (100 us).

r295605 may have made the race between ioat_reset_hw and
ioat_process_events wider, but I believe it already existed before that
revision.  ioat_process_events can be invoked by two asynchronous
sources: callout (softclock) and device interrupt.  Those could race
each other, to the same effect.

Reviewed by: markj
Approved by: re
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7097

8 years agoioat(4): Serialize ioat_reset_hw invocations
Conrad Meyer [Tue, 5 Jul 2016 20:52:35 +0000 (20:52 +0000)]
ioat(4): Serialize ioat_reset_hw invocations

Reviewed by: markj
Approved by: re
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7097

8 years agoioat(4): Split timer into poll and shrink functions
Conrad Meyer [Tue, 5 Jul 2016 20:51:52 +0000 (20:51 +0000)]
ioat(4): Split timer into poll and shrink functions

Poll should happen quickly, while shrink should happen infrequently.

Protect is_completion_pending with submit_lock.

Reviewed by: markj
Approved by: re
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7097

8 years agoDocument 302332, Native graphics support has been added to bhyve
Steven Kreuzer [Tue, 5 Jul 2016 20:48:59 +0000 (20:48 +0000)]
Document 302332, Native graphics support has been added to bhyve

Approved by: re (gjb, implicit, relnotes)

8 years agoThe paradigm of a callout is that it has three consequent states:
Gleb Smirnoff [Tue, 5 Jul 2016 18:47:17 +0000 (18:47 +0000)]
The paradigm of a callout is that it has three consequent states:
not scheduled -> scheduled -> running -> not scheduled. The API and the
manual page assume that, some comments in the code assume that, and looks
like some contributors to the code also did. The problem is that this
paradigm isn't true. A callout can be scheduled and running at the same
time, which makes API description ambigouous. In such case callout_stop()
family of functions/macros should return 1 and 0 at the same time, since it
successfully unscheduled future callout but the current one is running.
Before this change we returned 1 in such a case, with an exception that
if running callout was migrating we returned 0, unless CS_MIGRBLOCK was
specified.

With this change, we now return 0 in case if future callout was unscheduled,
but another one is still in action, indicating to API users that resources
are not yet safe to be freed.

However, the sleepqueue code relies on getting 1 return code in that case,
and there already was CS_MIGRBLOCK flag, that covered one of the edge cases.
In the new return path we will also use this flag, to keep sleepqueue safe.

Since the flag CS_MIGRBLOCK doesn't block migration and now isn't limited to
migration edge case, rename it to CS_EXECUTING.

This change fixes panics on a high loaded TCP server.

Reviewed by: jch, hselasky, rrs, kib
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7042

8 years agoCompile in the kassert_panic() function with INVARIANT_SUPPORT
Gleb Smirnoff [Tue, 5 Jul 2016 18:34:34 +0000 (18:34 +0000)]
Compile in the kassert_panic() function with INVARIANT_SUPPORT
option, not INVARIANTS.  The function is required if we want
to load in a module that is compiled with INVARIANTS.

Reviewed by: jhb
Approved by: re (gjb)

8 years agoEnsure that spinlock sections are balanced even after a panic.
Mark Johnston [Tue, 5 Jul 2016 17:59:04 +0000 (17:59 +0000)]
Ensure that spinlock sections are balanced even after a panic.

vpanic() uses spinlock_enter() to disable interrupts before dumping core.
However, when the scheduler is stopped and INVARIANTS is not configured,
thread_lock() does not acquire a spinlock section, while thread_unlock()
releases one. This can result in interrupts staying enabled while the
kernel dumps core, complicating post-mortem analysis of the crash.

Approved by: re (gjb)
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

8 years agoCall audit hooks to capture vnode attributes for three file-descriptor
Robert Watson [Tue, 5 Jul 2016 16:37:01 +0000 (16:37 +0000)]
Call audit hooks to capture vnode attributes for three file-descriptor
method implementations: fstat(2), close(2), and poll(2).  This change
synchronises auditing here with similar auditing for VFS-specific system
calls such as stat(2) that audit more complete vnode information.

Sponsored by: DARPA, AFRL
Approved by: re (kib)
MFC after: 1 week

8 years agoadd description for debug.elf{32,64}_legacy_coredump sysctl
Ed Maste [Tue, 5 Jul 2016 14:46:06 +0000 (14:46 +0000)]
add description for debug.elf{32,64}_legacy_coredump sysctl

Approved by: re (kib)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

8 years agoClarify the vnode_destroy_vobject() logic handling for already terminated
Konstantin Belousov [Tue, 5 Jul 2016 11:21:02 +0000 (11:21 +0000)]
Clarify the vnode_destroy_vobject() logic handling for already terminated
objects.

Assert that there is no new waiters for the already terminated objects.
Old waiters should have been notified by the termination calling
vnode_pager_dealloc() (old/new are with regard of the lock acquisition
interval).

Only clear the vp->v_object for the case of already terminated object,
since other branches call vnode_pager_dealloc(), which should clear
the pointer.  Assert this.

Tested by: pho
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

8 years agoFix a regression introduced on revision r271909, when using argument -g
Marcelo Araujo [Tue, 5 Jul 2016 07:01:42 +0000 (07:01 +0000)]
Fix a regression introduced on revision r271909, when using argument -g
or several hops we have segmentation fault because we overwrite the same
structure to store information for host and gateway.

Submitted by: Maryse Levavasseur <maryse.levavasseur@stormshield.eu>
Reworked by: hrs
Approved by: re (hrs)
Differential Revision: https://reviews.freebsd.org/D6980

8 years agoRemove SoC-specific integrations from dTSEC, to make it SoC agnostic.
Justin Hibbits [Tue, 5 Jul 2016 06:16:42 +0000 (06:16 +0000)]
Remove SoC-specific integrations from dTSEC, to make it SoC agnostic.

This will allow a single kernel to run on all SoCs supported by the dTSEC driver.

Approved by: re@(gjb)

8 years agoUnbreak the LBC driver, broken with the large RMan and 36-bit physical address changes.
Justin Hibbits [Tue, 5 Jul 2016 06:14:23 +0000 (06:14 +0000)]
Unbreak the LBC driver, broken with the large RMan and 36-bit physical address changes.

Remove the use of fdt_data_to_res(), and instead construct the resources
manually.  Additionally, avoid the 32-bit size limitation of fdt_data_get(), by
building physical addresses manually from the lbc ranges property.

Approved by: re@(gjb)

8 years agocxgbe(4): Changes to the CPL-handler registration mechanism and code
Navdeep Parhar [Tue, 5 Jul 2016 01:29:24 +0000 (01:29 +0000)]
cxgbe(4): Changes to the CPL-handler registration mechanism and code
related to "shared" CPLs.

a) Combine t4_set_tcb_field and t4_set_tcb_field_rpl into a single
function.  Allow callers to direct the response to any iq.  Tidy up
set_ulp_mode_iscsi while there to use names from t4_tcb.h instead of
magic constants.

b) Remove all CPL handler tables from struct adapter.  This reduces its
size by around 2KB.  All handlers are now registered at MOD_LOAD instead
of attach or some kind of initialization/activation.  The registration
functions do not need an adapter parameter any more.

c) Add per-iq handlers to deal with CPLs whose destination cannot be
determined solely from the opcode.  There are 2 such CPLs in use right
now: SET_TCB_RPL and L2T_WRITE_RPL.  The base driver continues to send
filter and L2T_WRITEs over the mgmtq and solicits the reply on fwq.
t4_tom (including the DDP code) now uses the port's ctrlq to send
L2T_WRITEs and SET_TCB_FIELDs and solicits the reply on an ofld_rxq.
fwq and ofld_rxq have different handlers that know what kind of tid to
expect in the reply.  Update t4_write_l2e and callers to to support any
wrq/iq combination.

Approved by: re@ (kib@)
Sponsored by: Chelsio Communications

8 years agoFix a race condition between the main thread in aqm_pie_cleanup() and the
Don Lewis [Tue, 5 Jul 2016 00:53:01 +0000 (00:53 +0000)]
Fix a race condition between the main thread in aqm_pie_cleanup() and the
callout thread that can cause a kernel panic.  Always do the final cleanup
in the callout thread by passing a separate callout function for that task
to callout_reset_sbt().

Protect the ref_count decrement in the callout with DN_BH_WLOCK().  All
other ref_count manipulation is protected with this lock.

There is still a tiny window between ref_count reaching zero and the end
of the callout function where it is unsafe to unload the module.  Fixing
this would require the use of callout_drain(), but this can't be done
because dummynet holds a mutex and callout_drain() might sleep.

Remove the callout_pending(), callout_active(), and callout_deactivate()
calls from calculate_drop_prob().  They are not needed because this callout
uses callout_init_mtx().

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
Approved by: re (gjb)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D6928

8 years agoFix build of ppp when WITHOUT_PAM is set
Baptiste Daroussin [Mon, 4 Jul 2016 21:18:57 +0000 (21:18 +0000)]
Fix build of ppp when WITHOUT_PAM is set

PR: 210658
Reported by: madpilot
Tested by: madpilot
Approved by: re@ (kib)

8 years agoFix interrupt loop when switching from USB device to USB host mode by
Hans Petter Selasky [Mon, 4 Jul 2016 17:12:22 +0000 (17:12 +0000)]
Fix interrupt loop when switching from USB device to USB host mode by
clearing all endpoint interrupt bits.

PR: 210736
Approved by: re (glebius)
MFC after: 1 week

8 years agoboot1.efi: fix assignment / comparison expression
Ed Maste [Mon, 4 Jul 2016 16:50:21 +0000 (16:50 +0000)]
boot1.efi: fix assignment / comparison expression

PR: 210706
Submitted by: David Binderman <dcb314@hotmail.com>
Approved by: re (kib)
MFC after: 1 week

8 years agoImport bhyve_graphics into CURRENT. Thanks to all who tested
Peter Grehan [Mon, 4 Jul 2016 03:19:06 +0000 (03:19 +0000)]
Import bhyve_graphics into CURRENT. Thanks to all who tested
this on the branch.

Original commit message:
  Initial bhyve native graphics support.

  This adds emulations for a raw framebuffer device, PS2 keyboard/mouse,
  XHCI USB controller and a USB tablet.

  A simple VNC server is provided for keyboard/mouse input, and graphics
  output.

  A VGA emulation is included, but is currently disconnected until an
  additional bhyve change to block out VGA memory is committed.

  Credits:
   - raw framebuffer, VNC server, XHCI controller, USB bus/device emulation
      and UEFI f/w support by Leon Dang
   - VGA, console/g, initial VNC server  by tychon@
   - PS2 keyboard/mouse jointly done by tychon@ and Leon Dang
   - hypervisor framebuffer mem support by neel@

  Tested by: Michael Dexter, in a number of revisions of this code.

  With the appropriate UEFI image, FreeBSD, Windows and Linux guests can
  installed and run in graphics mode using the UEFI/GOP framebuffer.

Approved by: re (gjb)

8 years agoAdd the forgotten "svn mv" from r302329
Baptiste Daroussin [Sun, 3 Jul 2016 19:31:21 +0000 (19:31 +0000)]
Add the forgotten "svn mv" from r302329

Reported by: Ivan Klymenko <fidaj@ukr.net>
Approved by: re (implicit)

8 years agoRemove ftp(1) related files when MK_FTP == no
Enji Cooper [Sun, 3 Jul 2016 18:27:00 +0000 (18:27 +0000)]
Remove ftp(1) related files when MK_FTP == no

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6969
MFC after: 1 week
Reviewed by: ngie
Submitted by: rakuco
Sponsored by: EMC / Isilon Storage Division

8 years agoPosixify the locales name for variants
Baptiste Daroussin [Sun, 3 Jul 2016 18:21:11 +0000 (18:21 +0000)]
Posixify the locales name for variants

For all locales with variants:
- if no ambiguity on the locale (only one variant) just use the regular name
- if ambiguity, pick one as default and append @<variant> to the others
  respecting POSIX

As a result:
- All the 3 components locales added recently are renamed to the usual 2
  components version for all but sr_RS.UTF-8
- Set sr_RS.UTF-8 to the cyrillic variant
- Add sr_RS.UTF-8@latin
- Remove the symlinks aliases they were created to represent the 2 components
  version as aliasas and are now useless
- Update the OptionalObsoleteFiles.inc and ObsoleteFiles.inc to reflect those
  changes

Discussed with: ache@
Approved by: re@ (gjb)

8 years agoProvide helper macros to detect 'non-silent SBDRY' state and to
Konstantin Belousov [Sun, 3 Jul 2016 18:19:48 +0000 (18:19 +0000)]
Provide helper macros to detect 'non-silent SBDRY' state and to
calculate appropriate return value for stops.  Simplify the code by
using them.

Fix typo in sig_suspend_threads().  The thread which sleep must be
aborted is td2. (*)

In issignal(), when handling stopping signal for thread in
TD_SBDRY_INTR state, do not stop, this is wrong and fires assert.
This is yet another place where execution should be forced out of
SBDRY-protected region.  For such case, return -1 from issignal() and
translate it to corresponding error code in sleepq_catch_signals().
Assert that other consumers of cursig() are not affected by the new
return value. (*)

Micro-optimize, mostly VFS and VOP methods, by avoiding calling the
functions when SIGDEFERSTOP_NOP non-change is requested. (**)

Reported and tested by: pho (*)
Requested by: bde (**)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

8 years agoFix .../usr.bin/lastcomm/legacy_test:main on i386
Enji Cooper [Sun, 3 Jul 2016 17:52:21 +0000 (17:52 +0000)]
Fix .../usr.bin/lastcomm/legacy_test:main on i386

The time in the output files was ahead by 3 hours on i386. Fix the incorrect
offset.

Differential Revision: https://reviews.freebsd.org/D7079 (as part of a larger diff)
MFC after: 1 week
PR: 210329
Reported by: asomers
Approved by: re (gjb)
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division

8 years agoOutput the diffs to standard error when comparing the expected vs the
Enji Cooper [Sun, 3 Jul 2016 17:51:24 +0000 (17:51 +0000)]
Output the diffs to standard error when comparing the expected vs the
obtained output from lastcomm instead of just printing out a summary, e.g.
"they differed".

This will make failures with results more apparent when running kyua debug,
kyua report-html, etc.

Differential Revision: https://reviews.freebsd.org/D7079 (as part of a larger diff)
MFC after: 1 week
Approved by: re (gjb)
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division

8 years agoFix race for incrementally rebuilding VERSION_MAP.
Bryan Drewery [Sun, 3 Jul 2016 17:28:39 +0000 (17:28 +0000)]
Fix race for incrementally rebuilding VERSION_MAP.

The dependency is needed in PROG_FULL since only the build of PROG_FULL
is using the LDFLAGS and depending on VERSION_MAP.  This was not a problem
with MK_DEBUG_FILES==no since it only builds PROG.

This should probably be using bsd.lib.mk instead [1]

Reported by: swills, gjb
Reviewed by: emaste
Noted by: rgrimes [1]
Sponsored by: EMC / Isilon Storage Division
Approved by: re (kib)

8 years agoFix a bad test resulting in a segfault with ISO-8859-5 locales
Baptiste Daroussin [Sun, 3 Jul 2016 15:00:12 +0000 (15:00 +0000)]
Fix a bad test resulting in a segfault with ISO-8859-5 locales

Reported by: Lauri Tirkkonen from Illumos
Approved by: re@ (gjb)

8 years agoRemove racy assert. The thread which changes vnode usecount from 0 to 1
Konstantin Belousov [Sun, 3 Jul 2016 01:56:48 +0000 (01:56 +0000)]
Remove racy assert. The thread which changes vnode usecount from 0 to 1
does it under the vnode interlock, but the interlock is not owned by the
asserting thread.  As result, we might read increased use counter but also
still see VI_OWEINACT.

In collaboration with: nwhitehorn
Hardware donated by: IBM LTC
Sponsored by: The FreeBSD Foundation (kib)
Approved by: re (gjb)

8 years agoUpdate libxo to 0.6.3
Enji Cooper [Sun, 3 Jul 2016 01:35:27 +0000 (01:35 +0000)]
Update libxo to 0.6.3

This fixes the 02 testcases on i386 (at least), and may fix the testcases
in general on 32-bit platforms

Differential Revision: https://reviews.freebsd.org/D7052
Approved by: phil (maintainer)
Approved by: re (gjb)
Reported by: asomers
Reviewed by: phil
Submitted by: phil
Sponsored by: EMC / Isilon Storage Division

8 years agoAdd more machines to the bsdinstall workaround blacklist
Allan Jude [Sun, 3 Jul 2016 01:23:38 +0000 (01:23 +0000)]
Add more machines to the bsdinstall workaround blacklist

Apply the LenovoFix (fake partition in pMBR is 2nd rather than 1st)
and GPT Active fix (mark the fake pMBR partition active) to respective
hardware that is confirmed to require such to boot correct.

Submitted by: Sam Fourman Jr. <sfourman@gmail.com> (ThinkPad W520)
Submitted by: Matthias Apitz <guru@unixarea.de> (Latitude E6330)
Approved by: re (gjb)
Sponsored by: ScaleEngine Inc.

8 years agoFix an error in bsdinstall when ZFS installation uses a bootpool
Allan Jude [Sun, 3 Jul 2016 01:22:59 +0000 (01:22 +0000)]
Fix an error in bsdinstall when ZFS installation uses a bootpool

A separate bootpool is used when the selected partition type is MBR
or when the disk is GELI encrypted and a UEFI loader is selected.

BIOS avoids the bootpool by using bootcode and loader that support GELI.

bsdinstall did not remount the bootpool after creating the main pool,
which caused an error when mkdir tried to create /boot/zfs

PR: 210717
Approved by: re (gjb)
Sponsored by: ScaleEngine Inc.

8 years agoChange type of the 'dead' variable to boolean.
Konstantin Belousov [Sun, 3 Jul 2016 00:08:17 +0000 (00:08 +0000)]
Change type of the 'dead' variable to boolean.

Requested by: alc
MFC after: 1 week
Approved by: re (gjb)

8 years agoHide warning about non-existent lookup tables and informational messages
Andrey V. Elsukov [Sat, 2 Jul 2016 11:54:20 +0000 (11:54 +0000)]
Hide warning about non-existent lookup tables and informational messages
about modified table entry when quied mode enabled.

Approved by: re (hrs)
Obtained from: Yandex LLC

8 years agoUpdate libxo to 0.6.3
Enji Cooper [Sat, 2 Jul 2016 05:30:27 +0000 (05:30 +0000)]
Update libxo to 0.6.3

Obtained from: https://github.com/Juniper/libxo/tree/0.6.3
Sponsored by: EMC / Isilon Storage Division

8 years agocxgbe(4): Avoid a NULL dereference while dumping the L2 table. Entries
Navdeep Parhar [Fri, 1 Jul 2016 23:18:49 +0000 (23:18 +0000)]
cxgbe(4): Avoid a NULL dereference while dumping the L2 table.  Entries
used by switching filters that rewrite L2 information do not have any
associated ifnet.

Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

8 years agoClean up some FDT-related code in the PowerPC bootloader, improving error
Nathan Whitehorn [Fri, 1 Jul 2016 21:09:30 +0000 (21:09 +0000)]
Clean up some FDT-related code in the PowerPC bootloader, improving error
checking and robustness. Prevents errors and crashes in FDT commands on
PowerMac G5 systems.

Approved by: re (gjb)

8 years agoDocument 300777, Add support for GPIO, Sensors and interrupts on AXP209 PMIC
Steven Kreuzer [Fri, 1 Jul 2016 20:25:59 +0000 (20:25 +0000)]
Document 300777, Add support for GPIO, Sensors and interrupts on AXP209 PMIC

Approved by: re (gjb, implicit, relnotes)

8 years agoDocument r299688, Add support for H3 SoC
Steven Kreuzer [Fri, 1 Jul 2016 20:19:02 +0000 (20:19 +0000)]
Document r299688, Add support for H3 SoC

Approved by: re (gjb, implicit, relnotes)

8 years agoDocument r263698, Add code for enabling second CPU core for A20 SoC.
Steven Kreuzer [Fri, 1 Jul 2016 20:16:35 +0000 (20:16 +0000)]
Document r263698, Add code for enabling second CPU core for A20 SoC.

Approved by: re (gjb, implicit, relnotes)

8 years agoWhen a process knote was attached to the process which is already exiting,
Konstantin Belousov [Fri, 1 Jul 2016 20:11:28 +0000 (20:11 +0000)]
When a process knote was attached to the process which is already exiting,
the knote is activated immediately.  If the exit1() later activates
knotes, such knote is attempted to be activated second time.  Detect
the condition by zeroed kn_ptr.p_proc pointer, and avoid excessive
activation.

Before r302235, such knotes were removed from the knlist immediately
upon activation.

Reported by: truckman
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)

8 years ago[net80211] teach AMRR to log the initial MCS rate as "MCS X"
Adrian Chadd [Fri, 1 Jul 2016 19:58:13 +0000 (19:58 +0000)]
[net80211] teach AMRR to log the initial MCS rate as "MCS X"

Otheriwse it logs it as the rate value, which is 0x80 (MCS flag) + MCS,
which isn't that helpful.

Approved by: re (gjb)

8 years agoFix detection of USB device disconnects in USB host mode when the USB
Hans Petter Selasky [Fri, 1 Jul 2016 07:27:33 +0000 (07:27 +0000)]
Fix detection of USB device disconnects in USB host mode when the USB
device is connected directly to the USB port of the DWC OTG, in this
case a RPI-zero.

PR: 210695
Approved by: re (gjb)
MFC after: 1 week

8 years agoMFV r302260: expat 2.2.0
Xin LI [Fri, 1 Jul 2016 05:48:45 +0000 (05:48 +0000)]
MFV r302260: expat 2.2.0

Approved by: re (kib)

8 years agoUpdate 11.0 to ALPHA6.
Glen Barber [Fri, 1 Jul 2016 00:00:35 +0000 (00:00 +0000)]
Update 11.0 to ALPHA6.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

8 years agoIn case of the global eventhandler make sure the current VNET
Bjoern A. Zeeb [Thu, 30 Jun 2016 19:32:45 +0000 (19:32 +0000)]
In case of the global eventhandler make sure the current VNET
is still operational before doing any work;  otherwise we might
run into, e.g., destroyed locks.

PR: 210724
Reported by: olevole olevole.ru
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Obtained from: projects/vnet
Approved by: re (gjb)

8 years agoVirtualise ipfilter.
Bjoern A. Zeeb [Thu, 30 Jun 2016 15:01:07 +0000 (15:01 +0000)]
Virtualise ipfilter.
Split initializzation an teardown into module (global state) and VNET
(per virtual network stack) parts.  Virtualise global state, which is
not "const".

Cleanup eventhandlers, so that we can make use of the passed in argument
to get the vnet state from the ifp;  disable the "cloner" event as it is
too early, has no state, and can fire before initialisation (see comment
in the source).

Handle the dynamic sysctls specially.  The problem is that "ipmain"
is the virtualized struct, but the fields used for the sysctls are
hanging off memory allocated and attached to the virtualized "ipmain"
thus standard VNET macros and sysctl handling do not work.
We still say it is VNET sysctls to get the proper protection checks
in the VIMAGE case;  to solve the problem of accessing the right bit
of memory hanging of each per-VNET ipmain, we use a dedicated handler
function wrapping around sysctl_ipf_int() undoing the base calculation
from kern_sysctl.c and then adding the passed-in offset into the right
struct depending on handler.  A bit of a mess exposing VNET-internals
this way but the only way to keep the code without having to massively
restructure ipf internals.

Approved by: re (hrs)
Sponsored by: The FreeBSD Foundation
Obtained from: projects/vnet
MFC after: 2 weeks
Reviewed by: cy
Differential Revision: https://reviews.freebsd.org/D7000

8 years agoRevert r299454 and r299448.
Alexander Motin [Thu, 30 Jun 2016 14:55:49 +0000 (14:55 +0000)]
Revert r299454 and r299448.

Those changes were found confusing FreeBSD libc ACL code, that doesn't
differentiate ACL for directories and files, and report ACLs for all
directories created after those patches as non-trivial.  On the other
side these changes were considered wrong from POSIX and NFSv4 points of
view.  Until further investigation done upstream, revert those changes
locally in preparation for FreeBSD 11.0 release.

Approved by: re (hrs)

8 years agoRemove dead code.
Cy Schubert [Thu, 30 Jun 2016 14:53:46 +0000 (14:53 +0000)]
Remove dead code.

Approved by: re@ (hrs@)
MFC after: 1 week

8 years agoMFV r302264:
Martin Matuska [Thu, 30 Jun 2016 08:51:50 +0000 (08:51 +0000)]
MFV r302264:

Sync libarchive with vendor, bugfixes for tests:
- fix tests on filesystems without birthtime support, e.g. UFS1 (1)
- vendor issue #729: avoid use of C99 for-scope declarations in
  test_write_format_gnutar_filenames.c

MFC after: 1 week
PR: 204157 (1)
Approved by: re (hrs)

8 years agoThis patch fixes two bugs related to the setting of the I-Bit
Michael Tuexen [Thu, 30 Jun 2016 06:06:35 +0000 (06:06 +0000)]
This patch fixes two bugs related to the setting of the I-Bit
for SCTP DATA and I-DATA chunks.
* For fragmented user messages, set the I-Bit only on the last
  fragment.
* When using explicit EOR mode, set the I-Bit on the last
  fragment, whenever SCTP_SACK_IMMEDIATELY was set in snd_flags
  for any of the send() calls.

Approved by: re (hrs)
MFC after: 1 week

8 years agoARM, ARM64: Workaround for buf_ring reordering
Wojciech Macek [Thu, 30 Jun 2016 05:18:37 +0000 (05:18 +0000)]
ARM, ARM64: Workaround for buf_ring reordering

    This patch offers a workaround to buf_ring reordering
    visible on armv7 and armv8. This is supposed to be
    removed once new buf_ring implementation is integrated
    into the tree.

    Obtained from:         Semihalf
    Reviewed by:           alc,emaste
    Differential Revision: https://reviews.freebsd.org/D6986
    Approved by:           re (gjb)

8 years agoARM64: fix DMAP calculation
Wojciech Macek [Thu, 30 Jun 2016 04:58:19 +0000 (04:58 +0000)]
ARM64: fix DMAP calculation

    Use arithmetic operators instead of logical. This fixes
    DMAP ranges calculation for ThunderX Dual Socket.

    Obtained from:         Semihalf
    Sponsored by:          Cavium
    Reviewed by:           zbb
    Differential Revision: https://reviews.freebsd.org/D7023
    Approved by:           re (gjb)

8 years agoMove the ipfw_log_bpf() calls from global module initialisation to
Bjoern A. Zeeb [Thu, 30 Jun 2016 01:33:14 +0000 (01:33 +0000)]
Move the ipfw_log_bpf() calls from global module initialisation to
per-VNET initialisation and virtualise the interface cloning to
allow a dedicated ipfw log interface per VNET.

Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoRemove unused global variables as well as unused memory
Bjoern A. Zeeb [Thu, 30 Jun 2016 01:32:12 +0000 (01:32 +0000)]
Remove unused global variables as well as unused memory
allocations from ipfilter in preparation for VNET support.

Suggested by: cy (see D7000)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Approved by: re (gjb)

8 years agoEnable indirect segment I/Os by default in the Xen blkfront driver when
Colin Percival [Wed, 29 Jun 2016 23:56:24 +0000 (23:56 +0000)]
Enable indirect segment I/Os by default in the Xen blkfront driver when
running on EC2.  Due to improvements in EC2, the performance penalty which
was present on some EC2 instances no longer exists, and enabling this
feature now consistently yields ~20% higher throughput with equal or lower
latency.

Reverts: r286063
Approved by: re (gjb)
MFC after: 2 weeks
Relnotes: Improved disk throughput on EC2

8 years agoFixed FreeBSD/mips MALTA support for QEMU
Oleksandr Tymoshenko [Wed, 29 Jun 2016 23:33:44 +0000 (23:33 +0000)]
Fixed FreeBSD/mips MALTA support for QEMU

Recource management functions in GT PCI controller driver
treated memory/IO resources as KSEG1 addresses, later during
activation these values would be increased by KSEG1 base again
rendering the address invalid and causing "bus error" trap.

Actual logic was converted to use real physical addresses,
so mapping takes place only during activation.

Submitted by: Aleksandr Rybalko <ray@FreeBSD.org>
Approved by: re (gjb)

8 years agoFlush every line when using meta mode and no -j or with -B.
Bryan Drewery [Wed, 29 Jun 2016 22:54:01 +0000 (22:54 +0000)]
Flush every line when using meta mode and no -j or with -B.

Otherwise the output is buffered and it appears that make is stuck on something
long-running.  This problem is not present with -j as it uses different
code that was already flushing.

Discussed with: sjg
Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_META_MODE: Avoid false-positive error due to missing .meta with build commands.
Bryan Drewery [Wed, 29 Jun 2016 22:39:22 +0000 (22:39 +0000)]
WITH_META_MODE: Avoid false-positive error due to missing .meta with build commands.

Sponsored by: EMC / Isilon Storage Division
Approved by: re (blanket, META_MODE)

8 years ago1.Improve handling around last compressed block of the file, which is
Maxim Sobolev [Wed, 29 Jun 2016 18:19:05 +0000 (18:19 +0000)]
1.Improve handling around last compressed block of the file, which is
  necessary because CLOOP format lacks explicit EOF or length, so that
  in the presence of padding or when the CLOOP is put onto a larger
  partition upper level provider size may be larger. Bound amount
  of extra data that we might touch to the max length of the compressed
  block and detect zero-padding in the last cluster, which when
  sector is all-zero might cause us to emit bogus I/O error after
  decompression of that fails. To not make code any more complicated
  that it needs to be deal with it in lazy-manner, i.e. when we
  first access that specific cluster.

  This change also fixes stupid mistake in the LZMA code, inherited
  from geom_lzma, which does not share length of the output buffer
  buffer with the decompression routine, so that in the presence
  of corrupted or purposedly tailored data may easily cause heap
  overflow and kernel memory corruption.

  Beef up validation of the CLOOP TOC by checking that lengths of
  all but the last compressed clusters match upper limit set by
  the decompressor and improve some error diagnostic output while
  I am here.

2.Add kern.geom.uzip.attach_to tunable to artifically limit
  attaching uzip to certain devices in the dev tree only.

    For example the following only makes us attaching to the
    GPT labels:

    kern.geom.uzip.attach_to="gpt/*"

3.Add kern.geom.uzip.noattach_to, which does opposite to the (2)
  above, i.e. prevents geom_uzip from tasting / attaching to
  providers matching some pattern. By default we don't attach
  to our own kind, i.e. kern.geom.uzip.noattach_to="*.uzip".
  It saves us quite some CPU cycles, esp on low-end embedded
  systems.

Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D7013

8 years agonet80211: fix LOR/deadlock in ieee80211_ff_node_cleanup().
Andriy Voskoboinyk [Wed, 29 Jun 2016 17:25:46 +0000 (17:25 +0000)]
net80211: fix LOR/deadlock in ieee80211_ff_node_cleanup().

Add new lock for stageq (part of ieee80211_superg structure) and
ni_tx_superg (part of ieee80211_node structure);
drop com_lock protection where it is used to protect them.

While here, drop duplicate OPACKETS counter incrementation.

ni_tx_ampdu is not protected with it (however, it is also used without
locking in other places; probably, it requires some other solution
to be thread-safe).

Tested with RTL8188CUS (AP) and RTL8188EU (STA).

NOTE: Since this change breaks KBI, all wireless drivers need to be
recompiled.

Reviewed by: adrian
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6958

8 years agoDon't warn about needing filemon for makeman.
Bryan Drewery [Wed, 29 Jun 2016 16:45:01 +0000 (16:45 +0000)]
Don't warn about needing filemon for makeman.

r287879 wasn't quite enough here since Makefile.inc1 is running
'make -C release -V VERSION' and hitting the warning.

Reported by: lattera
Sponsored by: EMC / Isilon Storage Division
Approved by: re (blanket, META_MODE)

8 years agoCorrect PERSISTENT RESERVE OUT command and populate scsi_cmd->length.
Sean Bruno [Wed, 29 Jun 2016 16:41:37 +0000 (16:41 +0000)]
Correct PERSISTENT RESERVE OUT command and populate scsi_cmd->length.

PR: 202625
Submitted by: niakrisn@gmail.com
Reviewed by: scottl kenm
Approved by: re (gjb)
MFC after: 2 weeks

8 years agoFix fat-fingering: #if AIM should have been #ifdef AIM to avoid failures on
Nathan Whitehorn [Wed, 29 Jun 2016 16:34:56 +0000 (16:34 +0000)]
Fix fat-fingering: #if AIM should have been #ifdef AIM to avoid failures on
Book-E kernels.

Approved by: re (gjb)
Pointy hat to: nwhitehorn

8 years agoDo not rely on firmware having pre-enabled the MMU in a reasonable way for
Nathan Whitehorn [Wed, 29 Jun 2016 14:40:43 +0000 (14:40 +0000)]
Do not rely on firmware having pre-enabled the MMU in a reasonable way for
late boot: enable it explicitly after installing the page tables. If booting
from an FDT, also make sure to escape the firmware's MMU context early
before overwriting firmware page tables.

Approved by: re (gjb)

8 years agolibcxxrt: correct mangled "typeinfo name" symbols in Version.map
Ed Maste [Wed, 29 Jun 2016 11:48:42 +0000 (11:48 +0000)]
libcxxrt: correct mangled "typeinfo name" symbols in Version.map

r260553 added missing C++ typinfos to libcxxrt's version script.
It appears that a number of duplicate mangled symbols were added due to
a cut and paste error. Switch the second instances to _ZTS*,
typeinfo name for *.

Found by lld, which produces an error or warning for duplicate symbols.

Reviewed by: dim
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7011

8 years agoAllow ZFS ARC min / max to be tuned at runtime
Steven Hartland [Wed, 29 Jun 2016 07:55:45 +0000 (07:55 +0000)]
Allow ZFS ARC min / max to be tuned at runtime

Prior to this change ZFS ARC min / max could only be changed using
boot time tunables, this allows the values to be tuned at runtime
using the sysctls:
* vfs.zfs.arc_max
* vfs.zfs.arc_min

When adjusting ZFS ARC minimum the memory used  will only reduce
to the new minimum given memory pressure.

Reviewed by: allanjude
Approved by: re (gjb)
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D5907

8 years agoUpdate vendor/libarchive to git 084ef320b8fc62e3fd3acb762fe6175d48d7829c
Martin Matuska [Wed, 29 Jun 2016 07:00:15 +0000 (07:00 +0000)]
Update vendor/libarchive to git 084ef320b8fc62e3fd3acb762fe6175d48d7829c

Vendor issues fixed:
#686: Correctly grow buffer in archive_string_append_from_wcs_in_codepage()
FreeBSD PR #204157: Fix test on filesystems without birthtime support

PR: 204157

8 years agocxgbe(4): Do not bring up an interface when IFCAP_TOE is enabled on it.
Navdeep Parhar [Wed, 29 Jun 2016 06:55:30 +0000 (06:55 +0000)]
cxgbe(4):  Do not bring up an interface when IFCAP_TOE is enabled on it.
The interface's queues are functional after VI_INIT_DONE (which is short
of interface-up) and that's all that's needed for t4_tom to communicate
with the chip.

Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

8 years agoUSB: Add Garmin FR230 device quirk (broken INQUIRY)
Conrad Meyer [Wed, 29 Jun 2016 06:42:20 +0000 (06:42 +0000)]
USB: Add Garmin FR230 device quirk (broken INQUIRY)

PR: 210544
Reviewed by: hps
Approved by: re

8 years agoVendor import of expat 2.2.0 (trimmed).
Xin LI [Wed, 29 Jun 2016 06:24:30 +0000 (06:24 +0000)]
Vendor import of expat 2.2.0 (trimmed).

8 years agoSeveral device drivers call if_alloc() and then do further checks and
Bjoern A. Zeeb [Wed, 29 Jun 2016 05:21:25 +0000 (05:21 +0000)]
Several device drivers call if_alloc() and then do further checks and
will cal if_free() in case of conflict, error, ..
if_free() however sets the VNET instance from the ifp->if_vnet which
was not yet initialized but would only in if_attach(). Fix this by
setting the curvnet from where we allocate the interface in if_alloc().
if_attach() will later overwrite this as needed. We do not set the home_vnet
early on as we only want to prevent the if_free() panic but not change any
of the other housekeeping, e.g., triggered through ifioctl()s.

Reviewed by: brooks
Approved by: re (gjb)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7010

8 years agoWITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.
Bryan Drewery [Wed, 29 Jun 2016 01:50:30 +0000 (01:50 +0000)]
WITH_SYSTEM_COMPILER: Avoid using GCC4.8+ logic on native GCC4.2 platforms.

As the XXX notes, these should really be checking MK_GNUCXX since there is
already a version check in share/mk/src.opts.mk to disable it.  Fixing that
here is more complex though.  This could also be using X_COMPILER_FEATURES
but uses X_COMPILER_VERSION to keep in sync with the src.opts.mk logic.

Tested by: andreast
Sponsored by: EMC / Isilon Storage Division
Approved by: re (gjb)

8 years agoDo not coredump if the packet is too long in the global (non-interface
Poul-Henning Kamp [Tue, 28 Jun 2016 20:10:30 +0000 (20:10 +0000)]
Do not coredump if the packet is too long in the global (non-interface
associated) instance.

The result is that the packet is dropped without an indication
that smaller MTU is advisable, which is not optimal, but better
than a NULL pointer deref.

Approved by: re (glebius)

8 years agoUse on crypto.x and rpc.x from the source tree.
Bryan Drewery [Tue, 28 Jun 2016 19:53:16 +0000 (19:53 +0000)]
Use on crypto.x and rpc.x from the source tree.

This fixes the build when DESTDIR may be blank or not yet populated.
It also fixes reproducibility.

Submitted by: brooks
Approved by: re (gjb)
Differential Revision: https://reviews.freebsd.org/D6455

8 years agoRevert svn r302253 at the request/review of Ken M. This commit is
Sean Bruno [Tue, 28 Jun 2016 18:32:15 +0000 (18:32 +0000)]
Revert svn r302253 at the request/review of Ken M.  This commit is
incorrect.

PR: 202625
Approved by: re (implicit)

8 years agoCorrect PERSISTENT RESERVE OUT command and populate scsi_cmd->length.
Sean Bruno [Tue, 28 Jun 2016 18:08:47 +0000 (18:08 +0000)]
Correct PERSISTENT RESERVE OUT command and populate scsi_cmd->length.

PR: 202625
Submitted by: niakrisn@gmail.com
Reviewed by: scottl
Approved by: re (hrs)
MFC after: 2 weeks

8 years agoCurrently the ntptime code and resettodr() are Giant-locked. In
Konstantin Belousov [Tue, 28 Jun 2016 16:43:23 +0000 (16:43 +0000)]
Currently the ntptime code and resettodr() are Giant-locked. In
particular, the Giant is supposed to protect against parallel
ntp_adjtime(2) invocations.  But, for instance, sys_ntp_adjtime() does
copyout(9) under Giant and then examines time_status to return syscall
result.  Since copyout(9) could sleep, the syscall result might be
inconsistent.

Another and more important issue is that if PPS is configured,
hardpps(9) is executed without any protection against the parallel
top-level code invocation. Potentially, this may result in the
inconsistent state of the ntptime state variables, but I cannot say
how serious such distortion is. The non-functional splclock() call in
sys_ntp_adjtime() protected against clock interrupts calling hardpps()
in the pre-SMP era.

Modernize the locking. A mutex protects ntptime data.  Due to the
hardpps() KPI legitimately serving from the interrupt filters (and
e.g. uart(4) does call it from filter), the lock cannot be sleepable
mutex if PPS_SYNC is defined.  Otherwise, use normal sleepable mutex
to reduce interrupt latency.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
Differential revision: https://reviews.freebsd.org/D6825

8 years agoDo not use Giant to prevent parallel calls to CLOCK_SETTIME(). Use
Konstantin Belousov [Tue, 28 Jun 2016 16:42:40 +0000 (16:42 +0000)]
Do not use Giant to prevent parallel calls to CLOCK_SETTIME().  Use
private mtx in resettodr(), no implementation of CLOCK_SETTIME() is
allowed to sleep.

Reviewed by:   imp, jhb
Sponsored by:   The FreeBSD Foundation
Approved by:   re (gjb)
X-Differential revision: https://reviews.freebsd.org/D6825