Repository navigation
fix(build): copy kernel module symlinks verbatim - #171
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
copyAllKernelModules used fs.cpSync with dereference: false but without verbatimSymlinks, so Node resolved guest symlink targets against the host. Relative targets were rewritten into absolute host paths that do not exist in the guest, and targets inside unreadable host directories aborted the process. Fixes earendil-works#163
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #163.
copyAllKernelModulescopies the initramfs kernel modules into the rootfs withfs.cpSync(..., { dereference: false }). WithoutverbatimSymlinks: true, Node still resolves each symlink target against the host:link.ko -> target.koare rewritten into absolute paths inside the temporary build directory, which do not exist in the guest.filesystem_error: Permission denied.This change passes
verbatimSymlinks: trueso module symlinks keep their original targets. It adds a test inhost/test/oci-rootfs-safety.test.tsthat checks a relative and an absolute module symlink survivesyncKernelModulesunchanged, plus aCHANGELOG.mdentry.Test:
node --test test/oci-rootfs-safety.test.tsfails without the fix (actual: '/tmp/.../initramfs/lib/modules/6.18.9-0-virt/kernel/target.ko', expected'target.ko') and passes with it (10/10).make -C host lintandmake -C host typecheckare clean.Contribution Agreement
Please ensure this PR follows the guidelines in
CONTRIBUTING.md.By submitting this pull request, I confirm the following:
I understand that the entity Earendil Inc. (incorporated in the state of Delaware in 2025) needs some rights from me in order to utilize my contributions in this PR. As a contributor I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Earendil Inc. can use, modify, copy, and redistribute my contributions, under Earendil Inc.'s choice of terms.