Repository navigation
fix(linter): Make make lint run and pass again - #1202
Draft
martijnhoekstra wants to merge 6 commits into
Draft
martijnhoekstra wants to merge 6 commits into
martijnhoekstra wants to merge 6 commits into
Conversation
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
The lint workflow moved to golangci-lint v2.15 with the Go v1.27.2 update in ee1476e, but the Makefile stayed at v2.9, which can't load a go1.27.3 module, so make lint stopped before linting. Fixes: urunc-dev#1201 Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
The hvt and spt tenders take the same command line, and their BuildExecCmd bodies were identical, which dupl reported. Build it in one solo5ExecCmd. Fixes: urunc-dev#1201 Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Statfs_t.Flags is an int64 on amd64 and arm64, and the ST_* constants are untyped, so keep them as int64 instead of converting the flags to uintptr, which gosec reported as G115. Fixes: urunc-dev#1201 Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
runcExec hands non-unikernel containers to runc with urunc's own arguments, and prepareXDGRuntimeDir only creates $XDG_RUNTIME_DIR/urunc for a rootless user, so G702 and G703 do not apply there. Fixes: urunc-dev#1201 Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
prepareXDGRuntimeDir opens $XDG_RUNTIME_DIR as an os.Root and creates urunc's directory in it, so a symlink can't send MkdirAll or Chmod outside, and G703 holds without the nolint. $XDG_RUNTIME_DIR itself must now exist, as the XDG specification requires. Fixes: urunc-dev#1201 Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
👷 Deploy request for urunc pending review.Visit the deploys page to approve it
|
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.
Description
make lintpins golangci-lint v2.9, which can't load a go1.27.3 module, so it stops before linting. The lint workflow moved to v2.15 with the Go v1.27.2 update in ee1476e; the Makefile stayed behind. With v2.15, six findings show up that CI doesn't report because ofonly-new-issues. This PR updates the Makefile and fixes or annotates those findings, one commit each, plus a follow-up:dupl: the hvt and sptBuildExecCmdbodies were identical; both now call onesolo5ExecCmd.gosecG115 ingetUnprivilegedMountFlags: the ST_* flags are compared as int64, the type ofStatfs_t.Flagson amd64 and arm64, instead of converting the flags to uintptr.gosecG702 and G703 incmd/urunc/utils.goare annotated as false positives:runcExechands non-unikernel containers to runc with urunc's own arguments, andprepareXDGRuntimeDironly creates$XDG_RUNTIME_DIR/uruncfor a rootless user.prepareXDGRuntimeDircreatesuruncthrough anos.Rootopened on$XDG_RUNTIME_DIR, so a symlink can't sendMkdirAllorChmodoutside it, and the G703 annotations go. G702 has no sanitizers in gosec v2.29, so theruncExecannotation stays. One behaviour change:$XDG_RUNTIME_DIRitself must now exist, as the XDG specification requires; before,MkdirAllcreated it.Related issues
How was this tested?
make lint's command (golangci-lint run -v --timeout=5m) reports 0 issues, with and without the follow-up.test_unikontainersas a non-root user).go build ./...passes for amd64;pkg/unikontainersalso builds and vets for arm64.prepareXDGRuntimeDirincmd/urunc(go test ./cmd/urunc; themake unittesttargets don't cover that package): the directory gets mode 0700 with the sticky bit, a missing$XDG_RUNTIME_DIRis an error, and auruncsymlink pointing outside is refused without touching its target. On the code before the follow-up, the last two fail.XDG_RUNTIME_DIR=/tmp/xdg urunc ...as a non-root user creates/tmp/xdg/uruncasdrwx-----T.make staticand Firecracker v1.7.0: all 14 specs the test machine can run pass, including the four hvt and spt Mirage specs. Skipped because the machine lacks devmapper, virtiofsd and Hyperlight: the two rumprun specs,Qemu-linux-read-file-virtiofsandHyperlight-unikraft-hello.LLM usage
Claude Opus 5.5 (
claude-opus-5-5) helped write the changes and this description, and ran the tests above. I reviewed the changes and the results.Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).