freebsd.git
9 years agoAdd support for empty ranges properties within the tree, some vendor
andrew [Fri, 19 Dec 2014 13:07:36 +0000 (13:07 +0000)]
Add support for empty ranges properties within the tree, some vendor
device trees have these, for example the ARM AArch64 Foundation Model.

Sponsored by: The FreeBSD Foundation

9 years agoCorrect the end address of the memory regions.
br [Fri, 19 Dec 2014 12:09:29 +0000 (12:09 +0000)]
Correct the end address of the memory regions.

Pointed out by: ian

9 years agoFix `make depend` in sys/modules
lwhsu [Fri, 19 Dec 2014 06:51:01 +0000 (06:51 +0000)]
Fix `make depend` in sys/modules

Differential Revision: https://reviews.freebsd.org/D1338
Reviewed by: delphij
Approved by: delphij

9 years agoPlug a memory leak.
delphij [Fri, 19 Dec 2014 06:48:47 +0000 (06:48 +0000)]
Plug a memory leak.

Obtained from: DragonFlyBSD (commit 5119ece)
MFC after: 2 weeks

9 years agoRemove a private copy of ieee80211_add_ssid().
adrian [Fri, 19 Dec 2014 01:41:51 +0000 (01:41 +0000)]
Remove a private copy of ieee80211_add_ssid().

PR: kern/196116
Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>

9 years agoMake ieee80211_add_ssid() public.
adrian [Fri, 19 Dec 2014 01:39:58 +0000 (01:39 +0000)]
Make ieee80211_add_ssid() public.

Some drivers use private copies of this.

PR: kern/196116
Submitted by: Andriy Voskoboinyk <s3erios@gmail.com>

9 years agoSlightly polish iSCSI parameters negotiation.
mav [Fri, 19 Dec 2014 01:12:22 +0000 (01:12 +0000)]
Slightly polish iSCSI parameters negotiation.

MFC after: 1 week

9 years agoAdd missing continue: we can't proceed further if the
delphij [Fri, 19 Dec 2014 00:20:29 +0000 (00:20 +0000)]
Add missing continue: we can't proceed further if the
kernel does not panic with zfs_panic_recover.

Illumos issue:
    5438 zfs_blkptr_verify should continue after zfs_panic_recover

Reported by: Coverity
CID: 1232014

9 years agoMFV r275914:
delphij [Thu, 18 Dec 2014 23:45:26 +0000 (23:45 +0000)]
MFV r275914:

As of r270383, the dbuf_compare comparator compares the dbuf
attributes in the following order:

db_level (indirect level)
db_blkid (block number)
db_state (current state)
the address of the element

Because db_state is being considered before the element's state,
changing of db_state would affect balancedness of the AVL tree,
even when the address of element compares differently.  For
instance, in dbuf_create, db_state may be altered after the
node is inserted into the AVL tree and may break AVL tree
balancedness.

Instead of using db_state as a comparision critera (introduced
in r270383), consider it only when we are doing a lookup, that
is one of the two dbuf pointers contains DB_SEARCH.

Illumos issue:
    5422 preserve AVL invariants in dn_dbufs

MFC after: 2 weeks

9 years agoPass real optimal transfer size supported by backend.
mav [Thu, 18 Dec 2014 22:32:22 +0000 (22:32 +0000)]
Pass real optimal transfer size supported by backend.

For files and ZVOLs that is 1MB now, not 128K.

MFC after: 1 week

9 years agoSync with NetBSD, mainly address NetBSD bug #43355:
delphij [Thu, 18 Dec 2014 20:23:19 +0000 (20:23 +0000)]
Sync with NetBSD, mainly address NetBSD bug #43355:

Fix valid_format() to be more careful about allowing only valid
printf formats.

Obtained from: NetBSD
MFC after: 2 weeks

9 years agoInclude section name in strip warning message
emaste [Thu, 18 Dec 2014 19:09:59 +0000 (19:09 +0000)]
Include section name in strip warning message

9 years agoFix accidental MK_DEBUG_FILES=no addition to NXBMAKE in r275909
ngie [Thu, 18 Dec 2014 18:30:33 +0000 (18:30 +0000)]
Fix accidental MK_DEBUG_FILES=no addition to NXBMAKE in r275909

X-MFC with: r275909
Sponsored by: EMC / Isilon Storage Division

9 years agoDon't build full clang toolchain or clang extras in stages 1-3 of buildworld
ngie [Thu, 18 Dec 2014 18:26:10 +0000 (18:26 +0000)]
Don't build full clang toolchain or clang extras in stages 1-3 of buildworld

MFC after: 1 week
Reviewed by: dim (as part of a "larger" diff)
Phabric: D1336
Sponsored by: EMC / Isilon Storage Division

9 years agoDocument STRIP_CMD in build(7) and note its importance with LOCAL_ITOOLS
ngie [Thu, 18 Dec 2014 18:20:33 +0000 (18:20 +0000)]
Document STRIP_CMD in build(7) and note its importance with LOCAL_ITOOLS

MFC after: 1 week
Phabric: D1335
Reviewed by: brueffer
Sponsored by: EMC / Isilon Storage Division

9 years agoFix building/installing tests when TESTSBASE != /usr/tests
ngie [Thu, 18 Dec 2014 18:16:00 +0000 (18:16 +0000)]
Fix building/installing tests when TESTSBASE != /usr/tests

The work in r258233 hardcoded the assumption that tests was the last component
of the tests tree by pushing tests as an explicit prefix for the paths in
BSD.tests.dist and /usr was the prefix for all tests, per BSD.usr.dist and all
of the mtree calls used in Makefile.inc1. This assumption breaks if/when one
provides a custom TESTSBASE "prefix", e.g. TESTSBASE=/mytests .

One thing that r258233 did properly though was remove "/usr/tests" creation
from BSD.usr.dist -- that should have not been there in the first place. That
was an "oops" on my part for the work that was originally committed in r241823

MFC after: 2 weeks
Phabric: D1301
Reviewed by: imp
Sponsored by: EMC / Isilon Storage Division

9 years agoSetgid before running a command as a specified user. Previously only
jamie [Thu, 18 Dec 2014 18:10:39 +0000 (18:10 +0000)]
Setgid before running a command as a specified user.  Previously only
initgroups(3) was called, what isn't quite enough.  This brings jail(8)
in line with jexec(8), which was already doing the right thing.

PR: 195984
MFC after: 1 week

9 years agoDon't deselect the card too soon. To set the block size or switch the
imp [Thu, 18 Dec 2014 16:57:22 +0000 (16:57 +0000)]
Don't deselect the card too soon. To set the block size or switch the
function parameters, the card has to be in transfer state. If it is in
the idle state, the commands are ignored. This caused us not to set
the proper parameters that we later assume to be present, leading to
downstream failures of the card / interface as our state machine
mismatches the card's.

Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun
<meloun at miracle.cz>

9 years agoRemove -fno-strict-alias, as it is no longer needed.
imp [Thu, 18 Dec 2014 16:57:19 +0000 (16:57 +0000)]
Remove -fno-strict-alias, as it is no longer needed.

9 years agoAdd AArch64 64-bit relocation values. These will be needed by rtld when
andrew [Thu, 18 Dec 2014 14:31:30 +0000 (14:31 +0000)]
Add AArch64 64-bit relocation values. These will be needed by rtld when
we import it along with utilities in elftoolchain.

Differential Revision: https://reviews.freebsd.org/D1330
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

9 years agoThe VOP_LOOKUP() implementations for CREATE op do not put the name
kib [Thu, 18 Dec 2014 10:01:12 +0000 (10:01 +0000)]
The VOP_LOOKUP() implementations for CREATE op do not put the name
into namecache, to avoid cache trashing when doing large operations.
E.g., tar archive extraction is not usually followed by access to many
of the files created.

Right now, each VOP_LOOKUP() implementation explicitely knowns about
this quirk and tests for both MAKEENTRY flag presence and op != CREATE
to make the call to cache_enter().  Centralize the handling of the
quirk into VFS, by deciding to cache only by MAKEENTRY flag in VOP.
VFS now sets NOCACHE flag for CREATE namei() calls.

Note that the change in semantic is backward-compatible and could be
merged to the stable branch, and is compatible with non-changed
third-party filesystems which correctly handle MAKEENTRY.

Suggested by: Chris Torek <torek@pi-coral.com>
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

9 years agoFix the scan handling for 11b->11g upgrades in a world where, well,
adrian [Thu, 18 Dec 2014 05:17:18 +0000 (05:17 +0000)]
Fix the scan handling for 11b->11g upgrades in a world where, well,
it's not just 11b/11g.

The following was happening, and it's quite .. annoyingly grr-y.

* create vap, setup wpa_supplicant with no bgscanning, etc - there's
  no call to ieee80211_media_change, so vap->iv_des_mode is
  IEEE80211_MODE_AUTO;
* do ifconfig wlan0 scan - same thing, media_change doesn't get called,
  iv_des_mode stays as auto.
* But then, run wpa_cli and do 'scan' - it'll do a media change.
* if you're on 11ng, vap->iv_des_mode gets changed to IEEE80211_MODE_11NG
* Then makescanlist() is called.  There's a block of code that gets
  called if iv_des_mode != IEEE80211_MODE_AUTO, and it does this:

if (vap->iv_des_mode != IEEE80211_MODE_11G ||
    mode != IEEE80211_MODE_11B)
continue;
mode = IEEE80211_MODE_11G; /* upgrade */

* .. now, iv_des_mode is not IEEE80211_MODE_11G, so it always runs
  'continue'
* .. and thus the scan list stays empty and no further channel
  scans occur. Ever.(1)

If you then disassociate and try associating to something, your
scan table has likely been purged / aged out and you'll never
see anything in the scan list.

(1) You need to do 'ifconfig wlan0 mode auto' or just destroy/re-create
    the VAP to get working wireless again.

Tested:

* iwn(4) - intel 5300 wifi; STA mode; using wpa_supplicant; bgscan
  enabled -and- wpa_supplicant scanning.

Thanks to:

* Everyone who kept poking me about this and wondering why the hell
  their wifi would eventually stop seeing scan lists.  Grr.
  I eventually snapped this evening and dug back into this code.

9 years agoIn bsdinstall's distextract, replace mixed_gauge() of dialog(3) with
dteske [Thu, 18 Dec 2014 03:51:09 +0000 (03:51 +0000)]
In bsdinstall's distextract, replace mixed_gauge() of dialog(3) with
new dpv(3) wrapper to dialog(3) dialog_gauge(). The dpv(3) library provides
a more flexible and refined interface similar to dialog_mixedgauge() however
is implemented atop the more generalized dialog_gauge() for portability.
Noticeable improvements in bsdinstall's distextract will be a status line
showing data rate information (with support for localeconv(3) to format
numbers according to $LANG or $LC_ALL conversion information), i18n support,
improved auto-sizing of gauge widget, a ``wheel barrow'' to keep the user
informed that things are moving (even if status/progress has not changed),
improved color support (mini-progress bars use the same color, if enabled,
as the main gauge bar), and several other improvements (some not visible).
dpv stands for "dialog progress view" (dpv was introduced in SVN r274116).

Differential Revision: https://reviews.freebsd.org/D714
Discussed on: -current
Reviewed by: julian
MFC after: 3 days
X-MFC-to: stable/10
Relnotes: Improved installer feedback from bsdinstall distextract

9 years agoMake gas parse '__tls_get_addr(foo@tlsgd)'.
jhibbits [Thu, 18 Dec 2014 03:12:46 +0000 (03:12 +0000)]
Make gas parse '__tls_get_addr(foo@tlsgd)'.

Corresponds to 727fc41e077139570ea8b8ddfd6c546b2a55627c.

This allows us to use -no-integrated-as with clang, if we prefer.

Obtained from: binutils-gdb (Relicensed from Alan Modra as GPLv2)
MFC after: 2 weeks
X-MFC-with: r275718

9 years agoUpdate the use of bus space macros to be more correct.
adrian [Wed, 17 Dec 2014 21:27:27 +0000 (21:27 +0000)]
Update the use of bus space macros to be more correct.

This was a problem on i386 PAE builds.

9 years agoUse the correct macro for listing the maximum bus space size.
adrian [Wed, 17 Dec 2014 21:26:25 +0000 (21:26 +0000)]
Use the correct macro for listing the maximum bus space size.

Without this, it fails to compile on i386 PAE builds.

9 years agoAdd a missing break.
tuexen [Wed, 17 Dec 2014 20:34:38 +0000 (20:34 +0000)]
Add a missing break.

Reported by: Coverity
CID: 1232014
MFC after:  3 days

9 years agoPlug a memory leak in an error code path.
tuexen [Wed, 17 Dec 2014 20:19:57 +0000 (20:19 +0000)]
Plug a memory leak in an error code path.

Reported by: Coverity
CID: 1018936
MFC after:  3 days

9 years agoFix sporadic build failures due to race when running make installworld
ngie [Wed, 17 Dec 2014 20:02:07 +0000 (20:02 +0000)]
Fix sporadic build failures due to race when running make installworld
when strip gets replaced at install time by adding it to ITOOLS for the
default usr.bin/xinstall STRIP_CMD

This will fix the failure noted in this Jenkins build step:
https://jenkins.freebsd.org/job/Build-UFS-image/688/

This will also fix the issue reported by alfred@ dealing with installing on
targets that differ from build hosts (e.g. installing on i386/i386 when built
on amd64/amd64)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

9 years agoParallelize building gnu/usr.bin/groff
ngie [Wed, 17 Dec 2014 19:46:12 +0000 (19:46 +0000)]
Parallelize building gnu/usr.bin/groff

This speeds up building the directory from the bootstrap-tools stage in
buildworld as well as building from the subdirectory

Based on a patch submitted via -arch:
https://lists.freebsd.org/pipermail/freebsd-arch/2014-December/016493.html

MFC after: 1 week
Submitted by: Jia-Shiun Li <jiashiun@gmail.com>
Sponsored by: EMC / Isilon Storage Division

9 years agoAdd configuration options to override physical and UNMAP blocks geometry.
mav [Wed, 17 Dec 2014 17:30:54 +0000 (17:30 +0000)]
Add configuration options to override physical and UNMAP blocks geometry.

While in most cases CTL should correctly fetch those values from backing
storages, there are some initiators (like MS SQL), that may not like large
physical block sizes, even if they are true.  For such cases allow override
fetched values with supported ones (like 4K).

MFC after: 1 week

9 years agoMake sequence numbers checks more strict.
mav [Wed, 17 Dec 2014 15:13:21 +0000 (15:13 +0000)]
Make sequence numbers checks more strict.

While we don't support MCS, hole in received sequence numbers may mean
only PDU loss.  While we don't support lost PDU recovery, terminate the
connection to avoid stuck commands.

While there, improve handling of sequence numbers wrap after 2^32 PDUs.

MFC after: 2 weeks

9 years agoDo not strip all when stripping an explicit symbol
emaste [Wed, 17 Dec 2014 14:46:21 +0000 (14:46 +0000)]
Do not strip all when stripping an explicit symbol

When requested to strip specific symbols (-N flag) the default should be
to strip nothing (other than the requested symbols). This is consistent
with binutils strip(1).

PR: 196038
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1327

9 years agoAdd configuration files for BERI soft-core synthesized on
br [Wed, 17 Dec 2014 11:36:31 +0000 (11:36 +0000)]
Add configuration files for BERI soft-core synthesized on
Terasic SoCKit board (Altera FPGA).

Use virtio block as root filesystem device.

Sponsored by: DARPA, AFRL

9 years agoMove memory node to the root, so fdt_get_mem_regions() can find it.
br [Wed, 17 Dec 2014 11:05:44 +0000 (11:05 +0000)]
Move memory node to the root, so fdt_get_mem_regions() can find it.

9 years agoo Add PIO[2,3] devices information
br [Wed, 17 Dec 2014 10:48:53 +0000 (10:48 +0000)]
o Add PIO[2,3] devices information
o Enable Virtio Block

9 years agoUse memory regions information provided in FDT.
br [Wed, 17 Dec 2014 09:34:54 +0000 (09:34 +0000)]
Use memory regions information provided in FDT.

Reviewed by: brooks
Sponsored by: DARPA, AFRL

9 years agoInitilize the msg_flags field consistently in all code paths.
tuexen [Wed, 17 Dec 2014 07:47:25 +0000 (07:47 +0000)]
Initilize the msg_flags field consistently in all code paths.

Reported by: Coverity
CID: 1018726

9 years agoAdjust printf format specifiers for dev_t and ino_t in kernel.
gleb [Wed, 17 Dec 2014 07:27:19 +0000 (07:27 +0000)]
Adjust printf format specifiers for dev_t and ino_t in kernel.

ino_t and dev_t are about to become uint64_t.

Reviewed by: kib, mckusick

9 years agoAdjust printf format specifiers for dev_t and ino_t in user space.
gleb [Wed, 17 Dec 2014 07:10:48 +0000 (07:10 +0000)]
Adjust printf format specifiers for dev_t and ino_t in user space.

ino_t and dev_t are about to become uint64_t.

Reviewed by: kib, mckusick

9 years agoMFV r275844:
delphij [Wed, 17 Dec 2014 06:55:44 +0000 (06:55 +0000)]
MFV r275844:

Fix unbound remote denial of service vulnerability.

Security: FreeBSD-SA-14:30.unbound
Security: CVE-2014-8602

9 years agoPrefix all the vxlan ifconfig commands so they are unique
bryanv [Wed, 17 Dec 2014 05:36:34 +0000 (05:36 +0000)]
Prefix all the vxlan ifconfig commands so they are unique

And rehook ifvxlan back into the build.

9 years agoFix 8259 IRQ priority resolver.
neel [Wed, 17 Dec 2014 03:04:43 +0000 (03:04 +0000)]
Fix 8259 IRQ priority resolver.
Initialize the 8259 such that IRQ7 is the lowest priority.

Reviewed by: tychon
Differential Revision: https://reviews.freebsd.org/D1322
MFC after: 1 week

9 years agoBump Dd for r275846
bdrewery [Wed, 17 Dec 2014 01:36:00 +0000 (01:36 +0000)]
Bump Dd for r275846

MFC after: 3 weeks

9 years agoAdd some additional clarification and fix a few gammer nits.
mckusick [Wed, 17 Dec 2014 01:32:27 +0000 (01:32 +0000)]
Add some additional clarification and fix a few gammer nits.

Reviewed by: kib
MFC after:   3 weeks

9 years agoInitialize an argument to NULL instead of expecting dlinfo() to do it.
will [Wed, 17 Dec 2014 00:22:41 +0000 (00:22 +0000)]
Initialize an argument to NULL instead of expecting dlinfo() to do it.

dlinfo() is a weak reference that may not be initialized at the time of
execution. The default implementation (in lib/libc/gen/dlfcn.c) neither
modifies the address pointed to by the third argument nor returns an error.

Differential Revision: https://reviews.freebsd.org/D1326
Reviewed by: markj
MFC after: 1 week

9 years agoDo not count RCTD bit set as an error.
mav [Tue, 16 Dec 2014 21:51:21 +0000 (21:51 +0000)]
Do not count RCTD bit set as an error.

We can not really implement it, but specification tells that it "shall"
work, so it can be safely ignored.

MFC after: 1 week

9 years agoAdd an UPDATING entry and warning about the change in r274807 to help users
brooks [Tue, 16 Dec 2014 20:45:17 +0000 (20:45 +0000)]
Add an UPDATING entry and warning about the change in r274807 to help users
transition to the new behavior.

Discussed with: jmallett
Sponsored by: DARPA, AFRL

9 years agosed: Bounds check the file path used in the 'w' command.
pfg [Tue, 16 Dec 2014 20:26:11 +0000 (20:26 +0000)]
sed: Bounds check the file path used in the 'w' command.

Modified version of a diff from Sebastien Marie to prevent a crash found
with the afl fuzzer.

Obtained from: OpenBSD (CVS Rev. 1.37)
MFC after: 1 week

9 years agoThe iret instruction may generate #np and #ss fault, besides #gp.
kib [Tue, 16 Dec 2014 18:28:33 +0000 (18:28 +0000)]
The iret instruction may generate #np and #ss fault, besides #gp.
When returning to usermode, the handler for that exceptions is also
executed with wrong gs base.  Handle all three possible faults in the
same way, checking for iret fault, and performing full iret.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 years agoMake NanoBSD source-able from other scripts.
will [Tue, 16 Dec 2014 17:59:05 +0000 (17:59 +0000)]
Make NanoBSD source-able from other scripts.

Summary:
This change converts NanoBSD into a two-script bundle.
- defaults.sh contains all non-CLI code.  Most NanoBSD code is moved into
  this file.
- nanobsd.sh now consists just of a command line interface that calls into
  functions in defaults.sh.

Test Plan: Run NanoBSD using a previously-working configuration.

Reviewers: imp

Reviewed By: imp

Differential Revision: https://reviews.freebsd.org/D1321

9 years agoCopy elftoolchain readelf from vendor branch
emaste [Tue, 16 Dec 2014 16:23:54 +0000 (16:23 +0000)]
Copy elftoolchain readelf from vendor branch

9 years agoAdd ability to not specify a zone identifier twice, when both source and
ae [Tue, 16 Dec 2014 14:59:20 +0000 (14:59 +0000)]
Add ability to not specify a zone identifier twice, when both source and
destination addresses are specified.
For example:
# ping6 -S fe80::1%ix0 ff02::1
or
# ping6 -S fe80::1 fe80::2%ix0

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

9 years agoAdd tests for pw -N
brd [Tue, 16 Dec 2014 14:50:33 +0000 (14:50 +0000)]
Add tests for pw -N

PR: 150449
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Approved by: will

9 years agoAdd missed break.
kib [Tue, 16 Dec 2014 09:49:07 +0000 (09:49 +0000)]
Add missed break.

CID: 1258587
Sponsored by: The FreeBSD Foundation
MFC after: 20 days

9 years agoAdd missed break.
kib [Tue, 16 Dec 2014 09:48:23 +0000 (09:48 +0000)]
Add missed break.

CID: 1258586
Sponsored by: The FreeBSD Foundation
MFC after: 4 days

9 years agoRename cpack*() to CMPLX*().
ed [Tue, 16 Dec 2014 09:21:56 +0000 (09:21 +0000)]
Rename cpack*() to CMPLX*().

The C11 standard introduced a set of macros (CMPLX, CMPLXF, CMPLXL) that
can be used to construct complex numbers from a pair of real and
imaginary numbers. Unfortunately, they require some compiler support,
which is why we only define them for Clang and GCC>=4.7.

The cpack() function in libm performs the same task as CMPLX(), but
cannot be used to generate compile-time constants. This means that all
invocations of cpack() can safely be replaced by C11's CMPLX(). To keep
the code building with GCC 4.2, provide copies of CMPLX() that can at
least be used to generate run-time complex numbers.

This makes it easier to build some of the functions outside of libm.

9 years agosbin/shutdown: Support time units as in 'shutdown -r +5sec'
gleb [Tue, 16 Dec 2014 08:29:02 +0000 (08:29 +0000)]
sbin/shutdown: Support time units as in 'shutdown -r +5sec'

Units supported: s, sec, m, min, h, hour.

Differential Revision: https://reviews.freebsd.org/D1272

9 years agoFor level triggered interrupts clear the PIC IRR bit when the interrupt pin
neel [Tue, 16 Dec 2014 06:33:57 +0000 (06:33 +0000)]
For level triggered interrupts clear the PIC IRR bit when the interrupt pin
is deasserted. Prior to this change each assertion on a level triggered irq
pin resulted in two interrupts being delivered to the CPU.

Differential Revision: https://reviews.freebsd.org/D1310
Reviewed by: tychon
MFC after: 1 week

9 years agoFix a bug introdiced in r217548. According to NS DP83815 data
yongari [Tue, 16 Dec 2014 06:13:30 +0000 (06:13 +0000)]
Fix a bug introdiced in r217548.  According to NS DP83815 data
sheet, RX filter should be disabled before programming.
Previously it was clearing wrong bits so RX filter was not
disabled in RX filter configuration.

Reported by: brad@OpenBSD.org

9 years agoUse standard BSD license disclaimer text
emaste [Mon, 15 Dec 2014 22:20:14 +0000 (22:20 +0000)]
Use standard BSD license disclaimer text

Approved by: benno, nwhitehorn

9 years agoProperly sort Xr to silence mandoc warnings.
dchagin [Mon, 15 Dec 2014 20:48:06 +0000 (20:48 +0000)]
Properly sort Xr to silence mandoc warnings.

Differential Revision: https://reviews.freebsd.org/D1314
Reviewed by: wblock
MFC after: 1 Month

9 years agoMFV r275784:
delphij [Mon, 15 Dec 2014 18:28:22 +0000 (18:28 +0000)]
MFV r275784:

Plug a memory leak in libzfs.  In zfs_iter_bookmarks, an nvlist is allocated
before calling lzc_get_bookmarks, which allocates the nvlist again (and
overwrites the pointer to previously allocated list).

Illumos issue:
    5427 memory leak in libzfs when doing rollback

MFC after: 2 weeks

9 years agoMFV r275783:
delphij [Mon, 15 Dec 2014 18:22:45 +0000 (18:22 +0000)]
MFV r275783:

Convert ARC flags to use enum.  Previously, public flags are defined in
arc.h and private flags are defined in arc.c which can lead to confusion
and programming errors.

Consistently use 'hdr' (when referencing arc_buf_hdr_t) instead of 'buf'
or 'ab' because arc_buf_t are often named 'buf' as well.

Illumos issue:
    5369 arc flags should be an enum
    5370 consistent arc_buf_hdr_t naming scheme

MFC after: 2 weeks

9 years agoCorrect elftoolchain strip(1) memory size calculation
emaste [Mon, 15 Dec 2014 18:18:57 +0000 (18:18 +0000)]
Correct elftoolchain strip(1) memory size calculation

Calculate the segment's memory size (p_memsz) using the virtual
addresses, not the file offsets. Otherwise padding preceeding SHT_NOBITS
sections may be excluded from the calculation, resulting in a segment
that is too small.

PR: 195653
Sponsored by: The FreeBSD Foundation

9 years agoCheck for SS_NBIO in so->so_state instead of sb->sb_flags in
jhb [Mon, 15 Dec 2014 17:52:08 +0000 (17:52 +0000)]
Check for SS_NBIO in so->so_state instead of sb->sb_flags in
soreceive_stream().

Differential Revision: https://reviews.freebsd.org/D1299
Reviewed by: bz, gnn
MFC after: 1 week

9 years agoMarkup fixes for kqueue(2), no content changes.
kib [Mon, 15 Dec 2014 14:58:10 +0000 (14:58 +0000)]
Markup fixes for kqueue(2), no content changes.

Reviewed by: brueffer (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 years agoFix incorrect type of "invalids" argument in __iconv() prototype.
kuriyama [Mon, 15 Dec 2014 14:36:04 +0000 (14:36 +0000)]
Fix incorrect type of "invalids" argument in __iconv() prototype.

9 years agoRemove empty generated file upon gperf failure
emaste [Mon, 15 Dec 2014 14:25:42 +0000 (14:25 +0000)]
Remove empty generated file upon gperf failure

Prior to this change the build could fail as follows, if gperf is not
available (or fails):

  - make(1) stops due to the gperf error, but an empty target file
    (cfns.h) is still created
  - the empty cfns.h is newer than the source cfns.gperf so it is not
    regenerated on subsequent builds
  - the gcc build fails (undefined reference to libc_name_p)

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 years agoFix typo.
br [Mon, 15 Dec 2014 12:15:18 +0000 (12:15 +0000)]
Fix typo.

9 years agoAdd a facility for non-init process to declare itself the reaper of
kib [Mon, 15 Dec 2014 12:01:42 +0000 (12:01 +0000)]
Add a facility for non-init process to declare itself the reaper of
the orphaned descendants.  Base of the API is modelled after the same
feature from the DragonFlyBSD.

Requested by: bapt
Reviewed by: jilles (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

9 years agoFollow r275792 eliminating fdt_data_verify().
br [Mon, 15 Dec 2014 11:57:39 +0000 (11:57 +0000)]
Follow r275792 eliminating fdt_data_verify().

9 years agoEliminate fdt_data_verify(). The verification it proceed is wrong
br [Mon, 15 Dec 2014 09:40:25 +0000 (09:40 +0000)]
Eliminate fdt_data_verify(). The verification it proceed is wrong
disallowing us to encode 64-bit register numbers.

Discussed with: nwhitehorn, andrew

9 years agoRegenerate usb.conf .
hselasky [Mon, 15 Dec 2014 09:35:46 +0000 (09:35 +0000)]
Regenerate usb.conf .

MFC after: 1 week

9 years agoResolve USB driver identification conflict.
hselasky [Mon, 15 Dec 2014 09:23:40 +0000 (09:23 +0000)]
Resolve USB driver identification conflict.

Reported by: Anish Mistry <amistry@am-productions.biz>
MFC after: 1 week

9 years agoMFV r275551:
delphij [Mon, 15 Dec 2014 07:52:23 +0000 (07:52 +0000)]
MFV r275551:

Remove "dbuf phys" db->db_data pointer aliases.

Use function accessors that cast db->db_data to the appropriate
"phys" type, removing the need for clients of the dmu buf user
API to keep properly typed pointer aliases to db->db_data in order
to conveniently access their data.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c:
        In zap_leaf() and zap_leaf_byteswap, now that the pointer alias
        field l_phys has been removed, use the db_data field in an on
        stack dmu_buf_t to point to the leaf's phys data.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c:
        Remove the db_user_data_ptr_ptr field from dbuf and all logic
        to maintain it.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c:
        Modify the DMU buf user API to remove the ability to specify
        a db_data aliasing pointer (db_user_data_ptr_ptr).

cddl/contrib/opensolaris/cmd/zdb/zdb.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h:
        Create and use the new "phys data" accessor functions
        dsl_dir_phys(), dsl_dataset_phys(), zap_m_phys(),
        zap_f_phys(), and zap_leaf_phys().

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h:
        Remove now unused "phys pointer" aliases to db->db_data
        from clients of the DMU buf user API.

Illumos issue:
    5314 Remove "dbuf phys" db->db_data pointer aliases in ZFS

MFC after: 2 weeks

9 years agoMFV r275550:
delphij [Mon, 15 Dec 2014 05:10:55 +0000 (05:10 +0000)]
MFV r275550:

In addition to r273158, make the code in spa_sync() that checks if the
current TXG is a no-op TXG less fragile.

Illumos issue:
    5347 idle pool may run itself out of space

MFC after: 2 weeks

9 years agoMFV r275549:
delphij [Mon, 15 Dec 2014 04:51:36 +0000 (04:51 +0000)]
MFV r275549:

Add a loader tunable, vfs.zfs.arc_meta_min, which controls how much metadata
ZFS should keep in ARC at minimum.

In arc_evict(), when doing recycle, take more factors into account by
applying the following policy:

  1. If no evictable data, evict metadata;
  2. If no evictable metadata, evict data;
  3. If we hit arc_meta_limit, evict metadata;
  4. If we haven't hit arc_meta_min, evict data;
  5* (Illumos only, not present in new FreeBSD code, yet) evict the oldest
     cached element from data and metadata.
     (FreeBSD) evict the data type specified by caller, which is the
     existing behavior.

Note that because of our splitted locks (implemented in r205231 to improve
scalability by reducing lock contention), implementing the fifth Illumos
behavior will not be cheap, so for now just implement the 1-4 and fall back
to current behavior for 5.

Illumos issue:
    5368 ARC should cache more metadata

MFC after: 2 months (assuming we didn't found better solution)

9 years agoMove ofw_cpu.c to sys/dev/ofw so that it can be used by other
rpaulo [Sun, 14 Dec 2014 22:41:08 +0000 (22:41 +0000)]
Move ofw_cpu.c to sys/dev/ofw so that it can be used by other
architectures.

Differential Revision: https://reviews.freebsd.org/D1307
Reviewed by: jhibbits

9 years agoUpdate clang patch for r275759 to use correct test cases.
dim [Sun, 14 Dec 2014 18:16:49 +0000 (18:16 +0000)]
Update clang patch for r275759 to use correct test cases.

9 years agoAdd a vigr(8) utility which does for /etc/group what vipw(8) does for
des [Sun, 14 Dec 2014 16:40:46 +0000 (16:40 +0000)]
Add a vigr(8) utility which does for /etc/group what vipw(8) does for
/etc/master.passwd.

9 years agosh: Make sure output suitable as shell input is also printable.
jilles [Sun, 14 Dec 2014 16:26:19 +0000 (16:26 +0000)]
sh: Make sure output suitable as shell input is also printable.

Commands like 'export -p', 'set' and 'trap', and tracing enabled via 'set
-x' generate output suitable as shell input by adding quotes as necessary.

If there are control characters other than newline or invalid UTF-8
sequences, use $'...' and \OOO to display them safely.

The resulting output is not parsable by a strict POSIX.1-2008 shell but sh
from FreeBSD 9.0 and newer and many other shells can parse it.

9 years agoClean up, reindent, add a special case for NIS / LDAP line
des [Sun, 14 Dec 2014 16:17:48 +0000 (16:17 +0000)]
Clean up, reindent, add a special case for NIS / LDAP line

MFC after: 1 week

9 years agoAdd clang patch corresponding to r275759.
dim [Sun, 14 Dec 2014 13:40:42 +0000 (13:40 +0000)]
Add clang patch corresponding to r275759.

9 years agoPull in r221170 from upstream clang trunk (by Roman Divacky):
dim [Sun, 14 Dec 2014 13:38:10 +0000 (13:38 +0000)]
Pull in r221170 from upstream clang trunk (by Roman Divacky):

  Implement vaarg lowering for ppc32. Lowering of scalars and
  aggregates is supported. Complex numbers are not.

This adds va_args support for PowerPC (32 bit) to clang.

Reviewed by: jhibbits
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1308

9 years agoUpdate patch-r274286-llvm-r201784-asm-dollar.diff, so
dim [Sun, 14 Dec 2014 13:32:14 +0000 (13:32 +0000)]
Update patch-r274286-llvm-r201784-asm-dollar.diff, so
test/MC/AsmParser/macros.s is properly deleted when patching.

9 years agoFix bug that made automount(8) never unmount stale autofs(5) mounts,
trasz [Sun, 14 Dec 2014 10:49:22 +0000 (10:49 +0000)]
Fix bug that made automount(8) never unmount stale autofs(5) mounts,
ie mounts for entries that were there in auto_master(5), and then
got removed.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix spurious "child process X terminated with exit status 1" messages
trasz [Sun, 14 Dec 2014 10:37:17 +0000 (10:37 +0000)]
Fix spurious "child process X terminated with exit status 1" messages
from automountd(8).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoFix gcc build.
kib [Sun, 14 Dec 2014 08:43:13 +0000 (08:43 +0000)]
Fix gcc build.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days

9 years agoFix quick_exit(3) manual page to match reality - the status was missing.
trasz [Sat, 13 Dec 2014 21:13:28 +0000 (21:13 +0000)]
Fix quick_exit(3) manual page to match reality - the status was missing.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9).
dchagin [Sat, 13 Dec 2014 21:00:10 +0000 (21:00 +0000)]
Add _NEW flag to mtx(9), sx(9), rmlock(9) and rwlock(9).
A _NEW flag passed to _init_flags() to avoid check for double-init.

Differential Revision: https://reviews.freebsd.org/D1208
Reviewed by: jhb, wblock
MFC after: 1 Month

9 years agoMFV r247174:
delphij [Sat, 13 Dec 2014 19:17:28 +0000 (19:17 +0000)]
MFV r247174:

Expose arc_meta_limit, et al via kstats.

Note that as a result, vfs.zfs.arc_meta_used is removed.
The existing vfs.zfs.arc_meta_limit sysctl/tunable is retained
with a SYSCTL_PROC wrapper.

Illumos ZFS issues:
    3561 arc_meta_limit should be exposed via kstats

Relnotes: yes
MFC after: 2 weeks

9 years agoUpdate llvm patches for r274286 and r275633 so all the tests will pass.
dim [Sat, 13 Dec 2014 18:54:46 +0000 (18:54 +0000)]
Update llvm patches for r274286 and r275633 so all the tests will pass.

9 years agoFix markup.
trasz [Sat, 13 Dec 2014 17:14:35 +0000 (17:14 +0000)]
Fix markup.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

9 years agoAdd facility to stop all userspace processes. The supposed use of the
kib [Sat, 13 Dec 2014 16:18:29 +0000 (16:18 +0000)]
Add facility to stop all userspace processes.  The supposed use of the
feature is to quisce the system before suspend.

Stop is implemented by reusing the thread_single(9) with the special
mode SINGLE_ALLPROC.  SINGLE_ALLPROC differs from the existing
single-threading modes by allowing (requiring) caller to operate on
other process.  Interruptible sleeps for !TDF_SBDRY threads are
suspended like SIGSTOP does it, instead of aborting the sleep, like
SINGLE_NO_EXIT, to avoid spurious EINTRs on resume.

Provide debugging sysctl debug.stop_all_proc, which causes total stop
and suspends syncer, while waiting for variable reset for resume.  It
is used for debugging; should be removed after the real use of the
interface is added.

In collaboration with: pho
Discussed with: avg
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

9 years agoOnly sleep interruptible while waiting for suspension end when
kib [Sat, 13 Dec 2014 16:07:01 +0000 (16:07 +0000)]
Only sleep interruptible while waiting for suspension end when
filesystem specified VFCF_SBDRY flag, i.e. for NFS.

There are two issues with the sleeps.  First, applications may get
unexpected EINTR from the disk i/o syscalls.  Second, interruptible
sleep allows the stop of the process, and since mount point is
referenced while thread sleeps, unmount cannot free mount point
structure' memory, blocking unmount indefinitely.

Even for NFS, it is probably only reasonable to enable PCATCH for intr
mounts, but this information is currently not available at VFS level.

Reported and tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoThe vinactive() call in vgonel() may start writes for the dirty pages,
kib [Sat, 13 Dec 2014 16:02:37 +0000 (16:02 +0000)]
The vinactive() call in vgonel() may start writes for the dirty pages,
creating delayed write buffers belonging to the reclaimed vnode.  Put
the buffer cleanup code after inactivation.

Add asserts that ensure that buffer queues are empty and add BO_DEAD
flag for bufobj to check that no buffers are added after the cleanup.
BO_DEAD is only used by INVARIANTS-enabled kernels.

Reported and tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoMFV r275548:
delphij [Sat, 13 Dec 2014 02:08:18 +0000 (02:08 +0000)]
MFV r275548:

Verify that the block pointer is structurally valid, before attempting to
read it in.  It can only be invalid in the case of a ZFS bug, but this
change will help identify such bugs in a more transparent way, by
panic'ing with a relevant message, rather than indexing off the end of an
array or something.

Illumos issue:
    5349 verify that block pointer is plausible before reading

MFC after: 2 weeks

9 years agoMFV r275547:
delphij [Sat, 13 Dec 2014 01:55:02 +0000 (01:55 +0000)]
MFV r275547:

Port Illumos 'zfs allow' examples update.  While I'm there also fix
a typo.

Illumos issue:
    4181 zfs(1m): 'zfs allow' examples in the man page are outdated

MFC after: 2 weeks

9 years agoMFV r275546:
delphij [Sat, 13 Dec 2014 01:39:24 +0000 (01:39 +0000)]
MFV r275546:

Reduce scrub activities when system there is enough dirty data, namely when
dirty data is more than zfs_vdev_async_write_active_min_dirty_percent (once
we start to increase the number of concurrent async writes).

While there also correct rounding error which would make scrub end up
pausing for (zfs_txg_timeout + 1) seconds instead of the desired
zfs_txg_timeout seconds.

Illumos issue:
    5351 scrub goes for an extra second each txg
    5352 scrub should pause when there is some dirty data

MFC after: 2 weeks