-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix use-after-free of zfsvfs after unmount #288
Fix use-after-free of zfsvfs after unmount #288
Conversation
With this the tests.py with no delay finally passes consistently. |
Should we include removing the delays from the tests in this PR or in #286? |
This test can be used to easily reproduce the error: fsutil file createnew C:\testfolder\poolfile.bin 200000000
:hans
zpool create tank \\?\C:\testfolder\poolfile.bin
zpool destroy tank
goto hans
del C:\testfolder\poolfile.bin |
9bce63d
to
770fa7d
Compare
I don't think it matters as long as they get merged with or after this one gets merged |
Yay, |
Hmmm, while unlikely to occur, I think there is an issue with this, |
We also can't just |
770fa7d
to
669adec
Compare
Updated to add |
cd5f081
to
73b95fb
Compare
Sorry, converting to draft because I think my last change is wrong, checking the |
We should also have a test for flushing on unmount, I'll try to add one. |
Ideally we'd set both |
73b95fb
to
f848a9d
Compare
Updated, I think that is the best I can come up with :\ |
f848a9d
to
e58b00a
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This is unrelated, and has been a thorn for quite some time. |
e58b00a
to
5764746
Compare
Yea, I found #95 which seems to be the same. I added my info there. |
5764746
to
350db38
Compare
I think there are a bunch more locations that might need a NULL check, I have a change for that too, but haven't tested it enough yet. Better to have a NULL dereference than having to chase a use-after-free though. |
Generally, all requests to ZFS come in via |
|
During unmount `zfsvfs` is destroyed and the pointer is zeroed in the VCB. There is however still a copy of the pointer in the DCB. Windows can still call into `zfs_AcquireForLazyWrite`, through `CcMgr` after unmount and this would use the already freed `zfsvfs` pointer. To fix this we set the pointer to zero in the DCB and add a zero check in `zfs_AcquireForLazyWrite`, `zfs_AcquireForReadAhead` and `fastio_acquire_for_mod_write`. Signed-off-by: Axel Gembe <[email protected]>
350db38
to
f6fbd3f
Compare
Fix for checkstyle |
51b8af1
into
openzfsonwindows:zfs-Windows-2.2.0-release
During unmount `zfsvfs` is destroyed and the pointer is zeroed in the VCB. There is however still a copy of the pointer in the DCB. Windows can still call into `zfs_AcquireForLazyWrite`, through `CcMgr` after unmount and this would use the already freed `zfsvfs` pointer. To fix this we set the pointer to zero in the DCB and add a zero check in `zfs_AcquireForLazyWrite`, `zfs_AcquireForReadAhead` and `fastio_acquire_for_mod_write`. Signed-off-by: Axel Gembe <[email protected]>
During unmount `zfsvfs` is destroyed and the pointer is zeroed in the VCB. There is however still a copy of the pointer in the DCB. Windows can still call into `zfs_AcquireForLazyWrite`, through `CcMgr` after unmount and this would use the already freed `zfsvfs` pointer. To fix this we set the pointer to zero in the DCB and add a zero check in `zfs_AcquireForLazyWrite`, `zfs_AcquireForReadAhead` and `fastio_acquire_for_mod_write`. Signed-off-by: Axel Gembe <[email protected]>
During unmount
zfsvfs
is destroyed and the pointer is zeroed in the VCB. There is however still a copy of the pointer in the DCB.Windows can still call into
zfs_AcquireForLazyWrite
, throughCcMgr
after unmount and this would use the already freedzfsvfs
pointer.To fix this we set the pointer to zero in the DCB and add a zero check in
zfs_AcquireForLazyWrite
,zfs_AcquireForReadAhead
andfastio_acquire_for_mod_write
.fixes #282