Skip to content

runner: relabel leash-managed mounts for SELinux#58

Merged
jaytaylor merged 2 commits into
mainfrom
fix/issue-57-selinux-relabel
Feb 12, 2026
Merged

runner: relabel leash-managed mounts for SELinux#58
jaytaylor merged 2 commits into
mainfrom
fix/issue-57-selinux-relabel

Conversation

@navanchauhan
Copy link
Copy Markdown
Collaborator

@navanchauhan navanchauhan commented Feb 12, 2026

Summary

  • detect SELinux on Linux hosts and relabel only leash-managed internal bind mounts with :z
  • keep caller workspace mounts and auto user mounts unchanged to avoid relabel-denied failures on home paths
  • add unit tests for relabel mode handling and mount assembly behavior

Why

Issue #57 reproduces on rootless podman + SELinux enforcing because /leash is mounted from a host temp dir without relabeling. leash-entry-linux-amd64 cannot execute, so cgroup-path is never written and startup fails with:

failed to locate cgroup path hint: .../cgroup-path not found after waiting

Validation

  • go test ./internal/runner -count=1 -run 'TestWithSELinuxRelabelMode|TestInternalBindMountSpecUsesSELinuxRelabel|TestLaunchContainersAddSELinuxRelabelToInternalMounts|TestLaunchCommandsUseSplitMounts|TestLaunchTargetContainerAppendsAutoMount|TestLaunchTargetContainerAppendsFileMount|TestLaunchTargetContainerSkipsDuplicateMount'
  • GCE Fedora (SELinux enforcing, podman-docker)
  • GCE openSUSE Leap + Docker
    • patched binary behavior unchanged (starts successfully to normal non-TTY failure in ssh command context)

Closes #57

@navanchauhan
Copy link
Copy Markdown
Collaborator Author

Addressed follow-up review notes:

  • simplified withSELinuxRelabelMode to a single strings.EqualFold(trimmed, "z") check (removed redundant condition)
  • added a clarifying comment in selinuxEnabled() documenting the safe-default behavior for unexpected /sys/fs/selinux/enforce content

Re-ran runner tests:

  • go test ./internal/runner -count=1 -run 'TestWithSELinuxRelabelMode|TestInternalBindMountSpecUsesSELinuxRelabel|TestLaunchContainersAddSELinuxRelabelToInternalMounts'

@jaytaylor jaytaylor merged commit 0f4aa83 into main Feb 12, 2026
1 check passed
@jaytaylor jaytaylor deleted the fix/issue-57-selinux-relabel branch February 12, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

failed to locate cgroup path

2 participants