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

Fix: sizeof(pid_t) != sizeof(pthread_t) #211

Merged
merged 1 commit into from
Aug 13, 2019
Merged

Conversation

timpalpant
Copy link
Contributor

@timpalpant timpalpant commented Aug 12, 2019

The real-time profiling code manages an array of threads to profile. This array is an array of pthread_t identifiers, but the code to allocate the array uses sizeof(pid_t), which many not equal sizeof(pthread_t). In particular, on Linux 4.15 x86_64, sizeof(pthread_t) = 8 while sizeof(pid_t) = 4. This leads to crashes since the code will write beyond its allocated space.

Based on git history, I believe this has existed since the introduction of real_time support in ccae9f7.

Fixes #210.

@timpalpant
Copy link
Contributor Author

@arigo if you don't mind taking a look, I'd appreciate it, or I can send another email to pypy-dev.

@arigo arigo merged commit d5a8509 into vmprof:master Aug 13, 2019
@arigo
Copy link
Contributor

arigo commented Aug 13, 2019

Looks like an obvious bug, yes.

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.

realloc(): invalid next size when inserting 9th real_time thread
3 participants