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>
40 lines
854 B
C
40 lines
854 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __UM_IRQ_H
|
|
#define __UM_IRQ_H
|
|
|
|
#define TIMER_IRQ 0
|
|
#define UMN_IRQ 1
|
|
#define UBD_IRQ 2
|
|
#define UM_ETH_IRQ 3
|
|
#define ACCEPT_IRQ 4
|
|
#define MCONSOLE_IRQ 5
|
|
#define WINCH_IRQ 6
|
|
#define SIGIO_WRITE_IRQ 7
|
|
#define TELNETD_IRQ 8
|
|
#define XTERM_IRQ 9
|
|
#define RANDOM_IRQ 10
|
|
#define SIGCHLD_IRQ 11
|
|
|
|
#ifdef CONFIG_UML_NET_VECTOR
|
|
|
|
#define VECTOR_BASE_IRQ (SIGCHLD_IRQ + 1)
|
|
#define VECTOR_IRQ_SPACE 8
|
|
|
|
#define UM_FIRST_DYN_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ)
|
|
|
|
#else
|
|
|
|
#define UM_FIRST_DYN_IRQ (SIGCHLD_IRQ + 1)
|
|
|
|
#endif
|
|
|
|
#define UM_LAST_SIGNAL_IRQ 64
|
|
/* If we have (simulated) PCI MSI, allow 64 more interrupt numbers for it */
|
|
#ifdef CONFIG_PCI_MSI
|
|
#define NR_IRQS (UM_LAST_SIGNAL_IRQ + 64)
|
|
#else
|
|
#define NR_IRQS UM_LAST_SIGNAL_IRQ
|
|
#endif /* CONFIG_PCI_MSI */
|
|
|
|
#include <asm-generic/irq.h>
|
|
#endif
|