diff options
author | ken <ken@FreeBSD.org> | 2016-12-12 21:54:49 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 2016-12-12 21:54:49 +0000 |
commit | cd86997f649cf620c319061f6d42b4aefdae8966 (patch) | |
tree | 8caa158594a1fc28089289278ac04ee07d0ff153 /include/complex.h | |
parent | 3a66497d3c950f9e711480c1d5ef61d132f96c6c (diff) | |
download | FreeBSD-src-cd86997f649cf620c319061f6d42b4aefdae8966.zip FreeBSD-src-cd86997f649cf620c319061f6d42b4aefdae8966.tar.gz |
MFC r307684, r307747
------------------------------------------------------------------------
r307684 | ken | 2016-10-20 13:42:26 -0600 (Thu, 20 Oct 2016) | 13 lines
For CCBs allocated on the stack, we need to clear the entire CCB, not just
the header. Otherwise stack garbage can lead to random flags getting set.
This showed up as 'camcontrol rescan all' failing with EINVAL because the
address type wasn't CAM_DATA_VADDR.
sbin/camcontrol/camcontrol.c:
In rescan_or_reset_bus(), bzero the stack-allocated CCBs before
use instead of clearing the body.
Sponsored by: Spectra Logic
------------------------------------------------------------------------
r307747 | ken | 2016-10-21 12:54:56 -0600 (Fri, 21 Oct 2016) | 27 lines
Fix a problem in camcontrol(8) that cropped up with r307684.
In r307684, I changed rescan_or_reset_bus() to bzero stack-allocated CCBs
before sending them to the kernel because there was stack garbage in there
that wound up meaning that bogus CCB flags were set.
While this fixed the 'camcontrol rescan all' case (XPT_DEV_MATCH CCBs were
failing previously), it broke the 'camcontrol rescan 0' (or any other
number) case when INVARIANTS are turned on. Rescanning a single bus
reliably produced an assert in cam_periph_runccb():
panic: cam_periph_runccb: ccb=0xfffff80044ffe000, func_code=0x708, flags=0xffffdde0
The flags values don't make sense from the code. Changing the CCBs in
rescan_or_reset_bus() from stack to heap allocated avoids the problem.
It would be better to understand why userland stack allocated CCBs don't
work properly, since there may be other code that breaks if stack allocated
CCBs don't work.
sbin/camcontrol/camcontrol.c:
In rescan_or_reset_bus(), allocate the CCBs using malloc(3) instead
of on the stack to avoid an assertion in cam_periph_runccb().
Sponsored by: Spectra Logic
------------------------------------------------------------------------
Sponsored by: Spectra Logic
Diffstat (limited to 'include/complex.h')
0 files changed, 0 insertions, 0 deletions