Skip to content
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 #4890

Closed
wants to merge 3 commits into from

Conversation

heary-cao
Copy link
Contributor

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.

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.
heary-cao referenced this pull request in behlendorf/zfs Jul 27, 2016
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 <[email protected]>
Issue openzfs#4872
zfs_allow_log_destroy parameter NULl update style
@heary-cao heary-cao closed this Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant