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 kill of the debuggee #9453

Merged
merged 1 commit into from
Feb 27, 2018
Merged

Fix kill of the debuggee #9453

merged 1 commit into from
Feb 27, 2018

Conversation

giuscri
Copy link
Contributor

@giuscri giuscri commented Feb 21, 2018

Error introduced while trying to fix #9410
pid, tid should be allowed to be zero too, afaik.

@radare
Copy link
Collaborator

radare commented Feb 22, 2018

why?

     If pid is zero:
             Sig is sent to all processes whose group ID is equal to the
             process group ID of the sender, and for which the process has
             permission; this is a variant of killpg(2).

@giuscri
Copy link
Contributor Author

giuscri commented Feb 22, 2018

oh. that means the parent process too - r2?

codebase is using this thing though:

binr/radare2/radare2.c:1393:							r_debug_kill (r.dbg, 0, false, 9); // KILL
binr/radare2/radare2.c:1399:								r_debug_kill (r.dbg, 0, false, 9); // KILL
binr/radare2/radare2.c:1422:					r_debug_kill (r.dbg, 0, false, 9); // KILL

@XVilka
Copy link
Contributor

XVilka commented Feb 27, 2018

What to do with this one?

@giuscri
Copy link
Contributor Author

giuscri commented Feb 27, 2018

Using pid=0 worked before eef9406 as gid of who launched r2 and who launched attached process is the same in most r2 usages.

Note that after that kill r2 was killed too but that was not a problem as you were already returning from main. You were skipping some free()s though.

@giuscri
Copy link
Contributor Author

giuscri commented Feb 27, 2018

Calling r_debug_kill with pid,tid of attached process should fix this error

Do you want to quit? (Y/n)
Do you want to kill the process? (Y/n)
Backend does not implement kill()

without using pid,tid of 0.

I've updated this PR with fc46aa1

@radare
Copy link
Collaborator

radare commented Feb 27, 2018 via email

@radare radare merged commit 02b7743 into radareorg:master Feb 27, 2018
SakiiR pushed a commit to SakiiR/radare2 that referenced this pull request Jul 1, 2019
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.

r2 segfault when using 'do' with remote gdb session
3 participants