mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

When in seccomp mode, we would hang forever on the futex if a child has died unexpectedly. In contrast, ptrace mode will notice it and kill the corresponding thread when it fails to run it. Fix this issue using a new IRQ that is fired after a SIGCHLD and keeping an (internal) list of all MMs. In the IRQ handler, find the affected MM and set its PID to -1 as well as the futex variable to FUTEX_IN_KERN. This, together with futex returning -EINTR after the signal is sufficient to implement a race-free detection of a child dying. Note that this also enables IRQ handling while starting a userspace process. This should be safe and SECCOMP requires the IRQ in case the process does not come up properly. Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net> Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://patch.msgid.link/20250602130052.545733-5-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
27 lines
654 B
C
27 lines
654 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
*/
|
|
|
|
#ifndef __IRQ_USER_H__
|
|
#define __IRQ_USER_H__
|
|
|
|
#include <sysdep/ptrace.h>
|
|
|
|
enum um_irq_type {
|
|
IRQ_READ,
|
|
IRQ_WRITE,
|
|
NUM_IRQ_TYPES,
|
|
};
|
|
|
|
struct siginfo;
|
|
extern void sigio_handler(int sig, struct siginfo *unused_si,
|
|
struct uml_pt_regs *regs, void *mc);
|
|
extern void sigchld_handler(int sig, struct siginfo *unused_si,
|
|
struct uml_pt_regs *regs, void *mc);
|
|
void sigio_run_timetravel_handlers(void);
|
|
extern void free_irq_by_fd(int fd);
|
|
extern void deactivate_fd(int fd, int irqnum);
|
|
extern int deactivate_all_fds(void);
|
|
|
|
#endif
|