]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFV r309587:
mm [Tue, 6 Dec 2016 01:35:27 +0000 (01:35 +0000)]
MFV r309587:

Sync libarchive with vendor.

Vendor bugfixes:

libarchive #831:
  Spelling fixes
libarchive #832:
  Relax sanity checks of number fields in tar header even more
OSS-Fuzz #16:
  Fix possible hang in uudecode_filter_read()
OSS-Fuzz #220:
  Reject an 'ar' filename table larger than 1GB or a filename larger
  than 1MB.

MFC after: 1 week

7 years agoRework syscall structure lookups.
jhb [Tue, 6 Dec 2016 00:39:00 +0000 (00:39 +0000)]
Rework syscall structure lookups.

Avoid always using an O(n^2) loop over known syscall structures with
strcmp() on each system call.  Instead, use a per-ABI cache indexed by
the system call number. The first 1024 system calls (which should cover
all of the normal system calls in currently-supported ABIs) use a flat array
indexed by the system call number to find system call structure.  For other
system calls, a linked list of structures storing an integer to structure
mapping is stored in the ABI.  The linked list isn't very smart, but it
should only be used by buggy applications invoking unknown system calls.

This also fixes handling of unknown system calls which currently trigger
a NULL pointer dereference.

Reviewed by: kib
MFC after: 2 weeks

7 years agoDon't attach to Host-PCI bridges with a bad bus number.
jhb [Tue, 6 Dec 2016 00:36:02 +0000 (00:36 +0000)]
Don't attach to Host-PCI bridges with a bad bus number.

If the bus number assigned to a Host-PCI bridge doesn't match the first
bus number in the associated producer range from _CRS, print a warning and
fail to attach rather than panicking due to an assertion failure.

At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge
device in the ACPI namespace that seems to correspond to the I/O hub in
the second socket of a two-socket machine.  However, the BIOS doesn't
configure the settings for this "ghost" bridge correctly, nor does it have
any PCI devices behind it.

Tested by: royger
MFC after: 2 weeks

7 years agoUpdate vendor/libarchive to git ddb3954bfdb9a0a98d50fb1c50cbecb603d9adf0
mm [Tue, 6 Dec 2016 00:35:20 +0000 (00:35 +0000)]
Update vendor/libarchive to git ddb3954bfdb9a0a98d50fb1c50cbecb603d9adf0

Vendor bugfixes:

libarchive #831:
  Spelling fixes
libarchive #832:
  Relax sanity checks of number fields in tar header even more
OSS-Fuzz #16:
  Fix possible hang in uudecode_filter_read()
OSS-Fuzz #220:
  Reject an 'ar' filename table larger than 1GB or a filename larger
  than 1MB.

7 years agorsu: add hardware crypto support (WEP, TKIP and CCMP).
avos [Tue, 6 Dec 2016 00:13:49 +0000 (00:13 +0000)]
rsu: add hardware crypto support (WEP, TKIP and CCMP).

This change includes firmware commands for key setup +
some additional checking via CAMREAD / CAMWRITE registers.
Nothing (except rsu_delete_key() for pairwise keys) is deferred;
to ensure that things are done in order rsu_set_key() will wait
until key deletion task will be finished.

Tested with Asus USB-N10 (all ciphers).

Differences from initial (reviewed) patch:
- Pause AC queues before disassociation - since CMD_DISCONNECT clears
crypto state all pending frames must be processed / dropped before it.
- Check sc_running flag before trying to set static keys.
- Clear key index from bitmap even when firmware command fails
(it will be invalidated via CAMWRITE anyway).

Reviewed by: adrian, kevlo
Tested by: kevlo
Differential Revision: https://reviews.freebsd.org/D8706

7 years agoBump Dd for addition of T6.
jhb [Tue, 6 Dec 2016 00:05:38 +0000 (00:05 +0000)]
Bump Dd for addition of T6.

Pointy hat to: jhb

7 years agoDocument support for Terminator 6 adapters in cxgbe(4) and cxgbev(4).
jhb [Tue, 6 Dec 2016 00:01:53 +0000 (00:01 +0000)]
Document support for Terminator 6 adapters in cxgbe(4) and cxgbev(4).

Approved by: np
MFC after: 3 days
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D8716

7 years agoFix the NFSv4.1 server for Open reclaim after a reboot.
rmacklem [Mon, 5 Dec 2016 22:36:25 +0000 (22:36 +0000)]
Fix the NFSv4.1 server for Open reclaim after a reboot.

The NFSv4.1 server failed to update the nfs-stablerestart file for
a client when the client was issued its first Open. As such, recovery
of Opens after a server reboot failed with NFSERR_NOGRACE.
This patch fixes this.
It also changes the code so that it malloc()'s the 1024 byte array
instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1.
Note that this bug only affected NFSv4.1 and only when clients attempted
to reclaim Opens after a server reboot.

MFC after: 2 weeks

7 years agopflog: Correctly initialise subrulenr
kp [Mon, 5 Dec 2016 21:52:10 +0000 (21:52 +0000)]
pflog: Correctly initialise subrulenr

subrulenr is considered unset if it's set to -1, not if it's set to 1.
See contrib/tcpdump/print-pflog.c pflog_print() for a user.

This caused incorrect pflog output (tcpdump -n -e -ttt -i pflog0):
  rule 0..16777216(match)
instead of the correct output of
  rule 0/0(match)

PR: 214832
Submitted by: andywhite@gmail.com

7 years agoRefactor the regression test code by splitting huge monolithic C
sobomax [Mon, 5 Dec 2016 17:21:04 +0000 (17:21 +0000)]
Refactor the regression test code by splitting huge monolithic C
file into smaller pieces that are hopefully easier to understand
and extend. This is to pave the ground for adding few more
socket timestamp formats that I am working on here.

No functional changes (I hope).

7 years agoFix build breakage caused by r309531.
mmel [Mon, 5 Dec 2016 15:55:51 +0000 (15:55 +0000)]
Fix build breakage caused by r309531.

Reported by: andrew
MFC after: 2 weeks
X-MFC with: r309531

7 years agoFix error in the example section
sevan [Mon, 5 Dec 2016 13:23:22 +0000 (13:23 +0000)]
Fix error in the example section
Adjust formatting highlighted by igor.

PR: 214683
Submitted by: Anindya Mukherjee <anindya49 AT hotmail DOT com>
Reviewed by: jilles
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D8591

7 years agoRelease DMAR table after using it.
kib [Mon, 5 Dec 2016 11:42:09 +0000 (11:42 +0000)]
Release DMAR table after using it.

Reported and tested by: hps
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRename fast taskqueues used by DMAR to avoid naming conflict of the
kib [Mon, 5 Dec 2016 11:41:09 +0000 (11:41 +0000)]
Rename fast taskqueues used by DMAR to avoid naming conflict of the
sleepable and spin mutexes created by the queues.

Reported and tested by: hps
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove an unneeded header. It was used when we had an arm64 specific GIC
andrew [Mon, 5 Dec 2016 11:40:54 +0000 (11:40 +0000)]
Remove an unneeded header. It was used when we had an arm64 specific GIC
driver, however with INTRNG this has been merged into a common arm driver.

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

7 years agoreadelf(1): Add support for extended program header numbers
cem [Mon, 5 Dec 2016 03:11:52 +0000 (03:11 +0000)]
readelf(1): Add support for extended program header numbers

Add support for extended program header numbers to elftoolchain
'readelf -h'.

Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D8702

7 years agoUse trunc_page() instead of rolling my own in pmap_track_page()
jhibbits [Mon, 5 Dec 2016 02:27:50 +0000 (02:27 +0000)]
Use trunc_page() instead of rolling my own in pmap_track_page()

7 years agoAdd Edimax EW-7622UMN to the list of devices supported by rsu(4).
kevlo [Mon, 5 Dec 2016 01:46:45 +0000 (01:46 +0000)]
Add Edimax EW-7622UMN to the list of devices supported by rsu(4).

7 years agoImport tzdata 2016j
bapt [Sun, 4 Dec 2016 23:23:59 +0000 (23:23 +0000)]
Import tzdata 2016j

MFC after: 2 days

7 years agorsu: fix RSSI reporting, partially revert r288414.
avos [Sun, 4 Dec 2016 21:40:49 +0000 (21:40 +0000)]
rsu: fix RSSI reporting, partially revert r288414.

- Append RCR_APP_PHYSTS bit after firmware loading - otherwise
firmware will reset the register and this modification will be lost.
(without it Rx PHY descriptor section will contain garbage).
- Check if R92S_RXDW0_PHYST bit is set (like it is done in rtwn(4)) -
even if infosz is non-zero the section may not contain anything useful.
- In case, if descriptor is absent (A-MPDU?) use last calibrated RSSI
(rtwn(4) uses RSSI from the previous (sub)frame; probably, this
approach should be used here too).

Tested with Asus USB-N10, STA mode.

7 years agoUpdate jemalloc to 4.4.0.
jasone [Sun, 4 Dec 2016 21:13:26 +0000 (21:13 +0000)]
Update jemalloc to 4.4.0.

7 years agoRestructure the code to handle reporting of non-exited processes from
kib [Sun, 4 Dec 2016 20:44:58 +0000 (20:44 +0000)]
Restructure the code to handle reporting of non-exited processes from
wait(2).
- Do not acquire the process spinlock if neither WTRAPPED nor WUNTRACED
  options were passed [1].
- Extract the code to report alive process into a new helper
  report_alive_proc() and use it for trapped, stopped and continued
  childrens.

Note that the process spinlock is required around the WTRAPPED and
WUNTRACED tests, because P_STOPPED_TRACE and P_STOPPED_SIG flags are
set before other threads are stopped at the suspension point, and that
threads increment p_suspcount while owning only the process spinlock,
the process lock is dropped by them.  If the spinlock is not taken for
tests, the syscall thread might miss both p_suspcount increment and
wakeup in wakeup in thread_suspend_switch().

Based on the submission by: mjg [1]
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoFixes for NVIDIA Tegra124 clocks:
mmel [Sun, 4 Dec 2016 16:04:22 +0000 (16:04 +0000)]
Fixes for NVIDIA Tegra124 clocks:
 - EMC clock have standard peripheral clock block. Use it.
 - Implement full frequency set method for PLLD2. This PLL
   is used as HDMI pixel clock so we must be able to set it
   to wide range of frequencies, within 5% tolerance allowed
   by HDMI specification. Due to this, full state space search
   (over m, n, p fields) is necessary.

MFC after: 3 weeks

7 years agoClock framework fixes:
mmel [Sun, 4 Dec 2016 16:02:59 +0000 (16:02 +0000)]
Clock framework fixes:
 - The clk_test_freq() (aka CLK_SET_DRYRUN) doesn't change frequency,
   don't cache it result.
 - Fix busy condition for clk_set_freq().

MFC after: 3 weeks

7 years agoDo not try to recreate wlan(4) interface if it already exists.
avos [Sun, 4 Dec 2016 15:58:34 +0000 (15:58 +0000)]
Do not try to recreate wlan(4) interface if it already exists.

This should fix error messages caused by devd(8) during startup:

Starting Network: lo0 wlan0.
...
Starting devd.
ifconfig: SIOCS80211: Device busy
wpa_supplicant already running?  (pid=323).

MFC after: 2 weeks

7 years agoAdd IDs for HDA codecs found on Nvidia Tegra SoCs.
mmel [Sun, 4 Dec 2016 15:28:30 +0000 (15:28 +0000)]
Add IDs for HDA codecs found on Nvidia Tegra SoCs.

MFC after: 2 weeks

7 years agoImplement fake pmap_mapdev_attr() for ARMv6.
mmel [Sun, 4 Dec 2016 15:27:39 +0000 (15:27 +0000)]
Implement fake pmap_mapdev_attr() for ARMv6.
This function is referenced, but never called from DRM2 code. Also,
real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't
have any additional attribute for a device memory type.

MFC after: 2 weeks

7 years agoFix too low volume on MSI H170 GAMING M3 board by poking vendor
yongari [Sun, 4 Dec 2016 05:55:18 +0000 (05:55 +0000)]
Fix too low volume on MSI H170 GAMING M3 board by poking vendor
specific COEF.

7 years agoRecognize RealTek ALC1150 7.1 channel HD audio codec.
yongari [Sun, 4 Dec 2016 05:46:30 +0000 (05:46 +0000)]
Recognize RealTek ALC1150 7.1 channel HD audio codec.

7 years agoioat(4): Compile on i386
cem [Sun, 4 Dec 2016 04:04:57 +0000 (04:04 +0000)]
ioat(4): Compile on i386

Truncate BUS_SPACE_MAXADDR_40BIT to essentially BUS_SPACE_MAXADDR_32BIT on
platforms with 32-bit bus_addr_t (i.e., i386).

PR: 215034
Reported by: ngie@
Sponsored by: Dell EMC Isilon

7 years agocoredump_phnum_test: Make expected pheader count more flexible
cem [Sun, 4 Dec 2016 03:50:57 +0000 (03:50 +0000)]
coredump_phnum_test: Make expected pheader count more flexible

Note: this test still requires binutils readelf (from ports) to pass, until a
few issues are resolved in elftoolchain.

PR: 215019
Reported by: ngie@
Sponsored by: Dell EMC Isilon

7 years agoindent(1): remove unneeded comma.
pfg [Sun, 4 Dec 2016 03:10:25 +0000 (03:10 +0000)]
indent(1): remove unneeded comma.

It is not a good practice to start a newline with a comma anyways.

Discussed with:  bjk
Differential Revision: https://reviews.freebsd.org/D8690

7 years agoRelax sanity check of number fields in tar header even more.
mm [Sun, 4 Dec 2016 02:58:13 +0000 (02:58 +0000)]
Relax sanity check of number fields in tar header even more.

This fixes reading tar archives created by older versions of
plexus-archiver (used by maven-assembly-plugin) that fill uid and gid
fields with spaces (PLXCOMP-233).

Vendor issue:
https://github.com/libarchive/libarchive/issues/832

Reported by: Antoine Brodin <antoine@freebsd.org>
MFC after: 1 week

7 years agoFix a typo (move parenthesis to correct location in the line).
jhibbits [Sun, 4 Dec 2016 02:15:46 +0000 (02:15 +0000)]
Fix a typo (move parenthesis to correct location in the line).

Before this, it would cause the one consumer of this API in powerpc usage
(dev/dpaa) to set the PTE WIMG flags to empty instead of --M-, making the
cache-enabled buffer portals non-coherent.

7 years agoUnbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS
ngie [Sun, 4 Dec 2016 02:08:40 +0000 (02:08 +0000)]
Unbreak "make depend" with sys/modules/ioat by adding opt_ddb.h to SRCS

MFC after: 2 weeks

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 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 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 agoUpdate vendor/libarchive to git 53d73345410d69e68171f05facaf4523e38e72bb
mm [Fri, 2 Dec 2016 09:26:51 +0000 (09:26 +0000)]
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

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.