]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
7 years agoMFstable/10 r301667:
ngie [Wed, 8 Jun 2016 18:00:07 +0000 (18:00 +0000)]
MFstable/10 r301667:

MFC r299834:

Fix .Dd

Today is the 14th, not the 10th of May

git-svn-id: svn://svn.freebsd.org/base/stable/9@301668 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301663:
ngie [Wed, 8 Jun 2016 17:50:51 +0000 (17:50 +0000)]
MFstable/10 r301663:

MFC r294507,r294567,r299466:

r294507 (by harti):

Fill the ifAlias leaf of the ifXTable with the interface description
if there is one available and it fits into the maximum size (64 characters).

r294567 (by bz):

Change the variable to a #define in order to make gcc happy which
otherwise will complain about "variably modified 'alias' at file scope".
Unbreaks the build on gcc platforms.

r299466 (by cem):

bsnmpd: Fix size of trapsink::comm to match other community arrays

This fixes a number of possible strcpy() buffer overruns between the various
community strings in trap.c.

CIDs: 100682010068211006822

git-svn-id: svn://svn.freebsd.org/base/stable/9@301664 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301661:
ngie [Wed, 8 Jun 2016 17:44:22 +0000 (17:44 +0000)]
MFstable/10 r301661:

MFC r256678,r256680,r260986,r272878,r286402:

r256678 (by syrinx):

Fix SNMP Error response PDUs and properly encode them when using v3 auth/encryption.

r256680 (by syrinx):

Fix the -Wconversion warnings produced when compiling the SNMP agent.

r260986 (by harti):

Fix a problem with OBJECT IDENTIFIER encoding: need to check the
second subid to be less than 40, not the first when the first
subid is 0 or 1.

r272878 (by syrinx):

Fix a bug in decoding string indexes in snmp_target(3), thus causing
bsnmpd(1) to not send v3 notifications properly; while here add two
missing return statements which could lead to abort() in case of a
rollback

r286402 (by araujo):

Fix variable 'old' is used uninitialized whenever '&&' condition is false.
Spotted by clang.

git-svn-id: svn://svn.freebsd.org/base/stable/9@301662 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301657:
ngie [Wed, 8 Jun 2016 17:35:59 +0000 (17:35 +0000)]
MFstable/10 r301657:

MFC r299701:

Move _bsnmptools_debug extern from bsnmpmap.c to bsnmptools.h

It was used in bsnmpmap.c but was stored in bsnmptools.c; moving the extern
to the header allows us to cover all of our bases for the variable, and allows
_bsnmptools_debug to be used in the future elsewhere -- not just bsnmpmap.c.

git-svn-id: svn://svn.freebsd.org/base/stable/9@301659 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301653:
ngie [Wed, 8 Jun 2016 17:29:07 +0000 (17:29 +0000)]
MFstable/10 r301653:

MFC r299810:

Correct function names that failed in error messages

It should be calloc/strdup, not malloc

git-svn-id: svn://svn.freebsd.org/base/stable/9@301654 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r300475:
ngie [Wed, 8 Jun 2016 17:24:57 +0000 (17:24 +0000)]
MFstable/10 r300475:

MFC r299710,r299711,r299763,r299783,r299811:

r299710:

Staticize global variables only used in bsnmpimport.c to fix
-Wmissing-variable-declarations warnings

r299711:

Fold two malloc + memset(.., 0, ..) calls into equivalent calloc calls

r299763:

Mute -Wstrlcpy-strlcat-size warning by using nitems with the size of the buffer

This is a no-op as the malloc above set the size of the buffer to the size used
below, but this keeps things consistent in case the malloc call changes somehow.

r299783:

Convert tok from enum tok to int32_t in function calls

get_token(..) returns int32_t, not enum tok, and in many cases tests for items
not in enum tok (e.g. '('). Make the typing consistent with get_token, which
includes a domino effect of changing enum tok to int32_t.

r299811:

Use strdup instead of malloc + strlcpy

Fix error messages on failure for calloc/strdup

git-svn-id: svn://svn.freebsd.org/base/stable/9@301652 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301636:
ngie [Wed, 8 Jun 2016 17:17:03 +0000 (17:17 +0000)]
MFstable/10 r301636:

MFC r300867,r300932,r300934,r300941,r300972,r300973:

r300867:

Only expose `hint_uaddr` in the ND_DEBUG case

This fixes a -Wunused-but-set-variable warning with gcc

r300932:

Catch malloc(3) errors and socket(2) errors

- malloc failing will result in a delayed segfault
- socket failing will result in delayed failures with setsockopt

Exit in the event that either of these high-level conditions are met.

CID: 976288, 976321, 976858

r300934:

Plug leak with ifp by calling freeifaddrs after calling getifaddrs

Obtained from: NetBSD v1.18

r300941:

Don't leak res in network_init(..)

Call freeaddrinfo on it after it's been used

CID: 1225050

r300972 (by markj):

Fix rpcbind init after r300941.

- getaddrinfo() sets res = NULL on failure and freeaddrinfo() always
  dereferences its argument, so we should only free the address list after
  a successful call.
- Address a second potential leak caused by getaddrinfo(AF_INET6)
  overwriting the address list returned by getaddrinfo(AF_INET).

X-MFC-With: r300941

r300973:

Follow up to r300932

In the event MK_INET6 != no in userspace, but is disabled in the
kernel, or if there aren't any IPv6 addresses configured in userspace
(for lo0 and all physical interfaces), rpcbind would terminate
immediately instead of silently failing on

Skip over the IPv6 block to its respective cleanup with freeifaddrs if
creating the socket failed instead of terminating rpcbind immediately

git-svn-id: svn://svn.freebsd.org/base/stable/9@301650 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301648:
ngie [Wed, 8 Jun 2016 17:13:57 +0000 (17:13 +0000)]
MFstable/10 r301648:

MFC r300947:

Staticize variables only used in rpcbind.c

This is some low hanging fruit necessary for making this WARNS?= 6 clean

git-svn-id: svn://svn.freebsd.org/base/stable/9@301649 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301646:
ngie [Wed, 8 Jun 2016 17:12:37 +0000 (17:12 +0000)]
MFstable/10 r301646:

MFC r300945:

Remove unnecessary caller_uaddr != NULL test before calling free on it

git-svn-id: svn://svn.freebsd.org/base/stable/9@301647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301644:
ngie [Wed, 8 Jun 2016 17:10:43 +0000 (17:10 +0000)]
MFstable/10 r301644:

MFC r300942:

Remove a useless if (x != NULL) check before calling free on allocated_uaddr

git-svn-id: svn://svn.freebsd.org/base/stable/9@301645 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300932,r300934,r300941,r300972,r300973:
ngie [Wed, 8 Jun 2016 17:04:15 +0000 (17:04 +0000)]
MFC r300932,r300934,r300941,r300972,r300973:

r300932:

Catch malloc(3) errors and socket(2) errors

- malloc failing will result in a delayed segfault
- socket failing will result in delayed failures with setsockopt

Exit in the event that either of these high-level conditions are met.

CID: 976288, 976321, 976858

r300934:

Plug leak with ifp by calling freeifaddrs after calling getifaddrs

Obtained from: NetBSD v1.18

r300941:

Don't leak res in network_init(..)

Call freeaddrinfo on it after it's been used

CID: 1225050

r300972 (by markj):

Fix rpcbind init after r300941.

- getaddrinfo() sets res = NULL on failure and freeaddrinfo() always
  dereferences its argument, so we should only free the address list after
  a successful call.
- Address a second potential leak caused by getaddrinfo(AF_INET6)
  overwriting the address list returned by getaddrinfo(AF_INET).

X-MFC-With: r300941

r300973:

Follow up to r300932

In the event MK_INET6 != no in userspace, but is disabled in the
kernel, or if there aren't any IPv6 addresses configured in userspace
(for lo0 and all physical interfaces), rpcbind would terminate
immediately instead of silently failing on

Skip over the IPv6 block to its respective cleanup with freeifaddrs if
creating the socket failed instead of terminating rpcbind immediately

git-svn-id: svn://svn.freebsd.org/base/stable/9@301643 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r296994:
ngie [Wed, 8 Jun 2016 16:59:09 +0000 (16:59 +0000)]
MFstable/10 r296994:
r296994 (by asomers):

MFC r293229, r293833 to usr.sbin/rpcbind

r293833 | asomers | 2016-01-13 10:33:50 -0700 (Wed, 13 Jan 2016) | 16 lines

Fix Coverity warnings regarding r293229

rpcbind/check_bound.c
        Fix CID1347798, a memory leak in mergeaddr.

rpcbind/tests/addrmerge_test.c
        Fix CID1347800 through CID1347803, memory leaks in ATF tests.  They
        are harmless because each ATF test case runs in its own process, but
        they are trivial to fix.  Fix a few other leaks that Coverity didn't
        detect, too.

r293229 | asomers | 2016-01-05 17:00:11 -0700 (Tue, 05 Jan 2016) | 36 lines

"source routing" in rpcbind

Fix a bug in rpcbind for multihomed hosts. If the server had interfaces on
two separate subnets, and a client on the first subnet contacted rpcbind at
the address on the second subnet, rpcbind would advertise addresses on the
first subnet. This is a bug, because it should prefer to advertise the
address where it was contacted. The requested service might be firewalled
off from the address on the first subnet, for example.

usr.sbin/rpcbind/check_bound.c
        If the address on which a request was received is known, pass that
        to addrmerge as the clnt_uaddr parameter. That is what addrmerge's
        comment indicates the parameter is supposed to mean. The previous
        behavior is that clnt_uaddr would contain the address from which the
        client sent the request.

usr.sbin/rpcbind/util.c
        Modify addrmerge to prefer to use an IP that is equal to clnt_uaddr,
        if one is found. Refactor the relevant portion of the function for
        clarity, and to reduce the number of ifdefs.

etc/mtree/BSD.tests.dist
usr.sbin/rpcbind/tests/Makefile
usr.sbin/rpcbind/tests/addrmerge_test.c
        Add unit tests for usr.sbin/rpcbind/util.c:addrmerge.

usr.sbin/rpcbind/check_bound.c
usr.sbin/rpcbind/rpcbind.h
usr.sbin/rpcbind/util.c
        Constify some function arguments

git-svn-id: svn://svn.freebsd.org/base/stable/9@301642 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301629:
ngie [Wed, 8 Jun 2016 14:20:54 +0000 (14:20 +0000)]
MFstable/10 r301629:

MFC r300387,r300388,r300389:

r300387:

getnetid(..): consistently fclose fd at the end of the function

This mutes a false positive with cppcheck, but also helps eliminate future
potential issues with this variable

r300388:

Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL

This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.

CID: 978179

r300389:

nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)

If the buffer couldn't be adequately resized to accomodate an additional "\n",
it would leak resultbuf by breaking from the loop early

CID: 1016702

git-svn-id: svn://svn.freebsd.org/base/stable/9@301630 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301619:
ngie [Wed, 8 Jun 2016 13:50:48 +0000 (13:50 +0000)]
MFstable/10 r301619:

MFC r300430:

Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each line

As a positive side-effect, this eliminates the double semicolons reported by Coverity:
the macro contained a trailing semicolon, in addition to the semicolon placed on
each line where EXPAND(..) was called.

CID: 1194269

git-svn-id: svn://svn.freebsd.org/base/stable/9@301620 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301617:
ngie [Wed, 8 Jun 2016 13:45:02 +0000 (13:45 +0000)]
MFstable/10 r301617:

MFC r300428:

Fix humanized decoding of struct stat with respect to .st_mtim

st_mtim was being incorrectly described as "stime=", not "mtime=". This was
introduced with the original feature commit (r176471).

PR: 209699

git-svn-id: svn://svn.freebsd.org/base/stable/9@301618 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301615:
ngie [Wed, 8 Jun 2016 13:41:51 +0000 (13:41 +0000)]
MFstable/10 r301615:

MFC r299844,r300931:

r299844:

Make hostid_save depend on hostid

r300931:

Make netif REQUIRE hostid

As noted in the PR, if etc/rc.d/zvol is removed, netif will be run before
hostid, and the MAC address generated for any bridge devices will be
non-deterministic. Make the MAC address generated be deterministic for
bridge devices by explicitly REQUIRE'ing hostid.

This fixes up the rest of the PR, inadvertently committed in r299844

PR: 195188

git-svn-id: svn://svn.freebsd.org/base/stable/9@301616 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301613:
ngie [Wed, 8 Jun 2016 13:37:18 +0000 (13:37 +0000)]
MFstable/10 r301613:

MFC r299843:

Fix broken dependency with routed when MK_ROUTED != no

Remove routed as a requirement in NETWORKING, and put it in routed as a BEFORE
requirement instead

git-svn-id: svn://svn.freebsd.org/base/stable/9@301614 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301610:
ngie [Wed, 8 Jun 2016 13:25:15 +0000 (13:25 +0000)]
MFstable/10 r301610:

MFC r299833:

Fix fully canonicalized example for `myvariable.27...`

`6` doesn't occur in the OID; it was spurious

Bump .Dd for the change

git-svn-id: svn://svn.freebsd.org/base/stable/9@301611 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r301608:
ngie [Wed, 8 Jun 2016 13:22:25 +0000 (13:22 +0000)]
MFstable/10 r301608:

MFC r299657:

Include arpa/inet.h to get the htonl(3) definition

git-svn-id: svn://svn.freebsd.org/base/stable/9@301609 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301102:
cy [Wed, 8 Jun 2016 03:09:30 +0000 (03:09 +0000)]
MFC r301102:

Don't rely on $ntpd_enable to periodically fetch the latest leapfile.

Suggested by: cperciva

git-svn-id: svn://svn.freebsd.org/base/stable/9@301578 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301235:
pfg [Mon, 6 Jun 2016 13:32:15 +0000 (13:32 +0000)]
MFC r301235:
dhclient(1): correct obvious mismatch in get_char().

Correct switch between current and previous line buffers when
encountering a carriage return in the input.

CID: 1305719
Obtained from: OpenBSD (CVS rev. 1.30)

git-svn-id: svn://svn.freebsd.org/base/stable/9@301507 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301206:
pfg [Sun, 5 Jun 2016 15:05:53 +0000 (15:05 +0000)]
MFC r301206:
usb/uhso: Don't bail out on first USB error.

CID: 1305680
Submitted by: hselasky
MFC after: 3 days

git-svn-id: svn://svn.freebsd.org/base/stable/9@301447 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300569:
dchagin [Sun, 5 Jun 2016 07:45:55 +0000 (07:45 +0000)]
MFC r300569:

Don't leak fp in case where fo_ioctl() returns an error.

Reported by: C Turt <ecturt@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/9@301432 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300376:
pfg [Sat, 4 Jun 2016 04:02:03 +0000 (04:02 +0000)]
MFC r300376:
ndis(4): Better mimic the behavior of rand() on Windows.

In ndis(4) we expose a rand() function that was constantly reseeding
with a time depending function every time it was called. This
essentially broke the reasoning behind seeding, and rendered srand()
a no-op.

Keep it simple, just use random() and srandom() as it's meant to work.
It would have been tempting to just go for arc4random() but we
want to mimic Microsoft, and we don't need crypto-grade randomness
here.

PR: 209616

git-svn-id: svn://svn.freebsd.org/base/stable/9@301299 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300489:
hselasky [Fri, 3 Jun 2016 09:17:22 +0000 (09:17 +0000)]
MFC r300489:
Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside
pause_sbt(). This allows pause() to continue working during a panic()
which is not invoking KDB. This is useful when debugging graphics
drivers using the LinuxKPI.

git-svn-id: svn://svn.freebsd.org/base/stable/9@301262 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301247: MFV r301238:
delphij [Fri, 3 Jun 2016 09:03:10 +0000 (09:03 +0000)]
MFC r301247: MFV r301238:

ntp 4.2.8p8.

Security: CVE-2016-4957, CVE-2016-4953, CVE-2016-4954
Security: CVE-2016-4955, CVE-2016-4956
Security: FreeBSD-SA-16:24.ntp
Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/9@301257 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300667:
hselasky [Fri, 3 Jun 2016 08:56:54 +0000 (08:56 +0000)]
MFC r300667:
Check for signals when locking the USB enumeration thread from
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

git-svn-id: svn://svn.freebsd.org/base/stable/9@301254 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299060:
hselasky [Fri, 3 Jun 2016 08:50:44 +0000 (08:50 +0000)]
MFC r299060:
Extend the UQ_NO_STRINGS quirk to also cover the USB language string
descriptor. This fixes enumeration of some older Samsung Galaxy S3
phones.

git-svn-id: svn://svn.freebsd.org/base/stable/9@301251 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300322, 300340:
pfg [Fri, 3 Jun 2016 03:22:00 +0000 (03:22 +0000)]
MFC r300322, 300340:
ed(1): Cleanups for the DES mode.

- Use arc4random_buf(3).
- Prevent a segmentation fault when ed receives a signal
  while being in getpass(). [1]

Obtained from: OpenBSD [1] (CVS Rev. 1.15)

git-svn-id: svn://svn.freebsd.org/base/stable/9@301234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300180:
cy [Wed, 1 Jun 2016 07:03:11 +0000 (07:03 +0000)]
MFC r300180:

Update leap-seconds to leap-seconds.3661459200.
NO leap second will be introduced at the end of June 2016.

Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/.
See also: http://www.iers.org/SharedDocs/News/EN/BulletinC.html

git-svn-id: svn://svn.freebsd.org/base/stable/9@301108 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMerge r301053:
glebius [Tue, 31 May 2016 16:58:00 +0000 (16:58 +0000)]
Merge r301053:

  Fix kernel stack disclosures in the Linux and 4.3BSD compat layers.

Security: SA-16:20
Security: SA-16:21

git-svn-id: svn://svn.freebsd.org/base/stable/9@301055 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300378:
pfg [Sun, 29 May 2016 16:32:56 +0000 (16:32 +0000)]
MFC r300378:
libc/regex: fix two buffer underruns.

Fix some rather complex regex issues found on OpenBSD as part of some
ongoing work to fix a sed(1) bug.

Curiously the OpenBSD tests don't trigger segfaults on FreeBSD but the
bugs were confirmed by running a port of FreeBSD's regex under OpenBSD's
malloc. Huge thanks to Ingo for confirming the behavior.

Obtained from: OpenBSD (CVS 1.20, 1.21)

git-svn-id: svn://svn.freebsd.org/base/stable/9@300964 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r298192,299234,299238,299736:
delphij [Sat, 28 May 2016 06:24:48 +0000 (06:24 +0000)]
MFC r298192,299234,299238,299736:

file 5.27.

git-svn-id: svn://svn.freebsd.org/base/stable/9@300900 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300638:
cy [Sat, 28 May 2016 03:34:00 +0000 (03:34 +0000)]
MFC r300638:

Use the expiry date to determine whether to replace the DB copy of
leapfile instead of using the leapfile serial number (create
timestamp).

PR: 209577

git-svn-id: svn://svn.freebsd.org/base/stable/9@300898 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC: r299514
rmacklem [Fri, 27 May 2016 23:15:58 +0000 (23:15 +0000)]
MFC: r299514
Fix use-after-free in NFS4 lock test service.

Trivial use-after-free where stp was freed too soon in the non-error path.
To fix, simply move its release to the end of the routine.

git-svn-id: svn://svn.freebsd.org/base/stable/9@300887 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299310:
jhb [Tue, 24 May 2016 23:04:16 +0000 (23:04 +0000)]
MFC 299310:
Don't store generated firmware object files in the source directory.

Trim the leading directory of a firmware source file from the resulting
target object file name so the object file is stored in the object
directory. Previously, using 'FIRMWS= /path/to/fw.bin:fw.bin' would
store the generated 'fw.bin.fwo' file in the /path/to directory. Now
it stores it in the object directory of the kernel module being built.

git-svn-id: svn://svn.freebsd.org/base/stable/9@300629 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r233128,r300561:
ngie [Tue, 24 May 2016 05:11:55 +0000 (05:11 +0000)]
MFstable/10 r233128,r300561:

r233128 (by harti):

memset() wants the size of the structure to clear, not the size
of the pointer to it.

r300561:

MFC r299465,r299807,r299808,r299817,r299831,r299832,r300167:

r299465 (by cem):

bsnmp: Don't overrun privkey buffer by copying wrong size

The 'priv_key' array is SNMP_PRIV_KEY_SIZ bytes, not SNMP_AUTH_KEY_SIZ.

CIDs: 10083261009675

r299807:

Replace QUADFMT with %ju and QUADXFMT with %jx and cast values with uintmax_t

This will cure some -Wformat warnings

r299808:

Use sizeof(..)s for the destination buffers instead of hardcoded values corresponding
to the destination buffer sizes

r299817:

Use SNMPD_INPUT_FAILED instead of SNMP_CODE_FAILED

SNMPD_INPUT_FAILED is `enum snmpd_input_err` type (which matches the return
code from the function). SNMP_CODE_FAILED is `enum snmp_code` type.

r299831:

Remove NO_WERROR and add WARNS?= 6

This now compiles cleanly on all architectures

Tested with: clang 3.8, gcc 4.2.1, gcc 4.5, make tinderbox

r299832:

Remove trailing whitespace in license tort

r300167 (by glebius):

Revert r299830, it has couple of fatal errors.

The CMSG_ family of macros take care of alignment, so we don't need r299830
at all, even if it was correct.  Put NO_WCAST_ALIGN into Makefile.

Together with: peter

git-svn-id: svn://svn.freebsd.org/base/stable/9@300566 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299764,r299765,r299769,r299770,r299774,r299802,r299803,r299805,r299814:
ngie [Tue, 24 May 2016 04:34:45 +0000 (04:34 +0000)]
MFC r299764,r299765,r299769,r299770,r299774,r299802,r299803,r299805,r299814:

r299764:

Use the size of the destination buffer, not the source buffer.

Technically this is a no-op, but mute the clang warning in case the malloc call
above for fstring ever changes in the future

r299765:

Fix theoretical buffer overflow issues in snmp_oid2asn_oid

Increase the size of `string` by 1 to account for the '\0' terminator. In the event
that `str` doesn't contain any non-alpha chars, i would be set to MAXSTR, and
the subsequent strlcpy call would overflow by a character.

Remove unnecessary `string[i] = '\0'` -- this is already handled by strlcpy.

r299769:

Use the size of the destination buffer instead of the malloc size, repeated, in order
to mute a -Wstrlcpy-strlcat-size warning

r299770:

Fix up r299764

I meant to use nitems, not sizeof(..) with the destination buffer. Using sizeof(..)
on a pointer will always truncate the output in the destination buffer incorrectly

Pointyhat to: ngie

r299774:

Do minimal work necessary to cure a -Wunused-but-set-variable warning from gcc

How errno is saved before and restored after strtoul calls needs a rethink

r299802:

Fix up both r299764 and r299770

nitems was wrong too, as it was being tested against a pointer instead of a buffer on
the stack.

Since the old code was just doing malloc, then strlcpy'ing the contents of the source
buffer into the destination buffer, replace it all with a call to strdup..

Supersized Duncecap to: ngie

r299803:

Replace malloc + memset(.., 0, ..) with calloc calls

r299805:

Fix up r299769

Similar to r299802, it was noted that using nitems on scalar pointers is
invalid.

Use strdup instead of malloc + strlcpy (which is what the old code was doing
anyhow).

Pointyhat to: ngie

r299814:

Replace malloc + memset(.., 0, ..) with calloc calls

git-svn-id: svn://svn.freebsd.org/base/stable/9@300560 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r300471:
ngie [Tue, 24 May 2016 04:18:15 +0000 (04:18 +0000)]
MFstable/10 r300471:

MFC r299712,r299759,r299760,r299761,r299762:

r299712:

Fix some trivial clang/gcc warnings in bsnmptc.c

- By definition, `enum snmp_tc` can't be false (the implied starting sequence
  index for the enum is 0). Don't test for it being < 0.
- Staticize `struct snmp_text_conv` to mute a -Wmissing-variable-declarations
  warning from clang.
- Remove set but unused variable, ptr, in parse_bridge_id(..) and
  parse_bport_id(..) to mute warning from gcc 4.9+.
- Mark value and string unused in snmp_inetaddr2oct(..) and parse_inetaddr(..)
  as they're just stub functions.

r299759:

Use calloc instead of memset(.., 0, ..) + malloc

r299760:

Sort variables in parse_ascii(..) per style(9)

r299761:

parse_ascii: make count size_t to mute a -Wsign-compare issue

count is always unsigned.

r299762:

Mark snmptoolctx unused in parse_authentication(..), parse_privacy(..),
parse_context(..), and parse_user_security(..).

git-svn-id: svn://svn.freebsd.org/base/stable/9@300558 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFV r299377:
pfg [Tue, 24 May 2016 03:00:24 +0000 (03:00 +0000)]
MFV r299377:
sed.1: Correction for the case insensitive case.

Use the capital I instead of the lowercase.

Submitted by: Mikhail T.

git-svn-id: svn://svn.freebsd.org/base/stable/9@300554 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299916: vfs_read_dirent: increment ncookies after adding a cookie
avg [Mon, 23 May 2016 07:21:16 +0000 (07:21 +0000)]
MFC r299916: vfs_read_dirent: increment ncookies after adding a cookie

git-svn-id: svn://svn.freebsd.org/base/stable/9@300485 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300024: zfs_ioc_rename: fix a reversed condition
avg [Mon, 23 May 2016 07:17:53 +0000 (07:17 +0000)]
MFC r300024: zfs_ioc_rename: fix a reversed condition

PR: 209093

git-svn-id: svn://svn.freebsd.org/base/stable/9@300483 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r300464:
ngie [Mon, 23 May 2016 05:30:24 +0000 (05:30 +0000)]
MFstable/10 r300464:

MFC r299659:

Remove unused const variable

git-svn-id: svn://svn.freebsd.org/base/stable/9@300466 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFstable/10 r300460:
ngie [Mon, 23 May 2016 05:25:34 +0000 (05:25 +0000)]
MFstable/10 r300460:

MFC r299655:

Add missing prototype for getchar(..)

git-svn-id: svn://svn.freebsd.org/base/stable/9@300462 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoBackport security fix for absolute path traversal vulnerability in bsdcpio.
mm [Sat, 21 May 2016 09:27:30 +0000 (09:27 +0000)]
Backport security fix for absolute path traversal vulnerability in bsdcpio.

This is a direct commit to stable/9.

Vendor git commits:
59357157706d47c365b2227739e17daba3607526
199d5c79b547cebe3d7d33e5acd10ae03008c4a2

Security: CVE-2015-2304

git-svn-id: svn://svn.freebsd.org/base/stable/9@300363 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoBackport security fix for integer signedness error in libarchive.
mm [Sat, 21 May 2016 09:24:02 +0000 (09:24 +0000)]
Backport security fix for integer signedness error in libarchive.
This is a direct commit to stable/9.

Upstream git commit: 22531545514043e04633e1c015c7540b9de9dbe4

Security: CVE-2013-0211

git-svn-id: svn://svn.freebsd.org/base/stable/9@300362 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC: r299201
rmacklem [Fri, 20 May 2016 01:25:14 +0000 (01:25 +0000)]
MFC: r299201
Give mountd -S priority over outstanding RPC requests when suspending the nfsd.

It was reported via email that under certain heavy RPC loads
long delays before the exports would be updated was observed
when using "mountd -S". This patch reverses the priority between
the exclusive lock request to suspend the nfsd threads and the
shared lock request for performing RPCs.
As such, when mountd attempts to suspend the nfsd threads, it
gets priority over outstanding RPC requests to do this.
I suspect that the case reported was an artificial test load,
but this patch did fix the problem for the reporter.

git-svn-id: svn://svn.freebsd.org/base/stable/9@300255 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFS r300243:
bdrewery [Thu, 19 May 2016 22:54:24 +0000 (22:54 +0000)]
MFS r300243:

  Follow-up r300233: Don't override MK_* from env as head does.

PR: D6271

git-svn-id: svn://svn.freebsd.org/base/stable/9@300244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoBump version for r300234
bdrewery [Thu, 19 May 2016 21:47:57 +0000 (21:47 +0000)]
Bump version for r300234

git-svn-id: svn://svn.freebsd.org/base/stable/9@300236 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFS r300233:
bdrewery [Thu, 19 May 2016 21:44:33 +0000 (21:44 +0000)]
MFS r300233:

  Allow MK_ overrides

PR: D6271

git-svn-id: svn://svn.freebsd.org/base/stable/9@300234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoUse unsigned version of min() when handling arguments of SETFKEY ioctl.
glebius [Tue, 17 May 2016 22:31:12 +0000 (22:31 +0000)]
Use unsigned version of min() when handling arguments of SETFKEY ioctl.

Submitted by: C Turt <cturt hardenedbsd.org>
Security: SA-16:18
Security: CVE-2016-1886

git-svn-id: svn://svn.freebsd.org/base/stable/9@300093 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agopick up specialreg.h changes from r273338 to fix r300037
avg [Tue, 17 May 2016 14:02:05 +0000 (14:02 +0000)]
pick up specialreg.h changes from r273338 to fix r300037

The original change applies to x86 family of platforms, in this branch
it's only for amd64 where it is really required.

This is a direct commit.

Reported by: Eugene Grosbein <eugen@grosbein.net>

git-svn-id: svn://svn.freebsd.org/base/stable/9@300053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298736,298737: ensure that initial local apic id is sane on AMD 10h systems
avg [Tue, 17 May 2016 08:36:12 +0000 (08:36 +0000)]
MFC r298736,298737: ensure that initial local apic id is sane on AMD 10h systems

git-svn-id: svn://svn.freebsd.org/base/stable/9@300037 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298106: zfs_rezget: z_vnode can not be NULL if zp is valid
avg [Tue, 17 May 2016 08:31:54 +0000 (08:31 +0000)]
MFC r298106: zfs_rezget: z_vnode can not be NULL if zp is valid

git-svn-id: svn://svn.freebsd.org/base/stable/9@300035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298473,298787: add invpcid, fix sahf/lahf in dtrace disassembler
avg [Tue, 17 May 2016 08:30:06 +0000 (08:30 +0000)]
MFC r298473,298787: add invpcid, fix sahf/lahf in dtrace disassembler

git-svn-id: svn://svn.freebsd.org/base/stable/9@300032 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r266103: Update dis_tables.c to the latest Illumos version.
avg [Tue, 17 May 2016 08:27:58 +0000 (08:27 +0000)]
MFC r266103: Update dis_tables.c to the latest Illumos version.

Latest as of May 2014.

On behalf of: grehan

git-svn-id: svn://svn.freebsd.org/base/stable/9@300031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298472: MFV r298471: 6052 decouple lzc_create() from the
avg [Tue, 17 May 2016 08:18:19 +0000 (08:18 +0000)]
MFC r298472: MFV r298471: 6052 decouple lzc_create() from the
implementation details

git-svn-id: svn://svn.freebsd.org/base/stable/9@300026 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoFix:
cy [Sun, 15 May 2016 15:26:19 +0000 (15:26 +0000)]
Fix:
IP Filter bug 1835705: It is impossible to delete a state using
SIOCDELST ioctl.

This is a direct commit to the stable/9 branch because this patch was
already included in the ipfilter 5.1.2 import in r254562. It was
ultimately included in ipfilter 4.1.29 (whereas stable/9 uses 4.1.28).

Obtained from: ipfilter CVS repo: ip_state.c r1.13

git-svn-id: svn://svn.freebsd.org/base/stable/9@299857 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299696 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299651:
ngie [Fri, 13 May 2016 09:54:15 +0000 (09:54 +0000)]
MFstable/10 r299651:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299652 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299649:
ngie [Fri, 13 May 2016 09:50:38 +0000 (09:50 +0000)]
MFstable/10 r299649:

MFC r298842:

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

CID: 1341474

git-svn-id: svn://svn.freebsd.org/base/stable/9@299650 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299643:
ngie [Fri, 13 May 2016 09:33:48 +0000 (09:33 +0000)]
MFstable/10 r299643:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299645 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299640:
ngie [Fri, 13 May 2016 09:32:05 +0000 (09:32 +0000)]
MFstable/10 r299640:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299644 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299638:
ngie [Fri, 13 May 2016 09:16:01 +0000 (09:16 +0000)]
MFstable/10 r299638:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299639 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299635:
ngie [Fri, 13 May 2016 09:07:42 +0000 (09:07 +0000)]
MFstable/10 r299635:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299636 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299632:
ngie [Fri, 13 May 2016 09:02:28 +0000 (09:02 +0000)]
MFstable/10 r299632:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299630:
ngie [Fri, 13 May 2016 08:59:49 +0000 (08:59 +0000)]
MFstable/10 r299630:

MFC r298340:
r298340 (by cem):

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

CID: 1006106

git-svn-id: svn://svn.freebsd.org/base/stable/9@299631 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299627:
ngie [Fri, 13 May 2016 08:51:51 +0000 (08:51 +0000)]
MFstable/10 r299627:

MFC r298676:
r298676 (by cem):

netipsec: Don't leak memory when deep copy fails

CID: 1331693

git-svn-id: svn://svn.freebsd.org/base/stable/9@299628 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299625:
ngie [Fri, 13 May 2016 08:46:13 +0000 (08:46 +0000)]
MFstable/10 r299625:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299626 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299623:
ngie [Fri, 13 May 2016 08:42:21 +0000 (08:42 +0000)]
MFstable/10 r299623:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299624 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299619:
ngie [Fri, 13 May 2016 08:34:53 +0000 (08:34 +0000)]
MFstable/10 r299619:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299620 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299616:
ngie [Fri, 13 May 2016 08:25:17 +0000 (08:25 +0000)]
MFstable/10 r299616:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299618 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299613:
ngie [Fri, 13 May 2016 08:04:03 +0000 (08:04 +0000)]
MFstable/10 r299613:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299614 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

These affect debugging messages.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299498 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r299035: sh: Handle empty hostname and $PWD when building prompt
vangyzen [Wed, 11 May 2016 22:13:50 +0000 (22:13 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299488 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299486 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298698:
pfg [Wed, 11 May 2016 00:37:15 +0000 (00:37 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299398 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299302 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

Remove Unused/Dead Code

git-svn-id: svn://svn.freebsd.org/base/stable/9@299301 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298294
davidcs [Tue, 10 May 2016 02:44:23 +0000 (02:44 +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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299300 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298609:
pfg [Tue, 10 May 2016 02:15:09 +0000 (02:15 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299296 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299261 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC: r298523
rmacklem [Sat, 7 May 2016 21:34:04 +0000 (21:34 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299225 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298519:
dchagin [Sat, 7 May 2016 08:26:05 +0000 (08:26 +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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299214 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC: r297869
rmacklem [Sat, 7 May 2016 00:07:03 +0000 (00:07 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299209 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC: r297837
rmacklem [Fri, 6 May 2016 23:55:28 +0000 (23:55 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299207 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

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

CID: 272297, 1007784

git-svn-id: svn://svn.freebsd.org/base/stable/9@299149 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298408:
jtl [Fri, 6 May 2016 01:27:01 +0000 (01:27 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299147 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299111:
ngie [Thu, 5 May 2016 08:17:55 +0000 (08:17 +0000)]
MFstable/10 r299111:

MFC r297999:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298732:
pfg [Thu, 5 May 2016 01:35:42 +0000 (01:35 +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().

git-svn-id: svn://svn.freebsd.org/base/stable/9@299107 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298731, r298734:
pfg [Thu, 5 May 2016 01:30:53 +0000 (01:30 +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.

git-svn-id: svn://svn.freebsd.org/base/stable/9@299105 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoFix several OpenSSL vulnerabilities.
delphij [Wed, 4 May 2016 06:53:02 +0000 (06:53 +0000)]
Fix several OpenSSL vulnerabilities.

Security: CVE-2016-2105, CVE-2016-2106, CVE-2016-2109
Security: CVE-2016-2176 (does not affect FreeBSD)
Security: FreeBSD-SA-16:17.openssl

git-svn-id: svn://svn.freebsd.org/base/stable/9@299053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299022:
ngie [Wed, 4 May 2016 00:35:41 +0000 (00:35 +0000)]
MFstable/10 r299022:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299018:
ngie [Wed, 4 May 2016 00:26:47 +0000 (00:26 +0000)]
MFstable/10 r299018:

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

git-svn-id: svn://svn.freebsd.org/base/stable/9@299019 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r299016:
ngie [Wed, 4 May 2016 00:19:46 +0000 (00:19 +0000)]
MFstable/10 r299016:

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(..).

git-svn-id: svn://svn.freebsd.org/base/stable/9@299017 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298556:
pfg [Tue, 3 May 2016 15:06:29 +0000 (15:06 +0000)]
MFC r298556:

ifconfig: prevent some improbable signed integer overflows.

ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int.
Use an unsigned index to prevent overflowing the index.

Adopt unsigned integers in other cases where it is useful
to be aware of the unsigned quantities and there is no
risk of the values being negative.

git-svn-id: svn://svn.freebsd.org/base/stable/9@298980 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFstable/10 r272871:
ngie [Sat, 30 Apr 2016 09:43:01 +0000 (09:43 +0000)]
MFstable/10 r272871:
r272871 (by hrs):

MFC r271909:
  Revert changes in r269180.  It could cause -c N option to enter an
  infinite loop if no reply packet is received.

git-svn-id: svn://svn.freebsd.org/base/stable/9@298843 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r297696 and r298424:
hselasky [Fri, 29 Apr 2016 11:38:45 +0000 (11:38 +0000)]
MFC r297696 and r298424:
Add new USB quirks.

Submitted by: AJ <aleksanderlothe@live.com>
PR: 208623
Submitted by: Naram Qashat <cyberbotx@cyberbotx.com>
PR: 208642

git-svn-id: svn://svn.freebsd.org/base/stable/9@298782 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r298458:
hselasky [Fri, 29 Apr 2016 11:31:27 +0000 (11:31 +0000)]
MFC r298458:
Add missing set of the current VNET when inputting IP packets in IPoIB.

This fixes a kernel panic when using IPoIB with VIMAGE and infiniband.

PR: 208957
Sponsored by: Mellanox Technologies
Tested by: Justin Clift <justin@postgresql.org>

git-svn-id: svn://svn.freebsd.org/base/stable/9@298780 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r297968:
hselasky [Fri, 29 Apr 2016 11:17:25 +0000 (11:17 +0000)]
MFC r297968:
Remove some unused fields.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/9@298777 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f