freebsd.git
7 years agoRestructure libz, place vendor files in contrib/zlib like other third
delphij [Wed, 4 Jan 2017 09:30:47 +0000 (09:30 +0000)]
Restructure libz, place vendor files in contrib/zlib like other third
party software, this provides more standarized import workflow and
makes future upgrades easier.

The following files are new with this commit:

zconf.h.in
zlib.map
zlib.pc.in

They are not connected to build, but were kept in tree for reference
for future maintenance.

All our local trivial changes were applied to contrib/zlib, and the
contrib/zlib vendor source code is intended to 100% match lib/libz
before this commit.

MFC after: 2 weeks

7 years agorun: ensure pthread_condattr_{init,setclock} is successful
ngie [Wed, 4 Jan 2017 09:06:49 +0000 (09:06 +0000)]
run: ensure pthread_condattr_{init,setclock} is successful

MFC after: 1 week
Reported by: Coverity
CID: 1268631, 1268633

7 years agosetrlimit_basic: don't leak buf; free it on completion
ngie [Wed, 4 Jan 2017 09:00:16 +0000 (09:00 +0000)]
setrlimit_basic: don't leak buf; free it on completion

MFC after: 3 days
Reported by: Coverity
CID: 978311

7 years agorevoke_perm: don't leak fd at the end of the test; close it
ngie [Wed, 4 Jan 2017 08:59:06 +0000 (08:59 +0000)]
revoke_perm: don't leak fd at the end of the test; close it

This code is unused on FreeBSD, but it mutes a valid Coverity warning
which would be true on NetBSD

MFC after: 3 days
Reported by: Coverity
CID: 978311

7 years agostat_symlink: don't leak fd; close the file descriptor when done
ngie [Wed, 4 Jan 2017 08:49:07 +0000 (08:49 +0000)]
stat_symlink: don't leak fd; close the file descriptor when done

MFC after: 3 days
Reported by: Coverity
CID: 978314

7 years agopipe_restart: free f on function exit to quell complaint from Coverity
ngie [Wed, 4 Jan 2017 08:43:27 +0000 (08:43 +0000)]
pipe_restart: free f on function exit to quell complaint from Coverity

MFC after: 3 days
Reported by: Coverity
CID: 978307

7 years agoswapcontext1: test for getcontext(3) and swapcontext(3) success properly
ngie [Wed, 4 Jan 2017 08:35:46 +0000 (08:35 +0000)]
swapcontext1: test for getcontext(3) and swapcontext(3) success properly

The beforementioned libcalls both succeed if the return codes aren't -1

MFC after: 3 days
Reported by: Coverity
CID: 976790, 976791

7 years agoClarify lifetime of child(..) function
ngie [Wed, 4 Jan 2017 08:25:31 +0000 (08:25 +0000)]
Clarify lifetime of child(..) function

Ensure child exits when complete as it's always run in a forked
process.

Add a missing break statement in :pselect_sigmask when calling
child(..) for clarity and to avoid weird domino effects if the
child process somehow does something it's not supposed to do
with the logfiles, file descriptors, etc

MFC after: 1 week
Reported by: Coverity
CID: 1223369, 1223370, 1300301

7 years agoAdd missing files in zlib 1.2.8.
delphij [Wed, 4 Jan 2017 08:12:31 +0000 (08:12 +0000)]
Add missing files in zlib 1.2.8.

7 years ago[net80211] Add VHT flags for printf/debugging.
adrian [Wed, 4 Jan 2017 08:08:50 +0000 (08:08 +0000)]
[net80211] Add VHT flags for printf/debugging.

Whilst here, note that the last bit is currently used by ifconfig (_CHAN_HT)
so don't use it without fixing that first.

7 years agofpu: ensure calls to pthread_create succeed and test sched_yield to make
ngie [Wed, 4 Jan 2017 08:07:48 +0000 (08:07 +0000)]
fpu: ensure calls to pthread_create succeed and test sched_yield to make
sure it returns 0

sched_yield tests for values returning 0 of type int and sched_yield is
of type long, so the test is a mismatch

MFC after: 1 week
Reported by: Coverity
CID: 1254953, 1254954, 1254965, 1254966

7 years agoUse calloc instead of malloc with buffers in snmp_{recv,send}_packet
ngie [Wed, 4 Jan 2017 07:53:01 +0000 (07:53 +0000)]
Use calloc instead of malloc with buffers in snmp_{recv,send}_packet

This doesn't fix the issue noted in the PR, but at the very least it
cleans up the error so it looks a bit more sane, and in the event
that bsnmp did wander off into the weeds, the likelihood of it
crashing with more sensible output is greater, in my opinion

MFC counter set high so I have enough time to resolve the real
underlying bug in bsnmpwalk

MFC after: 1 month
PR: 215721

7 years agomincore_resid: free buf after use
ngie [Wed, 4 Jan 2017 04:55:33 +0000 (04:55 +0000)]
mincore_resid: free buf after use

MFC after: 3 days
Reported by: Coverity
CID: 978304

7 years ago{strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use
ngie [Wed, 4 Jan 2017 04:50:03 +0000 (04:50 +0000)]
{strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use

MFC after: 3 days
Reported by: Coverity
CID: 978299, 978300

7 years agomknodat_fd: close dfd after use to avoid leaking it
ngie [Wed, 4 Jan 2017 04:32:00 +0000 (04:32 +0000)]
mknodat_fd: close dfd after use to avoid leaking it

MFC after: 3 days
Reported by: Coverity
CID: 978287

7 years agomkfifoat_fd: close dfd after use to avoid leaking it
ngie [Wed, 4 Jan 2017 04:29:53 +0000 (04:29 +0000)]
mkfifoat_fd: close dfd after use to avoid leaking it

MFC after: 3 days
Reported by: Coverity
CID: 978286

7 years agofexecve: don't leak fd on fexecve(2) failure; close before calling err
ngie [Wed, 4 Jan 2017 04:27:13 +0000 (04:27 +0000)]
fexecve: don't leak fd on fexecve(2) failure; close before calling err

MFC after: 3 days
Reported by: Coverity
CID: 978285

7 years agotty: don't leak s after opening it with openpty
ngie [Wed, 4 Jan 2017 04:19:05 +0000 (04:19 +0000)]
tty: don't leak s after opening it with openpty

MFC after: 3 days
Reported by: Coverity
CID: 978321

7 years agommap_prot_3, mmap_truncate, mmap_truncate_signal: don't leak fd and map
ngie [Wed, 4 Jan 2017 04:10:36 +0000 (04:10 +0000)]
mmap_prot_3, mmap_truncate, mmap_truncate_signal: don't leak fd and map

Reported by: Coverity
CID: 978306, 1251406, 1288196, 1300541

7 years agoFollowup to mtod removal in main stack (r311225). Continued removal
gnn [Wed, 4 Jan 2017 04:00:28 +0000 (04:00 +0000)]
Followup to mtod removal in main stack (r311225).  Continued removal
of mtod() calls from TCP_PROBE macros.

MFC after: 1 week
Sponsored by: Limelight Networks

7 years agolisten_low_port: check for errors from socket(2) before continuing
ngie [Wed, 4 Jan 2017 03:59:50 +0000 (03:59 +0000)]
listen_low_port: check for errors from socket(2) before continuing

MFC after: 3 days
Reported by: Coverity
CID: 976778

7 years agokqueue_desc_passing: initialize m.msg_flags to 0
ngie [Wed, 4 Jan 2017 03:54:54 +0000 (03:54 +0000)]
kqueue_desc_passing: initialize m.msg_flags to 0

This mutes an uninitialized scalar warning from Coverity

MFC after: 3 days
Reported by: Coverity
CID: 979620

7 years agoumask_open: don't leak fd on success
ngie [Wed, 4 Jan 2017 03:41:16 +0000 (03:41 +0000)]
umask_open: don't leak fd on success

MFC after: 3 days
Reported by: Coverity
CID: 978315

7 years agoARM GENERIC: Add support for Allwinner A33 SoC
manu [Wed, 4 Jan 2017 03:37:00 +0000 (03:37 +0000)]
ARM GENERIC: Add support for Allwinner A33 SoC

7 years agoAllwinner: Add A33 support
manu [Wed, 4 Jan 2017 03:35:39 +0000 (03:35 +0000)]
Allwinner: Add A33 support

Add basic support for A33/R16 that is enough to boot a kernel.
This adds the platform code, padconf data and the new clocks strings.

MFC after: 2 weeks

7 years agounlink_fifo: don't leak the file descriptors opened with mkfifo and open
ngie [Wed, 4 Jan 2017 03:35:23 +0000 (03:35 +0000)]
unlink_fifo: don't leak the file descriptors opened with mkfifo and open

MFC fater: 3 days
Reported by: Coverity
CID: 978316, 978317

7 years agottyname_err: close fd if it was opened successfully
ngie [Wed, 4 Jan 2017 02:52:39 +0000 (02:52 +0000)]
ttyname_err: close fd if it was opened successfully

MFC after: 3 days
Reported by: Coverity
CID: 978292

7 years agoFix Coverity issues
ngie [Wed, 4 Jan 2017 02:46:36 +0000 (02:46 +0000)]
Fix Coverity issues

- Initialize .sun_len before passing it to strlcpy and bind.
- Close fd on error

MFC after: 3 days
Reported by: Coverity
CID: 978283, 979581

7 years agohumanize_number_basic: don't leak buf
ngie [Wed, 4 Jan 2017 02:38:14 +0000 (02:38 +0000)]
humanize_number_basic: don't leak buf

MFC after: 3 days
Reported by: Coverity
CID: 1251407

7 years agoftok_link: don't leak fd
ngie [Wed, 4 Jan 2017 02:34:30 +0000 (02:34 +0000)]
ftok_link: don't leak fd

MFC after: 3 days
Reported by: Coverity
CID: 978291

7 years agoseekdir_basic: fix various Coverity issues
ngie [Wed, 4 Jan 2017 02:31:05 +0000 (02:31 +0000)]
seekdir_basic: fix various Coverity issues

Address..
- .. resource leaks of file descriptors and memory
- .. unchecked return values from creat(2), mkdir(2), and telldir(3)
- .. potential NULL derefs after calling readdir(3)

MFC after: 1 week
Reported by: Coverity
CID: 975255, 975256, 976989, 978989, 978990

7 years agomtx: plug open-coded mtx_lock access missed in r311172
mjg [Wed, 4 Jan 2017 02:25:31 +0000 (02:25 +0000)]
mtx: plug open-coded mtx_lock access missed in r311172

7 years agoFix DTrace TCP tracepoints to not use mtod() as it is both unnecessary and
gnn [Wed, 4 Jan 2017 02:19:13 +0000 (02:19 +0000)]
Fix DTrace TCP tracepoints to not use mtod() as it is both unnecessary and
dangerous.  Those wanting data from an mbuf should use DTrace itself to get
the data.

PR: 203409
Reviewed by: hiren
MFC after: 1 week
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D9035

7 years agoFix PMC architecture check to handle later IPAs including Skylake
gnn [Wed, 4 Jan 2017 02:15:03 +0000 (02:15 +0000)]
Fix PMC architecture check to handle later IPAs including Skylake
Tested with tools/test/hwpmc/pmctest.py

Obtained from: Oliver Pinter
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9036

7 years agoFix logical inversion when checking result from calloc
ngie [Wed, 4 Jan 2017 01:44:45 +0000 (01:44 +0000)]
Fix logical inversion when checking result from calloc
in snmp_output_err_resp(..)

X-MFC with: r310987
MFC after: 3 days
Reported by: Coverity
CID: 1368195

7 years agoInitialize msg.msg_flags to 0
ngie [Wed, 4 Jan 2017 01:38:07 +0000 (01:38 +0000)]
Initialize msg.msg_flags to 0

This mutes a valid coverity warning about it being uninitialized
when passed in to sendmsg(2).

MFC after: 2 weeks
Reported by: Coverity
CID: 1368202

7 years agoQuell Coverity for diskinfo(8)
asomers [Wed, 4 Jan 2017 00:39:06 +0000 (00:39 +0000)]
Quell Coverity for diskinfo(8)

* CID 1198994: Don't run the speed disk on a disk with no sectors
* CID 1011442: Don't call close(2) if open(2) fails
* CID 1011161: Use snprintf instead of sprintf
* CID 1009825: Check the return value of lseek

Reported by: Coverity
CID: 1198994 1011442 1011161 1009825
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp

7 years agortwn: fix possible buffer overrun.
avos [Wed, 4 Jan 2017 00:26:41 +0000 (00:26 +0000)]
rtwn: fix possible buffer overrun.

r297596 was not merged properly into new code; restore lost part.

7 years agoAdd some missing atomic_*_ptr #defines for arm.
markj [Wed, 4 Jan 2017 00:18:51 +0000 (00:18 +0000)]
Add some missing atomic_*_ptr #defines for arm.

MFC after: 1 week

7 years agoReduce lock accesses in thread lock similarly to r311172.
mjg [Tue, 3 Jan 2017 23:08:11 +0000 (23:08 +0000)]
Reduce lock accesses in thread lock similarly to r311172.

7 years agoSwap parameters around with parse_syntax_strval(..) for consistency with
ngie [Tue, 3 Jan 2017 22:33:07 +0000 (22:33 +0000)]
Swap parameters around with parse_syntax_strval(..) for consistency with
other parse_* APIs in bsnmp*

MFC after: 3 days
Noted by: bz

7 years agoMake /usr/lib/libbsnmptools.so.0 into an INTERRNALLIB
ngie [Tue, 3 Jan 2017 22:31:05 +0000 (22:31 +0000)]
Make /usr/lib/libbsnmptools.so.0 into an INTERRNALLIB

Although it increases the size of the bsnmp{get,set,walk} binaries by
four on my [amd64] system, it removes the need for producing .debug
files, profiled libraries, and for installing the library itself,
reducing the overall size use on disk by the utilities noted
previously.

Plus, it guards against ABI/API compatibility issues with the library
as it's only used internal to the tools themselves.

MFC after: 3 weeks

7 years agocxgbe(4): Update T4, T5 and T6 firmwares to 1.16.26.0. Changelog for
np [Tue, 3 Jan 2017 22:05:07 +0000 (22:05 +0000)]
cxgbe(4):  Update T4, T5 and T6 firmwares to 1.16.26.0.  Changelog for
all public firmwares for all chips since the last release (1.15.37.0)
follows (it's a straight copy-paste from the Release Notes for the
12/30/2016 Unified Wire release on Chelsio's website).

T6 Firmware
++++++++++++

Version : 1.16.26.0
Date    : 12/28/2016

Fixes
-----

BASE:
- Max number of egress and control queues adjusted to accomodate
  co-processor mode queues.
- Fixed intermittent DDR3/4 ECC errors.
- Fixed a traffic stall when ETS BW is configured as 0%.
- Max number of ethctrl queue in VF set to 1.

ETH:
- Added a new config file option 'speed' under port section to set the
  port speed.  Use only when auto negotiation is off.
- FEC option removed from firmware config file. cxgbtool can be used to
  change the fec setting.
- CPL_TX_TNL_LSO cpl handling added in ETH_TX_PKT_VM handler. This fixes
  large tunnel tcp packet support for VxLAN.

Version : 1.16.22.0
Date    : 12/05/2016

Fixes
-----

BASE:
- fw_port_type updated in fw API to match kernel.org definitions.
- Saved power by disaling unused MAC lanes.
- Configures correct power bin.
- Enhanced DDR4 performance.
- Enabled interrupts.
- Fixed an issue where filter rule for 'unicast hash' is not working.

ETH:
- Disabled auto negotiation by default because most of 100G switches do
  not support AN as of today.
- Fixed flow control not getting disabled problem.
- Fixed an issue where port0 doesn't come up sometimes.
- Fixed 10G link not coming up issue.
- Fixed an issue with promiscuous mode when dcbx disabled.

OFLD:
- Fixed a connection stuck issue when abort is received during out of tx
  pages backpressure.

ENHANCEMENTS
------------

BASE:
- Added inline TLS mode support.

Version : 1.16.12.0
Date    : 11/11/2016

ENHANCEMENTS
------------

BASE:
- Added T6 support.
- Added T6 1G/10G/25G/40G/100G link speeds.
- Added T6 co-processor mode crypto support.
- Added facility to increase link AN+AEC timeout.

OFLD:
- Added support for all T5 offload protocols except FCoE.

iSCSI:
- iscsi completion moderation enabled.

=======================================================================

T5 Firmware
++++++++++++

Version : 1.16.26.0
Date    : 12/28/2016

FIXES
-----

BASE:
- Max number of ethctrl queue in VF set to 1.

Version : 1.16.22.0
Date    : 12/05/2016

FIXES
-----

BASE:
- Fixed an issue where filter rule for 'unicast hash' is not working.

ETH:
- Fixed an issue with promiscuous mode when dcbx disabled.

ENHANCEMENTS
------------

ETH:
- Added 40G-KR support.

Version : 1.16.12.0
Date    : 11/11/2016

FIXES
-----

BASE:
- Fixed multiple issues related with VFs FLR processing.
- Fixed channel assignment based on number of ports in adapter.
- Fixed a crash when VM having PF assigned as passthrough mode is
  rebooted.
- Handled 2nd HELLO command from the same PF without seeing BYE from the
  same PF and if that is the only PF.
- A warning is printed in firmware log if PCI-E cookie generation is
  enabled in serial initialization file.
- Fixed multiple issues related with Filtering.
- Enabled DSGL memory write for iscsi and rdma.
- Added new FW_PARAMS_CMD[DEV] options to retrieve Serial Configuration
  and VPD version numbers.
- Fixed an issue where LVDS output was not getting enabled using vpd.

DCBX:
- Fixed DCBX CEE Incorrect class to pririty mapping.
- Fixed incorrect interpretation of DCBX IEEE PFC.

ETH:
- Adjusted the link related delay timings according to the QSFP spec.
- Improved 40G link bringup time with few switches.

OFLD:
- Do not reserve qp/cq if rdma capability is not enabled.
- Fixed an issue where approx 1600+ TOE connections were causing a
  firmware fatal error.

FOiSCSI:
- Fixed an issue where unloading foiscsi driver causes mailbox timeout.

ENHANCEMENTS
------------

BASE:
- Added 10G KR/KX support.
- Added T540-BT adapter support.
- Added 4 new rss key modes for PFs and VFs.

OFLD:
- Added new WR FW_RI_FR_NSMR_TPTE_WR to improve fast MR write
  performance in RDMA.

Version : 1.16.5.0
Date    : 10/26/2016

FIXES
-----

BASE:
- Fixed multiple issues where FLR from multiple VFs can cause firmware
  crash.
- Fixed channel assignment based on number of ports in adapter.
- Fixed the HELLO command master force api to handle the 2nd HELLO
  correctly without getting BYE from the PF driver.
- Added facility to retrieve Serial configuration and VPD version. Two
  new FW_PARAMS_CMD[DEV] options added to retrieve these values.
- Fixed multiple issues where FLR from multiple VFs are not completing.
- Added new RSS hash secret key modes.
- Fixed an issue where LVDS output was not getting enabled using vpd.

DCBX:
- Fixed an issue where iscsi tlv is sent incorrectly to host (DCBX CEE).
- Fixed an issue where app priority values are not handled correctly
  in fw (DCBX IEEE).

ETH:
- Adjusts the link related delay timings according to the QSFP spec.
- Changed 2.5G mac speed bit to 25G mac speed bit in fw API.
- Improvement in 40G link bringup time with few switches.

OFLD:
- Do not reserve qp/cq if rdma capability is not enabled.
- Fixed an issue where approx 1600+ TOE connections were causing a
  firmware fatal error.
- Fixed DSGL memory write in T5. Now iwarp and iscsi can use DSGL to do
  memory write.
- Fixed multiple issues in hash filter mode where incorrect protocol
  mask was getting used and affecting hash filter functionality.
- New fastpath WR FW_RI_FR_NSMR_TPTE_WR (with fully populated TPTE) is
  added for small REG_MR operations.

FOiSCSI:
- Fixed an issue in foiscsi recovery path.
- Fixed an issue where foiscsi (in VM in PCIE passthrough mode) didn't
  come up after VM FLR.

ENHANCEMENTS
------------

ETH:
- Implemented 1G/10G KR/KX ability.
- Implemented T540-BT adapter support.

=======================================================================

T4 Firmware
+++++++++++

Version : 1.16.12.0
Date    : 11/11/2016

FIXES
-----

BASE:
- Fixed an issue where reading temperature sesors using ldst command
  causes mailbox timeout.
- Added new FW_PARAMS_CMD[DEV] options to retrieve Serial Configuration
  and VPD version numbers.

ETH:
- Fixed DCBX CEE Incorrect class to pririty mapping.

FOiSCSI:
- Fixed an issue where unloading foiscsi driver causes mailbox timeout.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agomtx: reduce lock accesses
mjg [Tue, 3 Jan 2017 21:36:15 +0000 (21:36 +0000)]
mtx: reduce lock accesses

Instead of spuriously re-reading the lock value, read it once.

This change also has a side effect of fixing a performance bug:
on failed _mtx_obtain_lock, it was possible that re-read would find
the lock is unowned, but in this case the primitive would make a trip
through turnstile code.

This is diff reduction to a variant which uses atomic_fcmpset.

Discussed with: jhb (previous version)
Tested by: pho (previous version)

7 years agoFix typo
bjk [Tue, 3 Jan 2017 21:11:30 +0000 (21:11 +0000)]
Fix typo

7 years agoRevert r309619 "ifndef atomic_cas_* in cddl code"
mjg [Tue, 3 Jan 2017 21:02:30 +0000 (21:02 +0000)]
Revert r309619 "ifndef atomic_cas_* in cddl code"

It was a temporary change to ease an import of native atomic_cas primitives.
Instead, atomic_fcmpset was devised with different semantics. See r311168.

7 years agoamd64: add atomic_fcmpset
mjg [Tue, 3 Jan 2017 21:00:24 +0000 (21:00 +0000)]
amd64: add atomic_fcmpset

Reviewed by: kib, jhb

7 years agoAdd the upcoming atomic_fcmpset family to the atomic(9) man page.
mjg [Tue, 3 Jan 2017 20:59:50 +0000 (20:59 +0000)]
Add the upcoming atomic_fcmpset family to the atomic(9) man page.

These primitives give the caller the read value if the exchange attempt
failed which saves an explicit reload for cmpset loops.

The man page was partially submitted by kib.

Reviewed by: kib (previous version), jhb (previous version)

7 years agomisc minor fixes in mpr(4)
asomers [Tue, 3 Jan 2017 17:35:16 +0000 (17:35 +0000)]
misc minor fixes in mpr(4)

sys/dev/mpr/mpr_sas.c
* Fix a potential null pointer dereference (CID 1305731)
* Check for overrun of the ccb_scsiio.cdb_io.cdb_bytes buffer (CID
  1211934)

sys/dev/mpr/mpr_sas_lsi.c
* Nullify a dangling pointer in mprsas_get_sata_identify
* Fix a memory leak in mprsas_SSU_to_SATA_devices (CID 1211935)

Reported by: Coverity (partially)
CID: 1305731 1211934 1211935
Reviewed by: slm
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D8880

7 years agoIn the netfront_rxq struct, we should use NET_RX_RING_SIZE, not
cognet [Tue, 3 Jan 2017 17:24:56 +0000 (17:24 +0000)]
In the netfront_rxq struct, we should use NET_RX_RING_SIZE, not
NET_TX_RING_SIZE.

Reviewed by: royger

7 years agoRemove a GPL licensed DTS.
loos [Tue, 3 Jan 2017 16:46:51 +0000 (16:46 +0000)]
Remove a GPL licensed DTS.

The micro-Firewall DTS is now a single BSD licensed file.

Reported by: manu
Obtained from: pfSense
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoRestore r302384 that was dropped when r303816 updated the driver to 1.6.6.-k
sbruno [Tue, 3 Jan 2017 14:52:39 +0000 (14:52 +0000)]
Restore r302384 that was dropped when r303816 updated the driver to 1.6.6.-k

Original log:
Do not initialize the adapter on MTU change when adapter status is down.
This fixes long-standing problems when changing settings of the adapter.

Discussed in:
https://lists.freebsd.org/pipermail/freebsd-net/2016-June/045509.html

Reported by: Franco Fichtner <franco@opnsense.org>
MFH: 2 days

7 years agoUpdate libsysdecode for getfsstat() 'flags' argument changing to 'mode'.
jhb [Tue, 3 Jan 2017 01:39:05 +0000 (01:39 +0000)]
Update libsysdecode for getfsstat() 'flags' argument changing to 'mode'.

As a followup to r310638, update libsysdecode (and kdump) to decode the
'mode' argument to getfsstat().  sysdecode_getfsstat_flags() has been
renamed to sysdecode_getfsstat_mode() and now treats the argument as an
enumerated value rather than a mask of flags.

7 years agoRemove the "unused" DIF subroutine index left after r308582.
markj [Tue, 3 Jan 2017 00:24:12 +0000 (00:24 +0000)]
Remove the "unused" DIF subroutine index left after r308582.

These indices are input to a build-time script that generates code to
validate subroutine names.

7 years agoAdd a page queue for holding dirty anonymous unswappable pages.
markj [Tue, 3 Jan 2017 00:05:44 +0000 (00:05 +0000)]
Add a page queue for holding dirty anonymous unswappable pages.

On systems without a configured swap device, an attempt to launder pages
from a swap object will always fail and result in the page being
reactivated. This means that the page daemon will continuously scan pages
that can never be evicted. With this change, anonymous pages are instead
moved to PQ_UNSWAPPABLE after a failed laundering attempt when no swap
devices are configured. PQ_UNSWAPPABLE is not scanned unless a swap device
is configured, so unreferenced unswappable pages are excluded from the page
daemon's workload.

Reviewed by: alc

7 years agoindent(1): add a piece missed in r311138.
pstef [Mon, 2 Jan 2017 20:49:24 +0000 (20:49 +0000)]
indent(1): add a piece missed in r311138.

7 years agoOnly bake krb5_config.h support in to ssh(3), etc if both MK_GSSAPI and
ngie [Mon, 2 Jan 2017 20:29:50 +0000 (20:29 +0000)]
Only bake krb5_config.h support in to ssh(3), etc if both MK_GSSAPI and
MK_KERBEROS_SUPPORT != no

This fixes the odd case where someone specified MK_GSSAPI=no and
MK_KERBEROS_SUPPORT=yes (which admittedly, probably doesn't make sense,
but the build system doesn't prevent this case today, and it didn't when
I filed the bug back in 2011 either).

MFC after: 2 weeks
PR: 159745

7 years agoindent(1): add option -P for loading user-provided files as profiles
pstef [Mon, 2 Jan 2017 20:23:46 +0000 (20:23 +0000)]
indent(1): add option -P for loading user-provided files as profiles

Without this change, indent(1) would only look to load options from ~/.indent.pro if it's there and -npro wasn't used on the command line. This option lets the user set their own path to the file.

Approved by: pfg (mentor)
Differential Revision: https://reviews.freebsd.org/D9010

7 years agoRegen src.conf after recent changes to tools/build/options/... and
ngie [Mon, 2 Jan 2017 20:14:06 +0000 (20:14 +0000)]
Regen src.conf after recent changes to tools/build/options/... and
src.opts.mk

7 years agoAdd WITH_SSP to silence complaints from mkman about there not being a file
ngie [Mon, 2 Jan 2017 20:09:09 +0000 (20:09 +0000)]
Add WITH_SSP to silence complaints from mkman about there not being a file

MFC after: 3 days

7 years agoAdd documentation for MK_EFI added in r307243
ngie [Mon, 2 Jan 2017 20:07:56 +0000 (20:07 +0000)]
Add documentation for MK_EFI added in r307243

7 years agorcs was removed in r307351; kill off WITH*_RCS
ngie [Mon, 2 Jan 2017 20:01:07 +0000 (20:01 +0000)]
rcs was removed in r307351; kill off WITH*_RCS

MFC after: never

7 years agoMove the "MK_* options..." section before the "... MK_*_SUPPORT..." section
ngie [Mon, 2 Jan 2017 19:55:18 +0000 (19:55 +0000)]
Move the "MK_* options..." section before the "... MK_*_SUPPORT..." section

For the case that someone set WITHOUT_GSSAPI=, now WITHOUT_KERBEROS_SUPPORT
will be properly set.

This will likely fix the issue for the default case noted in the PR I filed
back in 2011. I am trying to fix the less obvious case documented in the PR
still.

MFC after: 2 weeks
PR: 159745

7 years agoMake native-xtools build correctly after clang/llvm 3.9.0 import
dim [Mon, 2 Jan 2017 19:33:22 +0000 (19:33 +0000)]
Make native-xtools build correctly after clang/llvm 3.9.0 import

During the clang/llvm 3.9.0 import, the build structure for it was
completely revamped.  This broke the native-xtools target.

It first attempts to build libllvmminimal, then the llvm-tblgen and
clang-tblgen executables, but these fail to link because they are linked
to the 'full' libllvm by default, as they normally are during the
'world' stage.

To make these link against libllvmminimal instead, define TOOLS_PREFIX,
similarly as during the bootstrap-tools phase.  The value itself is
empty, as we don't really want to use a prefix.

Reviewed by: imp
PR: 215684
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D9026

7 years agoWorkaround NFS bug with readdirplus when there are greater than 1 billion files in...
jpaetzel [Mon, 2 Jan 2017 19:18:56 +0000 (19:18 +0000)]
Workaround NFS bug with readdirplus when there are greater than 1 billion files in a filesystem.

Reviewed by kib
MFC after: 2 weeks
Sponsored by: iXsystems
Differential Revision: D9009

7 years agoConditionalize adding ${KRB5DIR}/lib/gssapi/krb5/gkrb5_err.et to ETSRCS
ngie [Mon, 2 Jan 2017 19:03:01 +0000 (19:03 +0000)]
Conditionalize adding ${KRB5DIR}/lib/gssapi/krb5/gkrb5_err.et to ETSRCS
if MK_GSSAPI != "no"

MFC after: 1 week

7 years agoBuild libexec/kadmind when MK_GSSAPI != no because it requires gssapi
ngie [Mon, 2 Jan 2017 19:02:00 +0000 (19:02 +0000)]
Build libexec/kadmind when MK_GSSAPI != no because it requires gssapi

MFC after: 1 week

7 years agoThere is no need to use temporary statfs buffer for fsid obliteration
kib [Mon, 2 Jan 2017 18:59:23 +0000 (18:59 +0000)]
There is no need to use temporary statfs buffer for fsid obliteration
and prison enforcement.  Do it on the caller buffer directly.

Besides eliminating memory copies, this change also removes large
structure from the kernel stack.

Extracted from: ino64 work by gleb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agolibgssapi_{krb5,ntlm,spnego} requires MK_GSSAPI != no; conditionalize
ngie [Mon, 2 Jan 2017 18:58:13 +0000 (18:58 +0000)]
libgssapi_{krb5,ntlm,spnego} requires MK_GSSAPI != no; conditionalize
their building on the knob

MFC after: 1 week

7 years agoStyle.
kib [Mon, 2 Jan 2017 18:49:48 +0000 (18:49 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agopatch(1): replace strnlen() with a simpler strlen().
pfg [Mon, 2 Jan 2017 18:27:35 +0000 (18:27 +0000)]
patch(1): replace strnlen() with a simpler strlen().

Small style fix with here.

Pointed out by: kib

7 years agoRevert r311106:
pfg [Mon, 2 Jan 2017 18:23:31 +0000 (18:23 +0000)]
Revert r311106:
patch(1): extend the maximum length of a line from USHRT_MAX to UINT_MAX.

This doesn't really work for 32 bit platforms.

Pointed out by: kib

7 years agoMove common code from kern_statfs() and kern_fstatfs() into a new helper.
kib [Mon, 2 Jan 2017 18:20:22 +0000 (18:20 +0000)]
Move common code from kern_statfs() and kern_fstatfs() into a new helper.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agopatch(1): extend the maximum length of a line from USHRT_MAX to UINT_MAX.
pfg [Mon, 2 Jan 2017 17:12:14 +0000 (17:12 +0000)]
patch(1): extend the maximum length of a line from USHRT_MAX to UINT_MAX.

We can handle such "big data" without much trouble.
Try to do a better job at detecting the rejection cause while here.

MFC after: 2 weeks

7 years agorsu: restore 40Mhz channel support.
avos [Mon, 2 Jan 2017 16:58:55 +0000 (16:58 +0000)]
rsu: restore 40Mhz channel support.

MFC after: 4 days.

7 years agoPrint flags in hex instead of decimal.
jhibbits [Mon, 2 Jan 2017 16:50:52 +0000 (16:50 +0000)]
Print flags in hex instead of decimal.

Hex is easier to grok for flags, and consistent with other prints.

7 years agoUpdate ntp.conf to use the ntpd pool feature.
ian [Mon, 2 Jan 2017 15:19:22 +0000 (15:19 +0000)]
Update ntp.conf to use the ntpd pool feature.

Our previous ntp.conf file configured 3 servers from freebsd.pool.ntp.org
using 3 separate 'server' config lines.  That is now replaced with a single
'pool' line which causes ntpd to add multiple servers from the pool.

More than just making the config smaller, the pool feature in ntpd has one
major advantage over configuring 3 separate servers from a pool: if a server
that was added using a 'pool' statement provides bad time (initially or at
some later date), ntpd automatically discards it and configures a new
different server from the pool without needing to be restarted.

These changes also add a 'tos' line to control how many pool servers get
added, a 'restrict source' line that is required to allow ntpd to add new
peers from the pool, and it deletes a 'restrict 127.127.1.0' line that does
nothing and should never have been there (127.127.1.0 is not a valid IP
address, it's a refclock identifier).

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

7 years agoCleanup inelegant calloc(3) introduced in r310984.
pfg [Mon, 2 Jan 2017 15:17:33 +0000 (15:17 +0000)]
Cleanup inelegant calloc(3) introduced in r310984.

7 years agolibkvm - extend a bit the swap statistics field.
pfg [Mon, 2 Jan 2017 15:12:11 +0000 (15:12 +0000)]
libkvm - extend a bit the swap statistics field.

Change ksw_used and ksw_total to unsigned, which increases the maximum
total swap that can be displayed properly from ~8TB to ~16TB.

Obtained from: DragonflyBSD (ecc2e461)
MFC after: 2 weeks

7 years agoRemove unneeded externs keywords. Reindent long lines.
kib [Mon, 2 Jan 2017 09:02:39 +0000 (09:02 +0000)]
Remove unneeded externs keywords.  Reindent long lines.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years ago[netmap] call RLOCK /and/ RUNLOCK.
adrian [Mon, 2 Jan 2017 06:36:12 +0000 (06:36 +0000)]
[netmap] call RLOCK /and/ RUNLOCK.

Reported by: olivier

7 years agoFactor out instances of a knote detach followed by a knote_drop() call.
markj [Mon, 2 Jan 2017 01:23:21 +0000 (01:23 +0000)]
Factor out instances of a knote detach followed by a knote_drop() call.

Reviewed by: kib (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9015

7 years ago2017 IFLIB updates in preparation for commits to e1000 and ixgbe.
sbruno [Mon, 2 Jan 2017 00:56:33 +0000 (00:56 +0000)]
2017 IFLIB updates in preparation for commits to e1000 and ixgbe.
- iflib - add checksum in place support (mmacy)
- iflib - initialize IP for TSO (going to be needed for e1000) (mmacy)
- iflib - move isc_txrx from shared context to softc context (mmacy)
- iflib - Normalize checks in TXQ drainage. (shurd)
- iflib - Fix queue capping checks (mmacy)
- iflib - Fix invalid assert, em can need 2 sentinels (mmacy)
- iflib - let the driver determine what capabilities are set and what
          tx csum flags are used (mmacy)
- add INVARIANTS debugging hooks to gtaskqueue enqueue (mmacy)
- update bnxt(4) to support the changes to iflib (shurd)

Some other various, sundry updates.  Slightly more verbose changelog:

Submitted by: mmacy@nextbsd.org
Reviewed by: shurd
mFC after:
Sponsored by: LimeLight Networks and Dell EMC Isilon

7 years agoStyle fixes for vm_map_insert().
kib [Sun, 1 Jan 2017 18:49:46 +0000 (18:49 +0000)]
Style fixes for vm_map_insert().

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoRemove some uses of the GCC __nonnull() attribute.
pfg [Sun, 1 Jan 2017 17:16:47 +0000 (17:16 +0000)]
Remove some uses of the GCC __nonnull() attribute.

While the checks are considered useful, the attribute does dangerous
optimizations, removing NULL checks where they can be needed. Remove the
uses of this attribute introduced in r281130: the changes were inspired on
Google's bionic where this attribute is not used anymore.

The __nonnull() attribute will be deprecrated from our headers and
replaced with the Clang _Nonnull qualifier in the future.

MFC after: 3 days

7 years agoFix up grammar.
cy [Sun, 1 Jan 2017 10:37:10 +0000 (10:37 +0000)]
Fix up grammar.

MFC after: 3 days

7 years agofd: access openfiles once in falloc_noinstall
mjg [Sun, 1 Jan 2017 08:55:28 +0000 (08:55 +0000)]
fd: access openfiles once in falloc_noinstall

This is similar to what's done with nprocs.

Note this is only a band aid.

7 years agoFix spelling errors; bump .Dd for the change
ngie [Sun, 1 Jan 2017 05:23:01 +0000 (05:23 +0000)]
Fix spelling errors; bump .Dd for the change

MFC after: 3 days

7 years agoInstall bsnmpclient(3) as snmp_client_{init,set_host,set_port}(3)
ngie [Sun, 1 Jan 2017 05:21:08 +0000 (05:21 +0000)]
Install bsnmpclient(3) as snmp_client_{init,set_host,set_port}(3)

MFC after: 3 days
X-MFC with: r310999

7 years agoBump .Dd for the spelling and .Nm updates
ngie [Sun, 1 Jan 2017 05:16:24 +0000 (05:16 +0000)]
Bump .Dd for the spelling and .Nm updates

MFC after: 3 days

7 years agoFix spelling errors
ngie [Sun, 1 Jan 2017 05:14:58 +0000 (05:14 +0000)]
Fix spelling errors

MFC after: 3 days
Reported by: igor

7 years agobsnmpclient(3) also documents snmp_client_init, snmp_client_set_host,
ngie [Sun, 1 Jan 2017 05:13:54 +0000 (05:13 +0000)]
bsnmpclient(3) also documents snmp_client_init, snmp_client_set_host,
and snmp_client_set_port. Add them to the NAME section

MFC after: 3 days

7 years agoLook for list.h in ${.CURDIR} to unbreak the build with a ports-based copy
ngie [Sun, 1 Jan 2017 04:13:24 +0000 (04:13 +0000)]
Look for list.h in ${.CURDIR} to unbreak the build with a ports-based copy
of llvm38 on ^/stable/11 (oh, the bugs you find when you set CC,CXX,CPP
manually and it skips the bootstrap stage for the toolchain...)

7 years agoBump WARNS to 6 to catch simple QA issues like some of the ones I squashed
ngie [Sun, 1 Jan 2017 04:02:06 +0000 (04:02 +0000)]
Bump WARNS to 6 to catch simple QA issues like some of the ones I squashed
in r310994

7 years agoMake sys/vfs/lookup_cap_dotdot actually work with "kyua test"
ngie [Sun, 1 Jan 2017 04:01:27 +0000 (04:01 +0000)]
Make sys/vfs/lookup_cap_dotdot actually work with "kyua test"

The tests don't work when reading/writing to file descriptors in the
sandbox after entering capability mode (and wouldn't have, regardless
of the framework), so adjust the tests so they function within the
framework.

For tests that enter capability mode over the course of the test, the
following is now done:

  1. Fork child process for capability mode test.
  2. In child...
     i.   Enter capability mode.
     ii.  Test invariants.
     iii. Exit after calling test function.
  3. Collect status for child and determine whether or not it completed
     successfully.

In order to test the invariants in the child process, they now use assert(3)
instead of ATF_REQUIRE*, as the atf-c-api functions right to results files
in the directories in order to determine where and how tests fail.

While in the area, fix several -Wshadow and -Wunused warnings found when I
bumped WARNS up to 6, and fix some minor style(9) issues with indentation
and type alignment.

PR: 215690

7 years agoCall snmp_pdu_free on req/resp with a consistent, correct pattern
ngie [Sun, 1 Jan 2017 00:23:43 +0000 (00:23 +0000)]
Call snmp_pdu_free on req/resp with a consistent, correct pattern

- snmp_pdu_free should be called before snmp_pdu_create is called
  again
- snmp_pdu_free should be called on the resp to snmp_dialog when
  successful

Tested with the following bsnmp commands:

  % export SNMPUSER=bsnmp SNMPPASSWD=bsnmptest
  % SNMP_ARGS="-A proto=sha -C context='' -K -P proto=des -v 3 -r 0"
  % bsnmpset $SNMP_ARGS sysLocation="MyAgent"
  % bsnmpget $SNMP_ARGS sysLocation
  % bsnmpwalk $SNMP_ARGS

MFC after: 12 days
X-MFC with: r310729, r310892, r310894

7 years agosnmp_discover_engine: fix up req/resp (PDU object) handling a bit
ngie [Sat, 31 Dec 2016 23:20:57 +0000 (23:20 +0000)]
snmp_discover_engine: fix up req/resp (PDU object) handling a bit

- Call snmp_pdu_free on req and resp when done with the objects
- Call snmp_pdu_free on req before calling snmp_pdu_create on it
  again

MFC after: 1 week

7 years agosnmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not
ngie [Sat, 31 Dec 2016 22:46:17 +0000 (22:46 +0000)]
snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not
on the stack

Some of the callers try to determine whether or not `object` is valid by
testing the value for NULL, which will never be true if it's a stack value,
so in order to be clear and correct down the call stack, use a heap
allocated object.

This also addresses a Coverity issue by initializing all of `object` via
calloc

MFC after: 1 week
Reported by: Coverity
CID: 1006392

7 years agosnmp_output_resp: style(9): sort variables by alignment
ngie [Sat, 31 Dec 2016 22:18:33 +0000 (22:18 +0000)]
snmp_output_resp: style(9): sort variables by alignment

MFC after: 3 days

7 years agoUpdate ObsoleteFiles.inc for r310803
asomers [Sat, 31 Dec 2016 21:31:58 +0000 (21:31 +0000)]
Update ObsoleteFiles.inc for r310803

MFC after: 26 days
X-MFC-with: 310803