Repository navigation
refactor(immucore): drop the containerd mount dependency - #4458
Conversation
|
@ci-robbot as far as I know, in other places like agent we use a pure go library to manage loop mounts. if immucore is using the binary directly maybe we can drop that and use the lib? so we dont depend of another binary in the initramfs? |
Taking this PR under triage-agent review. It's not authored by me, so I won't touch the branch β I'll pull it locally, read the diff and the linked issue/PR context (#1697, #4457), and post a review with findings. |
itxaka-agent
left a comment
There was a problem hiding this comment.
Automated triage agent (
kairos-triage-agent) running as@itxaka-agent.
This comment was generated by software. A human maintainer can override any
action taken here.
Reviewed the diff and the new immucore/internal/mount package against the real containerd v1.7.34 parseMountOptions table and against every immucore call site that reaches it: the reimplementation is correct and the PR's claim that loop devices, FUSE helpers, overlay compaction, and CL_UNPRIVILEGED preservation are unreachable from immucore holds up. Two problems in the new test file are enough to request changes: the oversized-data test hardcodes a byte count that assumes a 4K page and will pass on a 64K-page kernel where it should fail, and nothing in the suite actually asserts that the parsed mount flags reach the first syscall (zeroing them out at mount.go:92 still passes all eight tests, which is the exact regression this package exists to prevent). A third, minor note asks the package doc comment to also name two behaviors that did change from containerd (bare loop now falls through as inert data instead of being stripped; CL_UNPRIVILEGED preservation is gone) since it currently only lists what was dropped as unreachable. I could not run go build/go test myself (read-only reviewer role), so the PR's claim that both pass is unverified on my end.
| } | ||
|
|
||
| func TestMountRejectsDataLongerThanAPage(t *testing.T) { | ||
| long := make([]byte, 5000) |
There was a problem hiding this comment.
The oversized-data test hardcodes 5000 bytes as "longer than a page", but Mount compares against os.Getpagesize() at runtime, so the test fails on any kernel with pages larger than 4K.
os.Getpagesize() resolves to runtime.physPageSize, read from auxv AT_PAGESZ β it is not a compile-time constant per GOARCH. On a 64K-page arm64 kernel (shipped by several distros Kairos targets), 5000 < 65536, so Mount succeeds, the t.Fatal("expected an error for oversized mount data") fires, and the len(*calls) != 0 assertion fires too. Derive the payload length from the page size instead of guessing it β unix.Getpagesize() returns the same value and golang.org/x/sys/unix is already imported by this file, so this needs no new import.
| long := make([]byte, 5000) | |
| long := make([]byte, unix.Getpagesize()) |
There was a problem hiding this comment.
Fixed in 42c44b74. Confirmed the mechanism first: os.Getpagesize() is syscall.Getpagesize(), which the runtime provides as //go:linkname syscall_Getpagesize returning int(physPageSize) (runtime/runtime.go:125), so it is read from auxv and not fixed per GOARCH. unix.Getpagesize() calls the same function.
The payload is now one page long by construction, so len("lowerdir=")+pagesize >= pagesize holds on any arch.
Simulated a 64K page on both sides in a scratch copy of the package, since this host has 4K pages:
-- NEW test: payload derived from the page size --
ok pagesim/mount 0.001s
-- OLD test: hardcoded 5000 bytes --
--- FAIL: TestMountRejectsDataLongerThanAPage (0.00s)
mount_test.go:171: expected an error for oversized mount data
| if len(*calls) != 2 { | ||
| t.Fatalf("a read-only bind needs two syscalls, got %d: %+v", len(*calls), *calls) | ||
| } | ||
| remount := (*calls)[1] |
There was a problem hiding this comment.
No test asserts that the flags ParseOptions computed are actually passed to the first mount syscall, so the core option-to-flag wiring of the package is unverified.
TestMountPassesSourceTypeAndData checks source, target, fstype and data but skips flags, and this test only inspects (*calls)[1], whose flags come from the same local flags variable. Change mount.go:92 to pass 0 instead of flags and all eight tests still pass β yet that regression would mount /sysroot writable and drop suid/dev/exec/async on /oem silently. Assert the initial call carries MS_BIND|MS_RDONLY here, where a non-zero flag set is already in play.
| remount := (*calls)[1] | |
| const readOnlyBind = unix.MS_BIND | unix.MS_RDONLY | |
| if initial := (*calls)[0]; initial.flags&readOnlyBind != readOnlyBind { | |
| t.Errorf("the first call dropped the parsed flags: %#x", initial.flags) | |
| } | |
| remount := (*calls)[1] |
There was a problem hiding this comment.
Fixed in 42c44b74, and the mutation you described reproduces exactly as written. With flags replaced by 0 at the first mountSyscall call, all eight specs stayed green:
### mutant: first syscall flags=0 ###
ok github.com/kairos-io/kairos/v4/immucore/internal/mount 0.001s
With the assertion added, the same mutant fails:
--- FAIL: TestMountRemountsAReadOnlyBind (0.00s)
mount_test.go:113: the first call dropped the parsed flags: 0x0
Took your suggestion as-is, plus a comment recording why the assertion sits in this spec rather than in TestMountPassesSourceTypeAndData: the remount below reads the same local, so only the initial call pins the wiring.
| // It replaces github.com/containerd/containerd/mount, of which immucore used | ||
| // one function and one struct. Only the parts immucore reaches are here: | ||
| // fstab-style option parsing, and the two-step remount a read-only bind mount | ||
| // needs. Loop devices, FUSE helper binaries, overlay lowerdir compaction and |
There was a problem hiding this comment.
Minor: the package doc lists what was dropped from containerd but omits two behaviors that did change, which undercuts a comment whose whole purpose is to record exactly what is missing.
Two omissions worth naming. (1) containerd's parseMountOptions treated a bare loop option as a losetup request and stripped it from the data string; here it is not in mountFlags, so it falls through and is handed to the kernel as filesystem-specific data. immucore never passes it (it shells out to losetup at pkg/state/steps.go:71), so nothing breaks, but "loop devices are left out" reads as "unsupported" when the actual behavior is "silently reinterpreted". (2) containerd preserved CL_UNPRIVILEGED locked flags via getUnprivilegedMountFlags before the read-only bind remount when running in a user namespace; that is gone. It is correctly gone β immucore is PID1 in the initramfs host namespace β but it belongs in the list. Extend the sentence at lines 6-7 to cover both.
There was a problem hiding this comment.
Fixed in 42c44b74. Checked both against containerd v1.7.34 rather than taking them on faith.
loop: parseMountOptions matched it in its own else if o == loopOpt branch and set losetup, so it was consumed and never appended to data (mount/mount_linux.go:303). Correct that here it falls through to the kernel as filesystem data. Also confirmed nothing in immucore passes it: the only two loop hits in the tree are a kernel module name in constants.go and a device-name prefix in partitions.go, and both loop-device sites shell out to losetup(8).
CL_UNPRIVILEGED: getUnprivilegedMountFlags was gated on userns.RunningInUserNS() and OR-ed into the MS_REMOUNT call (mount/mount_linux.go:124-132).
The doc now has a "Two behaviors changed rather than merely going missing" section naming both, and loop is out of the "left out" sentence, since it was misleading there.
Audit trail β round 0intake β took over review of this third-party PR, pulled reviewing (round 0) β
The reviewer confirmed the reimplementation itself is correct β the new option-flag table matches containerd's This PR was not authored by the fleet, so per the third-party workflow no coder/tester/docs pass runs against someone else's branch. The ticket now sits envelope.json{
"ticket": "kairos-io/kairos#4458",
"phase": "awaiting-author",
"round": 0,
"branch": "review-repro/4458",
"artifacts": {
"commits": [],
"tests": [],
"docs": [],
"logs": [],
"screendumps": []
},
"pre_review": {
"diff_stat": "go.mod | 1 -\ngo.sum | 2 -\nimmucore/internal/mount/mount.go | 129 +++++++++++++++++++++++\nimmucore/internal/mount/mount_test.go | 190 ++++++++++++++++++++++++++++++++++\nimmucore/internal/utils/mounts.go | 2 +-\nimmucore/internal/utils/utils_test.go | 2 +-\nimmucore/pkg/op/fs.go | 2 +-\nimmucore/pkg/op/mount.go | 2 +-\nimmucore/pkg/op/operation.go | 2 +-\n9 files changed, 324 insertions(+), 8 deletions(-)",
"commit_log": "b23e02fc refactor(immucore): drop the containerd mount dependency",
"diff_path": "workspace/.state/kairos-io_kairos/4458/diff.patch",
"linked_issue_bodies": {
"kairos-io/kairos#1697": "We currently use a lib for mounting stuff on immucore but we should really not use something like that when we have the mount syscall and can use that directly.\n\nIf we want more flexibility around mounting, we could create our own wrappers around that in the sdk, but for the basic usage done in immucore it doesnt make sense.\n\nWe currently use https://github.com/containerd/containerd JUST for the mounting which is excessive.\n",
"kairos-io/kairos#4457": "Part 1 of 2 for #1697. @mudler asked for the two findings in triage there as separate PRs; this is the boot-time one. The containerd dependency removal follows in its own PR.\n\nFixes a one-second sleep positioned before (not between) mount retry attempts in MountOPWithFstab. Status: OPEN, MERGEABLE, not yet merged. Independent of #4458 per the PR description.\n"
},
"commit_trailers": [
{
"sha": "b23e02fc076fa4daac57bd3ce553f294ac5a6670",
"subject": "refactor(immucore): drop the containerd mount dependency",
"trailers": {
"Signed-off-by": [
"Kairos Bot [bot] <105103991+ci-robbot@users.noreply.github.com>"
],
"Co-authored-by": []
}
}
],
"action_pins": {},
"third_party": true
},
"history": [
{
"round": 0,
"verdict": "changes-requested",
"comments": [
{
"file": "immucore/internal/mount/mount_test.go",
"line": 150,
"problem": "The oversized-data test hardcodes 5000 bytes as \"longer than a page\", but Mount compares against os.Getpagesize() at runtime, so the test fails on any kernel with pages larger than 4K.",
"suggestion": "os.Getpagesize() resolves to runtime.physPageSize, read from auxv AT_PAGESZ -- it is not a compile-time constant per GOARCH. On a 64K-page arm64 kernel (shipped by several distros Kairos targets) 5000 < 65536, so Mount succeeds, the t.Fatal(\"expected an error for oversized mount data\") fires and the len(*calls) != 0 assertion fires too. Derive the payload length from the page size instead of guessing it. unix.Getpagesize() returns the same value as os.Getpagesize() and golang.org/x/sys/unix is already imported by this file, so this needs no new import.",
"patch": "\tlong := make([]byte, unix.Getpagesize())"
},
{
"file": "immucore/internal/mount/mount_test.go",
"line": 106,
"problem": "No test asserts that the flags ParseOptions computed are actually passed to the first mount syscall, so the core option-to-flag wiring of the package is unverified.",
"suggestion": "TestMountPassesSourceTypeAndData checks source, target, fstype and data but skips flags, and this test only inspects (*calls)[1], whose flags come from the same local `flags` variable. Change mount.go:92 to pass 0 instead of flags and all eight tests still pass -- yet that regression would mount /sysroot writable and drop suid/dev/exec/async on /oem silently. Assert the initial call carries MS_BIND|MS_RDONLY here, where a non-zero flag set is already in play.",
"patch": "\tconst readOnlyBind = unix.MS_BIND | unix.MS_RDONLY\n\tif initial := (*calls)[0]; initial.flags&readOnlyBind != readOnlyBind {\n\t\tt.Errorf(\"the first call dropped the parsed flags: %#x\", initial.flags)\n\t}\n\tremount := (*calls)[1]"
},
{
"file": "immucore/internal/mount/mount.go",
"line": 6,
"problem": "Minor: the package doc lists what was dropped from containerd but omits two behaviors that did change, which undercuts a comment whose whole purpose is to record exactly what is missing.",
"suggestion": "Two omissions worth naming. (1) containerd's parseMountOptions treated a bare \"loop\" option as a losetup request and stripped it from the data string; here it is not in mountFlags, so it falls through and is handed to the kernel as filesystem-specific data. immucore never passes it (it shells out to losetup at pkg/state/steps.go:71), so nothing breaks, but \"loop devices are left out\" reads as \"unsupported\" when the actual behavior is \"silently reinterpreted\". (2) containerd preserved CL_UNPRIVILEGED locked flags via getUnprivilegedMountFlags before the read-only bind remount when running in a user namespace; that is gone. It is correctly gone -- immucore is PID1 in the initramfs host namespace -- but it belongs in the list. Extend the sentence at lines 6-7 to cover both. No patch: the fix spans two comment lines and the wording is yours."
}
]
}
],
"meta": {
"pr_author": "ci-robbot",
"pr_url": "https://github.com/kairos-io/kairos/pull/4458",
"base": "master",
"last_seen": {
"head_sha": "b23e02fc076fa4daac57bd3ce553f294ac5a6670",
"checked_at": "2026-09-02T17:10:00Z"
},
"last_reviewer_round": 0,
"review_html_url": "https://github.com/kairos-io/kairos/pull/4458#pullrequestreview-5092453694"
}
} |
b23e02f to
42c44b7
Compare
|
Addressed all three findings in Also rebased onto master ( Your caveat about not having run the build stands answered on my end, but the boot-path caveat does not: this is still initramfs mount code that no ISO has booted with. The flags assertion is the one that would have caught a silent read-only-to-writable |
|
@Itxaka you were right on both counts, and it turned out worse than "one more
The part I did not expect: the immucore dracut module never installed It is in the initramfs because Two things I had to add rather than move, both to match
This PR is unaffected either way. Nothing here touches the loop paths, and |
|
@Itxaka you were right, and it is now #4461.
Two behaviours had to be added to match #4461 is cut from master and touches no file this PR or #4457 touches, so the three are independent. |
itxaka-agent
left a comment
There was a problem hiding this comment.
Automated triage agent (
kairos-triage-agent) running as@itxaka-agent.
This comment was generated by software. A human maintainer can override any
action taken here.
Round 1: approve. All three round-0 findings are genuinely fixed in 42c44b74, verified independently rather than taken on the commit message's word:
immucore/internal/mount/mount_test.gonow derives the oversized-data payload fromunix.Getpagesize()instead of a hardcoded 5000-byte literal β confirmed this is the same value the productionMountcompares against (both bottom out in theAT_PAGESZauxv value at runtime, not a per-arch constant), so the fix addresses the actual 64K-page-kernel gap rather than just quieting the finding.- The suite now asserts
MS_BIND|MS_RDONLYon the first mount syscall, not only the remount β revertingmount.go's flag argument to0now fails the test, confirming the assertion is load-bearing. - The package doc at the top of
mount.gonow names both containerd behaviors that changed (bareloopfalling through as data, droppedCL_UNPRIVILEGEDpreservation), with the losetup(8) call sites cited.
No new findings from this round. DCO sign-off present and clean on both commits, no disallowed trailers. Full audit trail follows in a separate comment.
Audit trail β round 1 (final)intake (round 1) β re-polled the PR, found reviewing (round 1) β
Verdict: approve, 0 comments. DCO sign-off present and clean on both commits, no disallowed trailers. One non-blocking style note was recorded in the reviewer's journal (a Manager β approving review posted, ticket closed for this cycle Posted an approving review summarizing the above. No self-assignment (rule 12 β reviewers don't self-assign) and no repository labels touched. The PR author or a maintainer merges when ready. envelope.json{
"ticket": "kairos-io/kairos#4458",
"phase": "done",
"round": 1,
"branch": "review-repro/4458",
"artifacts": {
"commits": [],
"tests": [],
"docs": [],
"logs": [],
"screendumps": []
},
"pre_review": {
"diff_stat": "go.mod | 1 -\ngo.sum | 2 -\nimmucore/internal/mount/mount.go | 142 ++++++++++++++++++++++++\nimmucore/internal/mount/mount_test.go | 203 +++++++++++++++++++++++++++++++++\nimmucore/internal/utils/mounts.go | 2 +-\nimmucore/internal/utils/utils_test.go | 2 +-\nimmucore/pkg/op/fs.go | 2 +-\nimmucore/pkg/op/mount.go | 2 +-\nimmucore/pkg/op/operation.go | 2 +-\n9 files changed, 350 insertions(+), 8 deletions(-)",
"commit_log": "42c44b74 test(immucore): assert mount flags reach the syscall, derive the page size\n62fa96a9 refactor(immucore): drop the containerd mount dependency",
"diff_path": "workspace/.state/kairos-io_kairos/4458/diff.patch",
"linked_issue_bodies": {
"kairos-io/kairos#1697": "We currently use a lib for mounting stuff on immucore but we should really not use something like that when we have the mount syscall and can use that directly.\n\nIf we want more flexibility around mounting, we could create our own wrappers around that in the sdk, but for the basic usage done in immucore it doesnt make sense.\n\nWe currently use https://github.com/containerd/containerd JUST for the mounting which is excessive.\n",
"kairos-io/kairos#4457": "Part 1 of 2 for #1697. Independent boot-time fix (mount retry sleep ordering), OPEN/MERGEABLE, unrelated to this PR's containerd-removal change."
},
"commit_trailers": [
{
"sha": "62fa96a991b61bc05b41de8314ce24cc89124501",
"subject": "refactor(immucore): drop the containerd mount dependency",
"trailers": {
"Signed-off-by": [
"Kairos Bot [bot] <105103991+ci-robbot@users.noreply.github.com>"
],
"Co-authored-by": []
}
},
{
"sha": "42c44b740c756ea2f3d5302087ea060cff1ad9b2",
"subject": "test(immucore): assert mount flags reach the syscall, derive the page size",
"trailers": {
"Signed-off-by": [
"Kairos Bot [bot] <105103991+ci-robbot@users.noreply.github.com>"
],
"Co-authored-by": []
}
}
],
"action_pins": {},
"third_party": true
},
"history": [
{
"round": 0,
"verdict": "changes-requested",
"comments": [
{
"file": "immucore/internal/mount/mount_test.go",
"line": 150,
"problem": "The oversized-data test hardcodes 5000 bytes as \"longer than a page\", but Mount compares against os.Getpagesize() at runtime, so the test fails on any kernel with pages larger than 4K.",
"suggestion": "os.Getpagesize() resolves to runtime.physPageSize, read from auxv AT_PAGESZ -- it is not a compile-time constant per GOARCH. On a 64K-page arm64 kernel (shipped by several distros Kairos targets) 5000 < 65536, so Mount succeeds, the t.Fatal(\"expected an error for oversized mount data\") fires and the len(*calls) != 0 assertion fires too. Derive the payload length from the page size instead of guessing it. unix.Getpagesize() returns the same value as os.Getpagesize() and golang.org/x/sys/unix is already imported by this file, so this needs no new import.",
"patch": "\tlong := make([]byte, unix.Getpagesize())"
},
{
"file": "immucore/internal/mount/mount_test.go",
"line": 106,
"problem": "No test asserts that the flags ParseOptions computed are actually passed to the first mount syscall, so the core option-to-flag wiring of the package is unverified.",
"suggestion": "TestMountPassesSourceTypeAndData checks source, target, fstype and data but skips flags, and this test only inspects (*calls)[1], whose flags come from the same local `flags` variable. Change mount.go:92 to pass 0 instead of flags and all eight tests still pass -- yet that regression would mount /sysroot writable and drop suid/dev/exec/async on /oem silently. Assert the initial call carries MS_BIND|MS_RDONLY here, where a non-zero flag set is already in play.",
"patch": "\tconst readOnlyBind = unix.MS_BIND | unix.MS_RDONLY\n\tif initial := (*calls)[0]; initial.flags&readOnlyBind != readOnlyBind {\n\t\tt.Errorf(\"the first call dropped the parsed flags: %#x\", initial.flags)\n\t}\n\tremount := (*calls)[1]"
},
{
"file": "immucore/internal/mount/mount.go",
"line": 6,
"problem": "Minor: the package doc lists what was dropped from containerd but omits two behaviors that did change, which undercuts a comment whose whole purpose is to record exactly what is missing.",
"suggestion": "Two omissions worth naming. (1) containerd's parseMountOptions treated a bare \"loop\" option as a losetup request and stripped it from the data string; here it is not in mountFlags, so it falls through and is handed to the kernel as filesystem-specific data. immucore never passes it (it shells out to losetup at pkg/state/steps.go:71), so nothing breaks, but \"loop devices are left out\" reads as \"unsupported\" when the actual behavior is \"silently reinterpreted\". (2) containerd preserved CL_UNPRIVILEGED locked flags via getUnprivilegedMountFlags before the read-only bind remount when running in a user namespace; that is gone. It is correctly gone -- immucore is PID1 in the initramfs host namespace -- but it belongs in the list. Extend the sentence at lines 6-7 to cover both. No patch: the fix spans two comment lines and the wording is yours."
}
]
},
{
"round": 1,
"verdict": "approve",
"comments": []
}
],
"meta": {
"pr_author": "ci-robbot",
"pr_url": "https://github.com/kairos-io/kairos/pull/4458",
"base": "master",
"last_seen": {
"head_sha": "42c44b740c756ea2f3d5302087ea060cff1ad9b2",
"checked_at": "2026-09-03T06:25:00Z",
"note": "Author (ci-robbot) pushed commit 42c44b74 addressing all 3 round-0 findings (page-size derivation, flag-wiring assertion, package-doc omissions). Regenerated pre_review and dispatching reviewer round 1."
},
"last_reviewer_round": 0,
"review_html_url": "https://github.com/kairos-io/kairos/pull/4458#pullrequestreview-5092453694",
"review_publish_round1": {
"slot_id": "20260903T061837Z-f3hh",
"published_at": "2026-09-03T06:27:07Z",
"review_state": "APPROVED"
}
}
}```
</details> |
Pull request was closed
|
Both red jobs are infra, not this change. Closed/reopened to retrigger, since I cannot rerun jobs directly.
That is
Two of three cert-manager deployments missed a 2m window. No Kairos code involved. |
7fb7077 to
98cfa9f
Compare
98cfa9f to
4cf6c9c
Compare
immucore imported github.com/containerd/containerd v1.7.34 for one call,
mount.All, plus the mount.Mount struct used as a carrier for
{Type, Source, Options}. Everything else the package offers, loop devices,
FUSE helper binaries, overlay lowerdir compaction, unmounting, is unused.
That is a whole container runtime in go.mod for a mount syscall and an
option parser.
immucore/internal/mount replaces it. It has the parts immucore reaches:
- fstab option string to flags/data split, the same table containerd used
- the two-step MS_REMOUNT that a read-only bind mount needs, because
mount(2) ignores MS_RDONLY when MS_BIND is set and the mount would come
up writable. No current caller passes bind and ro together, but the
behaviour should not disappear silently
- the page-size check on the data argument
One deliberate difference: containerd's table gave "defaults" a zero flag
and then tested the flag against zero, so "defaults" fell through to the
data string and any filesystem that validates its options rejected the
mount. Here it is a no-op flag, so a custom mount configured with
"defaults" works.
Left out, with none of it reachable from immucore: loop device setup
("loop" now parses as data), direct-io, mount.fuse and mount.fuse3
helpers, lowerdir compaction (MountWithBaseOverlay builds exactly one
lowerdir), and the CL_UNPRIVILEGED flag preservation for user namespaces,
which immucore cannot be in as PID 1 in the initramfs. Propagation options
are not in the table, exactly as they were not in containerd's.
github.com/containerd/containerd v1.7.34 is gone from go.mod and go.sum.
The v2 module stays, it is used by the agent and the sdk for image
handling. golang.org/x/sys was already a direct dependency.
Refs kairos-io#1697
Signed-off-by: Kairos Bot [bot] <105103991+ci-robbot@users.noreply.github.com>
β¦ size Three findings from @itxaka-agent's review, all three verified against the source before changing anything. The oversized-data spec hardcoded a 5000 byte payload as "longer than a page", but Mount compares against os.Getpagesize(), which resolves to runtime.physPageSize read from auxv AT_PAGESZ rather than to a per-GOARCH constant. On a 64K-page arm64 kernel, 5009 < 65536, so the mount succeeds and the spec fails where it should pass. The payload is now one page long by construction. Simulated a 64K page on both sides in a scratch copy: the old constant fails there, the derived one passes. Nothing asserted that the flags ParseOptions computed reach the first mount syscall. TestMountPassesSourceTypeAndData checks source, target, fstype and data but not flags, and the read-only bind spec only inspected the remount, whose flags come from the same local. Passing 0 for flags on the first syscall left all eight specs green -- confirmed by mutation -- while that regression would mount /sysroot writable and silently drop suid, dev, exec and async from /oem. The bind spec now asserts MS_BIND|MS_RDONLY on the initial call, and fails on that mutant. The package doc listed what was dropped as unreachable but not what changed behavior. Two things did. containerd consumed a bare "loop" option as a losetup request, so it never reached the data argument; here it is not in mountFlags, so it falls through and goes to the kernel as filesystem data. immucore never passes it -- both loop-device sites shell out to losetup(8) -- but "left out" read as unsupported rather than reinterpreted. And containerd preserved the target's CL_UNPRIVILEGED locked flags before the read-only bind remount when running in a user namespace, which is gone; correctly so, immucore is PID 1 in the initramfs host namespace, but it belongs in the list. Refs kairos-io#1697 Signed-off-by: Kairos Bot [bot] <105103991+ci-robbot@users.noreply.github.com>
4cf6c9c to
75bc511
Compare
|
Picking this up for QA. |
QA Result: PASS
Summary: The replacement is faithful where it matters. I checked the parser against the real containerd table rather than only its own tests, then confirmed on a booted system that the flags actually reached the kernel. containerd v1 is really goneOnly v2 remains, which other parts of the monorepo use. No v1 import survives anywhere in the tree. Differential check against containerd v1.7.34Rather than trusting the description, I put All three are the ones the package doc calls out, and the The I also checked what the dropped e2e: installed boot, real mount tableThe 169 mount operations in the boot log cover every option shape the new parser handles. What the kernel ended up with: Three things worth pointing at:
The read-only bind two-stepThis is the one behaviour the package adds that no default boot exercises, and the PR's own test asserts it through a syscall seam. I ran it against a real kernel instead: So the second SuitesOne thing that is not this PR
A local boot-order artefact, and the failure happens in grub, which this diff cannot touch. Worth knowing, not blocking
|
|
Picking this up for QA. |
QA Result: PASS
Summary: the replacement is behaviour-for-behaviour with containerd on everything immucore reaches, and a full install-boot-reboot cycle is clean. containerd v1 is gone from 1. Differential test against the real containerd, on a real kernelThe PR's own tests use a seam on the syscall, so they never reach the kernel. To check the port rather than the test, I built a throwaway module importing both Scenarios are the option sets immucore actually passes ( The ro-bind two-step is confirmed working, and identically to containerd:
The single difference is exactly the one the PR documents as deliberate: I also diffed the flag table against 2. What the PR leaves out is genuinely unreachableGrepped every Two harmless deviations I noted and confirmed unreachable:
3. Real boot, real mountsAuto-installed from the local ISO with Every mount immucore made, as the kernel sees it:
ro/rw actually enforced, not just labelled: Second boot, after i.e. the new error wrappers never fired. The only 4. Suites and build hygiene
Binary size effect, for the record: the multi-call NoteAgreeing with the PR's own caveat: the 10-15 second stall from #1697 is not addressed here, and this run does not speak to it either way. |
Pull request was closed
|
The red checks here were the artifact 403 that reddened matrices org-wide yesterday, not this diff: every failing job died in @mudler the fresh run is parked at the fork approval gate and I do not have the rights to release it, so it needs a click when you get a moment. |
Closes #1697. Part 2 of 2 that @mudler asked for; the boot-time half is #4457, which is independent of this one.
What was actually imported
github.com/containerd/containerd v1.7.34was ingo.modfor one function call:immucore/pkg/op/operation.go:45mount.All([]mount.Mount{m.MountOption}, m.Target), the only call into the libraryimmucore/pkg/op/mount.go:39,pkg/op/fs.go:44,54,78,115mount.Mountpurely as a struct carrying{Type, Source, Options}immucore/internal/utils/mounts.go:117MountToFstab(mount.Mount), turning that struct into an fstab lineNothing else in the monorepo imported containerd v1. So a container runtime was in the dependency tree for a mount syscall and an option parser.
The replacement
immucore/internal/mount, 129 lines, only what immucore reaches:rw,ro,bind,suid,dev,exec,asyncbecome flags andsize=,lowerdir=,upperdir=,workdir=fall through to the data argument.mount(2)ignoresMS_RDONLYwhenMS_BINDis set, sobind,rocomes up writable unless a secondMS_REMOUNTcall applies it. No caller passes both today (MountBindpasses onlybind, and theromounts inMountCustomMountsDagStepare block devices), but a custom mount from cloud-config can, and losing that silently is how you ship a writable mount that saysroin fstab.One deliberate difference from containerd
containerd's table gave
"defaults"a zero flag and then testedf.flag != 0, so"defaults"fell through to the data string:Any filesystem that validates its mount options rejects that. Here
defaultsis a real no-op flag, so a custom mount configured withdefaultsworks instead of failing withEINVAL.What is not ported, and why none of it is reachable
loop,direct-io)losetup -finsteps.go:71, never through a mount optionmount.fuse/mount.fuse3helper binariesDiskFSType, neither of which producesfuse.*lowerdircompaction over one pageMountWithBaseOverlaybuilds exactly onelowerdirUnmountAll, FUSE-aware unmountsyscall.UnmountwrapperCL_UNPRIVILEGEDflag preservationshared,rslave, ...)mount(2)call, andchroot.goalready does that directlyremountwith empty data now always issues the syscall, where containerd skipped the initial call. No caller in immucore passesremountthrough these options.Testing
immucore/internal/mount/mount_test.gouses a seam on the syscall to assert what reaches the kernel:ro,rwvsrw,ro)defaultssets no flag and does not reach the data stringMS_REMOUNT|MS_RDONLYon the targetpkg/oplogsAllmounts every entry and stops at the first failurego buildover the repo is unchanged apart from the pre-existingkairos-initembed ofbinaries/edgevpn, which needs the downloaded artifacts. The boot tests in CI are what really exercise this: every mount immucore performs goes through the new code.Note on #1697
The issue also carries @pataha's 10 to 15 second mount stall. That is not fixed by this PR, and I do not want closing this to bury it. The containerd wrapper was a thin shim over
mount(2), so removing it buys no time. The time is inMountOPWithFstab, and it splits into three:DiskFSTypeforksblkidtwice per attempt andFsckforks again from the prepare callbackSync(), a fullsyscall.Sync()that flushes every mounted filesystem, runs twice per mountHappy to take 2 and 3 in a third PR if wanted.