]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agosfxge: convert nvram erase method to use partition id
Andrew Rybchenko [Sun, 17 Jan 2016 05:12:37 +0000 (05:12 +0000)]
sfxge: convert nvram erase method to use partition id

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4957

8 years ago[PR 206224] bv_cnt is sometimes examined without holding the bufobj lock
Ravi Pokala [Sun, 17 Jan 2016 01:04:20 +0000 (01:04 +0000)]
[PR 206224] bv_cnt is sometimes examined without holding the bufobj lock

Add locking around access to bv_cnt which is currently being done unlocked

PR: 206224
Reviewed by: imp
Approved by: jhb
MFC after: 1 week
Sponsored by: Panasas, Inc.
Differential Revision: https://reviews.freebsd.org/D4931

8 years agoRemove leading slashes added to ObsoleteFiles.inc in r294113.
Dimitry Andric [Sun, 17 Jan 2016 00:52:28 +0000 (00:52 +0000)]
Remove leading slashes added to ObsoleteFiles.inc in r294113.

8 years agourtwn: add ROM structure for RTL8188EU
Andriy Voskoboinyk [Sun, 17 Jan 2016 00:52:21 +0000 (00:52 +0000)]
urtwn: add ROM structure for RTL8188EU

- Add the structure with already known fields offsets
  (some of them were taken from this driver,
  some (channel_plan, rf_* fields) - from TP-LINK official driver)
- Fix a typo / dehardcode a constant in RTL8192C ROM structure.

Tested with RTL8188EU, STA mode

Reviewed by: kevlo
Approved by: adrian (mentor)
Differential Revision: https://reviews.freebsd.org/D4274

8 years agoe5500 HWPMC is identical to e500mc, so add support check for it.
Justin Hibbits [Sun, 17 Jan 2016 00:14:22 +0000 (00:14 +0000)]
e5500 HWPMC is identical to e500mc, so add support check for it.

8 years agoDon't bother checking an ip[46].addr netmask/prefixlen. This is already
Jamie Gritton [Sat, 16 Jan 2016 22:32:57 +0000 (22:32 +0000)]
Don't bother checking an ip[46].addr netmask/prefixlen.  This is already
handled by ifconfig, and it was doing it wrong when the paramater included
extra ifconfig options.

PR: 205926
MFC after: 5 days

8 years agoPartially revert r294055.
Justin Hibbits [Sat, 16 Jan 2016 21:24:12 +0000 (21:24 +0000)]
Partially revert r294055.

This part was a botched revert of a test change.

Spotted by: alc

8 years agoNever 4k align the MBR bootpool because zfsldr can not deal with a gap
Allan Jude [Sat, 16 Jan 2016 19:25:16 +0000 (19:25 +0000)]
Never 4k align the MBR bootpool because zfsldr can not deal with a gap

If the bootpool does not start at the first sector of the BSD partition
then zfsldr seeks to the wrong offset inside the ZFS vdev label, and is
unable to find zfsboot, so the system does not boot

If 4k alignment is requested, align the BSD partition in the MBR table,
and align the swap and data pool, but the bootpool must start at sector 1

While here, if 4k alignment is requested, disable MBR CHS alignment, as
this results in not-4k aligned partitions.

Reported by: Alex Wilkinson
MFC after: 5 days
Sponsored by: ScaleEngine Inc.

8 years agoClear errno before calling getpw*.
Jamie Gritton [Sat, 16 Jan 2016 18:13:28 +0000 (18:13 +0000)]
Clear errno before calling getpw*.

8 years agoUse __ARM_ARCH to decide when ARM_TP_ADDRESS needs to be set. This fixes
Andrew Turner [Sat, 16 Jan 2016 10:12:50 +0000 (10:12 +0000)]
Use __ARM_ARCH to decide when ARM_TP_ADDRESS needs to be set. This fixes
an issue with clang 3.8.0 where none of the __ARM_ARCH_*__ macros were
defined on some ARMv6 kernel configs.

Sponsored by: ABT Systems Ltd

8 years agoBusy the mount point which is the owner of the audit vnode, around
Konstantin Belousov [Sat, 16 Jan 2016 10:06:33 +0000 (10:06 +0000)]
Busy the mount point which is the owner of the audit vnode, around
audit_record_write().  This is important so that VFS_STATFS() is not
done on the NULL or freed mp and the check for free space is
consistent with the vnode used for write.

Add vn_start_write() braces around VOP_FSYNC() calls on the audit vnode.

Move repeated code to fsync vnode and panic to the helper
audit_worker_sync_vp().

Reviewed by: rwatson
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoCompile for specific cortex model inside the RPi 2. It's closer to
Warner Losh [Sat, 16 Jan 2016 05:58:17 +0000 (05:58 +0000)]
Compile for specific cortex model inside the RPi 2. It's closer to
working, and might actually work...

8 years agoWe don't need at91_bs_tag. arm_base_bs_tag works now that we have
Warner Losh [Sat, 16 Jan 2016 05:47:34 +0000 (05:47 +0000)]
We don't need at91_bs_tag. arm_base_bs_tag works now that we have
better dynamic device mapping that didn't exit when we started this
port. Remove it, since everything works w/o it.

8 years agoBump .Dd for the content changes
Enji Cooper [Sat, 16 Jan 2016 05:35:42 +0000 (05:35 +0000)]
Bump .Dd for the content changes

8 years agoMove ohci files to their proper place in the tree for atmel.
Warner Losh [Sat, 16 Jan 2016 04:47:32 +0000 (04:47 +0000)]
Move ohci files to their proper place in the tree for atmel.
Fix when it is included (we don't have a at91rm9200 device).
From a similar patch in the PR, with tweaked names.

PR: 206229

8 years agoA fix to r292469: Iterate over the physical segments in descending rather
Alan Cox [Sat, 16 Jan 2016 04:41:40 +0000 (04:41 +0000)]
A fix to r292469: Iterate over the physical segments in descending rather
than ascending order in vm_phys_alloc_contig() so that, for example, a
sequence of contigmalloc(low=0, high=4GB) calls doesn't exhaust the supply
of low physical memory resulting in a later contigmalloc(low=0, high=1MB)
failure.

Reported by: cy
Tested by: cy
Sponsored by: EMC / Isilon Storage Division

8 years agoFix -Wunused warning with clang/gcc
Enji Cooper [Sat, 16 Jan 2016 02:19:56 +0000 (02:19 +0000)]
Fix -Wunused warning with clang/gcc

- Get rid of unused argc/argv variables in main
- Bump WARNS to 6

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agoFix warnings with clang/gcc
Enji Cooper [Sat, 16 Jan 2016 02:18:36 +0000 (02:18 +0000)]
Fix warnings with clang/gcc

- Get rid of unused argc/argv variables in main
- Exit on failure with a return code of 1 instead of -1 with err/errx as a
  return code of -1 is implementation dependent
- Bump WARNS to 6

MFC after: 5 days
Sponsored by: EMC / Isilon Storage Division

8 years agoFix warnings with gcc 5.0
Enji Cooper [Sat, 16 Jan 2016 02:15:13 +0000 (02:15 +0000)]
Fix warnings with gcc 5.0

reconnect.c:
- Convert the K&R prototype of main to an ANSI prototype to mute a
  warning from gcc 4.2.1
- Close s_sock2 after finishing off the last test to plug a leak and
  mute a warning from gcc 5.0 about a -Wunused-but-set variable

sendfile.c:
- Fix a -Wunused-but-set warning with gcc 5.0 with pagesize in main(..)

MFC after: 5 days
Sponsored by: EMC / Isilon Storage Division

8 years agoTest for EPROTOTYPE not EPROTONOSUPPORT
Enji Cooper [Sat, 16 Jan 2016 02:02:50 +0000 (02:02 +0000)]
Test for EPROTOTYPE not EPROTONOSUPPORT

- `SOCK_RAW` is the implied supported type parameter for socket(2) per route(4)
- localsw in `sys/kern/uipc_usrreq.c` doesn't have an entry for `SOCK_RAW`, so
  the prototype is invalid (this isn't explicitly documented anywhere I could
  find)

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

8 years agoAdd missing newline to message about requiring root privileges
Enji Cooper [Sat, 16 Jan 2016 01:37:17 +0000 (01:37 +0000)]
Add missing newline to message about requiring root privileges

This will help ensure that scripts/parsers don't get confused when the message
is printed out

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

8 years agotrim-time? What was I thinking. run-time.
Warner Losh [Sat, 16 Jan 2016 01:30:55 +0000 (01:30 +0000)]
trim-time? What was I thinking. run-time.

Noticed by: Allan Jude

8 years agoAdd some clarifications.
Warner Losh [Sat, 16 Jan 2016 01:13:27 +0000 (01:13 +0000)]
Add some clarifications.

8 years agoImprove the sentence flow as well which has the happy benefit of
Warner Losh [Sat, 16 Jan 2016 00:45:48 +0000 (00:45 +0000)]
Improve the sentence flow as well which has the happy benefit of
making read-only modify a noun, a case where it unquestionably should
be hyphenated.

8 years agoAlthough not directly modifying a noun, read-only should be hyphenated
Warner Losh [Sat, 16 Jan 2016 00:43:10 +0000 (00:43 +0000)]
Although not directly modifying a noun, read-only should be hyphenated
in this context (or in any, really).

8 years agoRead-only is typically hyphenated. Move (read only) to a spot where it
Warner Losh [Sat, 16 Jan 2016 00:39:36 +0000 (00:39 +0000)]
Read-only is typically hyphenated. Move (read only) to a spot where it
modifies a noun and hyphenate.

8 years agoRead-only is hyphenated when it modifies a noun.
Warner Losh [Sat, 16 Jan 2016 00:37:27 +0000 (00:37 +0000)]
Read-only is hyphenated when it modifies a noun.

8 years agoUpdate mandoc to 20160116
Baptiste Daroussin [Fri, 15 Jan 2016 23:28:12 +0000 (23:28 +0000)]
Update mandoc to 20160116

8 years agoRemove config.h imported by accident
Baptiste Daroussin [Fri, 15 Jan 2016 23:16:04 +0000 (23:16 +0000)]
Remove config.h imported by accident

8 years ago- Add support for zip to lesspipe.sh
Alex Kozlov [Fri, 15 Jan 2016 23:13:01 +0000 (23:13 +0000)]
- Add support for zip to lesspipe.sh

Approved by: des

8 years agoImport mdocml CVS snapshot 20160116
Baptiste Daroussin [Fri, 15 Jan 2016 23:08:59 +0000 (23:08 +0000)]
Import mdocml CVS snapshot 20160116

8 years ago- Match directory extraction message with Infozip [1]
Alex Kozlov [Fri, 15 Jan 2016 23:04:36 +0000 (23:04 +0000)]
- Match directory extraction message with Infozip [1]
- Add comment explaining masks in check_binary()

Obtained from: NetBSD [1]
Approved by: des

8 years ago- Extract common code from extract()/extract_stdout() to extract2fd()
Alex Kozlov [Fri, 15 Jan 2016 22:58:23 +0000 (22:58 +0000)]
- Extract common code from extract()/extract_stdout() to extract2fd()
- Update information about central directory handling

Obtained from: NetBSD
Approved by: des

8 years agoFAST_DEPEND: Fix incremental builds leading to kernel panics.
Bryan Drewery [Fri, 15 Jan 2016 22:08:58 +0000 (22:08 +0000)]
FAST_DEPEND: Fix incremental builds leading to kernel panics.

This fixes .depend.genassym.o not being included.  genassym.o depends on
all of the system headers and when rebuilt regenerates assym.s which
lists offsets for critial .S files to utilize.  By having a struct in a
system header change its offsets and not have generassym.o be rebuilt,
this would lead to panics.

The flaw in the initial commit was seeing ${OBJS} in ${SYSTEM_OBJS} and
assuming it had all of ${SRCS} in it.  This is not the case though.  The
older mkdep code splits out all of the various SRC lists for generating
the .depend file.  It also includes ${GEN_CFILES}, which had genassym.c
and was the only significant file lacking from ${SYSTEM_OBJS} upon inspection,
since it is not linked in.  Rather than duplicate the likely
soon-to-be-removed mkdep lists, just add genassym.o to the DEPENDOBJS
list.  Using ${SRCS} as bsd.dep.mk does would be nice but there are many
files in the build that are only added to ${OBJS} and not ${SRCS}, such
as bf_enc.o derived from bf_enc.S for i386.

Sponsored by: EMC / Isilon Storage Division
Reported by: dhw (several panics on current@)
Pointyhat to: bdrewery

8 years agoFAST_DEPEND: Rework optimization for r290524.
Bryan Drewery [Fri, 15 Jan 2016 22:08:51 +0000 (22:08 +0000)]
FAST_DEPEND: Rework optimization for r290524.

The .MAKEFLAGS check inside of the .for loop is extremely slow for some
reason.  Just moving it out of the loop trimmed -V lookup time from 11
seconds to 1 second in the kernel obj directory.

Sponsored by: EMC / Isilon Storage Division

8 years ago- Check for accf_filter before running the tests, otherwise it will always
Enji Cooper [Fri, 15 Jan 2016 21:59:18 +0000 (21:59 +0000)]
- Check for accf_filter before running the tests, otherwise it will always
  fail at subtest 9/11
- Use strncpy instead of strcpy with afa.af_name

8 years agoMFV r294101: 6527 Possible access beyond end of string in zpool comment
Dimitry Andric [Fri, 15 Jan 2016 21:45:53 +0000 (21:45 +0000)]
MFV r294101: 6527 Possible access beyond end of string in zpool comment

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Gordon Ross <gwr@nexenta.com>

illumos/illumos-gate@2bd7a8d078223b122d65fea49bb8641f858b1409

This fixes erroneous double increments of the 'check' variable in a loop
in spa_prop_validate().  I ran into this in the clang380-import branch,
where clang 3.8.0 warns about it.  (It is already fixed there.)

MFC after: 3 days

8 years agoAdd mmu format info into ARM vmcore.
Svatopluk Kraus [Fri, 15 Jan 2016 18:53:06 +0000 (18:53 +0000)]
Add mmu format info into ARM vmcore.
Fix kvatop translation for 64K pages.

Reviewed by: jhb
Approved by: kib (mentor)
Differential Revision:    https://reviews.freebsd.org/D4942

8 years agoReduce diffs to upstream by adding a couple comment blocks and moving the
Ian Lepore [Fri, 15 Jan 2016 18:27:34 +0000 (18:27 +0000)]
Reduce diffs to upstream by adding a couple comment blocks and moving the
parse_boot_param() function to the end of the file.

8 years agoUnbreak NOIP builds after r294084.
Bjoern A. Zeeb [Fri, 15 Jan 2016 16:45:36 +0000 (16:45 +0000)]
Unbreak NOIP builds after r294084.

8 years agosfxge: check the RX DMA end padding configuration on Medford
Andrew Rybchenko [Fri, 15 Jan 2016 15:20:26 +0000 (15:20 +0000)]
sfxge: check the RX DMA end padding configuration on Medford

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4952

8 years agosfxge: convert nvram read method to use partition id
Andrew Rybchenko [Fri, 15 Jan 2016 15:19:18 +0000 (15:19 +0000)]
sfxge: convert nvram read method to use partition id

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4951

8 years agosfxge: rename Huntington MAC methods to EF10 and use for Medford
Andrew Rybchenko [Fri, 15 Jan 2016 15:17:44 +0000 (15:17 +0000)]
sfxge: rename Huntington MAC methods to EF10 and use for Medford

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4950

8 years agosfxge: rename common hunt PHY methods to ef10 and use for Medford
Andrew Rybchenko [Fri, 15 Jan 2016 15:12:30 +0000 (15:12 +0000)]
sfxge: rename common hunt PHY methods to ef10 and use for Medford

Leaving BIST methods for now as, though the Medford bootrom now has lots
of BIST support, production firmware doesn't appear to have been updated
yet.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4949

8 years agoxenbus: add a comment with the names of the generated accessors
Roger Pau Monné [Fri, 15 Jan 2016 14:34:31 +0000 (14:34 +0000)]
xenbus: add a comment with the names of the generated accessors

For easy grepping.

Sponsored by: Citrix Systems R&D

8 years agoClean up original route path selection logic a bit.
Alexander V. Chernikov [Fri, 15 Jan 2016 13:47:11 +0000 (13:47 +0000)]
Clean up original route path selection logic a bit.

NULL pointer dereference claimed by Coverity was possible
  if one (or several) next-hops for had their weights set to 0.

CID: 1348482

8 years agoUse the recently added "make_dev_s()" function to solve old race setting the
Hans Petter Selasky [Fri, 15 Jan 2016 12:09:15 +0000 (12:09 +0000)]
Use the recently added "make_dev_s()" function to solve old race setting the
si_drv1 field in "struct cdev" when creating new character devices.

8 years agoRemove the commented out sc device from the i.MX kernels, they both use
Andrew Turner [Fri, 15 Jan 2016 11:40:41 +0000 (11:40 +0000)]
Remove the commented out sc device from the i.MX kernels, they both use
vt(4).

8 years agoImplement support for PCI suspend, resume and shutdown events in the
Hans Petter Selasky [Fri, 15 Jan 2016 11:18:58 +0000 (11:18 +0000)]
Implement support for PCI suspend, resume and shutdown events in the
LinuxKPI. Fix a few spaces to tabs. Bump the FreeBSD version to force
recompilation of existing KMODs.

MFC after: 1 week
Sponsored by: Mellanox Technologies

8 years agoMake nfscl_getmyip() use new routing KPI.
Alexander V. Chernikov [Fri, 15 Jan 2016 09:05:14 +0000 (09:05 +0000)]
Make nfscl_getmyip() use new routing KPI.

* Use standard IPv6 SAS instead of rt->rt_ifa address.
* Make address lookup work for IPv6 LLA.
* Save address into buffer provided by caller instead of using static vars.

Discussed with: rmacklem

8 years agosfxge: cleanup: simplify ef10_get_datapath_caps
Andrew Rybchenko [Fri, 15 Jan 2016 06:30:46 +0000 (06:30 +0000)]
sfxge: cleanup: simplify ef10_get_datapath_caps

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4938

8 years agosfxge: convert nvram rw_start method to use partition id
Andrew Rybchenko [Fri, 15 Jan 2016 06:28:58 +0000 (06:28 +0000)]
sfxge: convert nvram rw_start method to use partition id

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4937

8 years agosfxge: Medford still needs fallback for no privilege mask
Andrew Rybchenko [Fri, 15 Jan 2016 06:27:51 +0000 (06:27 +0000)]
sfxge: Medford still needs fallback for no privilege mask

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4936

8 years agosfxge: medford stores a single global copy of VPD
Andrew Rybchenko [Fri, 15 Jan 2016 06:26:37 +0000 (06:26 +0000)]
sfxge: medford stores a single global copy of VPD

Not per PF copies as on Huntington.

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4935

8 years agosfxge: support FATSOv2
Andrew Rybchenko [Fri, 15 Jan 2016 06:25:26 +0000 (06:25 +0000)]
sfxge: support FATSOv2

Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4934

8 years agosfxge: rework MCDI request completion
Andrew Rybchenko [Fri, 15 Jan 2016 06:23:04 +0000 (06:23 +0000)]
sfxge: rework MCDI request completion

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4933

8 years agosfxge: rename hunt_link_state_t to ef10_link_state_t
Andrew Rybchenko [Fri, 15 Jan 2016 06:21:39 +0000 (06:21 +0000)]
sfxge: rename hunt_link_state_t to ef10_link_state_t

Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4932

8 years agoConnect the ZFS boot environment menu to the UEFI loader
Allan Jude [Fri, 15 Jan 2016 05:45:45 +0000 (05:45 +0000)]
Connect the ZFS boot environment menu to the UEFI loader

MFC after: 3 days
Sponsored by: ScaleEngine Inc.

8 years agoMove init_zfs_bootenv to sys/boot/zfs/zfs.c instead of having a copy in each loader
Allan Jude [Fri, 15 Jan 2016 05:45:10 +0000 (05:45 +0000)]
Move init_zfs_bootenv to sys/boot/zfs/zfs.c instead of having a copy in each loader

While here, add a filter to ignore special datasets

MFC after: 3 days
Sponsored by: ScaleEngine Inc.

8 years agoAdd EFI ZFS boot support
Steven Hartland [Fri, 15 Jan 2016 02:33:47 +0000 (02:33 +0000)]
Add EFI ZFS boot support

This builds on the modular EFI loader support added r294060 adding a
module to provide ZFS boot support on EFI systems.

It should be noted that EFI uses a fixed size memory block for all
allocations performed by the loader so it may be necessary to tune this
size.

For example when building an image which uses mfs_root e.g. mfsbsd, adding
the following to /etc/make.conf would be needed to prevent EFI from running
out of memory when loading the mfs_root image.
EFI_STAGING_SIZE=128

Submitted by: Eric McCorkle
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoioat(4): Add support for 'fence' bit with DMA_FENCE flag
Conrad Meyer [Fri, 15 Jan 2016 01:34:43 +0000 (01:34 +0000)]
ioat(4): Add support for 'fence' bit with DMA_FENCE flag

Some classes of IOAT hardware prefetch reads.  DMA operations that
depend on the result of prior DMA operations must use the DMA_FENCE flag
to prevent stale reads.

(E.g., I've hit this personally on Broadwell-EP.  The Broadwell-DE has a
different IOAT unit that is documented to not pipeline DMA operations.)

Sponsored by: EMC / Isilon Storage Division

8 years agoModularise EFI boot loader
Steven Hartland [Fri, 15 Jan 2016 01:22:36 +0000 (01:22 +0000)]
Modularise EFI boot loader

Make EFI boot loader modular in preparation for adding ZFS support.

This is a partial commit of the D4515.

Submitted by: Eric McCorkle
Reviewed by: emaste (in part)
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay
Differential Revision: https://reviews.freebsd.org/D4515

8 years agoEnsure boot fsread correctly probes all partitions
Steven Hartland [Fri, 15 Jan 2016 01:06:37 +0000 (01:06 +0000)]
Ensure boot fsread correctly probes all partitions

The boot code fsread was caching the result of meta data request and
reusing it even for calls with inode = 0, which is used to partitions
trigger a probe.

The result was that success was incorrectly returned for all partition
probes after the first valid success, even for partitions which are not
UFS.

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoMake common boot file_loadraw name parameter const
Steven Hartland [Fri, 15 Jan 2016 00:55:36 +0000 (00:55 +0000)]
Make common boot file_loadraw name parameter const

Fix compiler warnings about dropping const qualifier by changing file_loadraw
name param to const, and updating method to make that the case (it was
abusing the variable).

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoFix a bug in INIT handling on accepted 1-to-1 style sockets when the
Michael Tuexen [Fri, 15 Jan 2016 00:26:15 +0000 (00:26 +0000)]
Fix a bug in INIT handling on accepted 1-to-1 style sockets when the
listener is closed.
This fix allows the following packetdrill test to pass:
// Setup a connected, blocking 1-to-1 style socket
+0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3
// Check the handshake with en empty(!) cookie
+0.0 bind(3, ..., ...) = 0
+0.0 listen(3, 1) = 0
+0.0 < sctp: INIT[flgs=0, tag=1, a_rwnd=1500, os=1, is=1, tsn=1]
+0.0 > sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=..., os=..., is=..., tsn=1, ...]
+0.0 < sctp: COOKIE_ECHO[flgs=0, len=..., val=...]
+0.0 > sctp: COOKIE_ACK[flgs=0]
+0.0 accept(3, ..., ...) = 4
+0.0 close(3) = 0
// Inject an INIT chunk and expect an INIT-ACK
+0.0 < sctp: INIT[flgs=0, tag=3, a_rwnd=1500, os=1, is=1, tsn=1]
+0.0 > sctp: INIT_ACK[flgs=0, tag=..., a_rwnd=..., os=..., is=..., tsn=..., ...]

MFC after: 3 days

8 years agoAdjust VM_MAX_KERNEL_ADDRESS to the max address, not the minimum next.
Justin Hibbits [Thu, 14 Jan 2016 23:22:43 +0000 (23:22 +0000)]
Adjust VM_MAX_KERNEL_ADDRESS to the max address, not the minimum next.

VM_MAX_KERNEL_ADDERESS is the maximum KVA address.  0xf8000000 is the start of
device mapping space.  Since several conditional checks use '<=' against
VM_MAX_KERNEL_ADDRESS, bad things could feasibly happen.

8 years agoFix OpenSSH client information leak.
Gleb Smirnoff [Thu, 14 Jan 2016 22:40:46 +0000 (22:40 +0000)]
Fix OpenSSH client information leak.

Security: SA-16:07.openssh
Security: CVE-2016-0777

8 years agoMake it possible to specify the path to userboot.so with the -b flag.
Juli Mallett [Thu, 14 Jan 2016 22:07:35 +0000 (22:07 +0000)]
Make it possible to specify the path to userboot.so with the -b flag.

Reviewed by: neel

8 years agoAdd rotationrate to geom disk dumpconf
Ravi Pokala [Thu, 14 Jan 2016 21:52:21 +0000 (21:52 +0000)]
Add rotationrate to geom disk dumpconf

Parse and report the nominal rotation rate reported by the drive.

Reviewed by: sbruno, jhb
Approved by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4483
Requested by: Kevin Bowling < kevin.bowling @ kev009.com >

8 years agoRemove unused reg param from fdt_fixup_memory
Steven Hartland [Thu, 14 Jan 2016 21:39:10 +0000 (21:39 +0000)]
Remove unused reg param from fdt_fixup_memory

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoPrevent bogus compiler in ZFS boot code
Steven Hartland [Thu, 14 Jan 2016 21:31:26 +0000 (21:31 +0000)]
Prevent bogus compiler in ZFS boot code

Silence a bogus compiler warning about indexing past the end of dn_bonus.

The ZFS code ensures this is not possible but the compiler can't determine
this so added an additional check to prevent this warning.

Sponsored by: Multiplay

8 years agoRemove aiod_timeout.
John Baldwin [Thu, 14 Jan 2016 21:28:56 +0000 (21:28 +0000)]
Remove aiod_timeout.

It hasn't been used since the AIO code was made MPSAFE 10 years ago.

Reviewed by: kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D4946

8 years agoImprovements to the MDXFileChunk() template function:
Jonathan T. Looney [Thu, 14 Jan 2016 21:08:23 +0000 (21:08 +0000)]
Improvements to the MDXFileChunk() template function:
- Remove unneeded fstat()/lseek() calls.
- Return NULL and set errno to EINVAL on negative length.
- Fix small style problems and expand variable names.

After this change, it is possible to use this code for some irregular
files. For example, 'md5 /dev/md0' should now succeed.

Differential Revision: https://reviews.freebsd.org/D4748
Suggested by: bde
Reviewed by: bde, allanjude, delphij

8 years agoRename aiod_bio taskqueue to aiod_kick.
John Baldwin [Thu, 14 Jan 2016 20:51:48 +0000 (20:51 +0000)]
Rename aiod_bio taskqueue to aiod_kick.

This taskqueue is not used to handle bio requests.  It is only used to
run aio_kick_nowait() to spin up new aio daemon processes.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D4904

8 years agoFix order of last two arguments of mtx_init
Oleksandr Tymoshenko [Thu, 14 Jan 2016 20:25:22 +0000 (20:25 +0000)]
Fix order of last two arguments of mtx_init

Spotted by: jmcneill@NetBSD.org

8 years agoFix the handling of the "PDC write transfer length" erratum for at91. The
Ian Lepore [Thu, 14 Jan 2016 19:33:13 +0000 (19:33 +0000)]
Fix the handling of the "PDC write transfer length" erratum for at91.  The
problem affects revision 1xx hardware as well as later versions.  Also, the
recommended workaround is to set the PDC count register for a 12-byte
transfer when the actual size is less than that, but there is no need to
extend or zero-out the data buffer, because the blklen register contains
the real transfer size and only that many bytes will be transferred.

Also add a sysctl to turn debugging printfs on or off on the fly.

8 years agoSet -mlong-calls where needed to get a static clang and lldb 3.8.0
Andrew Turner [Thu, 14 Jan 2016 19:00:13 +0000 (19:00 +0000)]
Set -mlong-calls where needed to get a static clang and lldb 3.8.0
linking. These are too large for a branch instruction to branch from an
earlier point in the code to somewhere later.

This will also allow these to be build with Thumb-2 when we get this
infrastructure.

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D4855

8 years agoOnly build EFI components on supported compilers
Steven Hartland [Thu, 14 Jan 2016 18:53:54 +0000 (18:53 +0000)]
Only build EFI components on supported compilers

As the in-tree GCC does not support __attribute__((ms_abi)) EFI can only
be built with Clang.

The EFI loader and boot1 validated this, but unused libefi was still built
causing issues under GCC after warnings where enabled by r293724.

Disable building all of EFI when the selected compiler is GCC.

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoRevert r293903
Steven Hartland [Thu, 14 Jan 2016 18:46:57 +0000 (18:46 +0000)]
Revert r293903

Revert r293903 as EFI shouldn't be built on this platform that the this
was reported on.

Sponsored by: Multiplay

8 years agoFix race condition involving ZFS remove events
Alan Somers [Thu, 14 Jan 2016 18:19:05 +0000 (18:19 +0000)]
Fix race condition involving ZFS remove events

When a ZFS drive disappears, ZFS sends a resource.fs.zfs.removed event to
userland. A userland program like zfsd(8) can use that event, for example to
activate a hotspare. The current code contains a race condition: vdev_geom
will sent the sysevent _before_ spa.c would update the vdev's status,
causing userland processes to see pool state that does not reflect the
device removal. This change moves the sysevent to spa.c, closing the race.

Reviewed by: delphij, Sean Eric Fagan
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D4902

8 years agoFix spelling of IPMI
Enji Cooper [Thu, 14 Jan 2016 18:04:49 +0000 (18:04 +0000)]
Fix spelling of IPMI

Sponsored by: EMC / Isilon Storage Division

8 years agoUpdate .Dd, missed in r294011
Benjamin Kaduk [Thu, 14 Jan 2016 17:16:47 +0000 (17:16 +0000)]
Update .Dd, missed in r294011

8 years agoWrap overlong comment lines.
Edward Tomasz Napierala [Thu, 14 Jan 2016 16:55:07 +0000 (16:55 +0000)]
Wrap overlong comment lines.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoFix the code to retry mount attempt in mountcritlocal if there are
Edward Tomasz Napierala [Thu, 14 Jan 2016 16:53:17 +0000 (16:53 +0000)]
Fix the code to retry mount attempt in mountcritlocal if there are
any root mount holds.  The previous one used a wrong conditional - the
"err=$?" assignment resets "$?" to 0.

Submitted by: jilles@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoFix panic in IP redirect. Panic was introduced in r293466.
Alexander V. Chernikov [Thu, 14 Jan 2016 16:31:00 +0000 (16:31 +0000)]
Fix panic in IP redirect. Panic was introduced in r293466.

Found by: Yamagi Burmeister <lists at yamagi.org>>

8 years agoDocument how to enter the debugger here. I'm sure there's some better
Warner Losh [Thu, 14 Jan 2016 16:23:07 +0000 (16:23 +0000)]
Document how to enter the debugger here. I'm sure there's some better
canonical place, and the nit-pickers are welcome to move this
information there with a cross reference.

Differential Review: https://reviews.freebsd.org/D4860

8 years agoFix building with GCC since PAGE_MASK is signed on i386.
John Baldwin [Thu, 14 Jan 2016 15:51:13 +0000 (15:51 +0000)]
Fix building with GCC since PAGE_MASK is signed on i386.

Reviewed by: ngie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4772

8 years agoAdjust previous fix to conform to the existing style in this file.
John Baldwin [Thu, 14 Jan 2016 15:49:24 +0000 (15:49 +0000)]
Adjust previous fix to conform to the existing style in this file.

8 years agoMake ng_netflow(9) use new routing KPI.
Alexander V. Chernikov [Thu, 14 Jan 2016 13:14:12 +0000 (13:14 +0000)]
Make ng_netflow(9) use new routing KPI.

Netflow module is supposed to store (along with fields like
  gateway address and interface index) matched netmask for each record.
  This (currently) requires returning individual route entries, instead
  of optimized next-hop structure. Given that, use control-plane
  rib_lookup_info() function to avoid accessing rtentries directly.
While rib_lookup_info() might be slower, than fibX_lookup() flavours,
  it is more scalable than rtalloc1_fib(), because rtentry mutex is
  not acquired.

8 years agoFail the SCTP_GET_ASSOC_NUMBER and SCTP_GET_ASSOC_ID_LIST
Michael Tuexen [Thu, 14 Jan 2016 11:25:28 +0000 (11:25 +0000)]
Fail the SCTP_GET_ASSOC_NUMBER and SCTP_GET_ASSOC_ID_LIST
socket options for 1-to-1 style sockets as specified in RFC 6458.

MFC after: 3 days

8 years agoInstall /etc/snmpd.config with 0600 permissions.
Gleb Smirnoff [Thu, 14 Jan 2016 10:25:18 +0000 (10:25 +0000)]
Install /etc/snmpd.config with 0600 permissions.

Noticed by: Pierre Kim
Security: SA-16:06.snmpd
Pointy hat to: glebius in 2005

8 years agoThere is a bug in tcp_output()'s implementation of the TCP_SIGNATURE
Gleb Smirnoff [Thu, 14 Jan 2016 10:22:45 +0000 (10:22 +0000)]
There is a bug in tcp_output()'s implementation of the TCP_SIGNATURE
(RFC 2385/TCP-MD5) kernel option.

If a tcpcb has TF_NOOPT flag, then tcp_addoptions() is not called,
and to.to_signature is an uninitialized stack variable. The value
is later used as write offset, which leads to writing to random
address.

Submitted by: rstone, jtl
Security: SA-16:05.tcp

8 years agoCall crextend() before copying old credentials to the new credentials
Gleb Smirnoff [Thu, 14 Jan 2016 10:16:25 +0000 (10:16 +0000)]
Call crextend() before copying old credentials to the new credentials
and replace crcopysafe by crcopy as crcopysafe is is not intended to be
safe in a threaded environment, it drops PROC_LOCK() in while() that
can lead to unexpected results, such as overwrite kernel memory.

In my POV crcopysafe() needs special attention. For now I do not see
any problems with this function, but who knows.

Submitted by: dchagin
Found by: trinity
Security: SA-16:04.linux

8 years agoRegen after r293907.
Gleb Smirnoff [Thu, 14 Jan 2016 10:15:21 +0000 (10:15 +0000)]
Regen after r293907.

8 years agoChange linux get_robust_list system call to match actual linux one.
Gleb Smirnoff [Thu, 14 Jan 2016 10:13:58 +0000 (10:13 +0000)]
Change linux get_robust_list system call to match actual linux one.

The set_robust_list system call request the kernel to record the head
of the list of robust futexes owned by the calling thread. The head
argument is the list head to record.
The get_robust_list system call should return the head of the robust
list of the thread whose thread id is specified in pid argument.
The list head should be stored in the location pointed to by head
argument.

In contrast, our implemenattion of get_robust_list system call copies
the known portion of memory pointed by recorded in set_robust_list
system call pointer to the head of the robust list to the location
pointed by head argument.

So, it is possible for a local attacker to read portions of kernel
memory, which may result in a privilege escalation.

Submitted by: mjg
Security: SA-16:03.linux

8 years agoVerify the packet length in sctp6_input().
Gleb Smirnoff [Thu, 14 Jan 2016 10:11:10 +0000 (10:11 +0000)]
Verify the packet length in sctp6_input().

The sctp6_ctlinput() function does not properly check the length of the packet
it receives from the ICMP6 input routine. This means that an attacker can craft
a packet that will cause a kernel panic.

When the kernel receives an ICMP6 error message with one of the types/codes
it handles, it calls icmp6_notify_error() to deliver it to the upper-level
protocol. icmp6_notify_error() cycles through the extension headers (if any)
to find the protocol number of the first non-extension header. It does NOT
verify the length of the non-extension header.

It passes information about the packet (including the actual packet) to the
upper-level protocol's pr_ctlinput function. In the case of SCTP for IPv6,
icmp6_notify_error() calls sctp6_ctlinput().

sctp6_ctlinput() assumes that the incoming packet contains a sufficiently-long
SCTP header and calls m_copydata() to extract a copy of that header. In turn,
m_copydata() assumes that the caller has already verified that the offset and
length parameters are correct. If they are incorrect, it will dereference a
NULL pointer and cause a kernel panic.

In short, no one is sufficiently verifying the input, and the result is a
kernel panic.

Submitted by: jtl
Security: SA-16:01.sctp

8 years agoAllow file specific user-specified flag overrides
Steven Hartland [Thu, 14 Jan 2016 10:09:05 +0000 (10:09 +0000)]
Allow file specific user-specified flag overrides

Allow user-specified warning flag overrides for specific files under
bsd.sys.mk, in the same way kern.mk does.

This will to be used by future commits.

MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agoFix GCC warnings causing build failure after r293724
Steven Hartland [Thu, 14 Jan 2016 09:22:01 +0000 (09:22 +0000)]
Fix GCC warnings causing build failure after r293724

Disable some compiler warnings for GCC (non-standard compiler) fixing
build failures introduced by r293724, which enabled WARNS in the EFI boot
code, when compiling with none standard compiler (GCC).

Raised by: ian
MFC after: 2 weeks
X-MFC-With: r293268
Sponsored by: Multiplay

8 years agosfxge: cleanup: quieten efx_mcdi_read_resonse_header error reporting
Andrew Rybchenko [Thu, 14 Jan 2016 09:20:25 +0000 (09:20 +0000)]
sfxge: cleanup: quieten efx_mcdi_read_resonse_header error reporting

The "mcdi_err_arg" probe still reports results of failed MCDI
commands, unless the caller invoked efx_mcdi_execute_quiet().

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4919

8 years agosfxge: add accessors for license-related MCDI calls to common code
Andrew Rybchenko [Thu, 14 Jan 2016 09:19:28 +0000 (09:19 +0000)]
sfxge: add accessors for license-related MCDI calls to common code

Add support for Huntington MCDI licensing interface to common code.
Ported from Linux net driver IOCTL functions with restructuring for
initial support for V3 licensing API.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision: https://reviews.freebsd.org/D4918