101564 Commits

Author SHA1 Message Date
nwhitehorn
f1bce3cd64 MFC r277792:
Fix bug in mapppings of multiple pages exposed by updates to the VSCSI
support in QEMU. Each page of a many page mapping was getting mapped to
the same physical address, which is not the desired behavior.
2015-02-03 00:29:58 +00:00
delphij
00fdf5663a MFC r277806:
Use unsigned int for index value.

Without this change a local attacker could trigger a panic by
tricking the kernel into accessing undefined kernel memory.

We would like to acknowledge Francisco Falcon from CORE Security
Technologies who discovered the issue and reported to the
FreeBSD Security Team.

More information can be found at CORE Security's advisory at:
http://www.coresecurity.com/content/freebsd-kernel-multiple-vulnerabilities

This is an errata candidate for releng/10.1 and releng/9.3.  Earlier
releases are not affected.

Reported by:  Francisco Falcon from CORE Security Technologies
Security:     CVE-2014-0998
Reviewed by:  dumbbell
2015-02-02 18:48:49 +00:00
pfg
c6be6095bb MFC r277354, r277365:
ext2: Garbage-collect some unused variables

Reported by:	clang static analysis
2015-02-02 15:52:11 +00:00
loos
ba803d12f9 MFC r277042:
Add support to turn off Beaglebone with poweroff(8) or shutdown(8) -p.

To cut off the power we need to start the shutdown sequence by writing
the OFF bit on PMIC.

Once the PMIC is programmed the SoC needs to toggle the PMIC_PWR_ENABLE
pin when it is ready for the PMIC to cut off the power.  This is done by
triggering the ALARM2 interrupt on SoC RTC.

The RTC driver only works in power management mode which means it won't
provide any kind of time keeping functionality.  It only implements a way
to trigger the ALARM2 interrupt when requested.
2015-02-02 12:48:13 +00:00
loos
49286c2a50 MFC r261459, r273045, r273047.
r261459:
Remove trailing tabs causing false grep positives.

r273045:
Sort the files in the am355x directory.

r273047:
Remove the need for files.beaglebone and std.beaglebone by moving the one
option they defined into files.am335x.
2015-02-02 12:36:05 +00:00
mav
900f0a33cf MFC r277758: Fix several potential overflows in UNMAP code. 2015-02-02 12:09:42 +00:00
loos
6ca887b620 MFC r276751:
Remove the check that prevent carp(4) advskew to be set to '0'.

CARP devices are created with advskew set to '0' and once you set it to
any other value in the valid range (0..254) you can't set it back to zero.

The code in question is also used to prevent that zeroed values overwrite
the CARP defaults when a new CARP device is created.  Since advskew already
defaults to '0' for newly created devices and the new value is guaranteed
to be within the valid range, it is safe to overwrite it here.

PR:		194672
Reported by:	cmb@pfsense.org
2015-02-02 11:42:35 +00:00
loos
d3f0aee2c6 MFC r277208:
Fix the PMIC node name to match the PMIC i2c address.

Remove an extra blank line.

No functional changes.
2015-02-02 11:26:52 +00:00
loos
e340772cb9 MFC r277206:
Catch a few cases where we need to release memory resources on errors.

Place parentheses around variables in macros.
2015-02-02 11:12:31 +00:00
dim
2071e2cb3e MFC r277901:
Fix a -Wcast-qual warning in libkern's strtol(), by using __DECONST.  No
functional change.

MFC r277903:

Similar to r277901, fix more -Wcast-qual warnings in libkern's strtoq(),
strtoul() and strtouq(), by using __DECONST.  No functional change.
2015-02-02 08:05:11 +00:00
dim
c01327573e MFC r277899:
Fix a bunch of -Wcast-qual warnings in cd9660_util.c, by using
__DECONST.  No functional change.
2015-02-02 07:42:03 +00:00
dim
3541d65302 MFC r277898:
Fix a bunch of -Wcast-qual warnings in msdosfs_conv.c, by using
__DECONST.  No functional change.
2015-02-02 07:37:25 +00:00
dim
c38e60c109 MFC r277883:
Ensure that lint does not pick up C11 keywords (e.g.  _Noreturn), even
if C11 mode is used.  It does not support any C11 constructs.
2015-02-02 07:30:00 +00:00
smh
ee75a2f04f MFC r276123:
Always sync the global ZFS config cache to reflect the new mosconfig

MFC r277351:
Clean ZFS spa config before syncing

Sponsored by:	Multiplay
2015-02-01 12:39:40 +00:00
jamie
c6bc15d7ab MFC r277855:
Add allow.mount.fdescfs jail flag.

PR:		192951
Submitted by:	ruben@verweg.com
2015-01-31 17:35:53 +00:00
kib
b397ed48ff MFC r277827:
tmpfs does not use UVM on FreeBSD.
2015-01-31 11:04:41 +00:00
kib
8cc5d657dc MFC r277646:
Avoid calling vmspace_free() while owning the process lock.
2015-01-31 11:02:20 +00:00
jhb
11512d9430 MFC 274398,274537:
Move NFS and TFTP filesystems before the synthetic filesystems (bzip,
gzip, and split).
2015-01-30 18:55:05 +00:00
mav
0a6db6b09e MFC r277247: Don't count status as sent until CTIO completes successfully.
If we aggregated status sending with data move and got error, allow status
to be updated and resent again separately.  Without this command may stuck
without status sent at all.
2015-01-30 09:05:43 +00:00
mav
aba44db36e MFC r277529: Don't count requests with status sent as overlapping.
While those requests are still in target OOA queue, for initiator they are
already completed, so tags can be reused.
2015-01-30 09:04:20 +00:00
hselasky
0392db24d4 MFC r277246:
Add more USB device IDs.

PR:		196362
2015-01-28 20:01:21 +00:00
hselasky
8f49a6a1cb MFC r277417:
Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular
the value returned in the "udp_port_level" field.
2015-01-28 19:41:31 +00:00
pfg
bad15605e4 MFC r277340, r277349:
Remove dead code.
After the ext2 variant of the "orlov allocator" was implemented,
the case for a negative or zero dirsize disappeared.

Drop the dead code and unsign dirsize given that it can't be
negative anyways.

ext2fs: fix for uninitialized pointer read.
path.ep_bp was being used uninitialized in ext4_ext_find_extent().

CID:		1062344
CID:		1008669
2015-01-28 15:36:24 +00:00
mav
4a44a3d569 MFC r277185:
Fix overflow bug from r248577, turning 30s TRIM timeout into ~4s.
2015-01-28 02:56:18 +00:00
mav
33230ae6d4 MFC r277169: Reimplement TRIM throttling added in r248577.
Previous throttling implementation approached problem from the wrong side.
It significantly limited useful delaying of TRIM requests and aggregation
potential, while not so much controlled TRIM burstiness under heavy load.

With this change random 4K write benchmarks (probably the worst case for
TRIM) show me IOPS increase by 20%, average latency reduction by 30%, peak
TRIM bursts reduction by 3 times and same peak TRIM map size (memory usage).

Also the new logic does not force map size down so heavily, really allowing
to keep deleted data for 32 TXG or 30 seconds under moderate load.  It was
practically impossible with old throttling logic, which pushed map down to
only 64 segments.
2015-01-28 02:55:20 +00:00
mav
67407ee0df MFC r277647: Fix wrong LUN reference in XCOPY block-to-block operation.
This could cause data corruption due to accessing wrong LUN in case of
retries on write errors.  Failed writes were retried to read LUN.
2015-01-27 19:41:24 +00:00
delphij
03ae650167 Fix SCTP SCTP_SS_VALUE kernel memory corruption and disclosure vulnerability
and SCTP stream reset vulnerability.

Security:	FreeBSD-SA-15:02.kmem
Security:	CVE-2014-8612
Security:	FreeBSD-SA-15:03.sctp
Security:	CVE-2014-8613
2015-01-27 19:36:08 +00:00
bryanv
ebf97d8f13 Bump __FreeBSD_version after r277789: Changes to the UDP tunneling callback 2015-01-27 06:24:33 +00:00
bryanv
b5fba8dc05 MFC r272886:
Add context pointer and source address to the UDP tunnel callback

  These are needed for the forthcoming vxlan implementation. The context
  pointer means we do not have to use a spare pointer field in the inpcb,
  and the source address is required to populate vxlan's forwarding table.
2015-01-27 06:19:30 +00:00
jkim
8459b965f7 MFC: r277594
Simplify retry loops.
2015-01-26 19:27:30 +00:00
jkim
2c7d513fe4 MFC: r277579
Revert r216942.  This commit was premature and caused too many complaints.
2015-01-26 19:25:35 +00:00
mav
0b8166b5c2 MFC r277385: Remove extra mtx_unlock().
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2015-01-26 16:30:17 +00:00
mav
58f009f0d3 MFC r277096: Skip extra bcopy() when scrubbing vdev without redundancy.
According to profiler, this bcopy() can use about 10% of CPU time.
2015-01-26 16:29:07 +00:00
kib
b45c95ab3d MFC r277390:
Ignore devfs directory entries for devices being destroyed.
2015-01-26 11:37:16 +00:00
ae
efbb33d3cf MFC r277295:
Fix condition and really sort ports. Also add comment describing
  the intent of this code.
2015-01-25 16:35:03 +00:00
mav
e6f27f6344 MFC r276983: When aggregating TRIM segments, move the new one to the end.
New segment at the list head may block all TRIM requests until txg of that
segment can be processed.  On my random I/O tests this change reduce peak
TRIM list length from 650 to 450 segments.  Hopefully it should reduce TRIM
burstiness when list processing is unblocked.
2015-01-25 14:31:44 +00:00
mav
35b0606440 MFC r276952: Add LBA as secondary sort key for synchronous I/O requests.
On FreeBSD gethrtime() implemented via getnanouptime(), that has 1ms (1/hz)
precision.  It makes primary sort key (timestamp) collision very possible.
In such situations sorting by secondary key of LBA is much more reasonable
then by totally meaningless zio pointer value.

With this change on multi-threaded synchronous ZVOL read I've measured 10%
throughput increase and average latency reduction.
2015-01-25 14:29:40 +00:00
mav
a833c07b8b MFC r276913: Use new optimized dmu_read_uio_dbuf() for ZVOLs in device mode.
This slightly reduces overhead by avoiding dnode_hold()/dnode_rele() calls.
2015-01-25 14:25:44 +00:00
kib
53cbeb6d49 MFC r277322:
Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger
attachment to the process.
2015-01-25 13:15:12 +00:00
kib
9ddc339f8b MFC r277321:
Make SIGSTOP working for sleeps done while waiting for fifo readers or
writers in open(2), when the fifo is located on an NFS mount.
2015-01-25 13:09:53 +00:00
cperciva
65e2f94603 MFC r277318:
When disabling C3+ CPU states due to the CPU_QUIRK_NO_C3 quirk, don't
  accidentally enable non-existent states.

  This bug was triggered if ACPI advertises the presence of a C2 state
  which we fail to parse via acpi_PkgGas due to our lack of support for
  FFixedHW resources, and causes an immediate panic when an attempt is
  made to enter the (NULL) state.

  One affected platform is the EC2 c4.8xlarge VM instance type; there
  may be others.
2015-01-25 08:16:51 +00:00
pfg
ea5c22141a MFC r277301:
ext2: cosmetical issues

Minor sorting and note when the cases are expected to fall through.
2015-01-24 21:23:53 +00:00
delphij
f72184af7f MFC r276904:
Improve style and fix a possible use-after-free case introduced in r268384
by reinitializing the 'freestate' pointer after freeing the memory.

Obtained from:	HardenedBSD (71fab80c5dd3034b71a29a61064625018671bbeb)
PR:		194525
Submitted by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>
2015-01-24 00:27:50 +00:00
delphij
ae11365e35 MFC r275923:
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
2015-01-23 22:46:07 +00:00
delphij
771ee7d0d8 MFC r276795:
Fix sos@'s name.
2015-01-23 18:55:24 +00:00
delphij
902f541eb5 MFC r275922: 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
2015-01-23 18:39:26 +00:00
delphij
b84208b123 MFC r275811: 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
2015-01-23 18:33:50 +00:00
delphij
9ef0e2ecd5 MFC r275782: 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
2015-01-23 18:30:32 +00:00
delphij
cab26f42cc MFC r275781: 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
2015-01-23 18:28:37 +00:00
delphij
49b7f05a49 MFC r275748: 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
2015-01-23 18:23:19 +00:00