]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
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

7 years agoMFC 302181: Add a tunable to disable migration of MSI-X interrupts.
jhb [Fri, 5 Aug 2016 17:14:45 +0000 (17:14 +0000)]
MFC 302181: Add a tunable to disable migration of MSI-X interrupts.

The new 'machdep.disable_msix_migration' tunable can be set to 1 to
disable migration of MSI-X interrupts.

Xen versions prior to 4.6.0 do not properly handle updates to MSI-X
table entries after the initial write.  In particular, the operation
to unmask a table entry after updating it during migration is not
propagated to the "real" table for passthrough devices causing the
interrupt to remain masked.  At least some systems in EC2 are
affected by this bug when using SRIOV.  The tunable can be set in
loader.conf as a workaround.

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

7 years agoMFstable/10 r303692:
ngie [Wed, 3 Aug 2016 01:26:02 +0000 (01:26 +0000)]
MFstable/10 r303692:

MFstable/11 r303691:

MFC r302550,r302551,r302552,r302553:

r302550:

Deobfuscate cleanup path in clnt_dg_create(..)

Similar to r300836 and r301800, cl and cu will always be non-NULL as they're
allocated using the mem_alloc routines, which always use
`malloc(..., M_WAITOK)`.

Deobfuscating the cleanup path fixes a leak where if cl was NULL and
cu was not, cu would not be free'd, and also removes a duplicate test for
cl not being NULL.

CID: 10070331007344

r302551:

Deobfuscate cleanup path in clnt_vc_create(..)

Similar to r300836, r301800, and r302550, cl and ct will always
be non-NULL as they're allocated using the mem_alloc routines,
which always use `malloc(..., M_WAITOK)`.

CID: 1007342

r302552:

Convert `svc_xprt_alloc(..)` and `svc_xprt_free(..)`'s prototypes to
ANSI C style prototypes

r302553:

Don't test for xpt not being NULL before calling svc_xprt_free(..)

svc_xprt_alloc(..) will always return initialized memory as it uses
mem_alloc(..) under the covers, which uses malloc(.., M_WAITOK, ..).

CID: 1007341

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

7 years agoMFC r301710:
markj [Tue, 2 Aug 2016 21:17:59 +0000 (21:17 +0000)]
MFC r301710:
Fix an infinite loop in setnetgrent(3) with NIS netgroups.

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

7 years agoMFC r303160.
cy [Wed, 27 Jul 2016 19:41:07 +0000 (19:41 +0000)]
MFC r303160.

Update leap-seconds to leap-seconds.3676752000.

As per https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16:

                                  UTC TIME STEP
                            on the 1st of January 2017

 A positive leap second will be introduced at the end of December 2016.
 The sequence of dates of the UTC second markers will be:

                          2016 December 31, 23h 59m 59s
                          2016 December 31, 23h 59m 60s
                          2017 January   1,  0h  0m  0s

 The difference between UTC and the International Atomic Time TAI is:

  from 2015 July 1, 0h UTC, to 2017 January 1 0h UTC   : UTC-TAI = - 36s
  from 2017 January 1, 0h UTC, until further notice    : UTC-TAI = - 37s

Obtained from: ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.3676752000
See also: https://www.iers.org/SharedDocs/News/EN/BulletinC.html
https://datacenter.iers.org/web/guest/eop/-/somos/5Rgv/latest/16

Relnotes: yes

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

7 years agoMFC 303109: Update crashinfo to work with newer gdb from ports.
jhb [Wed, 27 Jul 2016 17:55:40 +0000 (17:55 +0000)]
MFC 303109: Update crashinfo to work with newer gdb from ports.

If gdb from ports is installed, use it instead of the base system gdb
to extract variables from a kernel.  Note that base gdb and ports gdb
do not support the same options for invoking a single command in batch
mode, so a wrapper shell function is used.  In addition, prefer kgdb
from ports when generating a backtrace if present.

PR: 193335

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

7 years agoMFC 302899: Add documentation for the sigevent structure.
jhb [Mon, 25 Jul 2016 23:38:14 +0000 (23:38 +0000)]
MFC 302899: Add documentation for the sigevent structure.

- Add a sigevent(3) manpage to give a general overview of the sigevent
  structure and the available notification mechanisms.
- Document that AIO requests contain a nested sigevent structure that can
  be used to request completion notification.
- Expand the sigevent details in other manuals to note details such as
  the extra values stored in a queued signal's information or in a posted
  kevent.

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

7 years agoMFC 302861: Fix rendering issues.
jhb [Mon, 25 Jul 2016 19:18:42 +0000 (19:18 +0000)]
MFC 302861: Fix rendering issues.

- Use Ta to separate column headers.
- Correct width of the 'Code' column in the last table.

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

7 years agoMFC r302911:
pfg [Mon, 25 Jul 2016 15:05:01 +0000 (15:05 +0000)]
MFC r302911:
mail(1): Avoid closing negative file descriptors.

CID: 10081051008106

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

7 years agoFix bspatch heap overflow vulnerability.
delphij [Mon, 25 Jul 2016 14:53:04 +0000 (14:53 +0000)]
Fix bspatch heap overflow vulnerability.

Obtained from: Chromium
Reported by: Lu Tung-Pin
Security: FreeBSD-SA-16:25.bspatch

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

7 years agoMFC r302221,302222:
delphij [Mon, 25 Jul 2016 05:33:19 +0000 (05:33 +0000)]
MFC r302221,302222:

MFV r302218: file 5.28.

Relnotes: yes

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

7 years agoMFC r302542:
delphij [Mon, 25 Jul 2016 00:46:45 +0000 (00:46 +0000)]
MFC r302542:

Use _PATH_DEVNULL instead of hardcoding.

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

7 years agoMFC 302175:
jhb [Sun, 24 Jul 2016 05:24:10 +0000 (05:24 +0000)]
MFC 302175:
Add pci_get_max_payload() to fetch the PCI-express maximum payload size.

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

7 years agoMFC 300253: Remove dangling references to rman_await_resource().
jhb [Sun, 24 Jul 2016 04:38:50 +0000 (04:38 +0000)]
MFC 300253: Remove dangling references to rman_await_resource().

This function was removed when RF_TIMESHARE was removed a couple of years
ago.

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

7 years agoMFC 299977: Use polling spin loops for timeouts during early boot.
jhb [Sat, 23 Jul 2016 22:50:59 +0000 (22:50 +0000)]
MFC 299977: Use polling spin loops for timeouts during early boot.

Some ACPI operations such as mutex acquires and event waits accept a
timeout.  The ACPI OSD layer implements these timeouts by using regular
sleep timeouts.  However, this doesn't work during early boot before
event timers are setup.  Instead, use polling combined with DELAY()
to spin.

This fixes booting on upcoming Intel systems with Kaby Lake processors.

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

7 years agoFix build.
kib [Sat, 23 Jul 2016 11:26:24 +0000 (11:26 +0000)]
Fix build.

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

7 years agoMFC r302936:
kib [Sat, 23 Jul 2016 08:06:50 +0000 (08:06 +0000)]
MFC r302936:
Explicitely check for the valid range of file descriptor values.

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

7 years agoMFC r302772: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of
avg [Mon, 18 Jul 2016 06:47:08 +0000 (06:47 +0000)]
MFC r302772: re-apply r299908: zfsctl_snapdir_lookup: clear VV_ROOT of
snapshot's root

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

7 years agoMFC r302573:
kib [Mon, 18 Jul 2016 04:36:18 +0000 (04:36 +0000)]
MFC r302573:
Fill tf_trapno for trap frames created for syscall.

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

7 years agoMFC r302511, r302771, r302845:
pfg [Sun, 17 Jul 2016 18:33:17 +0000 (18:33 +0000)]
MFC r302511, r302771, r302845:
mail(1): check for out of memory conditions when calling calloc(3).

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

7 years agoMFC r302507:
markj [Fri, 15 Jul 2016 19:14:28 +0000 (19:14 +0000)]
MFC r302507:
Avoid truncating the return value of DTrace predicates.

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

7 years agoMFC r302476:
pfg [Wed, 13 Jul 2016 16:24:02 +0000 (16:24 +0000)]
MFC r302476:
ng_mppc(4): basic readability cleanups.

No functional change.

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

7 years agoMFC r286710: 6093 zfsctl_shares_lookup should only VN_RELE() on
avg [Wed, 13 Jul 2016 11:58:21 +0000 (11:58 +0000)]
MFC r286710: 6093 zfsctl_shares_lookup should only VN_RELE() on
zfs_zget() success

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

7 years agoMFC r300145: add vop_print methods to vnode operatios of various zfsctl
avg [Wed, 13 Jul 2016 11:18:37 +0000 (11:18 +0000)]
MFC r300145: add vop_print methods to vnode operatios of various zfsctl
node types

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

7 years agoMFC r300134: move zfsctl_freebsd_root_lookup right next to
avg [Wed, 13 Jul 2016 11:16:12 +0000 (11:16 +0000)]
MFC r300134: move zfsctl_freebsd_root_lookup right next to
zfsctl_root_lookup

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

7 years agoMFC r300130: zfsctl_freebsd_root_lookup: gfs_vop_lookup may return a
avg [Wed, 13 Jul 2016 11:08:50 +0000 (11:08 +0000)]
MFC r300130: zfsctl_freebsd_root_lookup: gfs_vop_lookup may return a
doomed vnode

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

7 years agoMFC r299951: do not destroy 'snapdir' when it becomes inactive
avg [Wed, 13 Jul 2016 11:04:21 +0000 (11:04 +0000)]
MFC r299951: do not destroy 'snapdir' when it becomes  inactive

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

7 years agoMFC r299949: try to recycle "snap" vnodes as soon as possible
avg [Wed, 13 Jul 2016 11:00:44 +0000 (11:00 +0000)]
MFC r299949: try to recycle "snap" vnodes as soon as possible

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

7 years agoPartial MFC r273641: use FreeBSD reclaim for illumos inactive
avg [Wed, 13 Jul 2016 10:58:52 +0000 (10:58 +0000)]
Partial MFC r273641: use FreeBSD reclaim for illumos inactive

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

7 years agofix a mismerge in r302751
avg [Wed, 13 Jul 2016 10:49:32 +0000 (10:49 +0000)]
fix a mismerge in r302751

This is a direct commit.

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

7 years agoMFC r299947: fix locking in zfsctl_root_lookup
avg [Wed, 13 Jul 2016 10:30:32 +0000 (10:30 +0000)]
MFC r299947: fix locking in zfsctl_root_lookup

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

7 years agorevert r302753 because of incorrect commit message
avg [Wed, 13 Jul 2016 10:26:38 +0000 (10:26 +0000)]
revert r302753 because of incorrect commit message

The change was MFC of r299947

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

7 years agoMFC r299946: gfs_lookup_dot() does not have to acquire any locks
avg [Wed, 13 Jul 2016 10:18:29 +0000 (10:18 +0000)]
MFC r299946: gfs_lookup_dot() does not have to acquire any locks

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

7 years agoMFC r299946: gfs_lookup_dot() does not have to acquire any locks
avg [Wed, 13 Jul 2016 10:14:36 +0000 (10:14 +0000)]
MFC r299946: gfs_lookup_dot() does not have to acquire any locks

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

7 years agoMFC r299945: avoid deadlock between zfsctl_snapdir_lookup and
avg [Wed, 13 Jul 2016 10:11:57 +0000 (10:11 +0000)]
MFC r299945: avoid deadlock between zfsctl_snapdir_lookup and
zfsctl_snapshot_reclaim

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

7 years agoMFC r299940: fix a vnode reference leak caused by illumos compat traverse()
avg [Wed, 13 Jul 2016 10:10:21 +0000 (10:10 +0000)]
MFC r299940: fix a vnode reference leak caused by illumos compat traverse()

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

7 years agoMFC r299914: zfsctl_ops_snapshot: remove methods should never be called
avg [Wed, 13 Jul 2016 10:06:17 +0000 (10:06 +0000)]
MFC r299914: zfsctl_ops_snapshot: remove methods should never be called

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

7 years agoMFC r301273: zfs_root: fix a potential root vnode reference leak
avg [Wed, 13 Jul 2016 09:50:17 +0000 (09:50 +0000)]
MFC r301273: zfs_root: fix a potential root vnode reference leak

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

7 years agoMFC r299908,300131,301275: zfs: set VROOT / VV_ROOT consistently and in
avg [Wed, 13 Jul 2016 09:48:04 +0000 (09:48 +0000)]
MFC r299908,300131,301275: zfs: set VROOT / VV_ROOT consistently and in
a single place

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

7 years agoMFC r299902,299938: mount_snapshot: consolidate all error handling
avg [Wed, 13 Jul 2016 09:41:04 +0000 (09:41 +0000)]
MFC r299902,299938: mount_snapshot: consolidate all error handling

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

7 years agoMFC r299906,301870: add zfs_vptocnp with special handling for snapshots
avg [Wed, 13 Jul 2016 09:37:50 +0000 (09:37 +0000)]
MFC r299906,301870: add zfs_vptocnp with special handling for snapshots
under .zfs

Note that the change is adjusted for the lack of LK_VNHELD in this branch.

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

7 years agoMFC r302123: fix deadlock-prone code in getzfsvfs()
avg [Wed, 13 Jul 2016 09:21:40 +0000 (09:21 +0000)]
MFC r302123: fix deadlock-prone code in getzfsvfs()

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

7 years agoMFC r299900: zfsctl: fix several problems with reference counts
avg [Wed, 13 Jul 2016 09:15:12 +0000 (09:15 +0000)]
MFC r299900: zfsctl: fix several problems with reference counts

PR: 207464

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

7 years agoMFC r298105: zfs: enable vn_io_fault support
avg [Wed, 13 Jul 2016 09:09:34 +0000 (09:09 +0000)]
MFC r298105: zfs: enable vn_io_fault support

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

7 years agoMFC r300133: zfsctl_common_fid: remove redundant assignment
avg [Wed, 13 Jul 2016 09:07:14 +0000 (09:07 +0000)]
MFC r300133: zfsctl_common_fid: remove redundant assignment

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

7 years agoMFC r300132: zfsctl: tighten assertion and remove unused definition
avg [Wed, 13 Jul 2016 09:05:27 +0000 (09:05 +0000)]
MFC r300132: zfsctl: tighten assertion and remove unused definition

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

7 years agoMFC r299913: dounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE
avg [Wed, 13 Jul 2016 09:02:14 +0000 (09:02 +0000)]
MFC r299913: dounmount: do not call mountcheckdirs() for mounts with MNT_IGNORE

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

7 years agoMFC r302534:
delphij [Mon, 11 Jul 2016 04:12:15 +0000 (04:12 +0000)]
MFC r302534:

Allow - in distribution names.  This is needed for freebsd-update to work
with 11.0+, where the debugging symbols use a new naming scheme for release
distribution files.

Errata candidate.

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

7 years agoMFstable/10 r302455:
ngie [Fri, 8 Jul 2016 21:20:09 +0000 (21:20 +0000)]
MFstable/10 r302455:

MFC r301871:

Add missing break in lock_partialfilelock(..) with NFS_RESERR

This will help ensure that the right error is trickled up when the
function is called if the lock status is NFS_RESERR

Tested with: fsx; svn info/svnversion (uses bdb locking); locktests from Bull http://nfsv4.bullopensource.org/tools/tests/locktest.php
CID: 10081611304956

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

7 years agoMFstable/10 r302453:
ngie [Fri, 8 Jul 2016 20:40:50 +0000 (20:40 +0000)]
MFstable/10 r302453:

MFC r301605:

Bounds check rpcbs_rmtcall(..) to ensure rtype is less than RPCBVERS_STAT

Not returning if rtype == RPCBVERS_STAT will cause us to overrun the inf array, as
it's defined to be exactly RPCBVERS_STAT elements in rpcb_prot.x:

> include/rpc/rpcb_prot.x:typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];

The proposed change also matches the rest of the rtype upper bound checks in the
file, so the original change was likely a typo.

CID: 1007567

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

7 years agoMFstable/10 r302444:
ngie [Fri, 8 Jul 2016 19:16:45 +0000 (19:16 +0000)]
MFstable/10 r302444:

MFC r301708:

Revert r301707

getnetent_p doesn't return NULL like getnetent does. coccinelle got confused and
I didn't verify that it worked before committing the change

Pointyhat to: ngie

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

7 years agoMFstable/10 r302442:
ngie [Fri, 8 Jul 2016 19:09:47 +0000 (19:09 +0000)]
MFstable/10 r302442:

MFC r301707:

Use NULL instead of `0` in _ht_getnetbyname(..)

- getnetent returns NULL on completion/error.
- .h_aliases is NULL terminated.

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

7 years agoMFC r302305: MFV r302260: expat 2.2.0.
delphij [Thu, 7 Jul 2016 05:04:20 +0000 (05:04 +0000)]
MFC r302305: MFV r302260: expat 2.2.0.

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

7 years agoMFC r301956, r301957, r301964, r301966, r301968, r301969, r302080,
hselasky [Wed, 29 Jun 2016 11:06:13 +0000 (11:06 +0000)]
MFC r301956, r301957, r301964, r301966, r301968, r301969, r302080,
    r302125 and r302171:

Added multiple new LibUSB v1.0 API functions.
Streams support is only available in FreeBSD 10+.
Refer to the individual commits for more details.

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

7 years agoMFC r301842:
hselasky [Wed, 29 Jun 2016 10:46:10 +0000 (10:46 +0000)]
MFC r301842:
Implement code to stop all USB endpoints before executing a USB device
reset command, alternate setting command or set configuration
command. Else LibUSB v1.0 will not re-open the endpoints which the
kernel closes and the USB application might wait infinitely for
transfers to complete.

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

7 years agoMFC r302076:
hselasky [Wed, 29 Jun 2016 10:23:19 +0000 (10:23 +0000)]
MFC r302076:
Update the definition for number of scratch pages to match the latest
version of the XHCI specification. Make sure the code can handle the
maximum number of allowed scratch pages.

Submitted by: Shichun_Ma@Dell.com

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

7 years agoMark filemon(4) as "experimental" for 9 since it has many unfixed
bdrewery [Mon, 27 Jun 2016 22:18:52 +0000 (22:18 +0000)]
Mark filemon(4) as "experimental" for 9 since it has many unfixed
stability, performance, and audit issues that have not been MFC'd.

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

7 years agoMFC r300683:
pfg [Fri, 24 Jun 2016 02:28:24 +0000 (02:28 +0000)]
MFC r300683:
libc: regexec(3) adjustment.

Change the behavior of when REG_STARTEND is combined with REG_NOTBOL.

From the original posting[1]:

"Enable the assumption that pmatch[0].rm_so is a continuation offset
to  a string and allows us to do a proper assessment of the character
in  regards to it's word position ('^' or '\<'), without risking going
into unallocated memory."

This change makes us similar to how glibc handles REG_STARTEND |
REG_NOTBOL, and is closely related to a soon-to-land fix to sed.

Special thanks to Martijn van Duren and Ingo Schwarze for working
out some consistent behaviour.

Differential Revision: https://reviews.freebsd.org/D6257
Taken from: openbsd-tech 2016-05-24 [1]  (Martijn van Duren)

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

7 years agoMFC r301549, r301550:
pfg [Tue, 21 Jun 2016 15:49:09 +0000 (15:49 +0000)]
MFC r301549, r301550:
ng_mppc(4): Bring netgraph(3) MPPC compression support.

Support for compression has been available from July 2007 but it
was never imported due to concerns with patents once held by
STAC/HiFn. The issues have clearly been resolved so bring it
in now.

Special thanks to Brett Glass for preserving the code and
pointing documentation for the expiration case.

Taken from: mav (through Brett Glass)

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

7 years agoMFC r301291:
pfg [Fri, 17 Jun 2016 02:31:18 +0000 (02:31 +0000)]
MFC r301291:
libiberty: prevent integer overflow.

Take care of very old bug leading to heap-buffer overflow by
processing certain file headers via bfd binary.

PR: 200888
Obtained from: OpenBSD

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

7 years agoMFC r301532
vangyzen [Wed, 15 Jun 2016 14:12:22 +0000 (14:12 +0000)]
MFC r301532

newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified

After going through the signal work list, during which do_sigwork()
is called and essentially does nothing because -s and -R were
specified on the command line, newsyslog will sleep for 10 seconds
as the (verbose) code says: "Pause 10 seconds to allow daemon(s)
to close log file(s)".

However, the man page verbiage for -R (and -s) seems quite clear
that this sleep() is unnecessary because the daemon was expected
to have already closed the log file before calling newsyslog.

PR: 210020
Submitted by: David A. Bright <david_a_bright@dell.com>
Sponsored by: Dell Inc.

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

7 years agoMFstable/10 r301836:
ngie [Sun, 12 Jun 2016 08:32:39 +0000 (08:32 +0000)]
MFstable/10 r301836:

MFC r300395:

Silence top(1) compiler warnings

The contrib/top code is no longer maintained upstream (last pulled 16 years
ago). The K&R-style followed by the code spews -Wimplicit-int and -Wreturn-type
warnings, amongst others. This silences 131 warnings with as little modification
as possible by adding necessary return types, definitions, headers, and header
guards, and missing header includes.

The 5 warnings that remain are due to undeclared ncurses references. I didn't
include curses.h and term.h because there are several local functions and macros
that conflict with those definitions.

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

7 years agoMFC r301584: Apply mergemaster r255428:
delphij [Sat, 11 Jun 2016 05:58:51 +0000 (05:58 +0000)]
MFC r301584: Apply mergemaster r255428:

Pass -n (do not emit comments) when saving mtree information for future
mergemaster(8) runs.

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

7 years agoMFC r301570:
pfg [Sat, 11 Jun 2016 03:59:44 +0000 (03:59 +0000)]
MFC r301570:
libsupc++: Fix typo in symbol map.

This went mostly unnoticed with the deprecation of the GNU toolchain
in tier 1 platforms. Fix it now for the rest.

PR: 169901

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

7 years agoMFstable/10 r301820:
ngie [Sat, 11 Jun 2016 01:44:27 +0000 (01:44 +0000)]
MFstable/10 r301820:

MFC r301704:

Test for strchr(3) returning NULL, not 0

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

7 years agoMFstable/10 r301818:
ngie [Sat, 11 Jun 2016 01:35:34 +0000 (01:35 +0000)]
MFstable/10 r301818:

MFC r301683:

Fix typo with description for $ipv6_cpe_wanif (upstram -> upstream)

PR: 210146

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

7 years agoMFstable/10 r301809:
ngie [Fri, 10 Jun 2016 18:22:21 +0000 (18:22 +0000)]
MFstable/10 r301809:

MFC r299513,r299515:

r299513 (by cem):

rtadvd(8): Don't use-after-free

This whole block of code as committed fully formed in r224144.  I'm not really
sure what the intent was, but it seems plausible that !persist ifis could need
other member cleanup.  Don't free the object until after we've finished
cleaning its members.

CID: 1006079

r299515 (by cem):

rtadvd(8): Fix use-after-close in cm_handler_client

cm_send() closes 'fd' on error.  In that case, bail out early without trying to
recv from or close 'fd' again.

CID: 1006078

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

7 years agoMFstable/10 r301806:
ngie [Fri, 10 Jun 2016 18:12:11 +0000 (18:12 +0000)]
MFstable/10 r301806:

MFC r299510:
r299510 (by cem):

libmp: Fix trivial buffer overrun

fgetln yields a non-NUL-terminated buffer and its length.  This routine
attempted to NUL-terminate it, but did not allocate space for the NUL.  So,
allocate space for the NUL.

CID: 1017457

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

7 years agoMFstable/10 r301803:
ngie [Fri, 10 Jun 2016 18:04:54 +0000 (18:04 +0000)]
MFstable/10 r301803:

MFC r299507:
r299507 (by cem):

rtadvd(8): Fix a typo in full msg receive logic

Check against the size of the struct, not the pointer.  Previously, a message
with a cm_len between 9 and 23 (inclusive) could cause int msglen to underflow
and read(2) to be invoked with msglen size (implicitly cast to signed),
overrunning the caller-provided buffer.

All users of cm_recv() supply a stack buffer.

On the other hand, the rtadvd control socket appears to only be writable by the
owner, who is probably root.

While here, correct some types to be size_t or ssize_t.

CID: 1008477
Security: unix socket remotes may overflow stack in rtadvd

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

7 years agoMFstable/10 r301801:
ngie [Fri, 10 Jun 2016 17:59:30 +0000 (17:59 +0000)]
MFstable/10 r301801:

MFC r300836:

Quell false positives in svc_vc_create and svc_vc_create_conn with cd and xprt

Both cd and xprt will be non-NULL after their respective malloc(9) wrappers are
called (mem_alloc and svc_xprt_alloc, which calls mem_alloc) as mem_alloc
always gets called with M_WAITOK|M_ZERO today. Thus, testing for them being
non-NULL is incorrect -- it misleads Coverity and it misleads the reader.

Remove some unnecessary NULL initializations as a follow up to help solidify
the fact that these pointers will be initialized properly in sys/rpc/.. with
the interfaces the way they are currently.

CID: 100733810073391007340

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

7 years agoMFC r301295:
cy [Fri, 10 Jun 2016 15:03:45 +0000 (15:03 +0000)]
MFC r301295:

Enable daily_ntpd_leapfile_enable by default. Otherwise an expired
leapfile will be ignored and ntpd will behave as if it has no
leapfile.

While here, remove an extraneous blank line.

Suggested by:   ache

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

7 years agoMFstable/10 r301789:
ngie [Fri, 10 Jun 2016 14:42:36 +0000 (14:42 +0000)]
MFstable/10 r301789:

MFC r299491:
r299491 (by cem):

route6d(8): Fix potential double-free

In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed
repeatedly.  It isn't clear to me that that case is possible, but be clear and
do the right thing in case it is.

CID: 272537

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

7 years agoMFstable/10 r301784:
ngie [Fri, 10 Jun 2016 14:27:56 +0000 (14:27 +0000)]
MFstable/10 r301784:

MFC r299461:
r299461 (by cem):

ffs_bswap: Copy one UFS dinode member at a time

No functional change.

CIDs: 974635, 974636, 977396, 977397, 977398, 977399

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

7 years agoMFstable/10 r301782:
ngie [Fri, 10 Jun 2016 14:10:51 +0000 (14:10 +0000)]
MFstable/10 r301782:

MFC r299460:
r299460 (by cem):

fsck_ffs: Don't overrun mount device buffer

Maybe this case is impossible.  Either way, when attempting to "/dev/"-prefix a
non-global device name, check that we do not overrun the f_mntfromname buffer.

In this case, truncating (with strlcpy or similar) would not be useful, since
the f_mntfromname result of getmntpt() is passed directly to open(2) later.

CID: 1006789

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

7 years agoMFstable/10 r301780:
ngie [Fri, 10 Jun 2016 14:06:16 +0000 (14:06 +0000)]
MFstable/10 r301780:

MFC r299387:
r299387 (by cem):

netipsec: Fix minor style nit

Coverity points out that 'continue' is equivalent to 'break' in a do {}
while(false) loop.

CID: 1354983

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

7 years agoMFC r301513:
pfg [Thu, 9 Jun 2016 16:30:27 +0000 (16:30 +0000)]
MFC r301513:
indent(1): Fix old typo.

It's typedef, not typdef.

Obtained from: NetBSD (CVS rev. 1.14)

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

7 years agoMFstable/10 r301695:
ngie [Wed, 8 Jun 2016 22:28:57 +0000 (22:28 +0000)]
MFstable/10 r301695:

MFC r300870,r300884:

r300870:

Unbreak the zfs(4) build

vm/vm_pageout.h grew a dependency on the bool typedef in r300865

arc.c didn't include sys/types.h, which included the definition for the typedef

Other items (ofed, drm2) might need to be chased for this commit.

Pointyhat to: alc

r300884:

Fix up r300870

The sys/types.h fix I proposed was only tested with zfs(4), not with
libzpool, which is where the build failure actually existed

Remove vm/vm_pageout.h from arc.c and zfs_vnops.c because they're both
unneeded

In collaboration with: kib

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

7 years agoMFstable/10 r301655:
ngie [Wed, 8 Jun 2016 19:31:12 +0000 (19:31 +0000)]
MFstable/10 r301655:

MFC r299766:

Fix logically dead code pointed out by clang/Coverity

parse_context, parse_user_security: test for validity of results from
parse_ascii(..) with by casting to int32_t and comparing to -1; comparing
unsigned types to negative values will always be false.

CID: 10114321011433

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

7 years agoMFstable/10 r301687:
ngie [Wed, 8 Jun 2016 18:47:00 +0000 (18:47 +0000)]
MFstable/10 r301687:

MFC r300624:

Fix up r300385

I accidentally glossed over the fact that tmp is manipulated via strchr, so
if we tried to free `tmp` after r300385, it would have crashed.

Create a separate pointer (tmp2) to track the original allocation of `tmp`,
and free `tmp2` if `p->nc_lookups` can't be malloced

CID: 1356026

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

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

MFC r300385:

Don't leak `tmp` if `p->nc_lookups` can't be malloced

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

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

MFC r300386:

Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new
struct xlist object fails

CID: 978277

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

7 years agoMFstable/10 r301680:
ngie [Wed, 8 Jun 2016 18:23:33 +0000 (18:23 +0000)]
MFstable/10 r301680:

MFC r300625:

Remove unnecessary memset(.., 0, ..)'s

The mem_alloc macro calls calloc (userspace) / malloc(.., M_WAITOK|M_ZERO)
under the covers, so zeroing out memory is already handled by the underlying
calls

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

7 years agoMFstable/10 r301675:
ngie [Wed, 8 Jun 2016 18:16:34 +0000 (18:16 +0000)]
MFstable/10 r301675:

MFC r300714:

The readme provides a high-level overview of how to upgrade top(1).

Reviewed By: ngie

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

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

MFC r299699:

Remove NO_WERROR from libbsnmp/Makefile.inc

This has been compiling without warnings with clang/gcc for a while now

Tested with: clang 3.8.0, gcc 4.2.x, gcc 5.x

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

7 years agoMFstable/10 r301671:
ngie [Wed, 8 Jun 2016 18:09:40 +0000 (18:09 +0000)]
MFstable/10 r301671:

MFC r299815:

Remove NO_WERROR.clang from this Makefile

This compiles with clang without warnings

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

7 years agoMFstable/10 r301669:
ngie [Wed, 8 Jun 2016 18:07:51 +0000 (18:07 +0000)]
MFstable/10 r301669:

MFC r299806:

Bump WARNS to 6

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

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