aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/init.go
AgeCommit message (Collapse)Author
3 dayscontainer: explicitly order initialisationOphestra
This avoids accessing uninitialised hostProc in some build modes. Signed-off-by: Ophestra <cat@gensokyo.uk>
5 dayscontainer: enter init path earlyOphestra
There is generally no use case where any setup is required before init, and requiring the explicit function call is error-prone and unnecessary. It also causes trouble with packages using a similar trick. This change moves argv0 check early and makes it an import side effect. The stub will be removed in v0.5. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-07container: binfmt registrationOphestra
This arranges for binfmt entries to be registered for the container. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-07container: optionally map uid/gid 0 as initOphestra
Unfortunately required to work around flawed APIs like binfmt_misc. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-07container: improve capability handlingOphestra
This cleans up preserving caps for expansion and correctly sets privileged caps. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-06container/init: mount intermediate before earlyOphestra
This is usable as scratch space during early. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-04-07internal/params: relocate from package containerOphestra
This does not make sense as part of the public API, so make it internal. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-04-05container/init: ignore finished processOphestra
This is not considered an error, if the process finishes while the signal is being delivered. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-30all: use filepathOphestra
This makes package check portable, and removes nonportable behaviour from package pkg, pipewire, and system. All other packages remain nonportable due to their nature. No latency increase was observed due to this change on amd64 and arm64 linux. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-25internal/netlink: wrap netpoll via contextOphestra
This removes netpoll boilerplate for the most common use case. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-17fhs: move from containerOphestra
This package is not container-specific. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-17ext: move syscall wrappers from containerOphestra
These are generally useful, and none of them are container-specific. Syscalls subtle to use and requiring container-specific setup remains in container. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-02-28container: improve documentationOphestra
This change removes inconsistencies collected over time in this package. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-01-11container/init: configure interface loOphestra
This enables loopback networking when owning the net namespace. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09container: load initial process started before syscallOphestra
This avoids a race between returning from syscall and checking the state. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-08container: spin instead of block on wait4 ECHILDOphestra
Blocking prevents further wait4 processing causing ops to never receive their signals. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-08container: friendlier error message for op timing outOphestra
This includes the string for the failing op which helps with troubleshooting. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-08container: make wait4 loop available to opsOphestra
Due to the special nature of the init process, regular wait calls are unavailable. This change provides infrastructure to access wait4 loop state from Op. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-08container: pass context as setup stateOphestra
This is useful currently for daemon Op, but could be used for many other things. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-08container: call op method right before initial processOphestra
This is at a point considered to be already "within" the container. Daemons internal to the container can be started here. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-11container/init: close setup pipe earlyOphestra
This prevents leaking the setup pipe. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-10container/init: close initial process files on terminationOphestra
This closes them during the adopt wait delay. This also keeps them alive. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-03message: rename NewMsg to NewOphestra
Should have done this when relocating this from container. Now is a good time to rename it before v0.3.x. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-23container/init: do not suspend outputOphestra
Init is not very talkative after process start even when verbose. Suspending output here is pointless and does more harm than good. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-23container/init: improve signal handlingOphestra
The SIGTERM signal is delivered in many other cases and can lead to strange behaviour. The unconditional resume of the logger also causes strange behaviour in the cancellation forwarding path. This change also passes through additional signals. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-22container/init: check msg in entrypointOphestra
This covers invalid call to Init. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-15container/init: use one channel for wait4Ophestra
When using two channels it is possible for the other case to be reached before all pending winfo are consumed, causing incorrect reporting. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-09container/init: unwrap descriptive fatal errorOphestra
These errors are printed with a descriptive message prefixed to them, so it is more readable to expose the underlying errno. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-09message: relocate from containerOphestra
This package is quite useful. This change allows it to be imported without importing container. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-10-07container/fhs: move pathname constantsOphestra
This allows referencing FHS pathnames without importing container. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-09-29container: remove global msgOphestra
This frees all container instances of side effects. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-09-28container/init: reduce verbose noiseOphestra
This makes it possible to optionally omit the identifying verbose message, for when the Op implementation can provide a much more useful message in its case, using information not yet available to the String method. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-30container: wrap container init start errorsOphestra
This helps indicate the exact origin and nature of the error. This eliminates generic WrapErr from container. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-29container/init: handle unwrapped errorsOphestra
This is much cleaner from both the return statement and the error handling. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-29container: repeat and impossible state typesOphestra
This moves repeated Op errors and impossible internal state errors off of msg. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-24container/init: measure init behaviourOphestra
This used to be entirely done via integration tests, with almost no hope of error injection and coverage profile. These tests significantly increase confidence of future work in this area. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-23container/dispatcher: start goroutine in dispatcherOphestra
This allows instrumentation of calls from goroutine without relying on finalizers. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-23container/init: avoid multiple lastcap callsOphestra
This reduces the size of []kexpect in the test suite. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-23container/dispatcher: instrument each goroutine individuallyOphestra
Scheduler nondeterminism cannot be accounted for, so do this instead. There should not be any performance penalty as these calls are optimised out for direct. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-23container/params: pass fd instead of fileOphestra
The file is very difficult to stub. Pass fd instead as it is the value that is actually useful. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-22container/init: call lockOSThread through dispatcherOphestra
This degrades test performance if not stubbed out. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-22container/init: wrap syscall helper functionsOphestra
This allows tests to stub all kernel behaviour, enabling measurement of all function call arguments and error injection. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-21container/init: op interface valid methodOphestra
Check ops early and eliminate duplicate checks. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-20container/ops: move Op type to init fileOphestra
This helps with the eventual separation of all setup ops into individual files. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-20container: ptrace protection via Yama LSMOphestra
This is only a nice to have feature as the init process has no additional privileges and the monitor process was never reachable anyway. Closes #4. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-18container: move PR_SET_NO_NEW_PRIVS to parentOphestra
This allows some LSM setup in the parent. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-17container: allow additional state between opsOphestra
This is useful for ops that need to be aware of previous instances of themselves. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-11container: use absolute for pathnameOphestra
This is simultaneously more efficient and less error-prone. This change caused minor API changes in multiple other packages. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-09container/params: remove confusingly named errorOphestra
Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-08-04container/init: use mount string constantsOphestra
These literals were missed when the constants were first defined. Signed-off-by: Ophestra <cat@gensokyo.uk>