Skip to content

Commit 740ec46

Browse files
authored
Revert "Enable ipv6, nftables, NAT, and nf_raw for Firecracker amd64 guests" (#11554)
Reverts #11542
1 parent cce0304 commit 740ec46

File tree

6 files changed

+25
-164
lines changed

6 files changed

+25
-164
lines changed

deps.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ def install_static_dependencies(workspace_name = "buildbuddy"):
216216
)
217217
http_file(
218218
name = "org_kernel_git_linux_kernel-vmlinux",
219-
sha256 = "7e972d01a27e7f3c3e01997e2b202a03e9eef279cd183fbdd2638a0901812052",
220-
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/linux/vmlinux-x86_64-v5.15-7e972d01a27e7f3c3e01997e2b202a03e9eef279cd183fbdd2638a0901812052"],
219+
sha256 = "ea6432b7a097873dd6ffb32481de57fa9c3bb2d2c68a2568e39a1d3decdd003d",
220+
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/linux/vmlinux-x86_64-v5.15-ea6432b7a097873dd6ffb32481de57fa9c3bb2d2c68a2568e39a1d3decdd003d"],
221221
executable = True,
222222
)
223223
http_file(
224224
name = "org_kernel_git_linux_kernel-vmlinux-6.1",
225-
sha256 = "04c7910a6ee6666f4ac713ce2a42ffaa49e7fd2d2d9268a123a38e3e84c5a8bd",
226-
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/linux/vmlinux-x86_64-v6.1-04c7910a6ee6666f4ac713ce2a42ffaa49e7fd2d2d9268a123a38e3e84c5a8bd"],
225+
sha256 = "221765c1c163d7f4687c0fba573c47a17ada6cbe4063c16e6205fabc7066fd15",
226+
urls = ["https://storage.googleapis.com/buildbuddy-tools/binaries/linux/vmlinux-x86_64-v6.1-221765c1c163d7f4687c0fba573c47a17ada6cbe4063c16e6205fabc7066fd15"],
227227
executable = True,
228228
)
229229
http_file(

enterprise/server/cmd/goinit/main.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"os/exec"
1313
"os/signal"
1414
"path/filepath"
15-
"runtime"
1615
"strconv"
1716
"strings"
1817
"syscall"
@@ -194,11 +193,8 @@ func startDockerd(ctx context.Context) error {
194193
args = append(args, "--host=unix:///var/run/docker.sock", "--host=tcp://0.0.0.0:2375", "--tls=false")
195194
}
196195
cmd := exec.CommandContext(ctx, "dockerd", args...)
197-
// TODO(bduffany): update arm64 image and remove this check for arm64 as well.
198-
if runtime.GOARCH != "amd64" {
199-
// Note: despite the big scary INSECURE env var name, dockerd is completely sandboxed inside a VM, so it's secure for our usage. Once we upgrade our guest kernels to support nf tables, we can remove this.
200-
cmd.Env = append(os.Environ(), "DOCKER_INSECURE_NO_IPTABLES_RAW=1")
201-
}
196+
// Note: despite the big scary INSECURE env var name, dockerd is completely sandboxed inside a VM, so it's secure for our usage. Once we upgrade our guest kernels to support nf tables, we can remove this.
197+
cmd.Env = append(os.Environ(), "DOCKER_INSECURE_NO_IPTABLES_RAW=1")
202198
// TODO(https://github.com/buildbuddy-io/buildbuddy-internal/issues/3306):
203199
// enable logging by default
204200
if *enableLogging {

enterprise/server/remote_execution/containers/firecracker/firecracker.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,10 +1620,7 @@ func getBootArgs(vmConfig *fcpb.VMConfiguration) string {
16201620
"i8042.nopnp",
16211621
"i8042.dumbkbd",
16221622
"tsc=reliable",
1623-
}
1624-
if runtime.GOARCH != "amd64" {
1625-
// TODO(bduffany): update arm64 image and enable ipv6 on arm64 as well.
1626-
kernelArgs = append(kernelArgs, "ipv6.disable=1")
1623+
"ipv6.disable=1",
16271624
}
16281625
if networkingEnabled(vmConfig.NetworkMode) {
16291626
kernelArgs = append(kernelArgs, machineIPBootArgs)

enterprise/server/remote_execution/containers/firecracker/firecracker_test.go

Lines changed: 9 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"os/exec"
1414
"path/filepath"
1515
"regexp"
16-
"runtime"
1716
"slices"
1817
"strings"
1918
"sync"
@@ -79,7 +78,6 @@ const (
7978
ubuntuImage = "mirror.gcr.io/library/ubuntu:20.04"
8079
imageWithDockerInstalled = "gcr.io/flame-public/executor-docker-default:enterprise-v1.6.0"
8180
imageWithDockerV28Installed = platform.Ubuntu24_04Image
82-
dockerDindImage = "gcr.io/flame-public/test-docker-dind@sha256:68f6d9ab84623d1116c5432a3b924a07ee09960e6129ca1cb03ef14010588cb4"
8381

8482
// Minimum memory needed for a firecracker VM. This may need to be increased
8583
// if the size of initrd.cpio increases.
@@ -153,7 +151,7 @@ func TestGuestAPIVersion(t *testing.T) {
153151
// Note that if you go with option 1, ALL VM snapshots will be invalidated
154152
// which will negatively affect customer experience. Be careful!
155153
const (
156-
expectedHash = "6856b316f80dc7e3ed9939148aee3e59640e1c749ec9d344e3a3c70a70422155"
154+
expectedHash = "4a0b9e65e9db406124d1bb745e3e9e0c7ce3d2d01f282bc73d0addab8a2f0a39"
157155
expectedVersion = "18"
158156
)
159157
assert.Equal(t, expectedHash, firecracker.GuestAPIHash)
@@ -2509,70 +2507,6 @@ func TestFirecrackerRunNOPWithZeroDisk(t *testing.T) {
25092507
assert.Equal(t, "/workspace\n", string(res.Stdout))
25102508
}
25112509

2512-
func TestFirecrackerRunWithIPv6Enabled(t *testing.T) {
2513-
if runtime.GOARCH != "amd64" {
2514-
// TODO(bduffany): update arm64 image and enable this test
2515-
t.Skipf("test is not yet supported on arm64")
2516-
}
2517-
2518-
ctx := context.Background()
2519-
env := getTestEnv(ctx, t, envOpts{})
2520-
rootDir := testfs.MakeTempDir(t)
2521-
workDir := testfs.MakeDirAll(t, rootDir, "work")
2522-
cmd := &repb.Command{
2523-
Arguments: []string{"sh", "-c", `
2524-
set -e
2525-
2526-
# IPv4 should be available with external networking.
2527-
if [ ! -r /proc/sys/net/ipv4/ip_forward ]; then
2528-
echo "missing /proc/sys/net/ipv4/ip_forward" >&2
2529-
exit 1
2530-
fi
2531-
if ! grep -Eq '^[[:space:]]*eth0:' /proc/net/dev; then
2532-
echo "expected eth0 device; got:" >&2
2533-
cat /proc/net/dev >&2
2534-
exit 1
2535-
fi
2536-
2537-
# IPv6 should also be enabled.
2538-
if grep -q 'ipv6.disable=1' /proc/cmdline; then
2539-
echo "kernel cmdline has ipv6.disable=1: $(cat /proc/cmdline)" >&2
2540-
exit 1
2541-
fi
2542-
if [ "$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6)" != "0" ] || [ "$(cat /proc/sys/net/ipv6/conf/default/disable_ipv6)" != "0" ]; then
2543-
echo "IPv6 disable flags: all=$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6) default=$(cat /proc/sys/net/ipv6/conf/default/disable_ipv6)" >&2
2544-
exit 1
2545-
fi
2546-
if ! grep -q . /proc/net/if_inet6; then
2547-
echo "expected non-empty /proc/net/if_inet6" >&2
2548-
cat /proc/net/if_inet6 >&2 || true
2549-
exit 1
2550-
fi
2551-
echo ipv4_ipv6_enabled
2552-
`},
2553-
}
2554-
opts := firecracker.ContainerOpts{
2555-
ContainerImage: busyboxImage,
2556-
ActionWorkingDirectory: workDir,
2557-
VMConfiguration: &fcpb.VMConfiguration{
2558-
NumCpus: 1,
2559-
MemSizeMb: 2500,
2560-
NetworkMode: fcpb.NetworkMode_NETWORK_MODE_EXTERNAL,
2561-
ScratchDiskSizeMb: 100,
2562-
},
2563-
ExecutorConfig: getExecutorConfig(t),
2564-
}
2565-
c, err := firecracker.NewContainer(ctx, env, &repb.ExecutionTask{}, opts)
2566-
require.NoError(t, err)
2567-
2568-
// Run will handle the full lifecycle: no need to call Remove() here.
2569-
res := c.Run(ctx, cmd, opts.ActionWorkingDirectory, oci.Credentials{})
2570-
require.NoError(t, res.Error)
2571-
assert.Equal(t, 0, res.ExitCode)
2572-
assert.Equal(t, "", string(res.Stderr))
2573-
assert.Equal(t, "ipv4_ipv6_enabled\n", string(res.Stdout))
2574-
}
2575-
25762510
func testFirecrackerRunWithDockerOverUDS(t *testing.T, containerImage string) {
25772511
if *skipDockerTests {
25782512
t.Skip()
@@ -2583,17 +2517,15 @@ func testFirecrackerRunWithDockerOverUDS(t *testing.T, containerImage string) {
25832517
rootDir := testfs.MakeTempDir(t)
25842518
workDir := testfs.MakeDirAll(t, rootDir, "work")
25852519
cmd := &repb.Command{
2586-
Arguments: []string{"sh", "-c", `
2520+
Arguments: []string{"bash", "-c", `
25872521
set -e
25882522
25892523
# Discard pull output to make the output deterministic
2590-
docker pull ` + busyboxImage + ` >/dev/null 2>&1
2591-
2592-
# Test basic command
2593-
docker run --rm ` + busyboxImage + ` echo Hello
2524+
docker pull ` + busyboxImage + ` &>/dev/null
25942525
2595-
# Test port publishing
2596-
docker run --rm -p 127.0.0.1:18080:80 ` + busyboxImage + ` echo world
2526+
# Try running a few commands
2527+
docker run --rm -p 127.0.0.1:18080:80 ` + busyboxImage + ` echo Hello
2528+
docker run --rm ` + busyboxImage + ` echo world
25972529
25982530
# Check what storage driver docker is using
25992531
docker info 2>/dev/null | grep 'Storage Driver'
@@ -2624,15 +2556,11 @@ func testFirecrackerRunWithDockerOverUDS(t *testing.T, containerImage string) {
26242556
}
26252557

26262558
assert.Equal(t, 0, res.ExitCode)
2627-
stdout := string(res.Stdout)
2559+
expectedStorageDriver := "vfs"
26282560
if snaputil.IsChunkedSnapshotSharingEnabled() {
2629-
// Docker may report the native overlay-backed fast path as either the
2630-
// legacy graphdriver name ("overlay2") or the newer containerd
2631-
// snapshotter name ("overlayfs"), depending on daemon configuration.
2632-
assert.Regexp(t, `^Hello\nworld\n Storage Driver: (overlay2|overlayfs)\n$`, stdout, "stdout should contain docker output with a native overlay storage driver")
2633-
} else {
2634-
assert.Equal(t, "Hello\nworld\n Storage Driver: vfs\n", stdout, "stdout should contain docker output")
2561+
expectedStorageDriver = "overlay2"
26352562
}
2563+
assert.Equal(t, "Hello\nworld\n Storage Driver: "+expectedStorageDriver+"\n", string(res.Stdout), "stdout should contain pwd output")
26362564
assert.Equal(t, "", string(res.Stderr), "stderr should be empty")
26372565
}
26382566

@@ -2641,24 +2569,9 @@ func TestFirecrackerRunWithDockerOverUDS(t *testing.T) {
26412569
}
26422570

26432571
func TestFirecrackerRunWithDockerV28OverUDS(t *testing.T) {
2644-
// docker v28 requires nf_raw in order to bind ports, so this tests that the
2645-
// 'raw' table is properly set up in the guest.
26462572
testFirecrackerRunWithDockerOverUDS(t, imageWithDockerV28Installed)
26472573
}
26482574

2649-
func TestFirecrackerRunWithDockerDindOverUDS(t *testing.T) {
2650-
if runtime.GOARCH != "amd64" {
2651-
// TODO(bduffany): make this work on arm64
2652-
t.Skipf("test is not yet supported on arm64")
2653-
}
2654-
2655-
// docker:dind has docker but doesn't have iptables-legacy, so this tests
2656-
// that we've properly set up the newer nftables-based iptables in the
2657-
// guest. It also tests that we've set up NAT correctly which is also needed
2658-
// to make this image work.
2659-
testFirecrackerRunWithDockerOverUDS(t, dockerDindImage)
2660-
}
2661-
26622575
func TestFirecrackerRunWithDockerOverTCP(t *testing.T) {
26632576
if *skipDockerTests {
26642577
t.Skip()

enterprise/vmsupport/kernel/microvm-kernel-x86_64-v5.15.config

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
# TODO: For our current iptables-legacy path, enable CONFIG_IP_NF_RAW (and CONFIG_IP6_NF_RAW if needed), or fully migrate to nftables (CONFIG_NF_TABLES + non-legacy iptables), then remove the DOCKER_INSECURE_NO_IPTABLES_RAW fallback in enterprise/server/cmd/goinit/main.go.
2+
#
13
# Config copied from https://github.com/firecracker-microvm/firecracker/blob/main/resources/guest_configs/microvm-kernel-ci-x86_64-5.10.config
24
# Linux/x86 5.10.0 Kernel Configuration
35
#
46
# Buildbuddy modifications:
57
#
68
# To support running docker in the VM:
79
# * Enabled CONFIG_NETFILTER and related options
8-
# * Enabled CONFIG_NF_TABLES plus IPv4 / IPv6 raw table support
9-
# * Enabled CONFIG_IPV6 and related IPv6 netfilter options
10+
# * Enabled CONFIG_IPV6 and related options
1011
#
1112
# To support running OCI in the VM:
1213
# * Enabled CONFIG_SECCOMP
@@ -1015,13 +1016,7 @@ CONFIG_NF_NAT_PROTO_SCTP=y
10151016
# CONFIG_NF_NAT_TFTP is not set
10161017
CONFIG_NF_NAT_REDIRECT=y
10171018
CONFIG_NETFILTER_SYNPROXY=y
1018-
CONFIG_NF_TABLES=y
1019-
CONFIG_NF_TABLES_INET=y
1020-
CONFIG_NFT_CT=y
1021-
CONFIG_NFT_MASQ=y
1022-
CONFIG_NFT_REDIR=y
1023-
CONFIG_NFT_NAT=y
1024-
CONFIG_NFT_COMPAT=y
1019+
# CONFIG_NF_TABLES is not set
10251020
CONFIG_NETFILTER_XTABLES=y
10261021

10271022
CONFIG_NETFILTER_XT_NAT=y
@@ -1080,7 +1075,6 @@ CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
10801075
# IP: Netfilter Configuration
10811076
#
10821077
CONFIG_NF_DEFRAG_IPV4=y
1083-
CONFIG_NF_TABLES_IPV4=y
10841078
CONFIG_NF_CONNTRACK_IPV4=y
10851079
# CONFIG_NF_SOCKET_IPV4 is not set
10861080
# CONFIG_NF_DUP_IPV4 is not set
@@ -1107,40 +1101,9 @@ CONFIG_IP_NF_MANGLE=y
11071101
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
11081102
# CONFIG_IP_NF_TARGET_ECN is not set
11091103
# CONFIG_IP_NF_TARGET_TTL is not set
1110-
CONFIG_IP_NF_RAW=y
1104+
# CONFIG_IP_NF_RAW is not set
11111105
# CONFIG_IP_NF_SECURITY is not set
11121106

1113-
#
1114-
# IPv6: Netfilter Configuration
1115-
#
1116-
# CONFIG_NF_SOCKET_IPV6 is not set
1117-
# CONFIG_NF_DUP_IPV6 is not set
1118-
CONFIG_NF_TABLES_IPV6=y
1119-
CONFIG_NF_REJECT_IPV6=y
1120-
CONFIG_NF_LOG_IPV6=y
1121-
CONFIG_IP6_NF_IPTABLES=y
1122-
# CONFIG_IP6_NF_MATCH_AH is not set
1123-
# CONFIG_IP6_NF_MATCH_EUI64 is not set
1124-
# CONFIG_IP6_NF_MATCH_FRAG is not set
1125-
# CONFIG_IP6_NF_MATCH_OPTS is not set
1126-
# CONFIG_IP6_NF_MATCH_HL is not set
1127-
# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
1128-
# CONFIG_IP6_NF_MATCH_MH is not set
1129-
# CONFIG_IP6_NF_MATCH_RPFILTER is not set
1130-
# CONFIG_IP6_NF_MATCH_RT is not set
1131-
# CONFIG_IP6_NF_TARGET_HL is not set
1132-
CONFIG_IP6_NF_FILTER=y
1133-
CONFIG_IP6_NF_TARGET_REJECT=y
1134-
CONFIG_IP6_NF_TARGET_SYNPROXY=y
1135-
CONFIG_IP6_NF_MANGLE=y
1136-
CONFIG_IP6_NF_RAW=y
1137-
# CONFIG_IP6_NF_SECURITY is not set
1138-
CONFIG_IP6_NF_NAT=y
1139-
CONFIG_IP6_NF_TARGET_MASQUERADE=y
1140-
# end of IPv6: Netfilter Configuration
1141-
1142-
CONFIG_NF_DEFRAG_IPV6=y
1143-
11441107
###### END BUILDBUDDY ADDED ######
11451108

11461109
#

enterprise/vmsupport/kernel/microvm-kernel-x86_64-v6.1.config

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
# TODO: For our current iptables-legacy path, enable CONFIG_IP_NF_RAW (and CONFIG_IP6_NF_RAW if needed), or fully migrate to nftables (CONFIG_NF_TABLES + non-legacy iptables), then remove the DOCKER_INSECURE_NO_IPTABLES_RAW fallback in enterprise/server/cmd/goinit/main.go.
12
# Config copied from https://github.com/firecracker-microvm/firecracker/blob/main/resources/guest_configs/microvm-kernel-ci-x86_64-6.1.config
23
# BuildBuddy-specific modifications:
34
# - Set CONFIG_PCI=y (see https://github.com/firecracker-microvm/firecracker/issues/4881)
45
# - Set CONFIG_FUSE_FS=y for FUSE support
56
# - Set CONFIG_TUN=y for networking
6-
# - Enable CONFIG_NF_TABLES plus IPv4 / IPv6 raw table support for Docker networking
77

88
#
99
# Automatically generated file; DO NOT EDIT.
@@ -1094,13 +1094,7 @@ CONFIG_NF_NAT=y
10941094
CONFIG_NF_NAT_REDIRECT=y
10951095
CONFIG_NF_NAT_MASQUERADE=y
10961096
CONFIG_NETFILTER_SYNPROXY=y
1097-
CONFIG_NF_TABLES=y
1098-
CONFIG_NF_TABLES_INET=y
1099-
CONFIG_NFT_CT=y
1100-
CONFIG_NFT_MASQ=y
1101-
CONFIG_NFT_REDIR=y
1102-
CONFIG_NFT_NAT=y
1103-
CONFIG_NFT_COMPAT=y
1097+
# CONFIG_NF_TABLES is not set
11041098
CONFIG_NETFILTER_XTABLES=y
11051099
CONFIG_NETFILTER_XTABLES_COMPAT=y
11061100

@@ -1194,7 +1188,6 @@ CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
11941188
# IP: Netfilter Configuration
11951189
#
11961190
CONFIG_NF_DEFRAG_IPV4=y
1197-
CONFIG_NF_TABLES_IPV4=y
11981191
# CONFIG_NF_SOCKET_IPV4 is not set
11991192
# CONFIG_NF_TPROXY_IPV4 is not set
12001193
# CONFIG_NF_DUP_IPV4 is not set
@@ -1217,7 +1210,7 @@ CONFIG_IP_NF_MANGLE=y
12171210
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
12181211
# CONFIG_IP_NF_TARGET_ECN is not set
12191212
# CONFIG_IP_NF_TARGET_TTL is not set
1220-
CONFIG_IP_NF_RAW=y
1213+
# CONFIG_IP_NF_RAW is not set
12211214
# CONFIG_IP_NF_SECURITY is not set
12221215
# CONFIG_IP_NF_ARPTABLES is not set
12231216
# end of IP: Netfilter Configuration
@@ -1228,7 +1221,6 @@ CONFIG_IP_NF_RAW=y
12281221
# CONFIG_NF_SOCKET_IPV6 is not set
12291222
# CONFIG_NF_TPROXY_IPV6 is not set
12301223
# CONFIG_NF_DUP_IPV6 is not set
1231-
CONFIG_NF_TABLES_IPV6=y
12321224
CONFIG_NF_REJECT_IPV6=y
12331225
CONFIG_NF_LOG_IPV6=y
12341226
CONFIG_IP6_NF_IPTABLES=y
@@ -1247,7 +1239,7 @@ CONFIG_IP6_NF_FILTER=y
12471239
CONFIG_IP6_NF_TARGET_REJECT=y
12481240
CONFIG_IP6_NF_TARGET_SYNPROXY=y
12491241
CONFIG_IP6_NF_MANGLE=y
1250-
CONFIG_IP6_NF_RAW=y
1242+
# CONFIG_IP6_NF_RAW is not set
12511243
# CONFIG_IP6_NF_SECURITY is not set
12521244
CONFIG_IP6_NF_NAT=y
12531245
CONFIG_IP6_NF_TARGET_MASQUERADE=y

0 commit comments

Comments
 (0)