]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMerge ^/head r309263 through r309518.
dim [Sun, 4 Dec 2016 00:00:56 +0000 (00:00 +0000)]
Merge ^/head r309263 through r309518.

7 years ago[camcontrol] init ts=0 to quieten gcc.
adrian [Sat, 3 Dec 2016 20:35:39 +0000 (20:35 +0000)]
[camcontrol] init ts=0 to quieten gcc.

It "looks" like ts is set to something on success, and not modified on
error.

Checked on IRC with: cem

7 years agoFix bug preventing limits(1) from being applied
dteske [Sat, 3 Dec 2016 19:03:40 +0000 (19:03 +0000)]
Fix bug preventing limits(1) from being applied

PR: misc/212493
Differential Revision: https://reviews.freebsd.org/D8232
Submitted by: girgen
Reviewed by: adrian
MFC after: 3 days
X-MFC-to: stable/11

7 years agoBuild smbios.ko as a module for amd64 and i386
rpokala [Sat, 3 Dec 2016 17:54:08 +0000 (17:54 +0000)]
Build smbios.ko as a module for amd64 and i386

For whatever reason, smapi, smbios, vpd are all under the "bios" directory.
smapi is only for i386, so the entire "bios" directory is only built for
i386. Break smapi out, and make only it i386-specific. Then, build the
"bios" directory for both amd64 and i386.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Panasas
Differential Revision: https://reviews.freebsd.org/D8609

7 years agoRevert r253678, r253661:
pfg [Sat, 3 Dec 2016 17:44:43 +0000 (17:44 +0000)]
Revert r253678, r253661:
Fix a segfault in ctfmerge(1) due to a bug in GCC.

The change was correct and the bug real, but upstream didn't adopt it
and we want to remain in sync. When/if upstream does something about it
we can bring their version.

The bug in question was fixed in GCC 4.9 which is now the default in
FreeBSD's ports. Our native gcc-4.2, which is still in use in some Tier-2
platforms also has a workaround so no end-user should be harmed by the
revert.

7 years agortwn: fix bitmap size calculation.
avos [Sat, 3 Dec 2016 17:27:10 +0000 (17:27 +0000)]
rtwn: fix bitmap size calculation.

Tested with RTL8188CE, STA mode.

7 years agorsu: fix frame processing in the Rx path (similar to r292207).
avos [Sat, 3 Dec 2016 16:02:53 +0000 (16:02 +0000)]
rsu: fix frame processing in the Rx path (similar to r292207).

- Fill in Rx radiotap header correctly (for every packet in a chain;
not once per chain).
- Fix rate / flags fields in Rx radiotap.
- Add debug messages for discarded frames.
- Pass received control (< sizeof(struct ieee80211_frame)) frames
to net80211 (if allowed by device filter; cannot happen yet).

Tested with Asus USB-N10.

Differential Revision: https://reviews.freebsd.org/D5723

7 years agoFix logic error so the R92C_TDECTRL register value is updated correctly.
kevlo [Sat, 3 Dec 2016 14:41:53 +0000 (14:41 +0000)]
Fix logic error so the R92C_TDECTRL register value is updated correctly.

Reviewed by: avos

7 years agorsu: remove unused structures / variables.
avos [Sat, 3 Dec 2016 14:26:58 +0000 (14:26 +0000)]
rsu: remove unused structures / variables.

7 years agoDIRDEPS_BUILD: Fix '/' in group names creating a bad cookie.
bdrewery [Sat, 3 Dec 2016 05:29:35 +0000 (05:29 +0000)]
DIRDEPS_BUILD: Fix '/' in group names creating a bad cookie.

This is reworking the change in r296585 but to still properly install
the files.  This limits the change to only the DIRDEPS_BUILD logic
for what it considers the name of the staging set, which is what the
cookie name is based off of.

Sponsored by: Dell EMC Isilon
MFC after: 1 week

7 years agoRevert r296585.
bdrewery [Sat, 3 Dec 2016 05:29:31 +0000 (05:29 +0000)]
Revert r296585.

This broke installing dtrace test files.  It was poorly tested.

Reported by: markj
Pointyhat to: bdrewery
MFC after: 1 week

7 years agoCreate the /usr/lib/include symlink as relative.
bdrewery [Sat, 3 Dec 2016 05:29:12 +0000 (05:29 +0000)]
Create the /usr/lib/include symlink as relative.

This ugly code is done to avoid assuming LIBDIR is 2 components
deep.

Reported by: jhb

7 years agoDon't build :strvis_locale if VIS_NOLOCALE is undefined
ngie [Sat, 3 Dec 2016 03:56:20 +0000 (03:56 +0000)]
Don't build :strvis_locale if VIS_NOLOCALE is undefined

The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features
in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower
in conditionally running the test instead of backporting the newer version of
libc-vis

MFC after: now

7 years agoRestore pathing for factor(1), which unnecessarily diverged in r278616
ngie [Sat, 3 Dec 2016 03:13:32 +0000 (03:13 +0000)]
Restore pathing for factor(1), which unnecessarily diverged in r278616

factor lives in /usr/games/, not /usr/bin, in NetBSD.

The correct way to handle this is do on-the-fly manipulation of the test
script via ATF_TESTS_SH_SED_<foo>, not by modify the pathing directly in
the test script.

This is being done to resolve an unnecessary conflict made when pulling
back ^/head@r309469 (contrib/netbsd-tests update) to ^/stable/10.

No functional change

MFC after: now

7 years ago[ath] use the correct AMPDU frame limit for the given node, rather than the global...
adrian [Sat, 3 Dec 2016 02:47:41 +0000 (02:47 +0000)]
[ath] use the correct AMPDU frame limit for the given node, rather than the global config.

This is important in hostap, ibss, (11s at some magical future date, etc)
where different nodes may have smaller limits.

Oops!

MFC after: 1 week
Relnotes: Yes

7 years ago[net80211] prepare for 11ac aware NICs that want to know per-vdev channel and centre...
adrian [Sat, 3 Dec 2016 02:45:18 +0000 (02:45 +0000)]
[net80211] prepare for 11ac aware NICs that want to know per-vdev channel and centre frequencies.

* ic_freq is the centre of the primary channel, not the centre of the
  HT40/HT80/etc channel.  Add a method to access that.
* Add a method to access the centre of the primary channel, including
  knowing the centre of the 5/10/20/40/80, versus the primary channel.
  Ie, it's the centre of the 40, 80, 160MHz channel.
* Add a method to access the centre frequency of the secondary 80MHz
  channel - we don't support VHT yet, but when we do.
* Add methods to access the current channel and the per-dev desired
  channel.  Ideally drivers that do full offload with a per-vap channel
  configuration should use the vap channel, NOT ic_curchan.
  Non-offload drivers that require net80211 to change the channel should
  be accessing ic_curchan.

7 years agoExpect 01:main to fail
ngie [Sat, 3 Dec 2016 02:24:15 +0000 (02:24 +0000)]
Expect 01:main to fail

Changes were made to ZFS in the past year with respect to how ACLs
are handled, causing failures in this test. Mark it TODO so (hopefully)
someone more knowledgeable (like mav or trasz) will fix the code or the
test.

PR: 212323

7 years agoExpect :coredump_phnum to fail
ngie [Sat, 3 Dec 2016 02:17:50 +0000 (02:17 +0000)]
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

7 years agoFix test coredump_phnum_test:coredump_phnum require.config specification
ngie [Sat, 3 Dec 2016 02:09:23 +0000 (02:09 +0000)]
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

7 years agoAllow simultaneous access to switch device, there is no reason to prevent
loos [Sat, 3 Dec 2016 01:55:38 +0000 (01:55 +0000)]
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)

7 years agothr_set_name(): silently truncate the given name as needed
vangyzen [Sat, 3 Dec 2016 01:14:21 +0000 (01:14 +0000)]
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

7 years agoDocument undocumented indent(1) options badp/nbadp, bs/nbs, and lc.
pfg [Sat, 3 Dec 2016 00:24:34 +0000 (00:24 +0000)]
Document undocumented indent(1) options badp/nbadp, bs/nbs, and lc.

Submitted by:  Piotr Stefaniak
Differential Revision: https://reviews.freebsd.org/D8690

7 years agoUpdate compiler-rt to release_39 branch r288513. Since this contains a
dim [Fri, 2 Dec 2016 20:17:41 +0000 (20:17 +0000)]
Update compiler-rt to release_39 branch r288513.  Since this contains a
rather unfortunate upstream workaround for an unwind header problem that
does not exist on FreeBSD, but which causes an unnecessary warning for
us, add some flags to the compiler-rt Makefile to suppress the warning.

7 years agoext2fs: renumber the license clauses to avoid skipping #3.
pfg [Fri, 2 Dec 2016 19:47:23 +0000 (19:47 +0000)]
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.

7 years agoUpdate build glue for clang 3.9.1 r288513.
dim [Fri, 2 Dec 2016 19:40:00 +0000 (19:40 +0000)]
Update build glue for clang 3.9.1 r288513.

7 years agoUpdate llvm, clang, lld and lldb to release_39 branch r288513.
dim [Fri, 2 Dec 2016 19:36:28 +0000 (19:36 +0000)]
Update llvm, clang, lld and lldb to release_39 branch r288513.

7 years agoVendor import of compiler-rt release_39 branch r288513:
dim [Fri, 2 Dec 2016 19:20:26 +0000 (19:20 +0000)]
Vendor import of compiler-rt release_39 branch r288513:
https://llvm.org/svn/llvm-project/compiler-rt/branches/release_39@288513

7 years agoVendor import of clang release_39 branch r288513:
dim [Fri, 2 Dec 2016 19:20:19 +0000 (19:20 +0000)]
Vendor import of clang release_39 branch r288513:
https://llvm.org/svn/llvm-project/cfe/branches/release_39@288513

7 years agovfs: provide fake locking primitives for the crossmp vnode
mjg [Fri, 2 Dec 2016 18:03:15 +0000 (18:03 +0000)]
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

7 years agoindent(1): Avoid out-of-bound accesses of array ps.p_stack.
pfg [Fri, 2 Dec 2016 16:42:45 +0000 (16:42 +0000)]
indent(1): Avoid out-of-bound accesses of array ps.p_stack.

Submitted by:  Piotr Stefaniak

7 years agoindent(1): Avoid out-of-bound accesses of arrays.
pfg [Fri, 2 Dec 2016 16:41:08 +0000 (16:41 +0000)]
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

7 years agoindent(1): Remove an extra newline added in a previous commit.
pfg [Fri, 2 Dec 2016 16:32:14 +0000 (16:32 +0000)]
indent(1): Remove an extra newline added in a previous commit.

It doesn't math the remaining of the case statement.

7 years agoEliminate a stale comment; vm_radix_prealloc() was replaced in r254141.
alc [Fri, 2 Dec 2016 16:29:30 +0000 (16:29 +0000)]
Eliminate a stale comment; vm_radix_prealloc() was replaced in r254141.

MFC after: 3 days

7 years agoindent(1): Optimize parser stack usage.
pfg [Fri, 2 Dec 2016 16:28:18 +0000 (16:28 +0000)]
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

7 years agoRevert r309372
rstone [Fri, 2 Dec 2016 15:38:34 +0000 (15:38 +0000)]
Revert r309372

The bug intended to be fixed by r309372 was already addressed by r296178,
so revert my change.

Reported by: seph

7 years agoFlag the vendor specific pages as such. This allows different decoding
imp [Fri, 2 Dec 2016 14:44:45 +0000 (14:44 +0000)]
Flag the vendor specific pages as such. This allows different decoding
for the same page number as different vendors encode vendor specific
pages differently.

7 years agodd is currently a bootstrap tool. It really doesn't have any business
imp [Fri, 2 Dec 2016 14:44:38 +0000 (14:44 +0000)]
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

7 years agoRetire long-broken/unused static rtld support
emaste [Fri, 2 Dec 2016 14:23:26 +0000 (14:23 +0000)]
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

7 years agoFix man page:
n_hibma [Fri, 2 Dec 2016 11:32:11 +0000 (11:32 +0000)]
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

7 years agoMore typos in strings.
n_hibma [Fri, 2 Dec 2016 11:30:21 +0000 (11:30 +0000)]
More typos in strings.

Submitted by: bde
MFC after: 3 days

7 years agoChanges to allow the patching of packets with an offset (and other changes.. see...
julian [Fri, 2 Dec 2016 10:47:10 +0000 (10:47 +0000)]
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)

7 years agoA little light wordsmithing only.
julian [Fri, 2 Dec 2016 09:51:12 +0000 (09:51 +0000)]
A little light wordsmithing only.

Sponsored by: FreeBSD

7 years agoRemove useless NULL checks.
hselasky [Fri, 2 Dec 2016 09:41:54 +0000 (09:41 +0000)]
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

7 years agoMFV r309403:
mm [Fri, 2 Dec 2016 09:30:13 +0000 (09:30 +0000)]
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

7 years agoFix return value from ng_uncallout().
hselasky [Fri, 2 Dec 2016 09:29:22 +0000 (09:29 +0000)]
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

7 years agoFix for endless recursion in the ACPI GPE handler during boot.
hselasky [Fri, 2 Dec 2016 08:21:08 +0000 (08:21 +0000)]
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

7 years agoFix the handling of TCP FIN-segments in the CLOSED state
tuexen [Fri, 2 Dec 2016 08:02:31 +0000 (08:02 +0000)]
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

7 years agoFix use-after-free bugs in pfsync(4)
marcel [Fri, 2 Dec 2016 06:15:59 +0000 (06:15 +0000)]
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

7 years agoUse memset(3) instead of bzero(3).
araujo [Fri, 2 Dec 2016 06:07:27 +0000 (06:07 +0000)]
Use memset(3) instead of bzero(3).

Obtained from: OpenBSD (r1.12, r1.20, r1.18 and r1.37)

7 years agoString terminators are called NUL, not NULL, also the variable
araujo [Fri, 2 Dec 2016 05:49:22 +0000 (05:49 +0000)]
String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from: OpenBSD (r1.34)

7 years agoindent(1): Do not define opchar unless it will be used.
pfg [Fri, 2 Dec 2016 01:52:32 +0000 (01:52 +0000)]
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

7 years agoindent(1): Fix indent's confusion about custom FreeBSD macros.
pfg [Fri, 2 Dec 2016 01:25:51 +0000 (01:25 +0000)]
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

7 years agoAdd SCSI REPORT TIMESTAMP and SET TIMESTAMP support.
ken [Thu, 1 Dec 2016 22:20:27 +0000 (22:20 +0000)]
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

7 years agoFix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.
bdrewery [Thu, 1 Dec 2016 22:12:58 +0000 (22:12 +0000)]
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

7 years agoFix a false positive in a buf_ring assert
rstone [Thu, 1 Dec 2016 21:08:42 +0000 (21:08 +0000)]
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

7 years agolibstand: dosfs cstyle cleanup for return keyword.
tsoome [Thu, 1 Dec 2016 19:19:20 +0000 (19:19 +0000)]
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

7 years agolocale: enable more warnings; fix them
vangyzen [Thu, 1 Dec 2016 17:36:31 +0000 (17:36 +0000)]
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

7 years agocapsicum_helpers: Squash errors from closed fds
cem [Thu, 1 Dec 2016 17:28:45 +0000 (17:28 +0000)]
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

7 years agoDuring vm_page_cache()'s call to vm_radix_insert(), if vm_page_alloc() was
alc [Thu, 1 Dec 2016 17:26:37 +0000 (17:26 +0000)]
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

7 years agolocale: fix buffer management
vangyzen [Thu, 1 Dec 2016 16:54:02 +0000 (16:54 +0000)]
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

7 years agoMFC r309362:
mm [Thu, 1 Dec 2016 15:46:26 +0000 (15:46 +0000)]
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)

7 years agoUpdate vendor/libarchive to git 2d2b3e928605f795515b03f060fd638c265b0778
mm [Thu, 1 Dec 2016 15:39:33 +0000 (15:39 +0000)]
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

7 years ago- Mention mismatching numbers in MSR vs. ACPI _PSS count warning: seeing
danfe [Thu, 1 Dec 2016 14:31:05 +0000 (14:31 +0000)]
- 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

7 years agoEFI loaders: parse rela relocations on amd64
emaste [Thu, 1 Dec 2016 14:28:37 +0000 (14:28 +0000)]
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

7 years agoSpeling fixes and fix line endings for err_msg output.
n_hibma [Thu, 1 Dec 2016 09:14:58 +0000 (09:14 +0000)]
Speling fixes and fix line endings for err_msg output.

In some cases there was not \n, in other cases there was.

7 years agoUpdate from subversion 1.9.4 to 1.9.5.
peter [Thu, 1 Dec 2016 07:50:44 +0000 (07:50 +0000)]
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.

7 years agohyperv/hn: Add 'options RSS' support.
sephe [Thu, 1 Dec 2016 05:37:29 +0000 (05:37 +0000)]
hyperv/hn: Add 'options RSS' support.

Reviewed by: adrian
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8676

7 years agoFinish incomplete comments in prior revision. I was going to fix this
imp [Thu, 1 Dec 2016 05:16:27 +0000 (05:16 +0000)]
Finish incomplete comments in prior revision. I was going to fix this
after I tested it, but didn't.

7 years agoRevert the 'performance' setting to 'NONE' from C2. C2 has issues with
imp [Thu, 1 Dec 2016 04:35:43 +0000 (04:35 +0000)]
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

7 years agoIf the kenv variable rc_debug is set, turn on rc_debug.
imp [Thu, 1 Dec 2016 04:35:41 +0000 (04:35 +0000)]
If the kenv variable rc_debug is set, turn on rc_debug.

7 years agoSimplify test.
imp [Thu, 1 Dec 2016 04:35:38 +0000 (04:35 +0000)]
Simplify test.

7 years agohyperv/hn: Don't hold txdesc, if no BPFs are attached.
sephe [Thu, 1 Dec 2016 03:39:34 +0000 (03:39 +0000)]
hyperv/hn: Don't hold txdesc, if no BPFs are attached.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8675

7 years agoMDIO_PHYACCESS_ACK is only valid for read access, remove it from
loos [Thu, 1 Dec 2016 03:34:04 +0000 (03:34 +0000)]
MDIO_PHYACCESS_ACK is only valid for read access, remove it from
miibus_writereg.

Reduce the DELAY() between reads while waiting for MII access.

Spotted by: yongari
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agohyperv/hn: Add HN_DEBUG kernel option.
sephe [Thu, 1 Dec 2016 03:27:16 +0000 (03:27 +0000)]
hyperv/hn: Add HN_DEBUG kernel option.

If bufring is used for per-TX ring descs, don't update "available"
counter, which is only used to help debugging.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8674

7 years agoThe RX_FREEBUFFER registers are a write to increment field.
loos [Thu, 1 Dec 2016 02:35:15 +0000 (02:35 +0000)]
The RX_FREEBUFFER registers are a write to increment field.

Writing the full queue size to it every time was makeing it overflow with a
lot of bogus values.

This fixes the interrupt storms on irq 40.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoRemove a death threat from the FreeBSD sources
cem [Thu, 1 Dec 2016 02:21:36 +0000 (02:21 +0000)]
Remove a death threat from the FreeBSD sources

Reported by: koobs@, araujo@, linimon@, bjk@, emaste@, jhb@, ngie@, cem@
Maintainer timeout: des@

7 years agoindent(1): Don't unnecessarily add a blank before a comment ends.
pfg [Thu, 1 Dec 2016 01:56:34 +0000 (01:56 +0000)]
indent(1): Don't unnecessarily add a blank before a comment ends.

pr_comment() did avoid adding surplus space character when a comment
contained it at the end. Now it's also paying attention to tabs.

Taken from:  Piotr Stefaniak

7 years agoindent(1): Don't ignore newlines after comments that follow braces.
pfg [Thu, 1 Dec 2016 01:48:56 +0000 (01:48 +0000)]
indent(1): Don't ignore newlines after comments that follow braces.

indent.c has a special loop that stores tokens from between an if () and
the next statement into a buffer. The loop ignored all newlines, but that
resulted in not calling dump_line() when it was needed to produce the
final line of the buffered up comment.

Taken from:  Piotr Stefaniak

7 years agoindent(1): Avoid out of bound access of array in_buffer
pfg [Thu, 1 Dec 2016 01:32:13 +0000 (01:32 +0000)]
indent(1): Avoid out of bound access of array in_buffer

Work-around a somewhat complex interaction within the code. From
Piotr's commit [1]:

When pr_comment() calls dump_line() for the first line of a multiline
comment, it doesn't include any indentation - it starts with the "/*".
This is consistent for both boxed and not boxed comments. Where the logic
diverges is in how it treats the rest of the lines of the comment. For box
comments indent assumes that it must not change anything, so lines are
dumped as they were, including the indentation where it exists. For the
rest of comments, it will first remove the indentation to store plain text
of the comment and then add it again where indent thinks it's appropriate
-- this is part of comment re-indenting process.

For continuations of multi-line comments, the code that handles comments
in dump_line() will use pad_output() to create indentation from the
beginning of the line (what indent calls the first column) and then write
string pointed by s_com afterwards. But if it's a box comment, the string
will include original indentation, unless it's the first line of the
comment. This is why tab characters from s_com have to be considered when
calculating how much padding is needed and the "while (*com_st == '\t')
com_st++, target += 8;" does that.

In dump_line(), /target/ is initially set to ps.com_col, so it always
assumes that indentation needs to be produced in this function, regardless
of which line of a box comment it is. But for the first line of a box
comment it is not true, so pr_comment() signals it by setting
ps.n_comment_delta, the negative comment delta, to a negative number which
is then added to /target/ in dump_line() on all lines except the first
one, so that the function produces adequate indentation in this special
case.

The bug was in how that negative offset was calculated: pr_comment() used
count_spaces() on in_buffer, which pr_comment() expected to contain
non-null terminated sequence of characters, originating from whatever
originally was on the left side of the comment. Understanding that
count_spaces() requires a string, pr_comment() temporarily set buf_ptr[-2]
to 0 in hope that it would nul-terminate the right thing in in_buffer and
calling count_spaces() would be safe and do the expected thing. This was
false whenever buf_ptr would point into save_com, an entirely different
char array than in_buffer.

The short-term fix is to recognize whether buf_ptr points into in_buffer
or save_com.

Reference:
[1]
https://github.com/pstef/freebsd_indent/commit/ea486a2aa3b056b146bdfbb8e94843159750f200

Taken from:  Piotr Stefaniak

7 years agoRevert r309314, which breaks installing ports.
gjb [Wed, 30 Nov 2016 22:00:25 +0000 (22:00 +0000)]
Revert r309314, which breaks installing ports.

Requested by: antoine
Differential Revision: https://reviews.freebsd.org/D8120 (related)
Sponsored by: The FreeBSD Foundation

7 years agoioat(4): Fix 'bogus completion_pending' KASSERT
cem [Wed, 30 Nov 2016 21:59:52 +0000 (21:59 +0000)]
ioat(4): Fix 'bogus completion_pending' KASSERT

Fix ioat_release to only set is_completion_pending if DMAs were actually
queued.  Otherwise, the spurious flag could trigger an assert in the
reset path on INVARIANTS kernels.

Reviewed by: bdrewery, Suraj Raju @ Isilon
Sponsored by: Dell EMC Isilon

7 years agoCleanup old debug dirs in delete-old-dirs target
dim [Wed, 30 Nov 2016 19:06:47 +0000 (19:06 +0000)]
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
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D8683

7 years agoInclude limits.h for CHAR_MAX
vangyzen [Wed, 30 Nov 2016 18:34:40 +0000 (18:34 +0000)]
Include limits.h for CHAR_MAX

This was needed on stable/10.  Apparently, sys/param.h supplies CHAR_MAX
on head.  Include limits.h anyway, for consistency, and because C says so.

Sponsored by: Dell EMC

7 years agoFix the PCI host generic FDT driver to call into the common code and not
andrew [Wed, 30 Nov 2016 14:18:52 +0000 (14:18 +0000)]
Fix the PCI host generic FDT driver to call into the common code and not
recurse into itself.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoFix the alloc function the ThunderX PCIe driver calls, the previous
andrew [Wed, 30 Nov 2016 14:17:06 +0000 (14:17 +0000)]
Fix the alloc function the ThunderX PCIe driver calls, the previous
function may not exist when FDT is removed from the kernel.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoClarify warning message when failing to configure audit on user login:
rwatson [Wed, 30 Nov 2016 14:02:36 +0000 (14:02 +0000)]
Clarify warning message when failing to configure audit on user login:
when au_user_mask() fails, it's not a failure to set the audit mask,
but to calculate the audit mask -- and hence a condfiguration-file
issue (of some sort).

MFC after: 3 days
Sponsored by: DARPA, AFRL

7 years agoMark the Alpine ethernet driver as FDT only. It calls
andrew [Wed, 30 Nov 2016 10:17:03 +0000 (10:17 +0000)]
Mark the Alpine ethernet driver as FDT only. It calls
alpine_serdes_resource_get which is defined in an FDT only file.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoMove the FDT specific parts of the GIC diver softc to the FDT attachment.
andrew [Wed, 30 Nov 2016 09:47:29 +0000 (09:47 +0000)]
Move the FDT specific parts of the GIC diver softc to the FDT attachment.
This allows the driver to be built in a kernel with no FDT support, e.g.
on arm64 with just ACPI.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoOnly include FDT headders when building for FDT.
andrew [Wed, 30 Nov 2016 09:45:18 +0000 (09:45 +0000)]
Only include FDT headders when building for FDT.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

7 years agoAdd `gmirror create` subcommand, alike to gstripe, gconcat, etc.
mav [Wed, 30 Nov 2016 09:27:08 +0000 (09:27 +0000)]
Add `gmirror create` subcommand, alike to gstripe, gconcat, etc.

It is quite specific mode of operation without storing on-disk metadata.
It can be useful in some cases in combination with some external control
tools handling mirror creation and disks hot-plug.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

7 years agohyperv/storvsc: Don't use timedwait.
sephe [Wed, 30 Nov 2016 08:21:15 +0000 (08:21 +0000)]
hyperv/storvsc: Don't use timedwait.

The timeout is unnecessary.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8656

7 years agohypver/vmbus: Remove extra assertion.
sephe [Wed, 30 Nov 2016 08:10:49 +0000 (08:10 +0000)]
hypver/vmbus: Remove extra assertion.

It is asserted by vmbus_chan_gpadl_connect() now.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8660

7 years agohyperv/hn: Allow TX to share event taskqueues.
sephe [Wed, 30 Nov 2016 07:54:28 +0000 (07:54 +0000)]
hyperv/hn: Allow TX to share event taskqueues.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8659

7 years agohyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.
sephe [Wed, 30 Nov 2016 07:45:05 +0000 (07:45 +0000)]
hyperv/vmbus: Add DEVMETHOD to map cpu to event taskq.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8658

7 years agoAllow a user-overridable setting 'PKG_CMD' to control the command used
matthew [Wed, 30 Nov 2016 07:16:29 +0000 (07:16 +0000)]
Allow a user-overridable setting 'PKG_CMD' to control the command used
to create a repo during 'make packages'

This would have been useful for a situation I found myself in where
pkg(8) had been upgraded to a version that wanted the FBSD_1.5 ABI
version but libc.so.7 had not been upgraded, and only provided
FBSD_1.4. I found I needed to update libc in order to run pkg, and I
also needed to use pkg to update libc... Which is why pkg-static
exists, but there's currently no way to tell the build system to use
pkg-static instead of pkg.

This creates a variable PKG_CMD, default value 'pkg', that can be
overridden from the command line.

Reviewed by: gjb
Approved by: gjb
Differential Revision: https://reviews.freebsd.org/D8120

7 years agohyperv/hn: Allow multiple TX taskqueues.
sephe [Wed, 30 Nov 2016 05:28:39 +0000 (05:28 +0000)]
hyperv/hn: Allow multiple TX taskqueues.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8655

7 years agohyperv/hn: Nuke the unused TX taskqueue CPU binding tunable.
sephe [Wed, 30 Nov 2016 05:11:59 +0000 (05:11 +0000)]
hyperv/hn: Nuke the unused TX taskqueue CPU binding tunable.

It was an experimental tunable, and is now deemed to be road blocker
for further changes.  Time to retire it.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D8654

7 years agoBring the powerpc DDB disassembler into the 21st century
jhibbits [Wed, 30 Nov 2016 02:35:51 +0000 (02:35 +0000)]
Bring the powerpc DDB disassembler into the 21st century

Bring in the most recent copy of NetBSD's db_disasm, to fix bugs and add more
instructions.

* Fix several bugs in the disassembler, most notably the disassembly of the
  rlwi* instructions, the original reason for bringing in this change.
* Add more registers to the SPR list
* Add more instructions to the opcode table

Obtained from: NetBSD
MFC after: 2 weeks

7 years agovfs: fix a whitespace nit in r309307
mjg [Wed, 30 Nov 2016 02:17:03 +0000 (02:17 +0000)]
vfs: fix a whitespace nit in r309307

7 years agovfs: avoid VOP_ISLOCKED in the common case in lookup
mjg [Wed, 30 Nov 2016 02:14:53 +0000 (02:14 +0000)]
vfs: avoid VOP_ISLOCKED in the common case in lookup