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

Inferior crashes after a certain time once in a while upon injection of a never-ending thread #3

Closed
korcankaraokcu opened this issue Feb 25, 2016 · 2 comments
Assignees
Labels

Comments

@korcankaraokcu
Copy link
Owner

It also crashes when superfluous number of threads get injected, which is quite normal to be honest but not desirable. Will try to write better threads asap.

@korcankaraokcu korcankaraokcu self-assigned this Feb 25, 2016
@korcankaraokcu korcankaraokcu changed the title Inferior crashes after a certain time upon injection of a never-ending thread Inferior crashes after a certain time once in a while upon injection of a never-ending thread Feb 25, 2016
@salihmarangoz
Copy link
Contributor

In PINCE/Injection/AdditionalThreadInjection.c",

threadinf is a local variable, it deallocates from memory when function ends. This may cause problems because first parameter of pthread_create() is the address of threadinf.

Suggested Change:

void injection()
{
    int *a=1;
    pthread_t *threadinf = (pthread_t*) malloc (sizeof(pthread_t));
    pthread_create(threadinf, NULL, infinite, (void*) a);
}

@korcankaraokcu
Copy link
Owner Author

That was a good one, tested on a few applications. After this patch, the debuggee doesn't crash even after 20-25 thread injections. Might close this issue once I test this enough.

Edit: Done enough tests, this is the correct fix. Thank you again @salihmarangoz. Closing this issue.

Closed by this patch

brkzlr pushed a commit to brkzlr/PINCE that referenced this issue Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants