]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoMFC r287831 (by cem):
kib [Mon, 16 May 2016 02:35:33 +0000 (02:35 +0000)]
MFC r287831 (by cem):
Note DOOMED vnodes with NOTE_REVOKE.

8 years agoMFC r298922:
kib [Mon, 16 May 2016 02:23:58 +0000 (02:23 +0000)]
MFC r298922:
Issue NOTE_EXTEND when a directory entry is added to or removed from
the monitored directory as the result of rename(2) operation.  The
renames staying in the directory are not reported.

8 years agoMFC r298921:
kib [Mon, 16 May 2016 02:21:54 +0000 (02:21 +0000)]
MFC r298921:
Fix reporting of NOTE_LINK when directory link count changes due to
rename removing or adding subdirectory entry.

8 years agoMFC r298864:
ngie [Sun, 15 May 2016 03:53:06 +0000 (03:53 +0000)]
MFC r298864:

Allow FILESGROUPS to be specified more than once by pruning out duplicates

8 years agoMFC r298881, 298882, 298883, 298885:
pfg [Sun, 15 May 2016 03:15:36 +0000 (03:15 +0000)]
MFC r298881, 298882, 298883, 298885:

Minor spelling fixes in:
tools, share, bluetooth, pmcstat, etc

Many of these have user-visible strings.

8 years agoMFC r298031: Static pointers need not be initialized.
cy [Sat, 14 May 2016 19:11:35 +0000 (19:11 +0000)]
MFC r298031: Static pointers need not be initialized.

8 years agoMFC r298030: Use NULL instead of 0 for pointer comparison.
cy [Sat, 14 May 2016 19:09:32 +0000 (19:09 +0000)]
MFC r298030: Use NULL instead of 0 for pointer comparison.

8 years agoMFC r275385 (by bapt):
dim [Sat, 14 May 2016 10:18:27 +0000 (10:18 +0000)]
MFC r275385 (by bapt):
  Sync the svn template with the one from ports

MFC r289180 (by peter):
  Update from svn-1.8.14 to 1.9.2.

  Formal release notes are available:
    https://subversion.apache.org/docs/release-notes/1.9.html

  Of particular note, the client checkout format has *not* changed so
  upgrades should *not* be required.

  When reading a repository (file:// or running as a local server), an
  improved fsfs version 7 is available with significant performance
  improvements.  An optional upgrade is possible to use the new features.
  Without the upgrade, this is fully read/write compatible with the
  version 6 fsfs as in svn-1.8.

MFC r298845:
  Update from subversion 1.9.2 to 1.9.4.

  This contains only bug fixes, no new features.  The repository format is
  also unchanged from 1.9.2.  Full list of changes between 1.9.4 and
  earlier versions:

    https://svn.apache.org/repos/asf/subversion/tags/1.9.4/CHANGES

  Note that the two security issues fixed in 1.9.4 (CVE-2016-2167 and
  CVE-2016-2168) do not affect the version of Subversion in the FreeBSD
  base system, since neither SASL nor Apache modules are enabled.

MFC r298996:
  Re-sync the FreeBSD-specific Subversion template with the one from
  ports.

Relnotes: yes

8 years agoMFC r298831:
pfg [Sat, 14 May 2016 00:44:23 +0000 (00:44 +0000)]
MFC r298831:
boot/forth: minor spelling fixes.

8 years agoMFC r298829
pfg [Sat, 14 May 2016 00:35:49 +0000 (00:35 +0000)]
MFC r298829
sys/compat/linux*: minor spelling fixes.

8 years agoMFC r299694:
markj [Fri, 13 May 2016 20:58:25 +0000 (20:58 +0000)]
MFC r299694:
Fix a bug in r298340: "sim" was referenced after being unset.

8 years agoMFC r298809, r298817
pfg [Fri, 13 May 2016 15:09:38 +0000 (15:09 +0000)]
MFC r298809, r298817
Minor spelling fixes.

8 years agoMFC r298839:
ngie [Fri, 13 May 2016 09:52:39 +0000 (09:52 +0000)]
MFC r298839:

Fix memory allocation edgecases in kvm_argv(..)

- Don't leak nbufp on realloc failure in kvm_argv
- Catch malloc errors with bufp
- Set buflen last in the "buflen == 0" case to ensure that
  bufp/nbufp is properly reallocated on the next go around

8 years agoMFC r298842:
ngie [Fri, 13 May 2016 09:49:52 +0000 (09:49 +0000)]
MFC r298842:

Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) fails

CID: 1341474

8 years agoMFC r298844:
ngie [Fri, 13 May 2016 09:46:23 +0000 (09:46 +0000)]
MFC r298844:

Make SERVERS REQUIRE clean when MK_KERBEROS==no

Make kdc run BEFORE SERVERS instead of being REQUIREd by SERVERS,
so systems that pedantically check REQUIREs function after r270782

8 years agoMFC r299162,r299163:
ngie [Fri, 13 May 2016 09:31:40 +0000 (09:31 +0000)]
MFC r299162,r299163:

r299162:

Only install NIS section 8 manpages if MK_NIS != no

r299163:

Fix r299162

share/man/man8/Makefile:
- Add src.opts.mk so MK_NIS can be tested
- Fix typo in MK_NIS conditional

tools/build/mk/OptionalObsoleteFiles.inc:
- Remove WIP diff from ^/user/ngie/detangle-rc

8 years agoMFC r298463:
ngie [Fri, 13 May 2016 09:18:46 +0000 (09:18 +0000)]
MFC r298463:

Add FEATURE knob for testing for UFS extended attribute kernel support

Support can be verified via `feature_present("ufs_extattr")`, etc.

Relnotes: yes

8 years agoMFC r298462:
ngie [Fri, 13 May 2016 09:14:43 +0000 (09:14 +0000)]
MFC r298462:

Return `ret` in op_ifentry(..) to mute a -Wunused-but-set-variable warning

This will also now detect error conditions with
value->var.subs[sub - 1] == LEAF_ifPhysAddress where `string_get(..)`
could fail if iifp->physaddr and/or iifp->physaddrlen were deemed
invalid.

CID: 1006551

8 years agoMFC r298665:
ngie [Fri, 13 May 2016 09:06:52 +0000 (09:06 +0000)]
MFC r298665:
r298665 (by cem):

aacraid(4): Fix some mostly trivial buffer overruns

strcpy(3) emits a trailing nul byte, trampling fields after the intended
destination.  Instead, use strncpy(3), intentionally leaving these fields
not nul-terminated.

CIDs: 1031024130546313054941305545

8 years agoMFC r298670:
ngie [Fri, 13 May 2016 09:05:29 +0000 (09:05 +0000)]
MFC r298670:
r298670 (by cem):

ciss(4): Fix overrun of array

The softc member 'ciss_logical' is an array of 'ciss_max_logical_bus' members.
Most of the time it is iterated correctly.  This patch fixes the two instances
where the driver iterated off the end of the array.

CID: 1305492

8 years agoMFC r298339:
ngie [Fri, 13 May 2016 09:01:20 +0000 (09:01 +0000)]
MFC r298339:
r298339 (by cem):

sound(4): Don't use-after-free in midi module unload

Also, use ANSI function parameter definitions (void) while here.

CID: 1006107

8 years agoMFC r298340:
ngie [Fri, 13 May 2016 08:58:49 +0000 (08:58 +0000)]
MFC r298340:
r298340 (by cem):

sym(4): Don't double-free 'sim' in failure case

CID: 1006106

8 years agoMFC r298671,r298672:
ngie [Fri, 13 May 2016 08:54:08 +0000 (08:54 +0000)]
MFC r298671,r298672:

r298671 (by cem):

g_part_bsd64: Check for valid on-disk npartitions value

This value is u32 on disk, but assigned to an int in memory.  After we do the
implicit conversion via assignment, check that the result is at least one[1]
(non-negative[2]).

1. The subsequent for-loop iterates from gpt_entries minus one, down, until
   reaching zero.  A negative or zero initial index results in undefined signed
   integer overflow.
2. It is also used to index into arrays later.

In practice, we expected non-malicious disks to contain small positive values.

CID: 1223202

r298672 (by cem):

g_part_bsd64: Delete duplicate/dead code

RAW_PART is handled earlier in the loop.

CID: 1223201

8 years agoMFC r298676:
ngie [Fri, 13 May 2016 08:49:29 +0000 (08:49 +0000)]
MFC r298676:
r298676 (by cem):

netipsec: Don't leak memory when deep copy fails

CID: 1331693

8 years agoMFC r298677:
ngie [Fri, 13 May 2016 08:44:59 +0000 (08:44 +0000)]
MFC r298677:
r298677 (by cem):

subr_mbpool: Don't free bogus pointer in error paths

An mbpool is allocated with a contiguous array of mbpages.  Freeing an
individual mbpage has never been valid.  Don't do it.

This bug has been present since this code was introduced in r117624 (2003).

CID: 1009687

8 years agoMFC r298337:
ngie [Fri, 13 May 2016 08:41:09 +0000 (08:41 +0000)]
MFC r298337:
r298337 (by cem):

pty(4): Use strlcpy to guarantee destination buffer isn't overrun

The devtoname() name is strcpyed into a small stack buffer.  Sure, we always
expect the name to be ttyXX (or ptyXX).  If that's the case, strlcpy() doesn't
hurt.

CID: 1006768

8 years agoMFC r298334:
ngie [Fri, 13 May 2016 08:39:33 +0000 (08:39 +0000)]
MFC r298334:
r298334 (by cem):

drm2(4): Fix double-free in low-memory error path

Reallocf frees 'block'; don't attempt to free it again.

CID: 1091165

8 years agoMFC r298669:
ngie [Fri, 13 May 2016 08:36:33 +0000 (08:36 +0000)]
MFC r298669:
r298669 (by cem):

iscsi_initiator(4): Fix use-after-free, double-free

ism_stop() already destroys and frees 'sp', including a call to ic_destroy().
Don't dereference 'sp' after ism_stop() and don't invoke ic_destroy() on the
freed memory either.

CIDs: 10061091304861

8 years agoMFC r298336:
ngie [Fri, 13 May 2016 08:30:26 +0000 (08:30 +0000)]
MFC r298336:
r298336 (by cem):

kgssapi(4): Fix string overrun in Kerberos principal construction

'buf.value' was previously treated as a nul-terminated string, but only
allocated with strlen() space.  Rectify this.

CID: 1007639

8 years agoMFC r295134,r298338,r298655:
ngie [Fri, 13 May 2016 08:25:06 +0000 (08:25 +0000)]
MFC r295134,r298338,r298655:

r295134 (by cem):

kcrypto_aes: Use separate sessions for AES and SHA1

Some hardware supports AES acceleration but not SHA1, e.g., AES-NI
extensions.  It is useful to have accelerated AES even if SHA1 must be
software.

Suggested by: asomers

r298338 (by cem):

kgssapi(4): Don't allow user-provided arguments to overrun stack buffer

An over-long path argument to gssd_syscall could overrun the stack sockaddr_un
buffer.  Fix gssd_syscall to not permit that.

If an over-long path is provided, gssd_syscall now returns EINVAL.

It looks like PRIV_NFS_DAEMON isn't granted anywhere, so my best guess is that
this is likely only triggerable by root.

CID: 1006751

r298655 (by cem):

kgssapi: Don't leak memory in error cases

CIDs: 100704610070471007048

8 years agoMFC r298333:
ngie [Fri, 13 May 2016 08:17:42 +0000 (08:17 +0000)]
MFC r298333:
r298333 (by cem):

Make Racct macro slightly more gracious given RACCT_UNDEFINED

rctl_string_to_rule could previously index below the zeroth element of
racct_types via the macro.  Maybe it shouldn't use the macro on
RACCT_UNDEFINED.  But given every other RACCT_ definition is non-negative, it
seems pretty easy to foot-shoot this one without the check.

CID: 1305574

8 years agoMFC r298328:
ngie [Fri, 13 May 2016 08:04:57 +0000 (08:04 +0000)]
MFC r298328:
r298328 (by cem):

bpf_getdltlist: Don't overrun 'lst'

'lst' is allocated with 'n1' members.  'n' indexes 'lst'.  So 'n == n1' is an
invalid 'lst' index.  This is a follow-up to r296009.

CID: 1352743

8 years agoMFC r298678:
ngie [Fri, 13 May 2016 07:56:14 +0000 (07:56 +0000)]
MFC r298678:
r298678 (by cem):

posix4_mib: Don't overrun facility_initialized array

The facility_initialized and facility arrays are the same size and were
intended to be indexed the same.  I believe this mismatch was just a
typo/braino in r208731.

CID: 1017430

8 years agoMFC r297986, r298017 to vdev_geom.c
asomers [Thu, 12 May 2016 15:31:58 +0000 (15:31 +0000)]
MFC r297986, r298017 to vdev_geom.c

r297986 | asomers | 2016-04-14 13:20:31 -0600 (Thu, 14 Apr 2016) | 6 lines

Update a debugging message in vdev_geom_open_by_guids for consistency with
similar messages elsewhere in the file.

r298017 | asomers | 2016-04-14 17:14:41 -0600 (Thu, 14 Apr 2016) | 8 lines

Add more debugging statements in vdev_geom.c

Log a debugging message whenever geom functions fail in vdev_geom_attach.
Printing these messages is controlled by vfs.zfs.debug

8 years agoMFC r298977: Fix a memory leak introduced with the devctl intergration of
scottl [Thu, 12 May 2016 12:03:27 +0000 (12:03 +0000)]
MFC r298977: Fix a memory leak introduced with the devctl intergration of
cam_periph

8 years agoMFC r299115:
kib [Thu, 12 May 2016 06:55:42 +0000 (06:55 +0000)]
MFC r299115:
Warn about consequences of suspending threads in arbitrary state of
execution

8 years agoMFC r299114:
kib [Thu, 12 May 2016 06:53:22 +0000 (06:53 +0000)]
MFC r299114:
Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resume
cycle.

PR: 209233

8 years agoMFC r298755:
pfg [Thu, 12 May 2016 00:45:57 +0000 (00:45 +0000)]
MFC r298755:
sys/geom: spelling fixes.

These affect debugging messages.

8 years agoMFC r299035: sh: Handle empty hostname and $PWD when building prompt
vangyzen [Wed, 11 May 2016 22:11:37 +0000 (22:11 +0000)]
MFC r299035: sh: Handle empty hostname and $PWD when building prompt

If the hostname is empty and \h is used in $PS1,
the remainder of the prompt following \h will be empty.
Likewise for $PWD and \w.  Fix it.

8 years agoMFC r299004: Work around (ignore) broken SRAT tables
vangyzen [Wed, 11 May 2016 22:06:28 +0000 (22:06 +0000)]
MFC r299004: Work around (ignore) broken SRAT tables

8 years agoMFC r296300:
markj [Wed, 11 May 2016 21:35:58 +0000 (21:35 +0000)]
MFC r296300:
Fix a typo that prevented pw(8) from setting a user's UID to 0.

8 years agoMFC r297832: MFV r297831: 6322 ZFS indirect block predictive prefetch
mav [Wed, 11 May 2016 11:35:37 +0000 (11:35 +0000)]
MFC r297832: MFV r297831: 6322 ZFS indirect block predictive prefetch

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Author: Alexander Motin <mav@FreeBSD.org>

Improve speculative prefetch of indirect blocks.

Scalability of many operations on wide ZFS pool can be limited by
requirement to prefetch indirect blocks first.  Recently added
asynchronous indirect block read partially helped, but did not
solve the problem completely.  This patch extends existing prefetcher
functionality to explicitly work with indirect blocks.

Before this change prefetcher issued reads for up to 8MB of data in
advance.  With this change it also issues indirect block reads
for up to 64MB of data in advance, so that when it will be time to
actually read those data, it can be done immediately.  Alike effect
can be achieved by just increasing maximal data prefetch distance,
but at higher memory cost.

Also this change introduces indirect block prefetch for rewrite
operations, that was never done before.  Previously ARC miss for
Indirect blocks regularly blocked rewrites, converting perfectly
aligned asynchronous operations into synchronous read-write pairs,
significantly reducing maximal rewrite speed.

While being there this issue was also fixed:
 - prefetch was done always, even if caching for the dataset was
completely disabled.

Testing on FreeBSD with zvol on top of 6x striped 2x mirrored pool
of 12 assorted HDDs shown me such performance numbers:
------- BEFORE --------
Write       491363677 bytes/sec
Read        312430631 bytes/sec
Rewrite      97680464 bytes/sec
-------- AFTER --------
Write       493524146 bytes/sec
Read        438598079 bytes/sec
Rewrite     277506044 bytes/sec

Closes #65
Closes #80

openzfs/openzfs@792fd28ac04f78cc5e43ead2d72a96f244ea84e8

8 years agoMFC r297509: MFV r297506: 6738 zfs send stream padding needs documentation
mav [Wed, 11 May 2016 11:32:38 +0000 (11:32 +0000)]
MFC r297509: MFV r297506: 6738 zfs send stream padding needs documentation

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Eli Rosenthal <eli.rosenthal@delphix.com>

illumos/illumos-gate@c20404ff77119516354b0d112d28b7ea0dadd303

8 years agoMFC r297507: MFV r297504:
mav [Wed, 11 May 2016 11:31:51 +0000 (11:31 +0000)]
MFC r297507: MFV r297504:
6681 zfs list burning lots of time in dodefault() via dsl_prop_*

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@d09e4475f635b6f66ee68d8c17a32bba7be17c96

8 years agoMFC r297763: MFV r297760: 6418 zpool should have a label clearing command
mav [Wed, 11 May 2016 11:24:59 +0000 (11:24 +0000)]
MFC r297763: MFV r297760: 6418 zpool should have a label clearing command

Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Author: Will Andrews <will@firepipe.net>

Closes #83
Closes #32

openzfs/openzfs@9663688425131744221ea99f9e66b9ed964492ae

FreeBSD already had `zpool labelclear` functionality, so this is mostly
just a diff reduction.

8 years agoMFC r297508: MFV r297505:
mav [Wed, 11 May 2016 11:23:22 +0000 (11:23 +0000)]
MFC r297508: MFV r297505:
6739 userland version of cv_timedwait_hires() always assumes absolute time

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: George Wilson <george.wilson@delphix.com>

illumos/illumos-gate@41c6413cb54bf338d7a59ed789ec2e0e44c35e6f

8 years agoMFC r298703:
pfg [Wed, 11 May 2016 00:59:06 +0000 (00:59 +0000)]
MFC r298703:
cam: unsign some types to match their definitions and avoid overflows.

numpatterns is u_int.

ctl:
CTL_NUM_MODE_PAGES comes from sizeof().
In struct:ctl_scsiio, kern_sg_entries is uint32_t.

8 years agoMFC r298698:
pfg [Wed, 11 May 2016 00:36:31 +0000 (00:36 +0000)]
MFC r298698:
geom: unsign some types to match their definitions and avoid overflows.

In struct:gctl_req, nargs is unsigned.

In mirror:
g_mirror_syncreqs is unsigned.

In raid:
in struct:g_raid_volume, v_disks_count is unsigned.

In virstor:
in struct:g_virstor_softc, n_components is unsigned.

8 years agoMFC r298904:
wblock [Tue, 10 May 2016 20:12:27 +0000 (20:12 +0000)]
MFC r298904:

Spelling fixes supplied by pfg@, detected with codespell, plus
additional misspellings detected by igor.

8 years agoMFC 294923
asomers [Tue, 10 May 2016 17:34:35 +0000 (17:34 +0000)]
MFC 294923

Fix grep_test:recurse with ZFS and TMPFS tmpdirs

contrib/netbsd-tests/usr.bin/grep/t_grep.sh
Fix grep_test:recurse when /tmp is either zfs or tmpfs. The test was
relying on an implicit ordering of directory recursion which happens to
be true when using UFS. grep's specification requires no such ordering.
The solution is to ignore the order of grep's results.

8 years agoMFC 297868
asomers [Tue, 10 May 2016 16:49:50 +0000 (16:49 +0000)]
MFC 297868

Fix rare double free in vdev_geom_attrchanged

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
        Don't drop the g_topology_lock before freeing old_physpath. That
        opens up a race where one thread can call vdev_geom_attrchanged,
        set old_physpath, drop the g_topology_lock, then block trying to
        acquire the SCL_STATE lock. Then another thread can come into
        vdev_geom_attrchanged, set old_physpath to the same value, and
        proceed to free it. When the first thread resumes, it will free
        the same location.

        It turns out that the SCL_STATE lock isn't needed. It was
        originally added by gibbs to protect vd->vdev_physpath while
        updating the same. However, the update process subsequently was
        switched to an atomic operation (a pointer swap). Now, there is
        no need for the SCL_STATE lock, and hence no need to drop the
        g_topology_lock.

8 years agoMFC 299205: Restore name=value format of PCI location strings.
jhb [Tue, 10 May 2016 03:42:18 +0000 (03:42 +0000)]
MFC 299205: Restore name=value format of PCI location strings.

When devctl was added, the location string for PCI devices was changed to
use the PCI "selector" that pciconf and devctl accept.  However, devd
assumes that location strings are formatted as a list of name=value pairs.
As a result, devd is no longer parsing any of the values out of PCI
device events.  Restore the previous format of the PCI location strings
to restore the location and slot keywords in case any devd scripts are
using this.  Add the "selector" as a new 'dbsf' location variable.

8 years agoMFC r298591
davidcs [Tue, 10 May 2016 02:35:13 +0000 (02:35 +0000)]
MFC r298591

1. Removed -Wno-shift-negative-value from Makefile
2. Fixed warning its absence caused in bxe_elink.c

8 years agoMFC r298496
davidcs [Tue, 10 May 2016 02:30:18 +0000 (02:30 +0000)]
MFC r298496

Remove Unused/Dead Code

8 years agoMFC r298294
davidcs [Tue, 10 May 2016 02:26:26 +0000 (02:26 +0000)]
MFC r298294
  1. modify fwdump (a.k.a grcdump) so that grcdump memory is allocated
     and freed on as needed basis.
  2. grcdump can be taken at failure points by invoking bxe_grc_dump()
     when trigger_grcdump sysctl flag is set. When grcdump is taken
     grcdump_done sysctl flag is set.
  3. grcdump_done can be monitored by the user to retrieve the grcdump

Submitted by: vaishali.kulkarni@qlogic.com

8 years agoMFC r298609:
pfg [Tue, 10 May 2016 02:13:17 +0000 (02:13 +0000)]
MFC r298609:
ext2fs: make use of the howmany() macro when available.

We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.

8 years agoMFC r298589:
markj [Mon, 9 May 2016 17:13:40 +0000 (17:13 +0000)]
MFC r298589:
Allow DOF sections with excessively long probe function components.

PR: 207735

8 years agoMFC r298783:
hselasky [Mon, 9 May 2016 13:12:12 +0000 (13:12 +0000)]
MFC r298783:
Regenerate usb.conf .

8 years agoMFC r298772:
hselasky [Mon, 9 May 2016 13:11:00 +0000 (13:11 +0000)]
MFC r298772:
Correct some error codes to native FreeBSD ones.

Sponsored by: Mellanox Technologies
Tested by: Netflix

8 years agoMFC r298771:
hselasky [Mon, 9 May 2016 13:09:41 +0000 (13:09 +0000)]
MFC r298771:
Add function to detect the presence of a port module and use this
function to error out early when no port module is present and doing
eeprom access. This also prevents error codes from filling up in
dmesg.

Sponsored by: Mellanox Technologies
Tested by: Netflix

8 years agoRevert r298920 until we have addressed all known regressions on head/ after
delphij [Sun, 8 May 2016 18:09:30 +0000 (18:09 +0000)]
Revert r298920 until we have addressed all known regressions on head/ after
settle.  file is now downgraded to 5.25.

PR: bin/209211
Requested by: Tomoaki AOKI
Relnotes: yes

8 years agoMFC r298898:
kib [Sun, 8 May 2016 09:08:05 +0000 (09:08 +0000)]
MFC r298898:
Explain NOTE_LINK reporting for the directories.

8 years agoMFC r298891:
kib [Sun, 8 May 2016 09:06:52 +0000 (09:06 +0000)]
MFC r298891:
Avoid duplicated calls to pmap_page_get_memattr().
Avoid logging inconsistency for the /dev/mem device.

8 years agoMFC r298890:
kib [Sun, 8 May 2016 09:02:51 +0000 (09:02 +0000)]
MFC r298890:
Make it explicit that D_MEM cdevsw d_flag is to signify that the
driver is (or behaves identically to) /dev/mem.  Remove the D_MEM flag
from random drivers.

8 years agoMFC: r298523
rmacklem [Sat, 7 May 2016 20:17:23 +0000 (20:17 +0000)]
MFC: r298523
Allow the NFSv4 server to reply NFSERR_WRONGSEC for the SetClientID operation.

It was reported via email that a Linux client couldn't do a Kerberized
NFS mount when only "sec=krb5" was specified for the exports. The Linux
client attempted a mount via krb5i and the server replied NFSERR_SERVERFAULT.
Although NFSERR_WRONGSEC isn't listed as an error for SetClientID, I
think it is the correct reply, so this patch enables that.
I do not know if this fixes the mount attempt, but adding "krb5i" to the
list of allowed security flavours does allow the mount to work.

8 years agoMFC: r298495
rmacklem [Sat, 7 May 2016 20:09:15 +0000 (20:09 +0000)]
MFC: r298495
Fix a LOR in the NFSv4.1 server.

The ordering of acquisition of the state and session mutexes was
reversed in two cases executed when an NFSv4.1 client created/freed
a session. Since clients will typically do this only when mounting
and dismounting, the likelyhood of causing a deadlock was low but possible.
This can only occur for NFSv4.1 mounts, since the others do not
use sessions.
This was detected while testing the pNFS server/client where the
client crashed during dismounting.
The patch also reorders the unlocks, although that isn't necessary
for correct operation.

8 years agoMFC r295856 (by des@):
dchagin [Sat, 7 May 2016 19:05:39 +0000 (19:05 +0000)]
MFC r295856 (by des@):
Implement /proc/$$/limits.

MFC r297781 (by dchagin@):
More complete implementation of /proc/self/limits.
Fix the way the code accesses process limits struct - pointed out by mjg@.

MFC r298318, 298319 (by cem@):
Don't print uninitialized values and initialize error return before use.

PR: 207386

8 years agoMFC r285394 (by mjg@):
dchagin [Sat, 7 May 2016 18:54:35 +0000 (18:54 +0000)]
MFC r285394 (by mjg@):
vref the vnode passed to vn_fullpath.

8 years agoMFC r298519:
dchagin [Sat, 7 May 2016 08:30:21 +0000 (08:30 +0000)]
MFC r298519:
Fix streams and svr4 module dependency. Both modules are complaining about
undefined symbol svr4_delete_socket which was moved from streams to the svr4 module
in r160558 that created a two-way dependency between them.

MFC r298520:
Allow to build svr4 module with SYSV support separatelly from the kernel build.

PR: 208464
Reported by: Kristoffer Eriksson

8 years agoMFC: r297869
rmacklem [Sat, 7 May 2016 00:02:28 +0000 (00:02 +0000)]
MFC: r297869
If the VOP_SETATTR() call that saves the exclusive create verifier failed,
the NFS server would leave the newly created vnode locked. This could
result in a file system that would not unmount and processes wedged,
waiting for the file to be unlocked.
Since this VOP_SETATTR() never fails for most file systems, this bug
doesn't normally manifest itself. I found it during testing of an
exported GlusterFS file system, which can fail.
This patch adds the vput() and changes the error to the correct NFS one.

8 years agoMFC: r297837
rmacklem [Fri, 6 May 2016 23:44:24 +0000 (23:44 +0000)]
MFC: r297837
Bruce Evans reported that there was a performance regression between
the old and new NFS clients. He did a good job of isolating the problem
which was caused by the new NFS client not setting the post write mtime
correctly. The new NFS client code was cloned from the old client, but
was incorrect, because the mtime in the nfs vnode's cache wasn't yet
updated. This patch fixes this problem. The patch also adds missing mutex
locking.

8 years agoMFC r298280
sbruno [Fri, 6 May 2016 19:18:44 +0000 (19:18 +0000)]
MFC r298280

aacraid(4): Sanely copyin userland pointers and ensure that we don't get
anything janky from a user. (cturt)

aac(4) landergriffith+freebsdbugzilla@gmail.com pointed out that aac(4)
had the same issue and handling of pointers, so let's change that too.

PR: 206573
Submitted by: cturt@hardenedbsd.org

8 years agoMFC r298224
sbruno [Fri, 6 May 2016 19:14:57 +0000 (19:14 +0000)]
MFC r298224

Correct possible underflow conditions when checking for available space
in the tx h/w ring buffer.

Sponsored by: Limelight Networks

8 years agoMFC r298279
sbruno [Fri, 6 May 2016 19:11:47 +0000 (19:11 +0000)]
MFC r298279

Plug memory leak in ctl(4) when ctl_copyin_args() is called with a non-
null terminated ASCII string.

PR: 207626
Submitted by: cturt@hardenedbsd.org

8 years agoMFC r298893:
bcr [Fri, 6 May 2016 17:55:11 +0000 (17:55 +0000)]
MFC r298893:
Provide an example to the kqueue man page, showing
a basic usage example.  Although it is an
untypical example for the use of kqueue, it is
better than nothing and should get people started.

PR: 196844
Submitted by: fernando.apesteguia@gmail.com
Reviewed by: kib
Approved by: kib
Differential Revision:  https://reviews.freebsd.org/D6082

8 years agoMFC r298385
sephe [Fri, 6 May 2016 05:44:12 +0000 (05:44 +0000)]
MFC r298385

dhclient: Log a warning instead of bailing upon "illegal" options

In Azure, the DHCP servers add private option (id 0xf5), which contains
binary form of an IPv4 address. Once this option is converted to string
form, it could contain '$', e.g.

IPv4 address: 100.72.36.54
binary form: 0x64 0x48 0x24 0x36
string form: "dH$6"

dhclient bails upon "illegal" options like the above example, thus the
VM bring-up will fail.

Also as a side note, this "illegal" option detection was added in
OpenBSD ~11years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.50&content-type=text/x-cvsweb-markup

And it was removed along with the removal of script support in OpenBSD
~3years ago:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.159&content-type=text/x-cvsweb-markup

Reported by: Hongxiong Xian <v-hoxian microsoft com>
Reviewed by: jhb, Dexuan Cui <decui microsoft com>
Tested by: Hongxiong Xian <v-hoxian microsoft com>
Analyzed by: Dong Liu <doliu microsoft com>
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D5853

8 years agoMFC r298038
sephe [Fri, 6 May 2016 05:16:42 +0000 (05:16 +0000)]
MFC r298038

hyperv/stor: Temporary disable the wrongly done command timeout.

It will be reenabled once the request processing is corrected.

Sponsored by: Microsoft OSTC

8 years agoMFC r298868, r298874:
pfg [Fri, 6 May 2016 01:37:06 +0000 (01:37 +0000)]
MFC r298868, r298874:
restore: fix memory and resource handle leaks.

CID: 272297, 1007784

8 years agoMFC r298408:
jtl [Fri, 6 May 2016 01:26:58 +0000 (01:26 +0000)]
MFC r298408:
  Prevent underflows in tp->snd_wnd if the remote side ACKs more than
  tp->snd_wnd. This can happen, for example, when the remote side responds
  to a window probe by ACKing the one byte it contains.

8 years agoMFC r295583, r295584, r295729, r295730:
markj [Thu, 5 May 2016 23:06:39 +0000 (23:06 +0000)]
MFC r295583, r295584, r295729, r295730:
NDP code cleanup changes.

MFC r295732:
Fix an IPv6 DAD reference count leak.

8 years agoMFC r298759:
wblock [Thu, 5 May 2016 19:44:06 +0000 (19:44 +0000)]
MFC r298759:

Clarify build(7) instructions for alternate object directory.

8 years agoMFC r297999:
ngie [Thu, 5 May 2016 08:11:36 +0000 (08:11 +0000)]
MFC r297999:

Clean up trailing whitespace in lib/libcam; no functional change

8 years agoMFC r298732:
pfg [Thu, 5 May 2016 01:34:58 +0000 (01:34 +0000)]
MFC r298732:
sys/devfs: unsign an index to prevent signed integer overflow.

cdp_maxdirent in struct:cdev_priv is of type u_int.  Use the same
type for the corresponding index in devfs_revoke().

8 years agoMFC r298731, r298734:
pfg [Thu, 5 May 2016 01:29:53 +0000 (01:29 +0000)]
MFC r298731, r298734:
ndis(4): unsign some indexes to prevent overflows.

The "len" parameter is uint32_t, indexing it with an int may
end up in a signed integer overflow.

strlen(3) returns an integer of size_t but a correponding index
of type u_int is more than enough.

8 years agoMerge r299077, which provides ability to override NO_INSTALLEXTRAKERNELS.
glebius [Wed, 4 May 2016 17:27:49 +0000 (17:27 +0000)]
Merge r299077, which provides ability to override NO_INSTALLEXTRAKERNELS.

Override NO_INSTALLEXTRAKERNELS for the release build. Historically, in
the stable/10 branch the regular 'installkernel' target DID NOT install
extra kernels, while the release build DID. This change finally restores
POLA, I hope.

Reported by: Fedor <f att.org.ru>
Reviewed by: gjb

8 years agoMFC r297857: re-enable AMD Topology extension on certain models if
avg [Wed, 4 May 2016 11:53:30 +0000 (11:53 +0000)]
MFC r297857: re-enable AMD Topology extension on certain models if
disabled by BIOS

8 years agoMFC r297812: zio: align use of "no dump" flag between use_uma and !use_uma cases
avg [Wed, 4 May 2016 11:40:13 +0000 (11:40 +0000)]
MFC r297812: zio: align use of "no dump" flag between use_uma and !use_uma cases

8 years agoMFC r298366:
ngie [Wed, 4 May 2016 07:39:23 +0000 (07:39 +0000)]
MFC r298366:

Fix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c

- Ensure socket(2) calls succeed
- Don't leak slist allocated by earlier socket(2) call

CID: 976773, 1251405

8 years agoMFC r298304:
ngie [Wed, 4 May 2016 07:37:02 +0000 (07:37 +0000)]
MFC r298304:

Fix issues identified by Coverity

- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).
- Remove intermediate variable for assigning from $TMPDIR if set in the
  environment to eliminate warnings about pointer conversions with "/tmp",
  and to mute an invalid buffer overflow concern from Coverity
  (snprintf and tacking on a NUL terminator was alleviating that concern
  before).
- Remove useless self-test of psize before it's initialized.
- Check the return values of getrlimit/setrlimit.

Cosmetic changes:
- Replace a `(void*)0` with NULL.
- Do some minor whitespace clean up.
- Remove an unnecessary cast to mmap.
- Make all munmap calls use ATF_REQUIRE_MSG instead of using the:

  > if (munmap(..) == -1)
  >    atf_tc_fail(..)

  idiom. Employ the new idiom consistently when calling munmap.

CID: 13313511331382-133138613315131331514133156513315831331694

8 years agoMFC r298301:
ngie [Wed, 4 May 2016 07:35:43 +0000 (07:35 +0000)]
MFC r298301:

Fix leaks and test for getpagesize() returning == -1

- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).

CID: 1331374-13313771331653-1331662

8 years agoMFC r298758:
ngie [Wed, 4 May 2016 07:33:58 +0000 (07:33 +0000)]
MFC r298758:

Remove logically impossible test in scsidoinquiry(..)

It was already done 4 lines prior and the value of error didn't change

CID: 1011236

8 years agoMFC r298753:
ngie [Wed, 4 May 2016 00:39:03 +0000 (00:39 +0000)]
MFC r298753:

Fix va_list handling

- Add missing va_end's after corresponding va_start's to cleanup state
- Eliminate questionable bzero'ing of va_list passed in to
  do_buff_decode(..) and do_encode(..) from buff_{de,en}code_visit(..)
  and csio_{de,en}code_visit(..). Make va_list a pointer instead and
  pass NULL into the underlying functions to handler this in a portable
  way.
- Do some minor style(9) clean up in affected functions.

CID: 1018500-1018503

8 years agoMFC r298450:
ngie [Wed, 4 May 2016 00:34:45 +0000 (00:34 +0000)]
MFC r298450:

Simplify always evaluated branch (`e != NULL`)

- xalloc(..) ensures that e will be non-null via malloc + err.
- `e` is already dereferenced above, so logically it's impossible
  to hit the lower test without crashing if it was indeed NULL.

CID: 1007408

8 years agoMFC r298311,r298312:
ngie [Wed, 4 May 2016 00:30:36 +0000 (00:30 +0000)]
MFC r298311,r298312:

r298311:

Make sure fmemopen succeeds in :test_append_binary_pos before calling ftell
on the FILE object

This fixes potential null pointer dereferences on failure

CID: 1254952

r298312:

Fix double fclose of `fp1` when freopen fails

freopen handles closing file descriptors on error, with the exception of
fdopen'ed descriptors, so closing an already fclose'd file descriptor is
incorrect

CID: 1338525

8 years agoMFC r298368,r298660:
ngie [Wed, 4 May 2016 00:29:05 +0000 (00:29 +0000)]
MFC r298368,r298660:

r298368:

Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c

Ensure opening /dev/zero succeeds. Abort the test if it doesn't.

Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero"

CID: 1251410

r298660:

Fix up r298368

Remove the semicolon accidentally added after the new conditional that tests
that /dev/zero is opened successfully.

CID: 1354980

8 years agoMFC r298448,r298464:
ngie [Wed, 4 May 2016 00:25:20 +0000 (00:25 +0000)]
MFC r298448,r298464:

r298448:

Don't leak `string` in parse_define(..) when a macro has been found
and the parser token != TOK_ASSIGN

CID: 10071871007188
Obtained from: Isilon OneFS (part of r445479)

r298464:

Use `sizeof(*uuser)` instead of `sizeof(struct usm_user)` for consistency with
the rest of the users in the file

No functional change

8 years agoMFC r298451,r298452,r298507,r298750:
ngie [Wed, 4 May 2016 00:14:50 +0000 (00:14 +0000)]
MFC r298451,r298452,r298507,r298750:

r298451:

Don't use `entry` after free in the "already in lists" case

Return with 0 as it isn't an error.

CID: 1006085
Obtained from: Isilon OneFS (part of r493633)

r298452:

Don't try to free `string` (stack allocated char[])

Fix minor style with warnx call while in the neighborhood

CID: 1009683

r298507:

Fix looking for "UTC" at start of ptr by using strnmp instead of improperly
unrolled equivalent

CID: 1347118

r298750:

Use a better idiom for finding UTC prefixed timezones

Instead of copy-pasting the string literal for "UTC" 3 times and using
strlen, use a static char[3] buffer and sizeof(..).

8 years agoMFC r295575, r295576, r295578, r295579, r295580:
markj [Tue, 3 May 2016 23:46:01 +0000 (23:46 +0000)]
MFC r295575, r295576, r295578, r295579, r295580:
Various NDP cleanups. No functional change intended.

8 years agoMFC r296479:
markj [Tue, 3 May 2016 20:08:05 +0000 (20:08 +0000)]
MFC r296479:
Fix fasttrap tracepoint locking.

8 years agoMFC r297771:
markj [Tue, 3 May 2016 19:42:58 +0000 (19:42 +0000)]
MFC r297771:
Initialize SDT probes during SI_SUB_DTRACE_PROVIDER.