]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
7 years agoFix whitespace nit, not functional changes.
gjb [Wed, 7 Dec 2016 19:01:38 +0000 (19:01 +0000)]
Fix whitespace nit, not functional changes.

Sponsored by: The FreeBSD Foundation

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

7 years agoDocument EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.
gjb [Wed, 7 Dec 2016 18:55:55 +0000 (18:55 +0000)]
Document EN-16:19, EN-16:20, EN-16:21, SA-16:36, SA-16:37, SA-16:38.

Sponsored by: The FreeBSD Foundation

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

7 years agoMerge r309639 from head:
glebius [Tue, 6 Dec 2016 18:54:04 +0000 (18:54 +0000)]
Merge r309639 from head:

  Fix possible buffer overflow(s) in link_ntoa(3).

  A specially crafted sockaddr_dl argument can trigger a static buffer overflow
  in the libc library, with possibility to rewrite with arbitrary data following
  static buffers that belong to other library functions.

Reviewed by: kib
Security: FreeBSD-SA-16:37.libc

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

7 years agoMerge r309638 from head:
glebius [Tue, 6 Dec 2016 18:52:33 +0000 (18:52 +0000)]
Merge r309638 from head:

  When telnetd(8) composes argument list for login(1), an unexpected sequence
  of memory allocation failures combined with insufficient error checking
  could result in the construction and execution of an argument sequence that
  was not intended.

  Fix that treating malloc(3) failures as fatal condition.

Submitted by: brooks
Security: FreeBSD-SA-16:36.telnetd

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

7 years agoMFC r292961, r295717:
kib [Tue, 6 Dec 2016 10:37:27 +0000 (10:37 +0000)]
MFC r292961, r295717:
Force nullfs vnode reclaim after unlinking and directory removal.

PR: 178238

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

7 years agoMFC r309332:
dim [Tue, 6 Dec 2016 07:33:49 +0000 (07:33 +0000)]
MFC r309332:

Cleanup old debug dirs in delete-old-dirs target

Any .debug or .symbols files under /usr/lib/debug which correspond to
OLD_FILES entries in ObsoleteFiles.inc are also automatically cleaned up
by the delete-old target.  Make this also apply to any OLD_DIRS entries.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D8683

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

7 years agoMFC r309179:
pfg [Sat, 3 Dec 2016 00:46:18 +0000 (00:46 +0000)]
MFC r309179:
ext2fs: avoid possible overflow when calculating malloc size.

This is inspired on r308064 for the case of mounting UFS.

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

7 years agoMFC r309027:
brooks [Wed, 30 Nov 2016 01:41:40 +0000 (01:41 +0000)]
MFC r309027:

Allocate a struct ifreq rather than using a (wrong) computed size for
the BIOCSETIF ioctl.

The kernel always copies an entire struct ifreq and IPv4 addresses will
always fit in an ifreq.

On systems with pointers larger than 64-bits, the computed size will be
less than the size of struct ifreq, potentially resulting in the kernel
attempting to copyin memory from outside the allocation.

Reviewed by: jhb
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D8445

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

7 years agoMFC r308808, r308809: Lookup locale when print all keywords as well.
ume [Sat, 26 Nov 2016 02:53:35 +0000 (02:53 +0000)]
MFC r308808, r308809: Lookup locale when print all keywords as well.

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

7 years agoMFC r308957: MFV r308954:
delphij [Tue, 22 Nov 2016 16:23:46 +0000 (16:23 +0000)]
MFC r308957: MFV r308954:

ntp 4.2.8p9.

Approved by: so

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

7 years agoMFC r308642:
kib [Mon, 21 Nov 2016 10:49:37 +0000 (10:49 +0000)]
MFC r308642:
Initialize reserved bytes in struct mq_attr.

PR: 214488

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

7 years agoMFC r308437 and r308461:
hselasky [Sat, 12 Nov 2016 17:32:22 +0000 (17:32 +0000)]
MFC r308437 and r308461:
Range check the jitter values to avoid bogus sample rate adjustments.
The expected deviation should not be more than 1Hz per second. The USB
v2.0 specification also mandates this requirement. Refer to chapter
5.12.4.2 about feedback.

Allow higher sample rates to have more jitter than lower ones.

PR: 208791

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

7 years agoMFC: r307891
rmacklem [Tue, 8 Nov 2016 21:57:49 +0000 (21:57 +0000)]
MFC: r307891
Fix the man page to reflect the change done by r307890 to mountd.c
so that the "-n" option uses the sysctl for the correct NFS server.
This is a content change.

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

7 years agoMFC: r307890
rmacklem [Tue, 8 Nov 2016 21:52:55 +0000 (21:52 +0000)]
MFC: r307890
mountd(8) was erroneously setting the sysctl for the old NFS server
when the new/default NFS server was running, for the "-n" option.

This patch fixes the problem for stable/10 and stable/9.
Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
there wouldn't have been many users affected by the code not setting
it to 0 when the "-n" option was specified.

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

7 years agoMFC r307518:
hselasky [Mon, 7 Nov 2016 09:23:07 +0000 (09:23 +0000)]
MFC r307518:
Fix device delete child function.

When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by: Jan Henrik Sylvester <me@janh.de>
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D8070

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

7 years agoMFC r308031:
hselasky [Mon, 7 Nov 2016 08:26:19 +0000 (08:26 +0000)]
MFC r308031:
Fix indentation and remove duplicate queue stopped stats increment.

Found by: Ryan Stone <rysto32@gmail.com>
Sponsored by: Mellanox Technologies

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

7 years agoMFC r308144 and r308165:
hselasky [Mon, 7 Nov 2016 08:17:23 +0000 (08:17 +0000)]
MFC r308144 and r308165:
Fixes for virtual T-axis buttons.

Make sure the virtual T-axis buttons gets cleared for USB mice which has
less than 6 buttons.

Make sure the virtual T-axis buttons generate button release event(s)
for continuous tilting.

PR: 213919
PR: 213957

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

7 years agoMFC r283636:
avos [Sun, 6 Nov 2016 14:25:52 +0000 (14:25 +0000)]
MFC r283636:
- Don't request BUS_DMA_ALLOCNOW for dma tags, that requires enormous
amount of memory.
- Don't request segsize of BUS_SPACE_MAXSIZE_32BIT, when maxsize is
MCLBYTES.

With this change bwi_attach() can succeed on i386.

PR: 214235
Submitted by: scottl

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

7 years agoMFC r307800, r307801
cy [Sat, 5 Nov 2016 17:02:38 +0000 (17:02 +0000)]
MFC r307800, r307801

r307800:

  Sources from the "current" build tree and generated sources in the
  object tree should be used instead of sources and headers from the
  already installed source tree on the build host.

  This was noticed while addressing issues in the upcoming amd update.

r307801:

  Align whitespace.

  r307801 is related to r307800 however it was a separate commit to
  HEAD in order to maintain a separation between the functional change
  and a correction of style.

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

7 years agoMFC r308270:
gjb [Fri, 4 Nov 2016 17:55:50 +0000 (17:55 +0000)]
MFC r308270:
 MFV r308265: Update tzdata to 2016i.

Sponsored by: The FreeBSD Foundation

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

7 years agoDocument SA-16:33-35.
gjb [Wed, 2 Nov 2016 18:11:06 +0000 (18:11 +0000)]
Document SA-16:33-35.

Sponsored by: The FreeBSD Foundation

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

7 years agoBackport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401:
delphij [Wed, 2 Nov 2016 07:09:31 +0000 (07:09 +0000)]
Backport OpenSSL commit af58be768ebb690f78530f796e92b8ae5c9a4401:

  Don't allow too many consecutive warning alerts

  Certain warning alerts are ignored if they are received. This can mean that
  no progress will be made if one peer continually sends those warning alerts.
  Implement a count so that we abort the connection if we receive too many.

  Issue reported by Shi Lei.

This is a direct commit to stable/10 and stable/9.

Security: CVE-2016-8610

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

7 years agoMFV r308191:
delphij [Wed, 2 Nov 2016 05:13:27 +0000 (05:13 +0000)]
MFV r308191:

BIND 9.9.9-P4.

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

7 years agoMerge r308143 from stable/10:
dim [Mon, 31 Oct 2016 18:45:01 +0000 (18:45 +0000)]
Merge r308143 from stable/10:

Pull in r228705 from upstream libc++ trunk (by Eric Fiselier):

  [libcxx] Fix PR 22468 - std::function<void()> does not accept
  non-void-returning functions

  Summary:
  The bug can be found here: https://llvm.org/bugs/show_bug.cgi?id=22468

  `__invoke_void_return_wrapper` is needed to properly handle calling a
  function that returns a value but where the std::function return type
  is void. Without this '-Wsystem-headers' will cause
  `function::operator()(...)` to not compile.

  Reviewers: eugenis, K-ballo, mclow.lists

  Reviewed By: mclow.lists

  Subscribers: cfe-commits

  Differential Revision: https://reviews.llvm.org/D7444

This should allow newer versions of the graphics/aseprite port to
compile without modification.

Direct commit to stable/10, since stable/11 and head already have this
change.

Reported by: yuri@rawbw.com
PR: 213773

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

7 years agoDocument EN-16:17-18, SA-16:26-32
gjb [Mon, 31 Oct 2016 16:44:31 +0000 (16:44 +0000)]
Document EN-16:17-18, SA-16:26-32

Sponsored by: The FreeBSD Foundation

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

7 years agoAdd posix_tnode to <search.h>.
ed [Sat, 29 Oct 2016 15:04:33 +0000 (15:04 +0000)]
Add posix_tnode to <search.h>.

In r307227 I've refactored the binary search tree functions to use the
posix_tnode type. As this change does not apply cleanly to this version
of FreeBSD, only make the change that matters: add the definition of the
newly introduced type.

This will ease source-level compatibility going forward.

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

7 years agoMFC r307578
davidcs [Wed, 26 Oct 2016 18:20:06 +0000 (18:20 +0000)]
MFC r307578
    1. Use taskqueue_create() instead of taskqueue_create_fast() for both
       fastpath and slowpath taskqueues.
    2. Service all transmits in taskqueue threads.
    3. additional stats counters for  keeping track of
     - bd availability
     - tx buf ring not emptied in the fp task queue.
       These are drained via timeout taskqueue.
     - tx attempts during link down.

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

7 years agoMerge r307936:
glebius [Tue, 25 Oct 2016 17:16:58 +0000 (17:16 +0000)]
Merge r307936:
  The argument validation in r296956 was not enough to close all possible
  overflows in sysarch(2).

  Submitted by: Kun Yang <kun.yang chaitin.com>
  Patch by:     kib
  Security:     SA-16:15

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

7 years agoMFC r307783:
bapt [Tue, 25 Oct 2016 14:55:03 +0000 (14:55 +0000)]
MFC r307783:

Import tzdata 2016h

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

7 years agoMFC r306790
davidcs [Mon, 17 Oct 2016 18:14:31 +0000 (18:14 +0000)]
MFC r306790
  Add support for adding up to 64 Multicast addresses with a single
  mailbox command

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

7 years agoMFC r306853
bapt [Sat, 15 Oct 2016 12:42:47 +0000 (12:42 +0000)]
MFC r306853

Import tzdata 2016g

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

7 years agoMFC r306852
bapt [Sat, 15 Oct 2016 12:38:50 +0000 (12:38 +0000)]
MFC r306852

Incorporate a change from OpenBSD by millert@OpenBSD.org

Don't warn about valid time zone abbreviations.  POSIX
through 2000 says that an abbreviation cannot start with ':', and
cannot contain ',', '-', '+', NUL, or a digit.  POSIX from 2001
on changes this rule to say that an abbreviation can contain only
'-', '+', and alphanumeric characters from the portable character
set in the current locale.  To be portable to both sets of rules,
an abbreviation must therefore use only ASCII letters."  Adapted
from tzcode2015f.

This is needed to be able to update tzdata to a newer version

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

7 years agoMFC r306478:
hselasky [Mon, 10 Oct 2016 11:48:23 +0000 (11:48 +0000)]
MFC r306478:
Add new USB ID.

While at it remove some whitespaces.

Submitted by: Jose Luis Duran <jlduran@gmail.com>
PR: 213110

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

7 years agoMFC r306451:
hselasky [Mon, 10 Oct 2016 11:36:43 +0000 (11:36 +0000)]
MFC r306451:
The IORESOURCE_XXX defines should resemble a bitmask while SYS_RES_XXX
are not bitmasks. Fix return value of pci_resource_flags() to reflect
this change.

Sponsored by: Mellanox Technologies

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

7 years agoMFC r306441 and r306634:
hselasky [Mon, 10 Oct 2016 11:27:59 +0000 (11:27 +0000)]
MFC r306441 and r306634:
While draining a timeout task prevent the taskqueue_enqueue_timeout()
function from restarting the timer.

Commonly taskqueue_enqueue_timeout() is called from within the task
function itself without any checks for teardown. Then it can happen
the timer stays active after the return of taskqueue_drain_timeout(),
because the timeout and task is drained separately.

This patch factors out the teardown flag into the timeout task itself,
allowing existing code to stay as-is instead of applying a teardown
flag to each and every of the timeout task consumers.

Add assert to taskqueue_drain_timeout() which prevents parallel
execution on the same timeout task.

Update manual page documenting the return value of
taskqueue_enqueue_timeout().

Differential Revision: https://reviews.freebsd.org/D8012
Reviewed by: kib, trasz

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

7 years agoMFC r305812:
pfg [Sun, 9 Oct 2016 19:59:20 +0000 (19:59 +0000)]
MFC r305812:

fifolog(1): invert order of calloc(3) arguments.

The second argument to calloc(3) should be the size, make it so.

While here be a little bit more cautious in fifolog_reader_open()
to protect in the unlikely event of an overflowed allocation.

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

7 years agoMFC r306522
davidcs [Thu, 6 Oct 2016 19:06:10 +0000 (19:06 +0000)]
MFC r306522
   Upgrade Firmware/Bootloader/ResetSeq/Minidump to revision 5.4.62

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

7 years agoMFC r306417: portsnap: only move expected snapshot contents from snap/ to files/
emaste [Wed, 5 Oct 2016 01:01:10 +0000 (01:01 +0000)]
MFC r306417: portsnap: only move expected snapshot contents from snap/ to files/

Previously it was possible to smuggle in addional files that would
used by later portsnap runs. Now we only move those files expected
to be in the snapshot into files/ and require that there are no
unexpected files.

This was used by portsnap attacks 2, 3, and 4 in the "non-cryptanalytic
attacks against FreeBSD update components" anonymous gist.

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

7 years agoMFH (r292408): use correct length in calloc() call
des [Mon, 3 Oct 2016 08:15:58 +0000 (08:15 +0000)]
MFH (r292408): use correct length in calloc() call

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

7 years agoMFC (part of) r298089 by pfg: Cleanup unnecessary semicolons
emaste [Thu, 29 Sep 2016 01:56:31 +0000 (01:56 +0000)]
MFC (part of) r298089 by pfg: Cleanup unnecessary semicolons

(Merged from stable/10 r306428)

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

7 years agoMFC r306075,r306109
ache [Wed, 28 Sep 2016 20:54:47 +0000 (20:54 +0000)]
MFC r306075,r306109

1) Microoptimize %p case.
2) Implememt %u for GNU compatibility.
3) Don't forget to advance buf for %w/%u.
4) Fail with incomplete week (week 0) request and no such week in the
year.
5) Fix yday formula when Sunday requested and the week started from Monday.
6) Fail with impossible yday for incomplete week (week 0) and direct %w/%u
request.
7) Shift yday/wday to the first day of the year, if incomplete week
(week 0) requested and no %w/%u used.
8) For already non-standard %z extension implement GNU compatible formats:
+hh and -hh.
9) Check for incorrect values for %z.

PR:     212983 (case 3 only)

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

7 years agoMFV r306384:
delphij [Wed, 28 Sep 2016 06:11:01 +0000 (06:11 +0000)]
MFV r306384:

BIND 9.9.9-P3.

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

7 years agoApply upstream revision 3612ff6fcec0e3d1f2a598135fe12177c0419582:
delphij [Mon, 26 Sep 2016 08:19:33 +0000 (08:19 +0000)]
Apply upstream revision 3612ff6fcec0e3d1f2a598135fe12177c0419582:

Fix overflow check in BN_bn2dec()
Fix an off by one error in the overflow check added by 07bed46
("Check for errors in BN_bn2dec()").

This fixes a regression introduced in SA-16:26.openssl.

Submitted by: jkim
PR: 212921

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

7 years agoMFC r272562,r272678,r272679
ache [Sun, 25 Sep 2016 23:05:44 +0000 (23:05 +0000)]
MFC r272562,r272678,r272679

1) Fix the case we have less arguments for format string than we expected.
2) Return error on unsupported format specs.
(both according to POSIX)
3) For %Z format, understand "UTC" name too.

PR:     93197 (only r272679)

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

7 years agoFix multiple OpenSSL vulnerabilities.
delphij [Fri, 23 Sep 2016 07:44:10 +0000 (07:44 +0000)]
Fix multiple OpenSSL vulnerabilities.

Security: FreeBSD-SA-16:26.openssl

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

7 years agoMFC bspatch Capsicumization and improvements
emaste [Fri, 23 Sep 2016 01:52:06 +0000 (01:52 +0000)]
MFC bspatch Capsicumization and improvements

r304691: bspatch: apply style(9)

Make style changes (and trivial refactoring of open calls) now in order
to reduce noise in diffs for future capsicum changes.

r304807 (allanjude): Capsicumize bspatch

Move all of the fopen() and open() calls to the top of main()

Restrict each FD to least privilege (read/seek only, write only, etc)

cap_enter(), and make all except the output FD read/seek only.

r304821: bspatch: remove output file in the case of error

r305486: bspatch: add sanity checks on sizes to avoid integer overflow

Note that this introduces an explicit 2GB limit, but this was already
implicit in variable and function argument types.

This is based on the "non-cryptanalytic attacks against freebsd
update components" anonymous gist. Further refinement is planned.

r305737: bspatch: remove superfluous newlines from errx strings

r305822: bspatch: use #define for header size instead of magic number

r306026: bspatch: Remove backwards-compatibility sys/capability.h support

bspatch previously included sys/capability.h or sys/capsicum.h based
on __FreeBSD_version, as FreeBSD is the upstream for bsdiff and we may
see this file incorporated into other third-party software.

The Capsicum header is now installed as sys/capsicum.h in stable/10 and
FreeBSD 10.3, so we can just use sys/capsicum.h and simplify the logic.

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

7 years agoMFC r264823 (ed): Make usage printing more consistent with other tools.
emaste [Thu, 22 Sep 2016 21:23:28 +0000 (21:23 +0000)]
MFC r264823 (ed): Make usage printing more consistent with other tools.

- Introduce a separate usage() function.
- Don't use argv[0]. Directly name the application, as we do elsewhere.
- Don't prepend the application name.
- Don't print two newlines.

Also apply the unnecessary semicolon cleanup from r298089

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

7 years agoMFC r305599:
kib [Thu, 22 Sep 2016 10:58:19 +0000 (10:58 +0000)]
MFC r305599:
Do not leak transient ENOLCK error from flush_newblk_dep() loop.

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

7 years agoMFC r305590:
hselasky [Thu, 15 Sep 2016 08:37:20 +0000 (08:37 +0000)]
MFC r305590:
Correctly map the USB mouse tilt delta values into buttons 5 and 6
instead of 3 and 4 which is used for the scroll wheel, according to
X.org.

PR: 170358

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

7 years agoMFC r305421:
hselasky [Mon, 12 Sep 2016 10:20:44 +0000 (10:20 +0000)]
MFC r305421:
Resolve deadlock between device_detach() and usbd_do_request_flags()
by reviving the SX control request lock and refining which lock
protects the common scratch area in "struct usb_device".

The SX control request lock was removed by r246759 because it caused a
lock order reversal with the USB enumeration lock inside
usbd_transfer_setup() as a function of r246616. It was thought that
reducing the number of locks would resolve the LOR, but because some
USB device drivers use usbd_do_request_flags() inside callback
functions, like in taskqueues, a deadlock may occur when these are
drained from device_detach(). By restoring the SX control request
lock usbd_do_request_flags() is allowed to complete its execution
when a USB device driver is detaching. By using the SX control request
lock to protect the scratch area, the LOR introduced by r246616 is
also resolved.

Bump the FreeBSD version while at it to force recompilation of all USB
kernel modules.

Found by: avos@

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

7 years agoMFC r305430:
dim [Sun, 11 Sep 2016 14:19:06 +0000 (14:19 +0000)]
MFC r305430:

Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable
way.

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

7 years agoMFC 303720: Apply the fix from r232612 to fixed function counters.
jhb [Fri, 9 Sep 2016 21:19:31 +0000 (21:19 +0000)]
MFC 303720: Apply the fix from r232612 to fixed function counters.

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

7 years agoMFC r305469:
delphij [Fri, 9 Sep 2016 07:00:50 +0000 (07:00 +0000)]
MFC r305469:

Ensure that we always open only files that is named by explicitly
using shell redirections instead of having gzip(1) to decide what
file to open.

Issue reported in the "non-cryptanalytic attacks against freebsd
update components" anonymous gist.

Reviewed by: allanjude, emaste

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

7 years agoMFC r304571:
hselasky [Fri, 9 Sep 2016 06:41:16 +0000 (06:41 +0000)]
MFC r304571:
Make the UKBD USB transfers double buffered and set them up one by one,
so they are memory independent which allows for handling panics
triggered by the keyboard driver itself, typically via CTRL+ALT+ESC
sequences. Or if the USB keyboard driver was processing a key at the
moment of panic. Allow UKBD to be attached while keyboard polling is active.

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

7 years agoMFC r305284:
hselasky [Fri, 9 Sep 2016 06:31:25 +0000 (06:31 +0000)]
MFC r305284:
Fix array size issue when using the pre-scaling feature for
ISOCHRONOUS USB transfers. Make sure enough length and buffer pointers
are allocated when setting up the libusb transfer structure to support
the maximum number of frames the kernel can handle.

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

7 years agoMFC r305389:
dim [Wed, 7 Sep 2016 19:25:08 +0000 (19:25 +0000)]
MFC r305389:

With clang 3.9.0, compiling sys/netinet/igmp.c results in the following
warning:

sys/netinet/igmp.c:546:21: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion]
        p->ipopt_list[0] = IPOPT_RA;    /* Router Alert Option */
                         ~ ^~~~~~~~
sys/netinet/ip.h:153:19: note: expanded from macro 'IPOPT_RA'
#define IPOPT_RA                148             /* router alert */
                                ^~~

This is because ipopt_list is an array of char, so IPOPT_RA is wrapped
to a negative value.  It would be nice to change ipopt_list to an array
of u_char, but it changes the signature of the public struct ipoption,
so add an explicit cast to suppress the warning.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D7777

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

7 years agoMFC r305388:
dim [Wed, 7 Sep 2016 19:21:52 +0000 (19:21 +0000)]
MFC r305388:

With clang 3.9.0, compiling uplcom results in the following warnings:

sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion]
        if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1)
            ~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~
sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE'
#define UT_READ_VENDOR_DEVICE   (UT_READ  | UT_VENDOR | UT_DEVICE)
                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

This is because UT_READ is 0x80, so the int8_t argument is wrapped to a
negative value.  Fix this by using uint8_t instead.

Reviewed by: imp, hselasky
Differential Revision: https://reviews.freebsd.org/D7776

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

7 years agoMFC r305360:
dim [Wed, 7 Sep 2016 19:17:03 +0000 (19:17 +0000)]
MFC r305360:

With clang 3.9.0, compiling cxgb results in the following warning:

sys/dev/cxgb/cxgb_sge.c:2873:44: error: implicit conversion from 'int'
to 'char' changes value from 128 to -128 [-Werror,-Wconstant-conversion]
                        *mtod(m, char *) = CPL_ASYNC_NOTIF;
                                         ~ ^~~~~~~~~~~~~~~

This is because CPL_ASYNC_NOTIF is 0x80, so the plain char argument is
wrapped to a negative value.  Fix this by using uint8_t instead.

Reviewed by: np
Differential Revision: https://reviews.freebsd.org/D7772

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

7 years agoMFC r305345:
dim [Wed, 7 Sep 2016 19:02:47 +0000 (19:02 +0000)]
MFC r305345:

With clang 3.9.0, compiling ppbus(4) results in the following warnings:

sys/dev/ppbus/ppb_1284.c:296:46: error: implicit conversion from 'int'
to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion]
if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
     ~~~~~~~~~~~~~~~~~~      ~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:785:48: error: implicit conversion from 'int'
to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
    ~~~~~~~~~~~~      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:786:29: error: implicit conversion from 'int'
to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
nACK | SELECT | PERROR | nBUSY)) {
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

This is because nBUSY is 0x80, so the plain char argument is wrapped to
a negative value.  Fix this in a minimal fashion, by using uint8_t in a
few places.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D7771

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

7 years agoMFC r305085:
dim [Wed, 7 Sep 2016 18:33:18 +0000 (18:33 +0000)]
MFC r305085:

Fix warnings in tnftp about invalid constant conversions, e.g.:

contrib/tnftp/src/ftp.c:2067:11: error: implicit conversion from 'int'
to 'char' changes value from 255 to -1 [-Werror,-Wconstant-conversion]
        buf[0] = IAC;
               ~ ^~~
/usr/include/arpa/telnet.h:39:13: note: expanded from macro 'IAC'
#define IAC     255             /* interpret as command: */
                ^~~
contrib/tnftp/src/ftp.c:2068:11: error: implicit conversion from 'int'
to 'char' changes value from 244 to -12 [-Werror,-Wconstant-conversion]
        buf[1] = IP;
               ~ ^~
/usr/include/arpa/telnet.h:50:12: note: expanded from macro 'IP'
#define IP      244             /* interrupt process--permanently */
                ^~~

Use an unsigned char buffer instead.

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

7 years agoMFC r305077:
dim [Wed, 7 Sep 2016 18:22:08 +0000 (18:22 +0000)]
MFC r305077:

Squelch clang 3.9.0 warnings about BASE (which is 32768) being converted
to -32768 when it is used as an argument to mp_itom(), in both libtelnet
and newkey.  This code has been wrong since r26238 (!), so after almost
20 years it is rather useless to try to correct it.

MFC r305086:

Fix warnings in telnet about invalid constant conversions, e.g.:

contrib/telnet/telnet/commands.c:2914:13: error: implicit conversion
from 'int' to 'char' changes value from 137 to -119
[-Werror,-Wconstant-conversion]
*lsrp++ = IPOPT_SSRR;
~ ^~~~~~~~~~
/usr/include/netinet/ip.h:152:21: note: expanded from macro 'IPOPT_SSRR'
#define IPOPT_SSRR              137             /* strict source route */
^~~
contrib/telnet/telnet/commands.c:2916:13: error: implicit conversion
from 'int' to 'char' changes value from 131 to -125
[-Werror,-Wconstant-conversion]
*lsrp++ = IPOPT_LSRR;
~ ^~~~~~~~~~
/usr/include/netinet/ip.h:148:21: note: expanded from macro 'IPOPT_LSRR'
#define IPOPT_LSRR              131             /* loose source route */
^~~

Use unsigned char buffers instead.

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

7 years agoMFC 304249
davidcs [Tue, 6 Sep 2016 20:55:59 +0000 (20:55 +0000)]
MFC 304249
      Add support for set/get cam search mode

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

7 years agoMFC r394247
davidcs [Tue, 6 Sep 2016 20:53:23 +0000 (20:53 +0000)]
MFC r394247
      Upgrade fw, bootloader and minidump template to version 5.4.58
      Add minidump retrieval code

MFC r394248
      Add ql_minidump.h

Added CFLAGS +=-fms-extensions in qlxgbe/Makefile

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

7 years agoMFC r303799, r303800:
pfg [Tue, 6 Sep 2016 19:54:52 +0000 (19:54 +0000)]
MFC r303799, r303800:
ext2fs: Add defines for some missing ext4 features and inode flags.

These are currently unused in our implementation and some even appear to
have not been implemented yet on linux but it is good to keep them for
reference.

Obtained from: NetBSD

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

7 years agofix r305459: stdint.h has to be included for uintmax_t
avg [Tue, 6 Sep 2016 08:14:56 +0000 (08:14 +0000)]
fix r305459: stdint.h has to be included for uintmax_t

Apparently on other branches the type is visible via indirect
inclusions.

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

7 years agoMFC r304674: intpm: add support for SB800
avg [Tue, 6 Sep 2016 06:26:24 +0000 (06:26 +0000)]
MFC r304674: intpm: add support for SB800

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

7 years agoMFC r303738: report sector size and number of sectors in lsdev output
avg [Tue, 6 Sep 2016 06:13:52 +0000 (06:13 +0000)]
MFC r303738: report sector size and number of sectors in lsdev output
for bios disks

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

7 years agoMFC r305365
ache [Tue, 6 Sep 2016 00:53:20 +0000 (00:53 +0000)]
MFC r305365

The bug:
$ echo x | awk '/[[:cntrl:]]/'
x

The NUL character in cntrl class truncates the pattern, and an empty
pattern matches anything. The patch skips NUL as a quick fix.

PR:     195792
Submitted by:   kdrakehp@zoho.com
Approved by:    bwk@cs.princeton.edu (the author)

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

7 years agoMFC r305269: cron: use existing maximum username constant MAXLOGNAME
emaste [Mon, 5 Sep 2016 17:56:52 +0000 (17:56 +0000)]
MFC r305269: cron: use existing maximum username constant MAXLOGNAME

Previously cron had its own maximum username length limit, which was
smaller than the system's MAXLOGNAME. This could lead to crontab -u
updating the wrong user's crontab (if the name was truncated, and
matched another user).

PR: 212305
Reported by: Andrii Kuzik

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

7 years agoMFstable/10 r305233:
ngie [Thu, 1 Sep 2016 19:36:39 +0000 (19:36 +0000)]
MFstable/10 r305233:

MFstable/11 r305225:

MFC r303573:

Cast result from third parameter to int instead of promoting it to size_t

This resolves a -Wformat issue when the value is used as a format width
precision specifier, i.e. %*s

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

7 years agoMFstable/10 r305229:
ngie [Thu, 1 Sep 2016 19:11:50 +0000 (19:11 +0000)]
MFstable/10 r305229:

MFstable/11 r304949,r305226:

r304949:

MFC r303830,r304693,r304694,r304698:

r303830:

Remove vestigal references to __alpha__

Replace alpha reference in getconf(1) with amd64 [*]

PR:   211300 [*]

r304693:

Clean up trailing whitespace

r304694:

Add `MIN_HOLE_SIZE` pathconf(2) support to getconf

This allows shell programs to programmatically determine whether
or not a filesystem supports sparse files

r304698:

Add support for _PC_ACL_NFS4 as TRUSTEDBSD_ACL_NFS4

The TRUSTEDBSD prefix was chosen for consistency with the other
related `_PC_ACL*` prefixed variables.

r305226:

MFC r304809:

Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs

It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
"_PC_ACL_NFS4".

Relnotes: yes

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

7 years agoMFC r304629:
hselasky [Mon, 29 Aug 2016 08:54:31 +0000 (08:54 +0000)]
MFC r304629:
Don't separate the status stage of the XHCI USB control transfers into
its own job because this breaks the simplified QEMU XHCI TRB parser,
which expects the complete USB control transfer as a series of back to
back TRBs. The old behaviour is kept under #ifdef in case this change
breaks enumeration of any USB devices.

PR: 212021

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

7 years agoMFC r304597:
hselasky [Mon, 29 Aug 2016 08:44:35 +0000 (08:44 +0000)]
MFC r304597:
Fix for invalid use of bits in input context. Basically split
configuring of EP0 and non-EP0 into xhci_cmd_evaluate_ctx() and
xhci_cmd_configure_ep() respectivly. This resolves some errors when
using XHCI under QEMU and gets is more in line with the XHCI
specification.

PR: 212021

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

7 years agoMFstable/10 r304982:
ngie [Mon, 29 Aug 2016 07:46:23 +0000 (07:46 +0000)]
MFstable/10 r304982:

MFstable/11 r304945:

MFC r304034:

Initialize `ai` to NULL and test for `ai` with type-appropriate values

Depending on the address family and ai_flags containing AI_V4MAPPED,
it might not do a proper DNS lookup on the provided DNS address

Convert some `ai` boolean true/false checks to NULL/non-NULL while here.

PR: 211790

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

7 years agoMFC r304779, r304780, r304781, r304782, r304802
cy [Sat, 27 Aug 2016 02:53:21 +0000 (02:53 +0000)]
MFC r304779, r304780, r304781, r304782, r304802

r304779:

  Revert r298887 (spelling fix) and remove $FreeBSD$ because text changes
  to leap-seconds invaldidates validation hash at the end of the file.

  Remove svn:keywords and replace with fbsd:nokeywords=yes to
  support this change.

r304780:

  Change the algorithm by which /var/db/leap-seconds is updated.

  1. Use the leap-seconds version number (update time) to determine
     whether to update the file or not.

  2. If the version numbers of the files is the same, use the later
     expiry date to determine which file to use.

  Suggested by: ian@

r304781:

  Add logic to replace the working ntp leap-seconds file in /var/db
  if it contains a $FreeBSD$ header. The header will cause the file
  to fail checksum of the hash causing ntpd to ignore the file.

r304782:

  Make validation of the leap-seconds file unconditional.

r304802:

  Remove the gratuitous check for $FreeBSD$ and rename the function
  to ntpd_init_leapfile, to ensure a copy exists in /var/db if a copy
  isn't already there.

  Reported by: ache@

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

7 years agoMFC r304721:
cy [Sat, 27 Aug 2016 02:27:29 +0000 (02:27 +0000)]
MFC r304721:

Fixup man page formatting.

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
Discussed with: bjk@

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

7 years agoMFC r304342:
hselasky [Fri, 26 Aug 2016 12:08:27 +0000 (12:08 +0000)]
MFC r304342:
Add support for setting blocking and non-blocking mode on /dev/rdma_cm
by returning success on FIONBIO and FIOASYNC IOCTLs. The actual flags
handling is done by the kern_ioctl() function.

Reported by: Alex Bowden <alex.bowden@outlook.com>
Sponsored by: Mellanox Technologies

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

7 years agoMFC r304232:
kib [Tue, 23 Aug 2016 08:13:08 +0000 (08:13 +0000)]
MFC r304232:
In UFS_BALLOC(), invalidate pages of indirect buffers on failed block
allocation unwinding.

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

7 years agoremove stray mergeinfo from sys/dev
avg [Tue, 23 Aug 2016 07:07:47 +0000 (07:07 +0000)]
remove stray mergeinfo from sys/dev

This is a direct commit.

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

7 years agoMFC r304521: JMicron JMB361 has only a single SATA port
avg [Tue, 23 Aug 2016 07:06:46 +0000 (07:06 +0000)]
MFC r304521: JMicron JMB361 has only a single SATA port

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

7 years agoMFC 302379: Correct locking annotation for p_comm.
jhb [Mon, 22 Aug 2016 18:12:24 +0000 (18:12 +0000)]
MFC 302379: Correct locking annotation for p_comm.

p_comm is changed during exec, it is not read-only after fork.

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

7 years agoMFC 304476: Fix various nits in the aio operation manpages.
jhb [Mon, 22 Aug 2016 17:52:10 +0000 (17:52 +0000)]
MFC 304476: Fix various nits in the aio operation manpages.

- Avoid double use of "request" in a single sentence.  Instead, describe
  aio_sigevent as being used to request notification of the associated
  operation's completion.  This matches the language used to describe
  aio_sigevent in aio(4).
- Simplify the prohibition on modifying buffers while requests are in
  flight.
- Fix case mismatch.
- Drop note about not using stack variables. C programmers should be able
  to figure out if a stack variable is safe based on the later warning
  about the life cycle requirements of control blocks.
- Remove prohibition on modifying the I/O buffer for aio_fsync() since
  it does not use an I/O buffer.  For aio_mlock(), prohibit modifications
  to the mapping (e.g. due to mprotect, munmap, mmap, etc.) but do not
  prohibit modifications to the memory backing the buffer (stores into
  the pages backing the buffer).

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

7 years agoMFC r303147
pfg [Sat, 20 Aug 2016 02:21:45 +0000 (02:21 +0000)]
MFC r303147
binutils: fix "Bad value" error in bfd for MIPS when using -Bsymbolic.

From OpenBSD's log:

Inspired by https://sourceware.org/ml/binutils/2010-08/msg00333.html,
but expressed differently so there are no GPLv3 issues.

Obtained from: OpenBSD (CVS rev. 1.7)

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

7 years agoMFC 298950: Fix an off by one error when remapping MSI-X vectors.
jhb [Sat, 20 Aug 2016 00:22:39 +0000 (00:22 +0000)]
MFC 298950: Fix an off by one error when remapping MSI-X vectors.

pci_remap_msix() can be used to alter the mapping of allocated
MSI-X vectors to the MSI-X table.  The code had an off by one error
when adding the IRQ resources after performing a remap.  This was
fatal for any vectors in the table that used the "last" valid IRQ as
those vectors were assigned a garbage IRQ value.

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

7 years agoMFC r304152:
kp [Fri, 19 Aug 2016 13:39:36 +0000 (13:39 +0000)]
MFC r304152:

pf: Add missing byte-order swap to pf_match_addr_range

Without this, rules using address ranges (e.g. "10.1.1.1 - 10.1.1.5") did not
match addresses correctly on little-endian systems.

PR:       211796
Obtained from:    OpenBSD (sthen)

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

7 years agoMFstable/10 r304210:
ngie [Tue, 16 Aug 2016 08:48:41 +0000 (08:48 +0000)]
MFstable/10 r304210:

MFstable/11 r304208:

MFC r303830:

Remove vestigal references to __alpha__

Replace alpha reference in getconf(1) with amd64 [*]

PR:   211300 [*]

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

7 years agoRevert r304120: MFC r302839: 6940 Cannot unlink directories when over quota
avg [Mon, 15 Aug 2016 09:27:15 +0000 (09:27 +0000)]
Revert r304120: MFC r302839: 6940 Cannot unlink directories when over quota

There is no dmu_tx_mark_netfree() function in this branch.

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

7 years agoMFC r302835: fix-up for configuration of AMD Family 10h processors
avg [Mon, 15 Aug 2016 09:06:33 +0000 (09:06 +0000)]
MFC r302835: fix-up for configuration of AMD Family 10h processors
borrowed from Linux

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

7 years agoMFC r303765:
hselasky [Mon, 15 Aug 2016 09:03:05 +0000 (09:03 +0000)]
MFC r303765:
Keep a reference count on USB keyboard polling to allow recursive
cngrab() during a panic for example, similar to what the AT-keyboard
driver is doing.

Found by: Bruce Evans <brde@optusnet.com.au>

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

7 years agoMFC r302840: 6878 Add scrub completion info to "zpool history"
avg [Mon, 15 Aug 2016 09:01:30 +0000 (09:01 +0000)]
MFC r302840: 6878 Add scrub completion info to "zpool history"

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

7 years agoMFC r302839: 6940 Cannot unlink directories when over quota
avg [Mon, 15 Aug 2016 08:53:24 +0000 (08:53 +0000)]
MFC r302839: 6940 Cannot unlink directories when over quota

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

7 years agoMFC r303086: 7164 zdb should be able to open the root dataset
avg [Mon, 15 Aug 2016 08:49:31 +0000 (08:49 +0000)]
MFC r303086: 7164 zdb should be able to open the root dataset

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

7 years agoMFC r303084: 6391 Override default SPA config location via environment
avg [Mon, 15 Aug 2016 08:44:22 +0000 (08:44 +0000)]
MFC r303084: 6391 Override default SPA config location via environment

Note that there was a merge conflict because of an unmerged earlier
change.

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

7 years agoMFC r303806:
cy [Sat, 13 Aug 2016 01:34:35 +0000 (01:34 +0000)]
MFC r303806:

Add Logitech Unifying receiver.

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

7 years agoMFC r302371:
hselasky [Fri, 12 Aug 2016 08:07:19 +0000 (08:07 +0000)]
MFC r302371:
Fix regression issue with XHCI on 32-bit ARMv7 Armada-38x. Make sure
"struct xhci_dev_ctx_addr" fits into a single 4K page until further.

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

7 years agoMFC r301039:
hselasky [Fri, 12 Aug 2016 07:59:06 +0000 (07:59 +0000)]
MFC r301039:
Add support for simplex USB MIDI devices, which only provide BULK or
INTERRUPT endpoints for moving data in one direction, like the KeyRig
49 from M-Audio.

Requested by: Ivan Klymenko <fidaj@ukr.net>

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

7 years agoMFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.
jhb [Tue, 9 Aug 2016 18:59:16 +0000 (18:59 +0000)]
MFC 303503: Don't treat NOCPU as a valid CPU to CPU_ISSET.

If a thread is created bound to a cpuset it might already be bound before
its very first timeslice, and td_lastcpu will be NOCPU in that case.

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

7 years agoMFC r228395 (by ed):
dim [Tue, 9 Aug 2016 18:53:57 +0000 (18:53 +0000)]
MFC r228395 (by ed):

Add missing "static const" to long options table.

This table is only used in this C file and passed to getopt_long(), so
we can safely add static and const to it.

MFC r241737 (by ed):

More -Wmissing-variable-declarations fixes.

MFC r270132 (by gabor):

- Do not look for more matching lines if -L is specified

Submitted by:   eadler (based on)

MFC r296799 (by ian):

Fix a bug in bsdgrep that caused the program to hang in a tight loop for
some combinations of command line options and search patterns.  The code was
examining regexec flags looking for a regcomp flag value.  The fix is to
look in the struct field where the decoded regcomp flag was stored when the
regex was compiled.

With this fix, it's possible to build WITHOUT_GNU_GREP_COMPAT and
WITH_BSDGREP and have a usable GPL-free grep (which of course lacks gnugrep
extensions).  It now passes the kyua tests except for one test that requires
the -z/--null-data gnu extension, and one test involving outputting context
lines across multiple files which appears to sometimes output an extra
delimiter line ("--") between matches (a rather obscure failure of a rather
obscure feature, so bsdgrep should be generally usable now).

MFC r303676:

Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
or "+" (these are invalid, because there is no preceding operand).

When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
invalid ? or + operators, some later logic in tre_compile_fast() goes
beyond the end of the buffer, leading to a crash.

Fix this by bailing out, and reporting a bad pattern instead.

Reported by: Steve Kargl

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

7 years agoDocument missing ENs and SAs.
gjb [Mon, 8 Aug 2016 23:18:27 +0000 (23:18 +0000)]
Document missing ENs and SAs.

Reviewed by: brd
Sponsored by: The FreeBSD Foundation

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

7 years agoMFC 303076,303225: Use MTX_SYSINIT for the VESA lock.
jhb [Sat, 6 Aug 2016 23:53:33 +0000 (23:53 +0000)]
MFC 303076,303225: Use MTX_SYSINIT for the VESA lock.

303076:
vesa: fix panic on suspend

Fix the following panic seen when migrating a FreeBSD guest on Xen:

panic: mtx_lock() of destroyed mutex @ /usr/src/sys/dev/fb/vesa.c:541
cpuid = 0
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe001d2fa4f0
vpanic() at vpanic+0x182/frame 0xfffffe001d2fa570
kassert_panic() at kassert_panic+0x126/frame 0xfffffe001d2fa5e0
__mtx_lock_flags() at __mtx_lock_flags+0x15b/frame 0xfffffe001d2fa630
vesa_bios_save_restore() at vesa_bios_save_restore+0x78/frame 0xfffffe001d2fa680
vga_suspend() at vga_suspend+0xa3/frame 0xfffffe001d2fa6b0
isavga_suspend() at isavga_suspend+0x1d/frame 0xfffffe001d2fa6d0
bus_generic_suspend_child() at bus_generic_suspend_child+0x44/frame
[...]

This is caused because vga_sub_configure (which is called if the VGA adapter
is attached after VESA tried to initialize), points to vesa_configure, which
doesn't initialize the VESA mutex. In order to fix it, make sure
vga_sub_configure points to vesa_load, so that all the needed vesa
components are properly initialized.

303225:
Use MTX_SYSINIT for the VESA lock.

vesa_init_done isn't a reliable guard for the mutex init.  If
vesa_configure() doesn't find valid VESA info it will not set
vesa_init_done, but the lock will remain initialized.  Revert r303076
and use MTX_SYSINIT to deterministically init the lock.

PR: 209203

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