mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 16:15:29 +07:00
91d44ff860
Richard reported that some UML processes survive if the UML main process receives a SIGTERM. This issue was caused by a wrongly placed signal(SIGTERM, SIG_DFL) in init_new_thread_signals(). It disabled the UML exit handler accidently for some processes. The correct solution is to disable the fatal handler for all UML helper threads/processes. Such that last_ditch_exit() does not get called multiple times and all processes can exit due to SIGTERM. Reported-and-tested-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Richard Weinberger <richard@nod.at>
60 lines
1.1 KiB
C
60 lines
1.1 KiB
C
/*
|
|
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
|
|
* Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
#include <sched.h>
|
|
#include <signal.h>
|
|
#include <string.h>
|
|
#include <netinet/in.h>
|
|
#include <sys/time.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/mman.h>
|
|
#include <sys/param.h>
|
|
#include <endian.h>
|
|
#include <byteswap.h>
|
|
|
|
#include "ubd.h"
|
|
#include <os.h>
|
|
|
|
int start_io_thread(unsigned long sp, int *fd_out)
|
|
{
|
|
int pid, fds[2], err;
|
|
|
|
err = os_pipe(fds, 1, 1);
|
|
if(err < 0){
|
|
printk("start_io_thread - os_pipe failed, err = %d\n", -err);
|
|
goto out;
|
|
}
|
|
|
|
kernel_fd = fds[0];
|
|
*fd_out = fds[1];
|
|
|
|
err = os_set_fd_block(*fd_out, 0);
|
|
if (err) {
|
|
printk("start_io_thread - failed to set nonblocking I/O.\n");
|
|
goto out_close;
|
|
}
|
|
|
|
pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM, NULL);
|
|
if(pid < 0){
|
|
err = -errno;
|
|
printk("start_io_thread - clone failed : errno = %d\n", errno);
|
|
goto out_close;
|
|
}
|
|
|
|
return(pid);
|
|
|
|
out_close:
|
|
os_close_file(fds[0]);
|
|
os_close_file(fds[1]);
|
|
kernel_fd = -1;
|
|
*fd_out = -1;
|
|
out:
|
|
return err;
|
|
}
|