1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
//! Named readings of one bundled backend capability.
//!
//! `BackendCapabilities::supports_blocked_wait_signal_interruption` says that
//! blocked waits decide signal interruption from the kernel's signal state
//! (Detcore's B1 mechanism). Many readers that are not about blocked waits
//! read it too, because every backend that sets it (ptrace, and e9patch, which
//! runs under ptrace) also has the facts those readers need. Each function
//! here names one of those facts for its readers.
//!
//! These are **legacy bundled conditions**, not separate capabilities: each is
//! exactly today's expression over the one capability, so every backend keeps
//! its behaviour. Some name a fact that is also true elsewhere. In-guest
//! LiteInst and SaBRe run guest threads as host tasks too
//! (`procfs_inode::guest_tids_name_host_tasks` in Detcore is true for them),
//! yet [`host_task_reads_enabled`] is false there. Widening any of these to its
//! truthful per-backend value changes that backend's behaviour and needs its
//! own review; it is deferred work in step 3.3 of the A5 design
//! (<https://github.com/rrnewton/hermit/issues/4485>, dev-hermit
//! `ai_docs/2026-10-16-a5-signal-delivery-design.md` section 15.12).
use BackendCapabilities;
use crateConfig;
/// Whether Detcore reads or signals a guest task through the host task of the
/// same ID: the host `/proc/<pid>/maps` for a futex address, a timespec read
/// that falls back to host memory maps, `/proc/<tid>` for what a descriptor
/// names, the `rt_sigqueueinfo` precheck, and the parent-death signal it sends
/// itself.
///
/// Legacy bundled condition: true exactly where
/// `supports_blocked_wait_signal_interruption` is (ptrace, e9patch).
/// Whether the kernel's signal state for a guest thread is the guest's own:
/// the thread is a host task, and no runtime in the guest's process installs
/// handlers or masks of its own. Detcore's signal-state copy is kept, and
/// compared with the kernel, only where this holds, and only here does
/// Detcore decide a process-directed signal to its own process from the
/// kernel's per-thread signal sets.
///
/// Legacy bundled condition: true exactly where
/// `supports_blocked_wait_signal_interruption` is (ptrace, e9patch).
/// Whether Detcore treats signals that Linux sends at host-chosen moments as
/// reaching the guest from the host: a terminal's signals, a child's exit
/// signal, the signals an orphaned process group receives, and those an
/// `fcntl` (async I/O, leases, directory notification), `ioctl`, `open` or
/// `prctl` arms. Where this holds, Detcore records them as host-timed so that
/// no scheduler decision depends on when they arrive. Such signals may reach
/// the guest on other backends too; false is not a statement that they do
/// not.
///
/// Legacy bundled condition: true exactly where
/// `supports_blocked_wait_signal_interruption` is (ptrace, e9patch).
/// Whether the scheduler models which thread the kernel gives a signal, from
/// the signal masks it reads from the kernel, and keeps the per-process ledger
/// of signals discarded at send time; the guest side publishes a waiting
/// thread's mask and records handler-restored real-time signals for it
/// (`publish_wait_mask`, `record_handler_restore_mask`). It needs serialized
/// threads, so that a mask it reads cannot change before the kernel acts on
/// it.
///
/// Legacy bundled condition: true exactly where threads are serialized and
/// `supports_blocked_wait_signal_interruption` holds (ptrace, e9patch).