Skip to content

Make sure TRACKER is not used after being destroyed #238

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

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Feb 14, 2024

Make sure TRACKER is not used after being destroyed.
Also add checks to umfMemoryTrackerGetPool()
to detect if TRACKER or its map is not initialized.

@ldorau ldorau requested a review from a team as a code owner February 14, 2024 22:04
@igchor
Copy link
Member

igchor commented Feb 14, 2024

Can you add some more info what problem is this solving?

@ldorau ldorau force-pushed the Fix_TRACKER_issues branch from 2fa0a88 to 05cd140 Compare February 15, 2024 08:36
@ldorau ldorau changed the title Fix TRACKER issues Make sure TRACKER is not used after being destroyed Feb 15, 2024
@ldorau
Copy link
Contributor Author

ldorau commented Feb 15, 2024

Can you add some more info what problem is this solving?

Added a comment and a commit description.

@bratpiorka bratpiorka requested a review from igchor February 15, 2024 08:46
@DamianDuy
Copy link

LGTM

@@ -80,6 +80,8 @@ static umf_result_t umfMemoryTrackerRemove(umf_memory_tracker_handle_t hTracker,

umf_memory_pool_handle_t umfMemoryTrackerGetPool(const void *ptr) {
assert(ptr);
assert(TRACKER);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don;t know if we should assert it. Creating memory tracker can fail for a few reasons, see here:

. I think we should rather just log this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with:

    if (TRACKER == NULL) {
        fprintf(stderr, "tracker is not created\n");
        return NULL;
    }

    if (TRACKER->map == NULL) {
        fprintf(stderr, "tracker's map is not created\n");
        return NULL;
    }

Done

Make sure TRACKER is not used after being destroyed.
Also add checks to umfMemoryTrackerGetPool()
to detect if TRACKER or its map is not initialized.

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Fix_TRACKER_issues branch from 05cd140 to 68a9e16 Compare February 16, 2024 07:11
@bratpiorka bratpiorka merged commit fb6bded into oneapi-src:main Feb 16, 2024
@ldorau ldorau deleted the Fix_TRACKER_issues branch February 17, 2024 09:32
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.

6 participants