/* * We cannot use glibc's abort(). It makes use of tgkill() which * has no effect within UML's kernel threads. * After that glibc would execute an invalid instruction to kill * the calling process and UML crashes with SIGSEGV.
*/ staticinlinevoid __attribute__ ((noreturn)) uml_abort(void)
{
sigset_t sig;
fflush(NULL);
if (!sigemptyset(&sig) && !sigaddset(&sig, SIGABRT))
sigprocmask(SIG_UNBLOCK, &sig, 0);
for (;;) if (kill(getpid(), SIGABRT) < 0) exit(127);
}
/* * UML helper threads must not handle SIGWINCH/INT/TERM
*/ void os_fix_helper_signals(void)
{
signal(SIGWINCH, SIG_IGN);
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
}
void os_dump_core(void)
{ int pid;
signal(SIGSEGV, SIG_DFL);
/* * We are about to SIGTERM this entire process group to ensure that * nothing is around to run after the kernel exits. The * kernel wants to abort, not die through SIGTERM, so we * ignore it here.
*/
signal(SIGTERM, SIG_IGN);
kill(0, SIGTERM); /* * Most of the other processes associated with this UML are * likely sTopped, so give them a SIGCONT so they see the * SIGTERM.
*/
kill(0, SIGCONT);
/* * Now, having sent signals to everyone but us, make sure they * die by ptrace. Processes can survive what's been done to * them so far - the mechanism I understand is receiving a * SIGSEGV and segfaulting immediately upon return. There is * always a SIGSEGV pending, and (I'm guessing) signals are * processed in numeric order so the SIGTERM (signal 15 vs * SIGSEGV being signal 11) is never handled. * * Run a waitpid loop until we get some kind of error. * Hopefully, it's ECHILD, but there's not a lot we can do if * it's something else. Tell os_kill_ptraced_process not to * wait for the child to report its death because there's * nothing reasonable to do if that fails.
*/
__uml_setup("quiet", quiet_cmd_param, "quiet\n" " Turns off information messages during boot.\n\n");
/* * The os_info/os_warn functions will be called by helper threads. These * have a very limited stack size and using the libc formatting functions * may overflow the stack. * So pull in the kernel vscnprintf and use that instead with a fixed * on-stack buffer.
*/ int vscnprintf(char *buf, size_t size, constchar *fmt, va_list args);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.