Revision tags: release/14.0.0 |
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0 |
|
#
bcce9c5b |
| 25-Nov-2021 |
Scott Long <scottl@FreeBSD.org> |
Fix "set but not used" warnings in the mps driver.
|
#
175ad3d0 |
| 03-Jun-2021 |
Kenneth D. Merry <ken@FreeBSD.org> |
Fix mpr(4) and mps(4) state transitions and a use-after-free panic.
When the mpr(4) and mps(4) drivers probe a SATA device, they issue an ATA Identify command (via mp{s,r}sas_get_sata_identify()) be
Fix mpr(4) and mps(4) state transitions and a use-after-free panic.
When the mpr(4) and mps(4) drivers probe a SATA device, they issue an ATA Identify command (via mp{s,r}sas_get_sata_identify()) before the target is fully setup in the driver. The drivers wait for completion of the identify command, and have a 5 second timeout. If the timeout fires, the command is marked with the SATA_ID_TIMEOUT flag so it can be freed later.
That is where the use-after-free problem comes in. Once the ATA Identify times out, the driver sends a target reset, and then frees any identify commands that have timed out. But, once the target reset completes, commands that were queued to the drive are returned to the driver by the controller.
At that point, the driver (in mp{s,r}_intr_locked()) looks up the command descriptor for that particular SMID, marks it CM_STATE_BUSY and sends it on for completion handling.
The problem at this stage is that the command has already been freed, and put on the free queue, so its state is CM_STATE_FREE. If INVARIANTS are turned on, we get a panic as soon as this command is allocated, because its state is no longer CM_STATE_FREE, but rather CM_STATE_BUSY.
So, the solution is to not free ATA Identify commands that get stuck until they actually return from the controller. Hopefully this works correctly on older firmware versions. If not, it could result in commands hanging around indefinitely. But, the alternative is a use-after-free panic or assertion (in the INVARIANTS case).
This also tightens up the state transitions between CM_STATE_FREE, CM_STATE_BUSY and CM_STATE_INQUEUE, so that the state transitions happen once, and we have assertions to make sure that commands are in the correct state before transitioning to the next state. Also, for each state assertion, we print out the current state of the command if it is incorrect.
mp{s,r}.c: Add a new sysctl variable, dump_reqs_alltypes, that controls the behavior of the dump_reqs sysctl. If dump_reqs_alltypes is non-zero, it will dump all commands, not just the commands that are in the CM_STATE_INQUEUE state. (You can see the commands that are in the queue by using mp{s,r}util debug dumpreqs.)
Make sure that the INQUEUE -> BUSY state transition happens in one place, the mp{s,r}_complete_command routine.
mp{s,r}_sas.c: Make sure we print the current command type in command state assertions.
mp{s,r}_sas_lsi.c: Add a new completion handler, mp{s,r}sas_ata_id_complete. This completion handler will free data allocated for an ATA Identify command and free the command structure.
In mp{s,r}_ata_id_timeout, do not set the command state to CM_STATE_BUSY. The command is still in queue in the controller. Since we were blocking waiting for this command to complete, there was no completion handler previously. Set the completion handler, so that whenever the command does come back, it will get freed properly.
Do not free ATA Identify commands that have timed out in mp{s,r}sas_add_device(). Wait for them to actually come back from the controller.
mp{s,r}var.h: Add a dump_reqs_alltypes variable for the new dump_reqs_alltypes sysctl.
Make sure we print the current state for state transition asserts.
This was tested in the Spectra Logic test bed (as described in the review), as well Netflix's Open Connect fleet (where panics dropped from a dozen or two a month to zero).
Reviewed by: imp@ (who is handling the commit with ken's OK) Sponsored by: Spectra Logic Differential Revision: https://reviews.freebsd.org/D25476
show more ...
|
Revision tags: release/13.0.0, release/12.2.0 |
|
#
742c5f20 |
| 02-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
mps: clean up empty lines in .c and .h files
|
Revision tags: release/11.4.0 |
|
#
75dfc66c |
| 27-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358269 through r358399.
|
#
0d87f3c7 |
| 26-Feb-2020 |
Warner Losh <imp@FreeBSD.org> |
Remove support for all pre FreeBSD 11.0 versions from mpr and mps.
Remove a number of workarounds for older versions of FreeBSD. FreeBSD stable/10 was branched over 6 years ago. All of these changes
Remove support for all pre FreeBSD 11.0 versions from mpr and mps.
Remove a number of workarounds for older versions of FreeBSD. FreeBSD stable/10 was branched over 6 years ago. All of these changes date from about that time or earlier. These workarounds are extensive and get in the way of understanding the current flow in the driver.
show more ...
|
Revision tags: release/12.1.0 |
|
#
a63915c2 |
| 28-Jul-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @r350386
Sponsored by: The FreeBSD Foundation
|
#
8fe7bf06 |
| 08-Jul-2019 |
Warner Losh <imp@FreeBSD.org> |
Fix bugs in recovery path and improve cm tracking
Eliminate the TIMEDOUT state. This state really conveyed two different concepts: I timed out during recovery (and my command got put on the recovery
Fix bugs in recovery path and improve cm tracking
Eliminate the TIMEDOUT state. This state really conveyed two different concepts: I timed out during recovery (and my command got put on the recovery queue), and I timed out diring discovery (which doesn't). Separate those two concepts into two flags. Use the TIMEDOUT flag to fail requests as timed out. Use the on queue flag to remove them from the queue.
In mps_intr_locked for MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY message type, when completing commands, ignore the ones that are not in state INQUEUE. They were already completed as part of the recovery process. When we complete them twice, we wind up with entries on the free queue that are marked as busy, trigging asserts.
Reviewed by: scottl (earlier version, just for mpr) Differential Revision: https://reviews.freebsd.org/D20785
show more ...
|
Revision tags: release/11.3.0 |
|
#
7648bc9f |
| 13-May-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @347527
Sponsored by: The FreeBSD Foundation
|
#
e7ef108c |
| 08-May-2019 |
Warner Losh <imp@FreeBSD.org> |
Add missing newline to debug printf.
|
#
86312e46 |
| 21-Dec-2018 |
Conrad Meyer <cem@FreeBSD.org> |
mps(4), mpr(4): remove SATA ID command cancellation hack
Add a generic mechanism to override mp?_wait_command's timeout behavior, which continues to invoke reinit by default. Invokers who set cm_ti
mps(4), mpr(4): remove SATA ID command cancellation hack
Add a generic mechanism to override mp?_wait_command's timeout behavior, which continues to invoke reinit by default. Invokers who set cm_timeout_handler may avoid automatic reinit and do their own handling.
Adapt mp?sas_get_sata_identify to this mechanism and remove its callout hack.
Reviewed by: scottl Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18614
show more ...
|
#
8277ce2b |
| 21-Dec-2018 |
Conrad Meyer <cem@FreeBSD.org> |
mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
In the event that the ID command timed out, mps(4)/mpr(4) did not free the command until it could be cancelled. However,
mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
In the event that the ID command timed out, mps(4)/mpr(4) did not free the command until it could be cancelled. However, it freed the associated buffer (cm_data). Fix the lifetime issue by freeing the associated buffer only after Abort Task or controller reset.
Reviewed by: scottl Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D18612
show more ...
|
Revision tags: release/12.0.0 |
|
#
3611ec60 |
| 18-Aug-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r337646 through r338014.
|
#
acc173a6 |
| 13-Aug-2018 |
Warner Losh <imp@FreeBSD.org> |
Port the mps panic-safe shutdown_final handling to mpr
r330951 by smh fixed the mps driver to avoid deadlocks when panicing. The same code is needed for mpr, so port it here, along with the fix whic
Port the mps panic-safe shutdown_final handling to mpr
r330951 by smh fixed the mps driver to avoid deadlocks when panicing. The same code is needed for mpr, so port it here, along with the fix which allows the CCBs scheduled to complete avoiding at least a scary message and likely other unintended consequences.
Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16663
show more ...
|
#
d4b95382 |
| 13-Aug-2018 |
Warner Losh <imp@FreeBSD.org> |
Call xpt_sim_poll in shutdown_final handler.
When we're shutting down, we send a number of start/stop commands to the known targets. We have to wait for them to complete. During a panic, the interru
Call xpt_sim_poll in shutdown_final handler.
When we're shutting down, we send a number of start/stop commands to the known targets. We have to wait for them to complete. During a panic, the interrupts are off, and using pause to wait for them to fire and complete won't work: we have to poll after pause returns so the completion routines of the CCBs run so we decrement work outstanding counts.
Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D16663
show more ...
|
Revision tags: release/11.2.0 |
|
#
7d147b81 |
| 14-Mar-2018 |
Steven Hartland <smh@FreeBSD.org> |
Fix mps deadlock when handling panic
During shutdown mps waits for its SSU requests to complete however when performing a reboot after handling a panic the scheduler is stopped so getmicrotime which
Fix mps deadlock when handling panic
During shutdown mps waits for its SSU requests to complete however when performing a reboot after handling a panic the scheduler is stopped so getmicrotime which is used can be non-functional.
Switch to using the same method as shutdown_panic to ensure we actually complete.
In addition reduce the timeout when RB_NOSYNC is set in howto as we expect this to fail.
Reviewed by: slm MFC after: 1 week Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D12776
show more ...
|
#
718cf2cc |
| 27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
show more ...
|
#
c2c014f2 |
| 07-Nov-2017 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Merge ^/head r323559 through r325504.
|
Revision tags: release/10.4.0 |
|
#
e5d34ca9 |
| 23-Sep-2017 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r320180
|
#
aeb9ac0d |
| 22-Sep-2017 |
Scott Long <scottl@FreeBSD.org> |
Clean up error messages related to device discovery
Sponsored by: Netflix
|
#
b754c279 |
| 13-Sep-2017 |
Navdeep Parhar <np@FreeBSD.org> |
MFH @ r323558.
|
#
3934d280 |
| 28-Aug-2017 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r322957
|
#
757ff642 |
| 27-Aug-2017 |
Scott Long <scottl@FreeBSD.org> |
Start overhauling debug printing in the MPS and MPR drivers. The focus of this commit it to make initiazation less chatty in the normal case, and more useful and informative when real debugging is t
Start overhauling debug printing in the MPS and MPR drivers. The focus of this commit it to make initiazation less chatty in the normal case, and more useful and informative when real debugging is turned on.
Reviewed by: ken (earlier version) Sponsored by: Netflix
show more ...
|
#
083c8ded |
| 13-Aug-2017 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r322451
|