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

Possible nullptr access #657

Closed
anakrish opened this issue May 14, 2024 · 3 comments
Closed

Possible nullptr access #657

anakrish opened this issue May 14, 2024 · 3 comments

Comments

@anakrish
Copy link
Contributor

The following code indicates that on line 184 n_tame could be null but goes on to access it unchecked on line 190.

if constexpr (mitigations(freelist_backward_edge))
{
if (n_tame != nullptr)
{
n_tame->prev.check_prev(
signed_prev(address_cast(this), address_cast(n_tame), key));
}
}
Aal::prefetch(&(n_tame->next_object));
return n_tame;

@mjp41
Copy link
Member

mjp41 commented May 15, 2024

@anakrish thanks for looking at this. I think in this case it is okay.

I assume you are referring to:

Aal::prefetch(&(n_tame->next_object));

Because of the & and -> this boils down to n_tame + offsetof(next_object). So in this case, we will be sending a prefetch hint to the null page. My understanding is that prefetch should not cause an access violation.

@anakrish
Copy link
Contributor Author

Ah, makes sense.

@mjp41
Copy link
Member

mjp41 commented Jun 13, 2024

So UBSan agreed with you that this was undefined behaviour, but the CI wasn't properly blocked on UBSan. I have ended up changing it in

d3b284c

as part of #662.

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

No branches or pull requests

2 participants