Commit Graph

217975 Commits

Author SHA1 Message Date
Enji Cooper
c68f00edd6 Expect :coredump_phnum to fail
The number of program headers on my system (GENERIC-NODEBUG) don't match the
expected (hardcoded) number in the test

PR:	215019
2016-12-03 02:17:50 +00:00
Enji Cooper
cebf0ec58a Fix test coredump_phnum_test:coredump_phnum require.config specification
The requirement is set via `atf_set "require.config" "allow_sysctl_side_effects"',
not `atf_set "require.config" "allow_sysctl_side_effects"'

X-MFC with: r308177
Pointyhat to: cmeyer
2016-12-03 02:09:23 +00:00
Luiz Otavio O Souza
3c27ea76f0 Allow simultaneous access to switch device, there is no reason to prevent
it.

Remove bogus wrappers and use the kernel defaults.

While here, use DEVMETHOD_END.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-03 01:55:38 +00:00
Eric van Gyzen
ff07dd913e thr_set_name(): silently truncate the given name as needed
Instead of failing with ENAMETOOLONG, which is swallowed by
pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1
bytes.  This is more likely what the user wants, and saves the
caller from truncating it before the call (which was the only
recourse).

Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2)
so the user might find the documentation for this behavior.

Reviewed by:	jilles
MFC after:	3 days
Sponsored by:	Dell EMC
2016-12-03 01:14:21 +00:00
Pedro F. Giffuni
86bd08e9ee Document undocumented indent(1) options badp/nbadp, bs/nbs, and lc.
Submitted by:	 Piotr Stefaniak
Differential Revision:	https://reviews.freebsd.org/D8690
2016-12-03 00:24:34 +00:00
Pedro F. Giffuni
fca15474a0 ext2fs: renumber the license clauses to avoid skipping #3.
This is to keep consistency with other files, and help license-checking
utilities determine the number of clauses that apply.

No functional change.
2016-12-02 19:47:23 +00:00
Mateusz Guzik
a2d3554542 vfs: provide fake locking primitives for the crossmp vnode
Since the vnode is only expected to be shared locked, we can save a
little overhead by only pretending we are locking in the first place.

Reviewed by:	kib
Tested by:	pho
2016-12-02 18:03:15 +00:00
Pedro F. Giffuni
488f148604 indent(1): Avoid out-of-bound accesses of array ps.p_stack.
Submitted by:	 Piotr Stefaniak
2016-12-02 16:42:45 +00:00
Pedro F. Giffuni
0bae80a336 indent(1): Avoid out-of-bound accesses of arrays.
ps.paren_indents:
When ps.paren_level was 0, this was accessing paren_indents[-1].

in_buffer:
This fragment checks if "*/" was read, but there's no guarantee that there
is more than one byte in the array (actually, this happens frequently for
the "{" in things like "int main(void) {").

Submitted by:	 Piotr Stefaniak
2016-12-02 16:41:08 +00:00
Pedro F. Giffuni
df54a266d3 indent(1): Remove an extra newline added in a previous commit.
It doesn't math the remaining of the case statement.
2016-12-02 16:32:14 +00:00
Alan Cox
8804a2b030 Eliminate a stale comment; vm_radix_prealloc() was replaced in r254141.
MFC after:	3 days
2016-12-02 16:29:30 +00:00
Pedro F. Giffuni
b30bb755da indent(1): Optimize parser stack usage.
When special else-if processing is enabled (-ei), we can assume "else if"
and "if" to be equivalent for indentation purposes.
This reduction saves a lot of stack space in case of a long "if-else-if
... else-if" sequence;  with this change,
Postgres/src/bin/psql/tab-complete.c as of 9.6beta3
requires minimum of the stack length to be 31 instead of 444.

Submitted by:	 Piotr Sephaniak
2016-12-02 16:28:18 +00:00
Ryan Stone
669f39b29c Revert r309372
The bug intended to be fixed by r309372 was already addressed by r296178,
so revert my change.

Reported by:	seph
2016-12-02 15:38:34 +00:00
Warner Losh
5619c99fb3 Flag the vendor specific pages as such. This allows different decoding
for the same page number as different vendors encode vendor specific
pages differently.
2016-12-02 14:44:45 +00:00
Warner Losh
158c18ffb4 dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

Differential Revision: https://reviews.freebsd.org/D8605
2016-12-02 14:44:38 +00:00
Ed Maste
eeef183376 Retire long-broken/unused static rtld support
rtld-elf has some vestigial support for building as a static executable.
r45501 introduced a partial implementation with a prescient note that it
"might never be enabled." r153515 introduced ELF symbol versioning
support, and removed part of the unused build infrastructure for static
rtld.

GNU ld populates rela relocation addends and GOT entries with the same
values, and rtld's run-time dynamic executable check relied on this.
Alternate toolchains may not populate the GOT entries, which caused
RTLD_IS_DYNAMIC to return false. Simplify rtld by just removing the
unused check.

If we want to restore static rtld support later on we ought to introduce
a build-time #ifdef flag.

PR:		214972
Reviewed by:	kan
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8687
2016-12-02 14:23:26 +00:00
Nick Hibma
8e349925f4 Fix man page:
- It should say 'read' in the I2CREAD section.
- last in the struct indicates the last command in a sequence, not the
  reverse.

Reviewed by:	imp
MFC after:	3 days
2016-12-02 11:32:11 +00:00
Nick Hibma
a96032e552 More typos in strings.
Submitted by:	bde
MFC after:	3 days
2016-12-02 11:30:21 +00:00
Julian Elischer
426b3d047a Changes to allow the patching of packets with an offset (and other changes.. see man page)
PR:	206185
Submitted by:	Dmitry Vagin <daemon-hammer@ya.ru>
MFC after:	 1 week
Relnotes:	yes (also ng_checksum node)
2016-12-02 10:47:10 +00:00
Julian Elischer
4e0973df9c A little light wordsmithing only.
Sponsored by:	FreeBSD
2016-12-02 09:51:12 +00:00
Hans Petter Selasky
de83258d59 Remove useless NULL checks.
NULL is not returned when allocating memory passing the M_WAITOK flag.

Submitted by:		trasz @
Differential Revision:  https://reviews.freebsd.org/D5772
Sponsored by:           Mellanox Technologies
MFC after:		1 week
2016-12-02 09:41:54 +00:00
Martin Matuska
c4247af46a MFV r309403:
Sync libarchive with vendor.

Vendor bugfixes:
Fix for heap-buffer-overflow in archive_le16dec()
Fix for heap-buffer-overflow in uudecode_bidder_bid()
Reworked fix for compatibility with archives created by Perl Archive::Tar

MFC after:	1 week
2016-12-02 09:30:13 +00:00
Hans Petter Selasky
0e493ed3a5 Fix return value from ng_uncallout().
callout_stop() recently started returning -1 when the callout is already
stopped, which is not handled by the netgraph code. Properly filter
the return value. Netgraph callers only want to know if the callout
was cancelled and not draining or already stopped.

Discussed with:		julian, glebius
MFC after:		2 weeks
2016-12-02 09:29:22 +00:00
Martin Matuska
640b179f4e Update vendor/libarchive to git 53d73345410d69e68171f05facaf4523e38e72bb
Vendor bugfixes:
Fix for heap-buffer-overflow in archive_le16dec()
Fix for heap-buffer-overflow in uudecode_bidder_bid()
Reworked fix for compatibility with archives created by Perl Archive::Tar
2016-12-02 09:26:51 +00:00
Hans Petter Selasky
c6e6b4fe3b Fix for endless recursion in the ACPI GPE handler during boot.
When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by:		jhb
MFC after:		2 weeks
2016-12-02 08:21:08 +00:00
Michael Tuexen
4ddd5aadea Fix the handling of TCP FIN-segments in the CLOSED state
When a TCP segment with the FIN bit set was received in the CLOSED state,
a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the
FIN counts as one byte. This accounting was missing and is fixed by this
patch.

Reviewed by:		hiren
MFC after:		1 month
Sponsored by:		Netflix, Inc.
Differential Revision:	https://svn.freebsd.org/base/head
2016-12-02 08:02:31 +00:00
Marcel Moolenaar
d6d35f1561 Fix use-after-free bugs in pfsync(4)
Use after free happens for state that is deleted. The reference
count is what prevents the state from being freed. When the
state is dequeued, the reference count is dropped and the memory
freed. We can't dereference the next pointer or re-queue the
state.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8671
2016-12-02 06:15:59 +00:00
Marcelo Araujo
bbdfc8f1ea Use memset(3) instead of bzero(3).
Obtained from:	OpenBSD (r1.12, r1.20, r1.18 and r1.37)
2016-12-02 06:07:27 +00:00
Marcelo Araujo
5902259135 String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from:	OpenBSD (r1.34)
2016-12-02 05:49:22 +00:00
Pedro F. Giffuni
cba6bdf9bc indent(1): Do not define opchar unless it will be used.
"opchar" is only used once depending on "undef" macro being defined.
Conditionalize it in the same way.

Submitted by:	Piotr Sephaniak
2016-12-02 01:52:32 +00:00
Pedro F. Giffuni
f171328eaa indent(1): Fix indent's confusion about custom FreeBSD macros.
Teach indent(1) about storage-class specifiers. Don't assume
"in_parameter_declaration" state if "in_decl" hasn't been set. Don't set
"in_decl" for storage-class specifiers.

That set of changes helps with recognizing the difference between file
scope declarations like this:

static LIST_HEAD(, alq) ald_active;
static int ald_shuttingdown = 0;
struct thread *ald_thread;

and old style function declarators like this:

static int
do_execve(td, args, mac_p)
	struct thread *td;
	struct image_args *args;
	struct mac *mac_p;
{

Unfortunately, at the same time this change makes indent(1) require
explicit int in declarations like "static a;", in order to understand that
it's part of a declaration. On the other hand, declarations like in the
first example are no longer indented as if ald_shuttingdown and ald_thread
were parameters of a function named LIST_HEAD.

Submitted by:	 Piotr Stefaniak
2016-12-02 01:25:51 +00:00
Kenneth D. Merry
28db0a5e74 Add SCSI REPORT TIMESTAMP and SET TIMESTAMP support.
This adds support to camcontrol(8) and libcam(3) for getting and setting
the time on SCSI protocol drives.  This is more commonly found on tape
drives, but is a SPC (SCSI Primary Commands) command, and may be found
on any device that speaks SCSI.

The new camcontrol timestamp subcommand allows getting the current device
time or setting the time to the current system time or any arbitrary time.

sbin/camcontrol/Makefile:
	Add timestamp.c.

sbin/camcontrol/camcontrol.8:
	Document the new timestamp subcommand.

sbin/camcontrol/camcontrol.c:
	Add the timestamp subcommand to camcontrol.

sbin/camcontrol/camcontrol.h:
	Add the timestamp() function prototype.

sbin/camcontrol/timestamp.c:
	Timestamp setting and reporting functionality.

sys/cam/scsi/scsi_all.c:
	Add two new CCB building functions, scsi_set_timestamp() and
	scsi_report_timestamp().  Also, add a new helper function,
	scsi_create_timestamp().

sys/cam/scsi/scsi_all.h:
	Add CDB and parameter data for the the set and report timestamp
	commands.

	Add function declarations for the new CCB building and helper
	functions.

Submitted by:	Sam Klopsch
Sponsored by:	Spectra Logic
MFC After:	2 weeks
2016-12-01 22:20:27 +00:00
Bryan Drewery
710542df20 Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.
This uses the same fix as r294894 did for the mlock test.  The code from
that commit is moved into a common object file which PROGS supports
building first.

Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8689
2016-12-01 22:12:58 +00:00
Ryan Stone
86a6fcd4ff Fix a false positive in a buf_ring assert
buf_ring contains an assert that checks whether an item being
enqueued already exists on the ring.  There is a subtle bug in
this assert.  An item can be returned by a peek() function and
freed, and then the consumer thread can be preempted before
calling advance().  If this happens the item appears to still be
on the queue, but another thread may allocate the item from the
free pool and wind up trying to enqueue it again, causing the
assert to trigger incorrectly.

Fix this by skipping the head of the consumer's portion of the
ring, as this index is what will be returned by peek().

Sponsored by:	Dell EMC Isilon
MFC After:	1 week
Differential Revision:	https://reviews.freebsd.org/D8685
Reviewed by:	hselasky
2016-12-01 21:08:42 +00:00
Toomas Soome
40a969525a libstand: dosfs cstyle cleanup for return keyword.
Reviewed by:	bapt, imp, allanjude
Approved by:	imp (mentor), allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8678
2016-12-01 19:19:20 +00:00
Eric van Gyzen
b28fd8ce86 locale: enable more warnings; fix them
Do not set WARNS, so it gets the current default of 6.
Fix the warnings by sprinkling static, const, or strdup.
Make some constant data tables const.  Fix whitespace.

MFC after:	1 week
Sponsored by:	Dell EMC
2016-12-01 17:36:31 +00:00
Conrad Meyer
103701b155 capsicum_helpers: Squash errors from closed fds
Squash EBADF from closed stdin, stdout, or stderr in caph_limit_stdio().
Any program used during special shell scripts may commonly be forked
from a parent process with closed standard stream.  Do the common sense
thing for this common use.

Reported by:	Iblis Lin <iblis AT hs.ntnu.edu.tw>
Reviewed by:	oshogbo@ (earlier version)
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8657
2016-12-01 17:28:45 +00:00
Alan Cox
563a19d546 During vm_page_cache()'s call to vm_radix_insert(), if vm_page_alloc() was
called to allocate a new page of radix trie nodes, there could be a call to
vm_radix_remove() on the same trie (of PG_CACHED pages) as the in-progress
vm_radix_insert().  With the removal of PG_CACHED pages, we can simplify
vm_radix_insert() and vm_radix_remove() by removing the flags on the root of
the trie that were used to detect this case and the code for restarting
vm_radix_insert() when it happened.

Reviewed by:	kib, markj
Tested by:	pho
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8664
2016-12-01 17:26:37 +00:00
Eric van Gyzen
71500aab3e locale: fix buffer management
Also, handle signed and unsigned chars, and more gracefully handle
invalid input.

Submitted by:	bde in response to r309331
MFC after:	1 week
Sponsored by:	Dell EMC
2016-12-01 16:54:02 +00:00
Martin Matuska
007dbc1f18 MFC r309362:
Sync libarchive with vendor.
Small improvements, style fixes, bugfixes.
Restores compatibility with tar archives created with Perl Archive::Tar (1)

MFC after:	1 week
Reported by:	Matthew Seaman <matthew@freebsd.org> (1)
2016-12-01 15:46:26 +00:00
Martin Matuska
181b8217c9 Update vendor/libarchive to git 2d2b3e928605f795515b03f060fd638c265b0778
Small improvements, style fixes, bugfixes.

Important vendor bugfixes:
Restore compatibility with Perl Archive::Tar that was broken with #825
2016-12-01 15:39:33 +00:00
Alexey Dokuchaev
a48f5e1ffa - Mention mismatching numbers in MSR vs. ACPI _PSS count warning: seeing
actual numbers would help debugging (also, `MSR' and `ACPI' are standard
  abbreviations and thus should be properly capitalized)
- Rephrase unsupported AMD CPUs message and wrap as an overly long line:
  `sorry' 1) is wrongly spelled after period (starts with a small letter)
  and 2) carries emotional "tinge" that is unnecessary and even bogus in
  debug message; `implemented' is not the best word as `supported' suits
  better in this context
- Improve readability when reporting resulted P-state transition (debug)

Approved by:	jhb
2016-12-01 14:31:05 +00:00
Ed Maste
c0eb4aa41b EFI loaders: parse rela relocations on amd64
Prior to this change the loader self relocation code interpreted amd64's
rela relocations as if they were rel relocations, discarding the addend.
This "works" because GNU ld 2.17.50 stores the addend value in both the
r_addend field of the relocation (as expected) and at the target of the
relocation.

Other linkers, and possibly other versions of GNU ld, won't have this
behaviour, so interpret the relocations correctly.

Reported by:	George Rimar
Reviewed by:	andrew
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8681
2016-12-01 14:28:37 +00:00
Nick Hibma
16e7325493 Speling fixes and fix line endings for err_msg output.
In some cases there was not \n, in other cases there was.
2016-12-01 09:14:58 +00:00
Peter Wemm
03bc1fa2f9 Update from subversion 1.9.4 to 1.9.5.
This includes a security fix for a component that we do not build, and
two potentially useful client side fixes for reintegrate merges and tree
conflict handling.  See CHANGES for full details.
2016-12-01 07:50:44 +00:00
Peter Wemm
608944fa5a Import subversion-1.9.5.
This includes a security fix for a component that we do not build, and
two potentially useful client side fixes for reintegrate merges and tree
conflict handling.  See CHANGES for full details.
2016-12-01 07:45:05 +00:00
Sepherosa Ziehau
34d68912be hyperv/hn: Add 'options RSS' support.
Reviewed by:	adrian
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D8676
2016-12-01 05:37:29 +00:00
Warner Losh
f8c1525499 Finish incomplete comments in prior revision. I was going to fix this
after I tested it, but didn't.
2016-12-01 05:16:27 +00:00
Warner Losh
5c42a629c3 Revert the 'performance' setting to 'NONE' from C2. C2 has issues with
USB in places, as well as having the potential for reducing
performance. Since this is used even when powerd isn't enabled, these
two problems can cause on servers. Supermicro X9 motherboards, for
example, have problems with the virtual IPMI USB keyboards and mice
attaching and detaching repeatedly. Since there are issues on some
CPUs with C2, fail safe by defaulting to not altering it.

MFC After: 3 days
2016-12-01 04:35:43 +00:00
Warner Losh
5ad34286cd If the kenv variable rc_debug is set, turn on rc_debug. 2016-12-01 04:35:41 +00:00