Commit Graph

218847 Commits

Author SHA1 Message Date
Andriy Voskoboinyk
3ddb14a5df sysctl(8): fix typename for uint32_t.
MFC after:	5 days.
2016-12-31 12:39:15 +00:00
Enji Cooper
560c5ef9a2 Similar to r310954, set .len to 0 on malloc failure and to len only
on success

MFC after:	1 week
2016-12-31 12:37:53 +00:00
Enji Cooper
39ebb4e1e0 Initialize ret to SNMPD_INPUT_OK at the top of snmp_input_start(..) to
avoid returning an uninitialized value

There are some really complicated, snakey if-statements combined with
switch statements that could result in an invalid value being returned
as `ret`

MFC after:	1 week
Reported by:	Coverity
CID:		1006551
2016-12-31 12:30:14 +00:00
Enji Cooper
8e02b381d3 Use strlcpy when copying com to pdu->community to avoid potential
buffer overruns

MFC after:	1 week
Reported by:	Coverity
CID:		1006823, 1006824
2016-12-31 12:18:17 +00:00
Enji Cooper
c4114bd1f5 Set value->v.octetstring.len to a correct value on malloc success/failure
The previous code always set value->v.octetstring.len to len, regardless
of the result from the malloc call. This misleads the caller on malloc
failure. Set .len to len on success and 0 on failure.

MFC after:	1 week
Reported by:	Coverity
CID:		1007590
2016-12-31 12:14:25 +00:00
Enji Cooper
a0e0e1ffa5 MIB-II: use strlcpy instead of strcpy when copying {descr,name}
This is of course to avoid buffer overruns

The remaining strcpy instance in the module needs to be audited for
correctness

MFC after:	1 week
Reported by:	Coverity
CID:		1006827, 1006828
2016-12-31 12:03:25 +00:00
Enji Cooper
02ff676c4d MIB-II: use strlcpy when copying interface names to .ifr_name
.ifra_name is assumed to be NUL terminated; using strlcpy(3)
ensures that it's indeed NUL terminated whereas strncpy does
not.

Tested and verified as follows with a combination of ifconfig,
snmpget, and snmpset:

  % ifconfig create lo1 127.0.0.2/8
  % SNMPARGS="-v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des -X bsnmptest localhost"
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 2
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: down(2)
  % snmpset $SNMPARGS IF-MIB::ifAdminStatus.4 i 1
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
  % snmpget $SNMPARGS IF-MIB::ifAdminStatus.4
  IF-MIB::ifAdminStatus.4 = INTEGER: up(1)

MFC after:	2 weeks
Reported by:	Coverity
CID:		1009652-1009656, 1349850
2016-12-31 11:50:36 +00:00
Enji Cooper
1e5211d238 Unbreak the build by passing the string to strdup, not its length
MFC after:	1 week
X-MFC with:	r310931
Pointyhat to:	ngie
2016-12-31 11:24:12 +00:00
Enji Cooper
bfb81e6524 Use strdup in snmp_parse_server(..) when possible instead of malloc+strcpy
This simplifies the code and mutes a Coverity warning about sc->cport being
improperly allocated

Reported by:	Coverity
CID:		1018247
MFC after:	1 week
2016-12-31 11:13:00 +00:00
Konstantin Belousov
6ca28febf6 Remove unused declaration.
The setconf() implementation was removed by r52778 Nov 1 1999.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-31 11:07:33 +00:00
Hiroki Sato
4909085f84 - Add static for symbols which need not to be exported.
- Clean up warnings to the WARNS=6 level.
2016-12-31 11:03:34 +00:00
Mateusz Guzik
6ff51a3685 Use vrefact in vnode_pager_alloc. 2016-12-31 10:37:56 +00:00
Enji Cooper
1b135e4f47 snmp_pdu_free the right object at the right time in snmptool_walk
r310892 was on the right track, but unfortunately it was resolving
the problem incorrectly and accidentally leaking memory in the
process.

- Call snmp_pdu_free on req before calling snmp_pdu_create on it
  at the bottom of the outer while loop
- Call snmp_pdu_free on resp after calling snmpwalk_nextpdu_create
  in the inner loop

MFC after:	12 days
X-MFC with:	r310729, r310892
Reported by:	valgrind
2016-12-31 10:01:25 +00:00
Hiroki Sato
00f6082b98 Remove extra NULL-check before free(3). 2016-12-31 09:52:00 +00:00
Enji Cooper
bcf5255764 Don't call snmp_pdu_free(..) until finished with the pdu and when ready to
allocate a new one via snmp_pdu_create(..)

This fixes bsnmpwalk, so it no longer crashes after r310729

X-MFC with:	r310729
MFC after:	12 days
2016-12-31 09:43:35 +00:00
Adrian Chadd
7c87f23e82 [net80211] add placeholders for the VHT action frame handling.
Upcoming vht support will register send/receive action handlers.
2016-12-31 07:50:14 +00:00
Hiroki Sato
34694ebe05 Replace two fat signal handlers with function calls in
the main I/O multiplex loop.  select() now watches
a pipe which is written by the new skinny signal
handlers and the received signals are handled inside
the loop sequencially.

This eliminates a complex signal mask to guarantee
async-signal safety.
2016-12-31 06:23:05 +00:00
Jung-uk Kim
a2795311af Do not remove llvm-objdump. It is installed by default since r310840. 2016-12-31 06:07:48 +00:00
Hiroki Sato
407cd97826 Retry to open an F_PIPE process when it dies unexpectedly.
Reported by:	Eugene Grosbein
PR:		215335
2016-12-31 03:07:48 +00:00
Luiz Otavio O Souza
378f3b198d Fix rcc_gpio_modify_bits(). Obviously (1 << 0) is not the same as 0.
Pointy hat to:	loos
MFC after:	3 days
2016-12-31 02:23:15 +00:00
Luiz Otavio O Souza
ab8fdacc82 Fixes the sensor initialization, always reset the digital outputs to start.
Obtained from:	pfSense
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-31 02:18:08 +00:00
Baptiste Daroussin
d630035127 Remove extra entries from the option enum
MFC after:	3 days
2016-12-30 23:46:11 +00:00
Enji Cooper
8373993535 Guard against use-after-free after calling mibif_free(..)
Set variables to NULL after calling free.

Also, remove unnecessary if (x != NULL) checks before calling free(x)

MFC after:	1 week
2016-12-30 23:44:39 +00:00
Baptiste Daroussin
d481a92572 Make sdiff --left-column work as expected
MFC after:	3 days
2016-12-30 23:41:33 +00:00
Martin Matuska
739d7cfd6d MFV r310869:
Sync libarchive with vendor.

Vendor bugfixes:
Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796)

MFC after:	2 weeks
X-MFC with:	r310866
2016-12-30 23:05:06 +00:00
Martin Matuska
36dffdb4e5 Update vendor/libarchive to git ab94a813b0f64cbc1bcb952bf55424a2d9c7f1d9
Vendor bugfixes:
Use __LA_DEPRECATED macro with functions deprecated in 379867e (r310796)
2016-12-30 23:00:00 +00:00
Martin Matuska
09c253fd1b MFV r310798:
Sync libarchive with vendor.

Vendor bugfixes (relevant to FreeBSD):
PR #843: Fix memory leak of struct archive_entry in cpio/cpio.c
PR #851: Spelling fixes
Fix two protoypes in manual page archive_read_disk.3

MFC after:	2 weeks
2016-12-30 22:54:08 +00:00
Andriy Voskoboinyk
b8ad00b0ed rtwn: add (untested) radar detection support for RTL8821AU
(disabled by default).

To enable it, dev.rtwn.%d.radar_detection tunable need to be set
to a nonzero value.

Tested with RTL8821AU, AP mode (no radar events were seen - so,
I have no idea if it is really correct / working)

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D8903
2016-12-30 22:24:01 +00:00
Martin Matuska
e9ed7ea4dc MFV r310796, r310797:
Sync libarchive with vendor.

Vendor changes (relevant to FreeBSD):
PR #771: Add NFSv4 ACL support to pax and restricted pax

NFSv4 ACL information may now be stored to and restored from tar archives.
ACL must be non-trivial and supported by the underlying filesystem, e.g.
natively by ZFS or by UFS with the NFSv4 ACL enable flag set.

MFC after:	2 weeks
Relnotes:	yes
2016-12-30 22:18:22 +00:00
Enji Cooper
2fd30e016e Fix whitespace in a comment and fixing a spelling error in a comment
MFC after:	3 days
2016-12-30 21:41:01 +00:00
Enji Cooper
cfff8d3dbd Unbreak ip_carp with WITHOUT_INET6 enabled by conditionalizing all IPv6
structs under the INET6 #ifdef. Similarly (even though it doesn't seem
to affect the build), conditionalize all IPv4 structs under the INET
#ifdef

This also unbreaks the LINT-NOINET6 tinderbox target on amd64; I have not
verified other MACHINE/TARGET pairs (e.g. armv6/arm).

MFC after:	2 weeks
X-MFC with:	r310847
Pointyhat to:	jpaetzel
Reported by:	O. Hartmann <o.hartmann@walstatt.org>
2016-12-30 21:33:01 +00:00
Piotr Pawel Stefaniak
93567e8778 indent(1): Avoid out of bounds access of array ps.paren_indents
ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents.

Approved by:	pfg (mentor)
2016-12-30 21:00:45 +00:00
Jared McNeill
c560956880 Add missing reg property to usbphy node.
MFC after:	1 week
2016-12-30 20:16:09 +00:00
Toomas Soome
ba8cf3277a loader: nandfs calls strategy with one extra argument.
The strategy argument cleanup in r310850 did miss another call to strategy(),
and left it with extra argument.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D9003
2016-12-30 20:00:41 +00:00
Toomas Soome
1ecc859193 dosfs support in libstand is broken since r298230
Apparently the libstand dosfs optimization is a bit too optimistic
and did introduce possible memory corruption.

This patch is backing out the bad part and since this results in
dosfs reading full blocks now, we can also remove extra offset argument
from dv_strategy callback.

The analysis of the issue and the backout patch is provided by Mikhail Kupchik.

PR:		214423
Submitted by:	Mikhail Kupchik
Reported by:	Mikhail Kupchik
Reviewed by:	bapt, allanjude
Approved by:	allanjude (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8644
2016-12-30 19:06:29 +00:00
Konstantin Belousov
7a432b84e8 Fix two similar bugs in the populate vm_fault() code.
If pager' populate method succeeded, but other thread raced with us
and modified vm_map, we must unbusy all pages busied by the pager,
before we retry the whole fault handling.  If pager instantiated more
pages than fit into the current map entry, we must unbusy the pages
which are clipped.

Also do some refactoring, clarify comments and use more clear local
variable names.

Reported and tested by:	kargl, subbsd@gmail.com (previous version)
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-12-30 18:55:33 +00:00
Josh Paetzel
8151740c88 Harden CARP against network loops.
If there is a loop in the network a CARP that is in MASTER state will see it's
own broadcasts, which will then cause it to assume BACKUP state.  When it
assumes BACKUP it will stop sending advertisements.  In that state it will no
longer see advertisements and will assume MASTER...

We can't catch all the cases where we are seeing our own CARP broadcast, but
we can catch the obvious case.

Submitted by:	torek
Obtained from:	FreeNAS
MFC after:	2 weeks
Sponsored by:	iXsystems
2016-12-30 18:46:21 +00:00
Olivier Houchard
8f87df16d4 Merge CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mostly
to make sure we don't use any FP instruction.
2016-12-30 18:23:58 +00:00
Toomas Soome
0a7135391e boot2 will deadlock if extended keys are used on text input
The boot2 family of bootblocks (zfsboot/gptzfsboot) are using separate
implementation if keyboard reading code, which has deadlock case when
extended key (arrows etc) are pressed.

The problem is about avoiding the noise from some systems, generating
false key events with scan code 1 and ascii code 00, so the code
does attempt to filter such cases out. Unfortunately the extended keys
also set ascii 0, and therefore the pressed key event is ignored and
the keypress is never read, resulting in infinite loop.

This update is moving the check to keyhit() function and is allowing
the rest of the code to process the extended keys.

Reviewed by:	bapt, allanjude
Approved by:	allanjude (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8608
2016-12-30 18:21:52 +00:00
Olivier Houchard
b8af8045a1 Import CK as of commit 255a47553aa5e8d0bb5f8eec63acac7f4c25a6d8, mainly
to add the option to disable double-related functions, as we don't want
them in the kernel.
2016-12-30 18:14:30 +00:00
Dimitry Andric
30d4828e63 Reapply 310775, now it also builds correctly if lldb is disabled:
Move llvm-objdump from CLANG_EXTRAS to installed by default

We currently install three tools from binutils 2.17.50: as, ld, and
objdump. Work is underway to migrate to a permissively-licensed
tool-chain, with one goal being the retirement of binutils 2.17.50.

LLVM's llvm-objdump is intended to be compatible with GNU objdump
although it is currently missing some options and may have formatting
differences. Enable it by default for testing and further investigation.
It may later be changed to install as /usr/bin/objdump, it becomes a
fully viable replacement.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D8879
2016-12-30 18:00:31 +00:00
Konstantin Belousov
0c8bd6a7d8 Assert that the pages found on the object queue by vm_page_next() and
vm_page_prev() have correct ownership.

In collaboration with:	alc
Sponsored by:	The FreeBSD Foundation (kib)
MFC after:	1 week
2016-12-30 17:37:06 +00:00
Alexander Kabaev
3abdc65497 Restore status quo: mips64 does not need subr_sfbuf.c
Reported by: br
2016-12-30 17:12:41 +00:00
Ruslan Bukin
436b590a4b Add parenthesis.
Noticed by:	hps
Sponsored by:	DARPA, AFRL
2016-12-30 16:26:54 +00:00
Ruslan Bukin
5b2e3029ff o Fix unlocking.
o Fix types for ds_addr/ds_len.

Sponsored by:	DARPA, AFRL
2016-12-30 16:06:05 +00:00
Dag-Erling Smørgrav
21ca0912c6 Fix inverted loop condition which broke multi-line responses to CONNECT.
PR:		194483
Submitted by:	Miłosz Kaniewski <milosz.kaniewski@gmail.com>
MFC after:	1 week
2016-12-30 14:54:54 +00:00
Adrian Chadd
869d88787d [netmap] fix locking regressions
* Firmware oriented NICs may need to sleep in their configuration paths.
  Use RLOCK instead of WLOCK to allow this to again occur.

  This fixes netmap on cxgbe.

* Change the worker lock to a normal mutex rather than a spin lock.
  Drivers shouldn't be doing netmap work from the fast interrupt
  handlers, so it's not required to be a spinlock.

Submitted by:	luigi, Vincenzo Maffione <v.maffione@gmail.com>
Reviewed by:	jhb
2016-12-30 14:47:46 +00:00
Konstantin Belousov
9a4ee196dd Style.
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-12-30 13:04:43 +00:00
Andrew Rybchenko
99e3d68596 sfxge(4): move queue size checks to after the NIC config has been populated
Submitted by:   Mark Spender <mspender at solarflare.com>
Reviewed by:    gnn
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D8974
2016-12-30 12:23:02 +00:00
Andrew Rybchenko
a98003dde4 sfxge(4): cleanup: add efsys_lock_state_t for type of state param in EFSYS_LOCK()
This allows the common code to use the correct type for the lock state
local variable passed to EFSYS_LOCK() and EFSYS_UNLOCK().

On Windows, this allows warning supression pragmas to be removed.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
2016-12-30 12:19:40 +00:00