Commit 3715df4
fix: prevent DNS bind-mount from escaping namespace and corrupting host
## Problem
The fallback DNS setup code in `ensure_namespace_dns()` was using
bind mounts inside network namespaces that could escape namespace
isolation and corrupt the host system's DNS configuration.
The issue: `ip netns exec` only enters the **network** namespace,
NOT the mount namespace. When the code attempted to bind-mount
over `/etc/resolv.conf` (which is a symlink to
`/run/systemd/resolve/stub-resolv.conf`), the kernel followed the
symlink in the **host's mount namespace** and created a bind mount
that corrupted the host's DNS.
This caused DNS resolution to fail system-wide on ci-1, breaking
the GitHub Actions runner for 3 weeks.
Evidence from ci-1:
- 165+ orphaned namespace configs in /etc/netns/
- Multiple bind mounts on /run/systemd/resolve/stub-resolv.conf
- Host's stub-resolv.conf contained namespace DNS content
## Solution
Removed the dangerous bind-mount fallback code (lines 540-577) and
replaced it with a safe approach that only updates
`/etc/netns/<name>/resolv.conf`, which is automatically bind-mounted
by the kernel when the namespace is created.
The new fallback:
- Updates the /etc/netns/ file directly (safe, host filesystem)
- Adds extensive documentation explaining why bind mounts are unsafe
- Fails gracefully with warnings if DNS setup fails
## Testing
- Verified DNS resolution works: test_jail_dns_resolution passes
- Verified no bind mounts created on stub-resolv.conf
- All Linux integration tests pass on ml-1
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 574ca02 commit 3715df4
1 file changed
Lines changed: 26 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
580 | 549 | | |
581 | 550 | | |
582 | 551 | | |
| |||
0 commit comments