Skip to content

Commit 37cce82

Browse files
authored
Prevent SHM SIGBUS on full backing stores (#11)
1 parent 98131da commit 37cce82

24 files changed

Lines changed: 1792 additions & 36 deletions

.agents/sow/current/SOW-0027-20260629-netdata-vendor-memory-safety-update.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
## Status
44

5-
Status: in-progress
5+
Status: paused
66

7-
Sub-state: Netdata vendoring exposed a missing public L3 cache enumeration API required by the eBPF cgroup consumer; implementation is paused for a user design decision.
7+
Sub-state: paused on 2026-07-12 so SOW-0030 can take the active slot for the
8+
fleet-observed SHM SIGBUS crash. The earlier L3 API decision was resolved by using the
9+
direct L2 snapshot path; resume from final validation, artifact maintenance, review,
10+
and lifecycle closure for the already merged Netdata vendor update.
811

912
## Requirements
1013

.agents/sow/current/SOW-0030-20260712-shm-sigbus-on-full-backing-store.md

Lines changed: 531 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# SOW-0031 - Align Linux SHM build gating with the platform contract
2+
3+
## Status
4+
5+
Status: open
6+
7+
Sub-state: tracked follow-up discovered by SOW-0030; execution must wait until the
8+
active SOW completes.
9+
10+
## Requirements
11+
12+
### Purpose
13+
14+
Make the build system match NetIPC's public platform contract: Linux and native
15+
Windows provide SHM transports, while FreeBSD and macOS use their baseline transports
16+
without attempting to compile Linux futex code.
17+
18+
### User Request
19+
20+
The user delegated all SOW-0030 technical choices to the assistant with a requirement
21+
to choose long-term-best solutions without shortcuts and reminded the project to keep
22+
both native Windows and `MSYSTEM=MSYS` support. The approved plan tracks the broader
23+
build-gating inconsistency separately from the urgent Linux SIGBUS fix.
24+
25+
### Assistant Understanding
26+
27+
Facts:
28+
29+
- `docs/level1-posix-shm.md` defines POSIX SHM as Linux-only and says FreeBSD/macOS
30+
use baseline UDS.
31+
- The C Linux SHM source includes Linux futex headers and syscalls.
32+
- Rust and Go use explicit Linux target/build gates for POSIX SHM.
33+
- CMake commonly uses `NOT APPLE` for C SHM, service, tests, and interop targets; that
34+
condition also includes FreeBSD.
35+
- CMake treats Windows, Cygwin, and `MSYSTEM=MSYS` as the Windows runtime and must
36+
preserve native Windows transport coverage.
37+
38+
Inferences:
39+
40+
- The CMake gates encode a broader platform set than the implementation and public
41+
contract support.
42+
- Repair may require separating baseline POSIX service targets from Linux-only SHM
43+
components rather than mechanically replacing every `NOT APPLE` condition.
44+
45+
Unknowns:
46+
47+
- The exact smallest coherent CMake target split must be established by a complete
48+
dependency graph and cross-platform configure/build investigation when this SOW is
49+
activated.
50+
51+
### Acceptance Criteria
52+
53+
- Linux C/Rust/Go SHM and service targets retain their current behavior and tests.
54+
- Native Windows and `MSYSTEM=MSYS` Named Pipe/Windows SHM builds and tests remain green.
55+
- FreeBSD and macOS configure/build only supported baseline components and never compile
56+
Linux futex sources.
57+
- CMake conditions, public docs, and actual target availability agree.
58+
59+
## Analysis
60+
61+
Sources checked:
62+
63+
- `docs/level1-posix-shm.md`
64+
- `docs/level1-transport.md`
65+
- `CMakeLists.txt`
66+
- `src/libnetdata/netipc/src/transport/posix/netipc_shm.c`
67+
- `src/crates/netipc/src/transport/mod.rs`
68+
- `src/go/pkg/netipc/transport/posix/shm_linux.go`
69+
70+
Current state:
71+
72+
- The platform contract and language build gates are Linux-specific, while several
73+
CMake gates use the broader `NOT APPLE` condition.
74+
75+
Risks:
76+
77+
- A mechanical condition replacement could remove useful baseline service targets on
78+
FreeBSD/macOS or accidentally affect Windows/MSYS target selection.
79+
- Cross-platform proof requires access to the authorized test systems or equivalent CI.
80+
81+
## Pre-Implementation Gate
82+
83+
Status: blocked
84+
85+
Problem / root-cause model:
86+
87+
- CMake uses exclusion-based `NOT APPLE` conditions where the contract requires an
88+
explicit Linux capability boundary. The correct fix depends on whether each gated
89+
target is entirely Linux-only or mixes reusable baseline code with SHM dependencies.
90+
91+
Evidence reviewed:
92+
93+
- `docs/level1-posix-shm.md:5-11`
94+
- `docs/level1-transport.md:470-500`
95+
- `CMakeLists.txt:31,67-100,290-305,488-508`
96+
- `src/libnetdata/netipc/src/transport/posix/netipc_shm.c:1-25`
97+
- `src/crates/netipc/src/transport/mod.rs:6-10`
98+
- `src/go/pkg/netipc/transport/posix/shm_linux.go:1-6`
99+
100+
Affected contracts and surfaces:
101+
102+
- CMake target availability, Linux/FreeBSD/macOS/native-Windows/MSYS builds, POSIX
103+
baseline service composition, Linux and Windows SHM transports, tests, CI, and public
104+
platform documentation.
105+
106+
Existing patterns to reuse:
107+
108+
- Rust `cfg(target_os = "linux")`, Go `//go:build linux`, and CMake's existing
109+
`NETIPC_WINDOWS_RUNTIME` capability boundary.
110+
111+
Risk and blast radius:
112+
113+
- Medium: build-system changes can silently omit targets or compile unsupported sources.
114+
Keep the work separate from SOW-0030 and validate every supported platform family.
115+
116+
Sensitive data handling plan:
117+
118+
- No sensitive data is needed. Durable artifacts will contain only platform names,
119+
source paths, build commands, and sanitized test outcomes.
120+
121+
Implementation plan:
122+
123+
1. Map every CMake platform condition to its source dependencies and public contract.
124+
2. Define explicit Linux SHM gates while retaining baseline POSIX and Windows/MSYS
125+
components on their supported platforms.
126+
3. Update tests, CI, and docs where target availability changes.
127+
128+
Validation plan:
129+
130+
- Linux configure/build/test and POSIX interop.
131+
- Authorized FreeBSD and macOS configure/build/test for baseline UDS behavior.
132+
- Authorized native Windows and `MSYSTEM=MSYS` configure/build/test for Named Pipe and
133+
Windows SHM behavior.
134+
- Same-pattern search for broad platform exclusions that stand in for Linux capability.
135+
136+
Artifact impact plan:
137+
138+
- AGENTS.md: update only if supported validation commands or platform workflow changes.
139+
- Runtime project skills: unaffected unless a reusable cross-platform validation workflow
140+
is discovered.
141+
- Specs: update if investigation changes actual supported target availability.
142+
- End-user/operator docs: update platform/build documentation if commands or targets change.
143+
- End-user/operator skills: update `docs/netipc-integrator-skill.md` if platform guidance changes.
144+
- SOW lifecycle: remain pending until SOW-0030 completes; execute independently.
145+
146+
Open-source reference evidence:
147+
148+
- None needed yet; this follow-up tracks an internal build-contract mismatch. External
149+
build-system references may be researched when the SOW is activated.
150+
151+
Open decisions:
152+
153+
- None at creation. Any design fork exposed by the dependency graph will be investigated
154+
and presented before implementation.
155+
156+
## Implications And Decisions
157+
158+
- User decision (2026-07-12): choose the long-term-best design without shortcuts and
159+
preserve both native Windows and `MSYSTEM=MSYS` support.
160+
- Decision: track this build-contract repair separately so the urgent SOW-0030 crash fix
161+
remains focused.
162+
163+
## Plan
164+
165+
1. Wait for SOW-0030 to complete.
166+
2. Complete the target/dependency analysis and pre-implementation gate.
167+
3. Implement and validate the approved cross-platform target split.
168+
169+
## Execution Log
170+
171+
### 2026-07-12
172+
173+
- Created as the real pending follow-up for the CMake/platform-contract discrepancy
174+
discovered during SOW-0030 research.
175+
176+
## Validation
177+
178+
Acceptance criteria evidence:
179+
180+
- Pending activation.
181+
182+
Tests or equivalent validation:
183+
184+
- Pending activation.
185+
186+
Real-use evidence:
187+
188+
- Pending activation.
189+
190+
Reviewer findings:
191+
192+
- Pending activation.
193+
194+
Same-failure scan:
195+
196+
- Pending activation.
197+
198+
Sensitive data gate:
199+
200+
- This SOW contains only public platform names, source paths, and build-contract facts.
201+
202+
Artifact maintenance gate:
203+
204+
- Pending activation for all artifact classes.
205+
206+
Specs update:
207+
208+
- Pending activation.
209+
210+
Project skills update:
211+
212+
- Pending activation.
213+
214+
End-user/operator docs update:
215+
216+
- Pending activation.
217+
218+
End-user/operator skills update:
219+
220+
- Pending activation.
221+
222+
Lessons:
223+
224+
- Pending activation.
225+
226+
Follow-up mapping:
227+
228+
- This file is the tracked follow-up from SOW-0030.
229+
230+
## Outcome
231+
232+
Pending.
233+
234+
## Lessons Extracted
235+
236+
Pending.
237+
238+
## Followup
239+
240+
None yet.
241+
242+
## Regression Log
243+
244+
None yet.

0 commit comments

Comments
 (0)