raise(SIGKILL)
Kamil Rytarowski <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm trying to streamline the behavior of a debugger catching (or not) a
program that is executing raise(SIGKILL).
$ cat raise.c
#include <signal.h>
int
main(int argc, char **argv)
{
raise(SIGKILL);
return 0;
}
I wrote a ptrace(2) example (extracted from the ATF suite from NetBSD
with compat code included):
http://netbsd.org/~kamil/kernel/traceme.c
FreeBSD works for this code reporting a stopped process.
Linux considers raise(SIGKILL) causing signaled as expected.
static int sig_ignored(struct task_struct *t, int sig, bool force)
{
/*
* Blocked signals are never ignored, since the
* signal handler may change by the time it is
* unblocked.
*/
if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig))
return 0;
/*
* Tracers may want to know about even ignored signal unless it
* is SIGKILL which can't be reported anyway but can be ignored
* by SIGNAL_UNKILLABLE task.
*/
if (t->ptrace && sig != SIGKILL)
return 0;
return sig_task_ignored(t, sig, force);
}
https://elixir.bootlin.com/linux/latest/source/kernel/signal.c#L99
NetBSD is right now in the Linux camp.. I'm trying to assert its
behavior with regression tests but I'm unsure who is correct*.
* I know that it's largely OS specific and non-standard extension.
signature.asc
(application/pgp-signature, 850 B)
-----BEGIN PGP SIGNATURE----- iQJABAEBCAAqFiEELaxVpweEzw+lMDwuS7MI6bAudmwFAlrjjSIMHG41NEBnbXgu Y29tAAoJEEuzCOmwLnZsjKQP/iwZDpQP9T9kRsODrS5/UBvwGBwdU497TUaxo3O0 PgjndW6Ow/f4dt+Y64xxMt18Z0fevPEFbsDVQTyFgukX1mg9gOlmz2KhF1cvNU+H cYtR5lex7qi58xgFwnG1VdUPMJwdmFpHO+a9oloBde9JAIOel+13xfad4WKAHOHN hFi+fK6zLn6JL8hm1KUXHZYEe2hYJ0I5h1eKJC9tFx8N7mV844gAGbBa8ZPYLE3N v53uRVAFD2W8L70zFIknOREGRY6geoEl/HQ/kfhNlf1hIOEiTr+qRsLreuluKNDk b8k8bZceXPufRHm11uOeXRYltcwihPPWFtxro0pIQqtQV8zKC5L2ANknnDHCvmw7 4L+RalK0n1hCu6ugTQALRscClQZniwKvBF0v64rG0O882VShNXOVsNbxm7djbFyf QSNrUj37ijd1o2orlAmrw5T0rVl3qbom3ci68+BVDraIxi7XSjKxw7es5duc7gFz oICxGjiVSdnbqssR4RGAb6+G9AKicntX7Kemhes/Q+vfzArxJSbwN/61OxKO6AWm 8Z2yGQu9JA0wx3v+aMLCVWhjEpxp0+FJhLtqq0zH0taUYQeFy5ToNPLVaLwe95Q6 26PDioZ+ZQOMvApww7i49GqHPan2JTamjVVSpttAEI+5Xnemy+TwDFkhhjFXae49 +zBL =BQjJ -----END PGP SIGNATURE-----