np [Thu, 23 Mar 2017 20:23:00 +0000 (20:23 +0000)]
MFC r314814 and r315325.
r314814:
cxgbe/iw_cxgbe: Abort connection if there is an error during c4iw_modify_qp.
r315325:
cxgbe/iw_cxgbe: Use the socket and not the toepcb to reach for the
inpcb. t4_tom detaches the inpcb from the toepcb as soon as the
hardware is done with the connection (in final_cpl_received) but the
socket is around as long as the cm_id and the rest of iWARP state is.
This fixes an intermittent NULL dereference during abort.
mav [Thu, 23 Mar 2017 06:55:32 +0000 (06:55 +0000)]
MFC r315067: Partially fix target task management requests handling.
- XPT_NOTIFY_ACKNOWLEDGE was not handled, causing stuck requests.
- XPT_ABORT was not even trying to abort active ATIOs/INOTs.
- Initiator's tag was not stored and not used where needed.
- List of TM request types needed update.
- mpt_scsi_tgt_status() missed some useful debugging.
After this change global TM requests, such as reset, should work properly.
ABORT TASK (ABTS) requests are still not passes to CTL, that is not good
and should be fixed.
mav [Thu, 23 Mar 2017 06:49:01 +0000 (06:49 +0000)]
MFC r314998: Fix FC target mode in mpt(4), broken in multiple ways.
- Not set BufferLength caused receive of empty ATIOs.
- CDB length guessing was broken at least for RC16.
- mpt_req_untimeout() was called with wrong req parameter.
- Sense data reporting was broken in several ways.
With this change my LSI7204EP-LC can pass at least basic tests as target.
The code is still far from perfect, but finally I found second hw/driver
after isp(4) that really can work in CAM target mode.
The sim_vid, hba_vid, and dev_name fields of struct ccb_pathinq are
fixed-length strings. AFAICT the only place they're read is in
sbin/camcontrol/camcontrol.c, which assumes they'll be null-terminated.
However, the kernel doesn't null-terminate them. A bunch of copy-pasted code
uses strncpy to write them, and doesn't guarantee null-termination. For at
least 4 drivers (mpr, mps, ciss, and hyperv), the hba_vid field actually
overflows. You can see the result by doing "camcontrol negotiate da0 -v".
This change null-terminates those fields everywhere they're set in the
kernel. It also shortens a few strings to ensure they'll fit within the
16-character field.
mav [Thu, 23 Mar 2017 06:37:23 +0000 (06:37 +0000)]
MFC r308423 (by scottl):
Fix the fallout from r308268 (mpt driver causes endless witness warnings in
VMWare and elsewhere) with the precision of a dull, rusty butter knife.
ngie [Thu, 23 Mar 2017 04:54:31 +0000 (04:54 +0000)]
MFC r315360:
Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files}
This is being done for the following reasons:
- kvm_open(3), etc says they will return NULL.
- NULL by definition is (void*)0 per POSIX, but can be redefined,
depending on the compiler, etc.
ngie [Thu, 23 Mar 2017 04:50:50 +0000 (04:50 +0000)]
MFC r315363,r315365:
r315363:
Fix manlint errors
- Add missing comma after kvm_dpcpu_setcpu .Nm macro use (multiple
.Nm entries should be separated by commas)
- Add missing section for kvm_dpcpu_setcpu Xr.
r315365:
Tweak r315363 slightly
I noticed after commit that kvm_dpcpu_setcpu was defined in the manpage.
Thus, the correct macro for the function reference is .Fn, not .Xr.
ngie [Thu, 23 Mar 2017 04:47:43 +0000 (04:47 +0000)]
MFC r315654:
Fix linking /rescue/rescue to multiple programs in usr.bin after r315113
I meant for the line that conditionally added in /usr/bin/nc support to
be `+=', not `=`. This restores hardlinks for all programs in usr.bin
specified before nc(1), e.g., bunzip2 and tar.
bdrewery [Wed, 22 Mar 2017 18:35:48 +0000 (18:35 +0000)]
MFC r314709,r314790,r314794:
r314709:
Fix bootstrapping mtree after r313404 for older systems.
r314790:
Added comments for why nmtree/libmd are bootstrapped.
r314794:
Fix bootstrapping libmd on older systems after r314709.
ngie [Wed, 22 Mar 2017 01:11:13 +0000 (01:11 +0000)]
MFC r315320:
Start adding basic tests for cam(3)
This change contains several negative and positive tests for:
- cam_open_device
- cam_close_device
- cam_getccb
- cam_freeccb
This also contains a test for the failure case noted in bug 217649,
i.e., O_RDWR must be specified because pass(4) requires it.
This test unfortunately cannot assume that cam-capable devices are
present, so the user must explicitly provide a device via
`test_suites.FreeBSD.cam_test_device`. In the future, a test kernel
module might be shipped, or ctl(4) might be used, as a test device
when testing out libcam, which will allow the tests to do away with
having to specify an explicit test device.
vangyzen [Tue, 21 Mar 2017 01:24:56 +0000 (01:24 +0000)]
MFC r315510
nanosleep: plug a kernel memory disclosure
nanosleep() updates rmtp on EINVAL. In that case, kern_nanosleep()
has not updated rmt, so sys_nanosleep() updates the user-space rmtp
by copying garbage from its stack frame. This is not only a kernel
memory disclosure, it's also not POSIX-compliant. Fix it to update
rmtp only on EINTR.
ngie [Mon, 20 Mar 2017 03:13:03 +0000 (03:13 +0000)]
MFC r315206:
bsnmpd: fix segfault when trans_insert_port(..) is called with multiple
out of order addresses
Move `port->transport` initialization before the TAILQ_FOREACH(..) loop
to ensure that the value is properly initialized before it's inserted
into the TAILQ.
ngie [Mon, 20 Mar 2017 03:01:23 +0000 (03:01 +0000)]
MFC r315202:
lib/libcam/cam_cdbparse.3: fix manpage warnings
- Add comma before and after 'e.g.'; remove surrounding parentheses
that were unnecessary after this change [1].
- Add .Mt when referencing ken and Peter Dufault's email addresses
[2].
- Sprinkle around .An use where proper [2].
ngie [Mon, 20 Mar 2017 03:00:22 +0000 (03:00 +0000)]
MFC r315132,r315133,r315186:
r315132:
Use .Dv when referencing NULL
This is the correct markup macro, as opposed to .Va (variable names)
While here, annotate several bare references to `NULL` with .Dv.
r315133:
lib/libcam/cam.3: fix manpage warnings
- spelling: "mis-named" should be "misnamed".
- delete spaces interspersed in literal representation of
`struct cam_device` as hard-tabs separate the types and fields.
- Add commas after `e.g.`.
r315186:
lib/libcam/cam.3: note that cam_freeccb(3) with ccb == NULL is a no-op
This allows me to accurately test this scenario, and for others to rely
on the behavior, instead of relying on knowledge obtained via code
inspection.
pfg [Mon, 20 Mar 2017 00:55:24 +0000 (00:55 +0000)]
MFC r315212, r315213, r315214, r315215:
mkimg(1): let calloc(3) do the multiplication.
nscd(8): let calloc(3) do the multiplying.
mpsutil(8): let calloc(3) do the multiplying.
ypbind(8): let calloc(3) do the multiplying.
erj [Thu, 16 Mar 2017 23:18:57 +0000 (23:18 +0000)]
ixgbe(4): Fix VF build failure on i386 caused by r315333
SYSCTL_ADD_UQUAD on i386 expects a uint64_t pointer, and not an
unsigned long pointer. So change the data type of the original variable to
u64 (uint64_t) from unsigned long, since the statistics are intended to be
64 bits, anyway.
mm [Thu, 16 Mar 2017 23:08:18 +0000 (23:08 +0000)]
MFC r314571:
Update libarchive to version 3.3.1 (and sync with latest vendor dist)
Notable vendor changes:
PR #501: improvements in ACL path handling
PR #724: fix hang when reading malformed cpio files
PR #864: fix out of bounds read with malformed GNU tar archives
Documentation, style, test suite improvements and typo fixes.
New options to bsdtar that enable or disable reading and/or writing of:
Access Control Lists (--acls, --no-acls)
Extended file flags (--fflags, --no-fflags)
Extended attributes (--xattrs, --no-xattrs)
Mac OS X metadata (Mac OS X only) (--mac-metadata, --no-mac-metadata)
mav [Thu, 16 Mar 2017 07:11:35 +0000 (07:11 +0000)]
MFC r314549: Execute last ZIO of log commit synchronously.
For short transactions overhead of context switch can be too large.
Skipping it gives significant latency reduction. For large ones,
including multiple ZIOs, latency is less critical, while throughput
there may become limited by checksumming speed of single CPU core.
To get best of both cases, execute last ZIO directly from calling
thread context to save latency, while all others (if there are any)
enqueue to taskqueues in traditional way.
ngie [Thu, 16 Mar 2017 01:59:43 +0000 (01:59 +0000)]
MFC r314924:
sbin/devfs: clarify usage
- Note existence of -m option.
- Note that -s applies to rule keyword, only, by adding usage text
specifically for the `rule` and `ruleset` keywords.
Don't go into any further detail in usage(..) -- it's best that one
reads the manpage to get a better idea of how things work as there are
a number of different option-specific keywords and arguments, as well
as some rule grammar.
ngie [Thu, 16 Mar 2017 01:47:26 +0000 (01:47 +0000)]
MFC r274130:
r274130 (by bapt):
Avoid installing security.functions with executable bits, periodic(8) will
try to execute all files with an executable bit in /etc/periodic/*/ while
this file is supposed only to be sourced by others
badger [Thu, 16 Mar 2017 01:41:36 +0000 (01:41 +0000)]
MFC r313733:
sleepq_catch_signals: do thread suspension before signal check
Since locks are dropped when a thread suspends, it's possible for another
thread to deliver a signal to the suspended thread. If the thread awakens from
suspension without checking for signals, it may go to sleep despite having
a pending signal that should wake it up. Therefore the suspension check is
done first, so any signals sent while suspended will be caught in the
subsequent signal check.
ngie [Thu, 16 Mar 2017 01:38:04 +0000 (01:38 +0000)]
MFC r314830:
mergemaster: fix description of -p
-p only handles updating /etc/master.passwd and /etc/group . No more,
no less.
Also, mergemaster (and no other portions of the vanilla FreeBSD build
process) should be messing with __MAKECONF or SRCCONF as part of the
installworld or distribution process. Don't insinuate that mergemaster
does that as it's a false claim.
erj [Wed, 15 Mar 2017 21:20:17 +0000 (21:20 +0000)]
ixgbe(4): Update to 3.2.11-k
Includes:
1. Support for X553 (Denverton) Ethernet devices.
2. Initialization code refactoring.
3. ixgbe-specific netmap code moved to ixgbe folder
(but not removed from dev/netmap/).
4. VF driver full split. Some cleanup can be had due to redundant code,
but this split goes inline with the refactoring.
NOTE: This is a direct commit to stable/10. Newer branches will receive an
iflib-converted version of ixgbe, with these updates included, instead.
dim [Wed, 15 Mar 2017 19:50:58 +0000 (19:50 +0000)]
MFC r310232:
After r310171, the kernel version of sscanf() has format string checking
enabled. This results in a -Werror warning in mlx4ib:
sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c:90:22: error: format specifies type 'unsigned long long *' but the argument has type 'u64 *' (aka 'unsigned long *') [-Werror,-Wformat]
sscanf(buf, "%llx", &sysadmin_ag_val);
~~~~ ^~~~~~~~~~~~~~~~
Change sysadmin_ag_val to unsigned long long to avoid the warning.
hselasky [Tue, 14 Mar 2017 15:56:19 +0000 (15:56 +0000)]
MFC r314328:
Fix startup race initialising ACPI CM battery structures on MacBookPro.
During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.
hselasky [Tue, 14 Mar 2017 15:50:36 +0000 (15:50 +0000)]
MFC r313941:
Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.
This patch adds a thread construction and destruction call for the
first thread in a procedure.
hselasky [Tue, 14 Mar 2017 15:37:29 +0000 (15:37 +0000)]
MFC r312551:
Fix for race leading to endless timer interrupts related to
configtimer().
During normal operation "state->nextcallopt" will always be less than
or equal to "state->nextcall" and checking only "state->nextcallopt"
before calling "callout_process()" is sufficient. However when
"configtimer()" is called a race might happen requiring both of these
binary times to be checked.
Short description of race:
1) A configtimer() call will reset both "state->nextcall" and
"state->nextcallopt" to the same binary time.
2) If a "callout_reset()" call happens between "configtimer()" and the
next "callout_process()" call, "state->nextcallopt" will get updated
and "state->nextcall" will remain at the current time. Refer to logic
inside cpu_new_callout().
3) getnextcpuevent() only respects "state->nextcall" and returns this
value over and over again, even if it is in the past, until "now >=
state->nextcallopt" becomes true. Then these two time variables are
corrected by a "callout_process()" call and the situation goes back to
normal.
The problem manifests itself in different ways. The common factor is
the timer process(es) consume all CPU on one or more CPU cores for a
long time, blocking other kernel processes from getting execution
time. This can be seen by very high interrupt counts as displayed by
"vmstat -i | grep timer" right after boot.
When EARLY_AP_STARTUP was enabled in r310177 the likelyhood of hitting
this bug apparently increased.
Example output from "vmstat -i" before patch:
cpu0:timer 7591 69
cpu9:timer 39031773 358089
cpu4:timer 9359 85
cpu3:timer 9100 83
cpu2:timer 9620 88
Example output from "vmstat -i" after patch:
cpu0:timer 4242 34
cpu6:timer 5531 44
cpu3:timer 6450 52
cpu1:timer 4545 36
cpu9:timer 7153 58
Before the patch cpu9 in the example above, was spinning in a loop in
order to reach 39 million interrupts just a few seconds after
bootup. After the patch the timer interrupt counts are more or less
consistent.
Discussed with: mav @
Reported by: several people
Sponsored by: Mellanox Technologies
hselasky [Tue, 14 Mar 2017 15:28:59 +0000 (15:28 +0000)]
MFC r312424:
Fix problem with suspend and resume when using Skylake chipsets. Make
sure the XHCI controller is reset after halting it. The problem is
clearly a BIOS bug as the suspend and resume is failing without
loading the XHCI driver. The same happens when using Linux and the
XHCI driver is not loaded.
mav [Mon, 13 Mar 2017 06:52:29 +0000 (06:52 +0000)]
MFC r314786: Import mpr(4) driver P12 to P14 diff from vendor site.
This is mostly a version bump to stay in version number sync with firmware.
The only change there was cosmetic: Display degraded speed message upon
receiving Active Cable Exception Event with DEGRADED reason code.
ATF_TP_ADD_TC should use `tp` as the second argument, not `tcs`, as
ATF_TP_ADD_TCS uses `tp` as its first argument.
Bump .Dd for the change.
r314796:
Fix atf-sh(3) manpage issues
- Fix spelling errors (specifiying -> specifying) [1]
- Escape '.' at start of lines using & to tell the roff processor
that the line isn't meant to be treated as a command [2].
Bump .Dd for the change
r314797:
Fix grammar warning noted by igor
Remove surrounding ellipses in e.g. section and add a comma before and after
the e.g. reference.
r314798:
Fix out-of-order sections in atf-sh(1)
- `.Op` must be used in the SYNOPSIS section, not the NAME section.
- Move ATF_SHELL environment variable description up to first
ENVIRONMENT section. Garbage collect the duplicate ENVIRONMENT
section.
Bump .Dd for the change
r314799:
Fix manlint issues with atf-check(1)
- Use `.Bf Em`/`.Ef` instead of prefixing lines with `.Em`. The forms
are equivalent with traditional roff, but unnecessarily verbose. The
former form applies the .Em macro to the enclosed block.
- Move EXIT_STATUS section down so the section complies with section
ordering specified by mdoc(7) and enforced by manlint(1).
Bump .Dd for the change
r314800:
Fix issues with atf-check(1) found by igor and refer to atf-check(1)
- Fix typo (specifiying -> specifying)
- Add atf-check(1) to SEE ALSO section for completeness. It's mentioned
above, but by convention the SEE ALSO section should list all relevant
references to other tools and APIs.
Bump .Dd for the change
r314801:
Fix igor/manlint issues with atf-c(3)
- Remove surrounding ellipses in i.e. section and add a comma before
and after the i.e. reference [1].
- Fix typo (specifiying -> specifying) [1].
- Escape '.' at start of lines using & to tell the roff processor
that the line isn't meant to be treated as a command [2].
Bump .Dd for the change
r314802:
Fix atf-c-api(3) manpage issues
- Fix typo (specifiying -> specifying).
- Remove surrounding ellipses in i.e. section and add a comma before
and after the i.e. reference.
Bump .Dd for the change
r314803:
Fix typos
- specifiying -> specifying
- manged -> managed
Bump .Dd for the change
r314804:
Fix issues noted by igor/manlint
- Fix typos [1]:
-- manged -> managed
-- specifiying -> specifying
- Escape '.' at start of lines using & to tell the roff processor
that the line isn't meant to be treated as a command [2].
Bump .Dd for the change
r314805:
Remove *-api(3) manpages removed in ATF 0.21
I overlooked the fact that these manpages had been removed upstream
and replaced with their non *-api(3) equivalents. Follow upstream's
lead and remove the unused manpages.
mav [Sun, 12 Mar 2017 06:18:41 +0000 (06:18 +0000)]
MFC r314307: Add support for SIMs without autosense.
If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).
ngie [Sun, 12 Mar 2017 04:57:21 +0000 (04:57 +0000)]
MFC r314545:
Add missing section to .Xr macro calls for wpifw(4)
The driver manpage for wpifw(4) is missing, but will be added soon. This
fixes the other 2 .Xr calls lacking sections to match the 3rd,
syntactically correct, reference in the SEE ALSO section.
ngie [Sun, 12 Mar 2017 04:32:31 +0000 (04:32 +0000)]
MFC r314239:
Add shutdown/poweroff support to rescue(8)
shutdown is a safer way to power off than reboot (in general), because of
the added shutdown process that it executes via /etc/rc.shutdown . It was
odd that it was missing from rescue(8) since reboot and friends were
added in past commits.
While here, alias poweroff to shutdown for parity with sbin/shutdown/Makefile
avg [Sat, 11 Mar 2017 15:21:34 +0000 (15:21 +0000)]
qlxgbe: add GCC_MS_EXTENSIONS to CFLAGS to make old base GCC happy
The module uses unnamed structure and union fields and base GCC in
stable/10 doesn't like it.
I think that that is a C11 feature, so it is courteous of more modern
compilers to not complain about it when compiling in C99 mode.
This is a direct commit as the change is not required in head.
dchagin [Sat, 11 Mar 2017 08:40:59 +0000 (08:40 +0000)]
MFC r303464 (by brooks@):
Don't create pointless backups of generated files in "make sysent".
Any sensible workflow will include a revision control system from which
to restore the old files if required. In normal usage, developers just
have to clean up the mess.
loos [Sat, 11 Mar 2017 07:54:05 +0000 (07:54 +0000)]
MFC of r314281:
Disable the driver managed queue for igb(4) when the legacy transmit
interface is used.
The legacy API (IGB_LEGACY_TX) is enabled when ALTQ is built into kernel.
As noted in altq(9), it is responsibility of the caller to protect this
queue against concurrent access and, in the igb case, the interface send
queue is protected by tx queue mutex. This obviously cannot protect the
driver managed queue against concurrent access from different tx queues
and leads to numerous and quite strange panic traces (usually shown as
packets disappearing into thin air).
Improving the locking to cope with this means serialize all access to this
(single) queue and produces no gain, it actually affects the performance
quite noticeabily.
The driver managed queue is already disabled when an ALTQ queue discipline
is set on interface (in altq_enable()), because the driver managed queue
can interfere with ALTQ timing (whence the reports that setting an ALTQ
queue discipline on interface also fixes the issue).
Disabling this additional queue keeps the ability to use if_start() to
send packets to individual NIC queues while it simply eliminate the race.
This is a direct commit to stable/11 as -head driver does not support ALTQ
anymore.