-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zfs_allow_log_destroy parameter NULL pointer dereference #4872
Comments
Under Linux tsd_set() will call the destructor on the thread specific data when the passed value is NULL. Therefore, there is no need to call strfree() on the poolname after tsd_set(). The call to tsd_set() must also be moved after spa_open() to prevent a use-after-free style defect. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue openzfs#4872
Proposed fix in #4884, reviews welcome. |
I should add that the proposed fix doesn't exactly agree with the stack trace you posted since it suggests the error occurred in tsd_set(). However, the way Linux kernel unwinds stack traces makes them not 100% reliable so this may the second |
@heary-cao |
I've added the ``` to the original comment for readability. |
It seems to be doing strlen. |
Oh yeah we does, so this is pretty old version isn't it. |
zfs_allow_log_destroy parameter NULL pointer dereference issues: please see openzfs#4872 Observed during Linux 2.6.32.41 automated testing while running the ZFS Test Suite. Cause ZFS software to produce coredump. Cause analysis: In zfs_ioc_log_history function, the implementation of tsd_set function, will he_value of the TSD module is set to null, resulting in TSD module remove a entry, so he_value of the entry is null, casue to implement zfs_allow_log_key private function zfs_allow_log_destroy. zfs_allow_log_destroy parameter is null, the strfree a null. Produce coredump. Solution: 1, in order to safety, in the zfs_ioc_log_history function,from the TSD module to get to the poolName, it is possible for the NULL, so whether the processing of NULL. if poolname is NULL,return error. 2, zfs_allow_log_key of the private function zfs_allow_log_destroy in the Senate, it is possible for the emergence of NULL, so for arg release when the judge for the NULL and then strfree it.
zfs_allow_log_destroy parameter NULL pointer dereference issues: please see zfsonlinux#4872 Observed during Linux 2.6.32.41 automated testing while running the ZFS Test Suite. Cause ZFS software to produce coredump. Cause analysis: In zfs_ioc_log_history function, the implementation of tsd_set function, will he_value of the TSD module is set to null, resulting in TSD module remove a entry, so he_value of the entry is null, casue to implement zfs_allow_log_key private function zfs_allow_log_destroy. zfs_allow_log_destroy parameter is null, the strfree a null. Produce coredump. Solution: 1, in order to safety, in the zfs_ioc_log_history function,from the TSD module to get to the poolName, it is possible for the NULL, so whether the processing of NULL. if poolname is NULL,return error. 2, zfs_allow_log_key of the private function zfs_allow_log_destroy in the Senate, it is possible for the emergence of NULL, so for arg release when the judge for the NULL and then strfree it.
A really really old version. The odd thing I see about this backtrace is |
@behlendorf Yes I notice the [zfs] thing too. |
dear all: see strfree coredump, we code review zfs-0.6.5.7, the coredump process is basically no change. I have a commit pull requests, please reviews. thinks you! |
@heary-cao |
zfs_allow_log_destroy parameter NULL pointer dereference issues: please see openzfs#4872 Observed during Linux 2.6.32.41 automated testing while running the ZFS Test Suite. Cause ZFS software to produce coredump. Cause analysis: In zfs_ioc_log_history function, the implementation of tsd_set function, will he_value of the TSD module is set to null, resulting in TSD module remove a entry, so he_value of the entry is null, casue to implement zfs_allow_log_key private function zfs_allow_log_destroy. zfs_allow_log_destroy parameter is null, the strfree a null. Produce coredump. Solution: 1, in order to safety, in the zfs_ioc_log_history function,from the TSD module to get to the poolName, it is possible for the NULL, so whether the processing of NULL. if poolname is NULL,return error. 2, zfs_allow_log_key of the private function zfs_allow_log_destroy in the Senate, it is possible for the emergence of NULL, so for arg release when the judge for the NULL and then strfree it.
zfs_allow_log_destroy parameter NULL pointer dereference issues: please see openzfs#4872 Observed during Linux 2.6.32.41 automated testing while running the ZFS Test Suite. Cause ZFS software to produce coredump. Cause analysis: In zfs_ioc_log_history function, the implementation of tsd_set function, will he_value of the TSD module is set to null, resulting in TSD module remove a entry, so he_value of the entry is null, casue to implement zfs_allow_log_key private function zfs_allow_log_destroy. zfs_allow_log_destroy parameter is null, the strfree a null. Produce coredump. Solution: 1, in order to safety, in the zfs_ioc_log_history function,from the TSD module to get to the poolName, it is possible for the NULL, so whether the processing of NULL. if poolname is NULL,return error. 2, zfs_allow_log_key of the private function zfs_allow_log_destroy in the Senate, it is possible for the emergence of NULL, so for arg release when the judge for the NULL and then strfree it. Signed-off-by: caoxuewen <cao.xuewen@zte.com.cn>
The Problem:
Observed during Linux 2.6.32.41 automated testing while running the ZFS Test Suite.
Primary analysis of causes:
zfs_ioc_log_history execute tsd_set when tsd set he_value of zfs_allow_log_key is null, so that execute zfs_allow_log_destroy parameter is null, strfree is coredump.
The text was updated successfully, but these errors were encountered: