mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
urpc encodes with encoding/json, which walks the payload on every call: a realistic control.ExecArgs costs 7084ns and 10 allocations to cross. ZAP reads a field at a constant offset out of the buffer that arrived, so the same payload is 740ns and one allocation -- but only if the offsets are stated, and a stated offset that is wrong is silent corruption rather than a compile error. So state them from the types themselves. //tools/zap reflects over the payloads at build time and writes the wire as Go source with the offsets as constants. It lives inside Bazel because pkg/sentry/control cannot be imported from outside it: the *_go_proto packages it depends on have no source in the tree. Six payloads had no layout to state. A map, an interface and a type from another module have no offsets, so each is answered in the type: SaveOpts.Metadata and StartContainerArgs.InitialCgroups/Limits cross as lists of pairs; boot.Route.Destination restates net.IPNet as Subnet; OpenMountArgs restates the OCI mount fields the call actually uses; StartArgs.Spec and SinkConfig.Config carry their documents as the bytes they arrived as; MetricsRegistrationResponse carries the protocol buffer the same way; and seccheck's session options become a type instead of a map of any. ExecArgs and MetricsExportData still have none: ExecArgs holds live kernel objects behind an interface, and MetricsExportData reaches a prometheus snapshot whose labels are a map. Co-authored-by: Hanzo Dev <[email protected]>
432 lines
22 KiB
Go
432 lines
22 KiB
Go
// Copyright 2026 The gVisor Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// Code generated by zip; DO NOT EDIT.
|
|
|
|
package config
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
zap "github.com/zap-proto/go"
|
|
refs "gvisor.dev/gvisor/pkg/refs"
|
|
)
|
|
|
|
// ---- Config ------------------------------------------------------------
|
|
|
|
const (
|
|
configRootDirAt = 0
|
|
configTracebackAt = 8
|
|
configDebugAt = 16
|
|
configLogFilenameAt = 24
|
|
configLogFormatAt = 32
|
|
configDebugLogAt = 40
|
|
configDebugToUserLogAt = 48
|
|
configDebugCommandAt = 56
|
|
configPanicLogAt = 64
|
|
configCoverageReportAt = 72
|
|
configDebugLogFormatAt = 80
|
|
configFileAccessAt = 88
|
|
configFileAccessMountsAt = 96
|
|
configOverlayAt = 104
|
|
configOverlay2At = 112
|
|
configFSGoferHostUDSAt = 120
|
|
configHostUDSAt = 128
|
|
configHostFifoAt = 136
|
|
configCharacterDevicePolicyAt = 144
|
|
configHostSettingsAt = 152
|
|
configNetworkAt = 160
|
|
configGoferNetworkNamespaceAt = 168
|
|
configEnableRawAt = 176
|
|
configAllowPacketEndpointWriteAt = 177
|
|
configAllowLiveTCPMigrationAt = 178
|
|
configHostGSOAt = 179
|
|
configGVisorGSOAt = 180
|
|
configGVisorGROAt = 181
|
|
configTXChecksumOffloadAt = 182
|
|
configRXChecksumOffloadAt = 183
|
|
configQDiscAt = 184
|
|
configTBFRateAt = 192
|
|
configTBFBurstAt = 200
|
|
configLogPacketsAt = 208
|
|
configPCAPAt = 216
|
|
configPlatformAt = 224
|
|
configPlatformDevicePathAt = 232
|
|
configMetricServerAt = 240
|
|
configSidecarReleaseEnforcementPolicyAt = 248
|
|
configSidecarUsagePolicyAt = 256
|
|
configFinalMetricsLogAt = 264
|
|
configProfilingMetricsAt = 272
|
|
configProfilingMetricsLogAt = 280
|
|
configProfilingMetricsRateAt = 288
|
|
configStraceAt = 296
|
|
configStraceSyscallsAt = 304
|
|
configStraceLogSizeAt = 312
|
|
configStraceEventAt = 320
|
|
configDisableSeccompAt = 321
|
|
configEnableCoreTagsAt = 322
|
|
configWatchdogActionAt = 328
|
|
configPanicSignalAt = 336
|
|
configProfileEnableAt = 344
|
|
configProfileBlockAt = 352
|
|
configProfileCPUAt = 360
|
|
configProfileGCIntervalAt = 368
|
|
configProfileHeapAt = 376
|
|
configProfileMutexAt = 384
|
|
configTraceFileAt = 392
|
|
configNumNetworkChannelsAt = 400
|
|
configNetworkProcessorsPerChannelAt = 408
|
|
configRootlessAt = 416
|
|
configAlsoLogToStderrAt = 417
|
|
configReferenceLeakAt = 420
|
|
configCPUNumFromQuotaAt = 424
|
|
configAllowFlagOverrideAt = 425
|
|
configOCISeccompAt = 426
|
|
configIgnoreCgroupsAt = 427
|
|
configInSandboxCgroupAt = 432
|
|
configSystemdCgroupAt = 440
|
|
configPodInitConfigAt = 448
|
|
configXDPAt = 456
|
|
configAFXDPUseNeedWakeupAt = 464
|
|
configFDLimitAt = 472
|
|
configDCacheAt = 480
|
|
configIOUringAt = 488
|
|
configDirectFSAt = 489
|
|
configAppHugePagesAt = 490
|
|
configNVProxyAt = 491
|
|
configNVProxyDockerAt = 492
|
|
configNVProxyDriverVersionAt = 496
|
|
configNVProxyAllowedDriverCapabilitiesAt = 504
|
|
configNVProxyAllowUnsupportedDriverAt = 512
|
|
configTPUProxyAt = 513
|
|
configRDMAProxyAt = 514
|
|
configTestOnlyAllowRunAsCurrentUserWithoutChrootAt = 515
|
|
configTestOnlyTestNameEnvAt = 520
|
|
configTestOnlyAFSSyscallPanicAt = 528
|
|
configReproduceNATAt = 529
|
|
configReproduceNftablesAt = 530
|
|
configNetDisconnectOkAt = 531
|
|
configTestOnlyAutosaveImagePathAt = 536
|
|
configTestOnlyAutosaveResumeAt = 544
|
|
configRestoreSpecValidationAt = 552
|
|
configGVisorMarkerFileAt = 560
|
|
configOverrideProcsAt = 568
|
|
configSystrapDisableSyscallPatchingAt = 576
|
|
configSystrapDisableFastPathAt = 577
|
|
configNftablesAt = 578
|
|
configAllowSUIDAt = 579
|
|
configUseCPUNumsAt = 580
|
|
configPauseExternalNetworkingAt = 581
|
|
configAllowConnectedOnSaveAt = 582
|
|
configAllowRootfsTarAnnotationAt = 583
|
|
configControlRPCStopTimeoutAt = 584
|
|
configSharedRootDirAt = 592
|
|
configSize = 600
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*Config)(nil)
|
|
|
|
// MarshalZAP writes Config from constant offsets.
|
|
func (x *Config) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(configSize + 256)
|
|
ob := b.StartObject(configSize)
|
|
ob.SetText(configRootDirAt, string(x.RootDir))
|
|
ob.SetText(configTracebackAt, string(x.Traceback))
|
|
ob.SetBool(configDebugAt, bool(x.Debug))
|
|
ob.SetText(configLogFilenameAt, string(x.LogFilename))
|
|
ob.SetText(configLogFormatAt, string(x.LogFormat))
|
|
ob.SetText(configDebugLogAt, string(x.DebugLog))
|
|
ob.SetBool(configDebugToUserLogAt, bool(x.DebugToUserLog))
|
|
ob.SetText(configDebugCommandAt, string(x.DebugCommand))
|
|
ob.SetText(configPanicLogAt, string(x.PanicLog))
|
|
ob.SetText(configCoverageReportAt, string(x.CoverageReport))
|
|
ob.SetText(configDebugLogFormatAt, string(x.DebugLogFormat))
|
|
ob.SetInt64(configFileAccessAt, int64(x.FileAccess))
|
|
ob.SetInt64(configFileAccessMountsAt, int64(x.FileAccessMounts))
|
|
ob.SetBool(configOverlayAt, bool(x.Overlay))
|
|
{
|
|
eb := zap.NewBuilder(zap.HeaderSize)
|
|
eb.StartObject(0).FinishAsRoot()
|
|
ob.SetBytes(configOverlay2At, eb.Finish())
|
|
}
|
|
ob.SetBool(configFSGoferHostUDSAt, bool(x.FSGoferHostUDS))
|
|
ob.SetInt64(configHostUDSAt, int64(x.HostUDS))
|
|
ob.SetInt64(configHostFifoAt, int64(x.HostFifo))
|
|
ob.SetInt64(configCharacterDevicePolicyAt, int64(x.CharacterDevicePolicy))
|
|
ob.SetInt64(configHostSettingsAt, int64(x.HostSettings))
|
|
ob.SetInt64(configNetworkAt, int64(x.Network))
|
|
ob.SetText(configGoferNetworkNamespaceAt, string(x.GoferNetworkNamespace))
|
|
ob.SetBool(configEnableRawAt, bool(x.EnableRaw))
|
|
ob.SetBool(configAllowPacketEndpointWriteAt, bool(x.AllowPacketEndpointWrite))
|
|
ob.SetBool(configAllowLiveTCPMigrationAt, bool(x.AllowLiveTCPMigration))
|
|
ob.SetBool(configHostGSOAt, bool(x.HostGSO))
|
|
ob.SetBool(configGVisorGSOAt, bool(x.GVisorGSO))
|
|
ob.SetBool(configGVisorGROAt, bool(x.GVisorGRO))
|
|
ob.SetBool(configTXChecksumOffloadAt, bool(x.TXChecksumOffload))
|
|
ob.SetBool(configRXChecksumOffloadAt, bool(x.RXChecksumOffload))
|
|
ob.SetInt64(configQDiscAt, int64(x.QDisc))
|
|
ob.SetUint64(configTBFRateAt, uint64(x.TBFRate))
|
|
ob.SetUint64(configTBFBurstAt, uint64(x.TBFBurst))
|
|
ob.SetBool(configLogPacketsAt, bool(x.LogPackets))
|
|
ob.SetText(configPCAPAt, string(x.PCAP))
|
|
ob.SetText(configPlatformAt, string(x.Platform))
|
|
ob.SetText(configPlatformDevicePathAt, string(x.PlatformDevicePath))
|
|
ob.SetText(configMetricServerAt, string(x.MetricServer))
|
|
ob.SetText(configSidecarReleaseEnforcementPolicyAt, string(x.SidecarReleaseEnforcementPolicy))
|
|
ob.SetText(configSidecarUsagePolicyAt, string(x.SidecarUsagePolicy))
|
|
ob.SetText(configFinalMetricsLogAt, string(x.FinalMetricsLog))
|
|
ob.SetText(configProfilingMetricsAt, string(x.ProfilingMetrics))
|
|
ob.SetText(configProfilingMetricsLogAt, string(x.ProfilingMetricsLog))
|
|
ob.SetInt64(configProfilingMetricsRateAt, int64(x.ProfilingMetricsRate))
|
|
ob.SetBool(configStraceAt, bool(x.Strace))
|
|
ob.SetText(configStraceSyscallsAt, string(x.StraceSyscalls))
|
|
ob.SetUint64(configStraceLogSizeAt, uint64(x.StraceLogSize))
|
|
ob.SetBool(configStraceEventAt, bool(x.StraceEvent))
|
|
ob.SetBool(configDisableSeccompAt, bool(x.DisableSeccomp))
|
|
ob.SetBool(configEnableCoreTagsAt, bool(x.EnableCoreTags))
|
|
ob.SetText(configWatchdogActionAt, string(x.WatchdogAction))
|
|
ob.SetInt64(configPanicSignalAt, int64(x.PanicSignal))
|
|
ob.SetBool(configProfileEnableAt, bool(x.ProfileEnable))
|
|
ob.SetText(configProfileBlockAt, string(x.ProfileBlock))
|
|
ob.SetText(configProfileCPUAt, string(x.ProfileCPU))
|
|
ob.SetInt64(configProfileGCIntervalAt, int64(x.ProfileGCInterval))
|
|
ob.SetText(configProfileHeapAt, string(x.ProfileHeap))
|
|
ob.SetText(configProfileMutexAt, string(x.ProfileMutex))
|
|
ob.SetText(configTraceFileAt, string(x.TraceFile))
|
|
ob.SetInt64(configNumNetworkChannelsAt, int64(x.NumNetworkChannels))
|
|
ob.SetInt64(configNetworkProcessorsPerChannelAt, int64(x.NetworkProcessorsPerChannel))
|
|
ob.SetBool(configRootlessAt, bool(x.Rootless))
|
|
ob.SetBool(configAlsoLogToStderrAt, bool(x.AlsoLogToStderr))
|
|
ob.SetUint32(configReferenceLeakAt, uint32(x.ReferenceLeak))
|
|
ob.SetBool(configCPUNumFromQuotaAt, bool(x.CPUNumFromQuota))
|
|
ob.SetBool(configAllowFlagOverrideAt, bool(x.AllowFlagOverride))
|
|
ob.SetBool(configOCISeccompAt, bool(x.OCISeccomp))
|
|
ob.SetBool(configIgnoreCgroupsAt, bool(x.IgnoreCgroups))
|
|
ob.SetInt64(configInSandboxCgroupAt, int64(x.InSandboxCgroup))
|
|
ob.SetBool(configSystemdCgroupAt, bool(x.SystemdCgroup))
|
|
ob.SetText(configPodInitConfigAt, string(x.PodInitConfig))
|
|
innerXDP, err := x.XDP.MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ob.SetBytes(configXDPAt, innerXDP)
|
|
ob.SetBool(configAFXDPUseNeedWakeupAt, bool(x.AFXDPUseNeedWakeup))
|
|
ob.SetInt64(configFDLimitAt, int64(x.FDLimit))
|
|
ob.SetInt64(configDCacheAt, int64(x.DCache))
|
|
ob.SetBool(configIOUringAt, bool(x.IOUring))
|
|
ob.SetBool(configDirectFSAt, bool(x.DirectFS))
|
|
ob.SetBool(configAppHugePagesAt, bool(x.AppHugePages))
|
|
ob.SetBool(configNVProxyAt, bool(x.NVProxy))
|
|
ob.SetBool(configNVProxyDockerAt, bool(x.NVProxyDocker))
|
|
ob.SetText(configNVProxyDriverVersionAt, string(x.NVProxyDriverVersion))
|
|
ob.SetText(configNVProxyAllowedDriverCapabilitiesAt, string(x.NVProxyAllowedDriverCapabilities))
|
|
ob.SetBool(configNVProxyAllowUnsupportedDriverAt, bool(x.NVProxyAllowUnsupportedDriver))
|
|
ob.SetBool(configTPUProxyAt, bool(x.TPUProxy))
|
|
ob.SetBool(configRDMAProxyAt, bool(x.RDMAProxy))
|
|
ob.SetBool(configTestOnlyAllowRunAsCurrentUserWithoutChrootAt, bool(x.TestOnlyAllowRunAsCurrentUserWithoutChroot))
|
|
ob.SetText(configTestOnlyTestNameEnvAt, string(x.TestOnlyTestNameEnv))
|
|
ob.SetBool(configTestOnlyAFSSyscallPanicAt, bool(x.TestOnlyAFSSyscallPanic))
|
|
ob.SetBool(configReproduceNATAt, bool(x.ReproduceNAT))
|
|
ob.SetBool(configReproduceNftablesAt, bool(x.ReproduceNftables))
|
|
ob.SetBool(configNetDisconnectOkAt, bool(x.NetDisconnectOk))
|
|
ob.SetText(configTestOnlyAutosaveImagePathAt, string(x.TestOnlyAutosaveImagePath))
|
|
ob.SetBool(configTestOnlyAutosaveResumeAt, bool(x.TestOnlyAutosaveResume))
|
|
ob.SetInt64(configRestoreSpecValidationAt, int64(x.RestoreSpecValidation))
|
|
ob.SetBool(configGVisorMarkerFileAt, bool(x.GVisorMarkerFile))
|
|
ob.SetText(configOverrideProcsAt, string(x.OverrideProcs))
|
|
ob.SetBool(configSystrapDisableSyscallPatchingAt, bool(x.SystrapDisableSyscallPatching))
|
|
ob.SetBool(configSystrapDisableFastPathAt, bool(x.SystrapDisableFastPath))
|
|
ob.SetBool(configNftablesAt, bool(x.Nftables))
|
|
ob.SetBool(configAllowSUIDAt, bool(x.AllowSUID))
|
|
ob.SetBool(configUseCPUNumsAt, bool(x.UseCPUNums))
|
|
ob.SetBool(configPauseExternalNetworkingAt, bool(x.PauseExternalNetworking))
|
|
ob.SetBool(configAllowConnectedOnSaveAt, bool(x.AllowConnectedOnSave))
|
|
ob.SetBool(configAllowRootfsTarAnnotationAt, bool(x.AllowRootfsTarAnnotation))
|
|
ob.SetInt64(configControlRPCStopTimeoutAt, int64(x.ControlRPCStopTimeout))
|
|
ob.SetText(configSharedRootDirAt, string(x.SharedRootDir))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads Config out of the buffer that arrived.
|
|
func (x *Config) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("Config: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.RootDir = string(strings.Clone(o.Text(configRootDirAt)))
|
|
x.Traceback = string(strings.Clone(o.Text(configTracebackAt)))
|
|
x.Debug = bool(o.Bool(configDebugAt))
|
|
x.LogFilename = string(strings.Clone(o.Text(configLogFilenameAt)))
|
|
x.LogFormat = string(strings.Clone(o.Text(configLogFormatAt)))
|
|
x.DebugLog = string(strings.Clone(o.Text(configDebugLogAt)))
|
|
x.DebugToUserLog = bool(o.Bool(configDebugToUserLogAt))
|
|
x.DebugCommand = string(strings.Clone(o.Text(configDebugCommandAt)))
|
|
x.PanicLog = string(strings.Clone(o.Text(configPanicLogAt)))
|
|
x.CoverageReport = string(strings.Clone(o.Text(configCoverageReportAt)))
|
|
x.DebugLogFormat = string(strings.Clone(o.Text(configDebugLogFormatAt)))
|
|
x.FileAccess = FileAccessType(o.Int64(configFileAccessAt))
|
|
x.FileAccessMounts = FileAccessType(o.Int64(configFileAccessMountsAt))
|
|
x.Overlay = bool(o.Bool(configOverlayAt))
|
|
x.FSGoferHostUDS = bool(o.Bool(configFSGoferHostUDSAt))
|
|
x.HostUDS = HostUDS(o.Int64(configHostUDSAt))
|
|
x.HostFifo = HostFifo(o.Int64(configHostFifoAt))
|
|
x.CharacterDevicePolicy = CharacterDevicePolicy(o.Int64(configCharacterDevicePolicyAt))
|
|
x.HostSettings = HostSettingsPolicy(o.Int64(configHostSettingsAt))
|
|
x.Network = NetworkType(o.Int64(configNetworkAt))
|
|
x.GoferNetworkNamespace = GoferNetworkNamespace(strings.Clone(o.Text(configGoferNetworkNamespaceAt)))
|
|
x.EnableRaw = bool(o.Bool(configEnableRawAt))
|
|
x.AllowPacketEndpointWrite = bool(o.Bool(configAllowPacketEndpointWriteAt))
|
|
x.AllowLiveTCPMigration = bool(o.Bool(configAllowLiveTCPMigrationAt))
|
|
x.HostGSO = bool(o.Bool(configHostGSOAt))
|
|
x.GVisorGSO = bool(o.Bool(configGVisorGSOAt))
|
|
x.GVisorGRO = bool(o.Bool(configGVisorGROAt))
|
|
x.TXChecksumOffload = bool(o.Bool(configTXChecksumOffloadAt))
|
|
x.RXChecksumOffload = bool(o.Bool(configRXChecksumOffloadAt))
|
|
x.QDisc = QueueingDiscipline(o.Int64(configQDiscAt))
|
|
x.TBFRate = uint64(o.Uint64(configTBFRateAt))
|
|
x.TBFBurst = uint64(o.Uint64(configTBFBurstAt))
|
|
x.LogPackets = bool(o.Bool(configLogPacketsAt))
|
|
x.PCAP = string(strings.Clone(o.Text(configPCAPAt)))
|
|
x.Platform = string(strings.Clone(o.Text(configPlatformAt)))
|
|
x.PlatformDevicePath = string(strings.Clone(o.Text(configPlatformDevicePathAt)))
|
|
x.MetricServer = string(strings.Clone(o.Text(configMetricServerAt)))
|
|
x.SidecarReleaseEnforcementPolicy = SidecarReleasePolicy(strings.Clone(o.Text(configSidecarReleaseEnforcementPolicyAt)))
|
|
x.SidecarUsagePolicy = SidecarUsagePolicy(strings.Clone(o.Text(configSidecarUsagePolicyAt)))
|
|
x.FinalMetricsLog = string(strings.Clone(o.Text(configFinalMetricsLogAt)))
|
|
x.ProfilingMetrics = string(strings.Clone(o.Text(configProfilingMetricsAt)))
|
|
x.ProfilingMetricsLog = string(strings.Clone(o.Text(configProfilingMetricsLogAt)))
|
|
x.ProfilingMetricsRate = int(o.Int64(configProfilingMetricsRateAt))
|
|
x.Strace = bool(o.Bool(configStraceAt))
|
|
x.StraceSyscalls = string(strings.Clone(o.Text(configStraceSyscallsAt)))
|
|
x.StraceLogSize = uint(o.Uint64(configStraceLogSizeAt))
|
|
x.StraceEvent = bool(o.Bool(configStraceEventAt))
|
|
x.DisableSeccomp = bool(o.Bool(configDisableSeccompAt))
|
|
x.EnableCoreTags = bool(o.Bool(configEnableCoreTagsAt))
|
|
x.WatchdogAction = string(strings.Clone(o.Text(configWatchdogActionAt)))
|
|
x.PanicSignal = int(o.Int64(configPanicSignalAt))
|
|
x.ProfileEnable = bool(o.Bool(configProfileEnableAt))
|
|
x.ProfileBlock = string(strings.Clone(o.Text(configProfileBlockAt)))
|
|
x.ProfileCPU = string(strings.Clone(o.Text(configProfileCPUAt)))
|
|
x.ProfileGCInterval = time.Duration(o.Int64(configProfileGCIntervalAt))
|
|
x.ProfileHeap = string(strings.Clone(o.Text(configProfileHeapAt)))
|
|
x.ProfileMutex = string(strings.Clone(o.Text(configProfileMutexAt)))
|
|
x.TraceFile = string(strings.Clone(o.Text(configTraceFileAt)))
|
|
x.NumNetworkChannels = int(o.Int64(configNumNetworkChannelsAt))
|
|
x.NetworkProcessorsPerChannel = int(o.Int64(configNetworkProcessorsPerChannelAt))
|
|
x.Rootless = bool(o.Bool(configRootlessAt))
|
|
x.AlsoLogToStderr = bool(o.Bool(configAlsoLogToStderrAt))
|
|
x.ReferenceLeak = refs.LeakMode(o.Uint32(configReferenceLeakAt))
|
|
x.CPUNumFromQuota = bool(o.Bool(configCPUNumFromQuotaAt))
|
|
x.AllowFlagOverride = bool(o.Bool(configAllowFlagOverrideAt))
|
|
x.OCISeccomp = bool(o.Bool(configOCISeccompAt))
|
|
x.IgnoreCgroups = bool(o.Bool(configIgnoreCgroupsAt))
|
|
x.InSandboxCgroup = InSandboxCgroupType(o.Int64(configInSandboxCgroupAt))
|
|
x.SystemdCgroup = bool(o.Bool(configSystemdCgroupAt))
|
|
x.PodInitConfig = string(strings.Clone(o.Text(configPodInitConfigAt)))
|
|
if raw := o.Bytes(configXDPAt); len(raw) > 0 {
|
|
if err := x.XDP.UnmarshalZAP(raw); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
x.AFXDPUseNeedWakeup = bool(o.Bool(configAFXDPUseNeedWakeupAt))
|
|
x.FDLimit = int(o.Int64(configFDLimitAt))
|
|
x.DCache = int(o.Int64(configDCacheAt))
|
|
x.IOUring = bool(o.Bool(configIOUringAt))
|
|
x.DirectFS = bool(o.Bool(configDirectFSAt))
|
|
x.AppHugePages = bool(o.Bool(configAppHugePagesAt))
|
|
x.NVProxy = bool(o.Bool(configNVProxyAt))
|
|
x.NVProxyDocker = bool(o.Bool(configNVProxyDockerAt))
|
|
x.NVProxyDriverVersion = string(strings.Clone(o.Text(configNVProxyDriverVersionAt)))
|
|
x.NVProxyAllowedDriverCapabilities = string(strings.Clone(o.Text(configNVProxyAllowedDriverCapabilitiesAt)))
|
|
x.NVProxyAllowUnsupportedDriver = bool(o.Bool(configNVProxyAllowUnsupportedDriverAt))
|
|
x.TPUProxy = bool(o.Bool(configTPUProxyAt))
|
|
x.RDMAProxy = bool(o.Bool(configRDMAProxyAt))
|
|
x.TestOnlyAllowRunAsCurrentUserWithoutChroot = bool(o.Bool(configTestOnlyAllowRunAsCurrentUserWithoutChrootAt))
|
|
x.TestOnlyTestNameEnv = string(strings.Clone(o.Text(configTestOnlyTestNameEnvAt)))
|
|
x.TestOnlyAFSSyscallPanic = bool(o.Bool(configTestOnlyAFSSyscallPanicAt))
|
|
x.ReproduceNAT = bool(o.Bool(configReproduceNATAt))
|
|
x.ReproduceNftables = bool(o.Bool(configReproduceNftablesAt))
|
|
x.NetDisconnectOk = bool(o.Bool(configNetDisconnectOkAt))
|
|
x.TestOnlyAutosaveImagePath = string(strings.Clone(o.Text(configTestOnlyAutosaveImagePathAt)))
|
|
x.TestOnlyAutosaveResume = bool(o.Bool(configTestOnlyAutosaveResumeAt))
|
|
x.RestoreSpecValidation = RestoreSpecValidationPolicy(o.Int64(configRestoreSpecValidationAt))
|
|
x.GVisorMarkerFile = bool(o.Bool(configGVisorMarkerFileAt))
|
|
x.OverrideProcs = string(strings.Clone(o.Text(configOverrideProcsAt)))
|
|
x.SystrapDisableSyscallPatching = bool(o.Bool(configSystrapDisableSyscallPatchingAt))
|
|
x.SystrapDisableFastPath = bool(o.Bool(configSystrapDisableFastPathAt))
|
|
x.Nftables = bool(o.Bool(configNftablesAt))
|
|
x.AllowSUID = bool(o.Bool(configAllowSUIDAt))
|
|
x.UseCPUNums = bool(o.Bool(configUseCPUNumsAt))
|
|
x.PauseExternalNetworking = bool(o.Bool(configPauseExternalNetworkingAt))
|
|
x.AllowConnectedOnSave = bool(o.Bool(configAllowConnectedOnSaveAt))
|
|
x.AllowRootfsTarAnnotation = bool(o.Bool(configAllowRootfsTarAnnotationAt))
|
|
x.ControlRPCStopTimeout = time.Duration(o.Int64(configControlRPCStopTimeoutAt))
|
|
x.SharedRootDir = string(strings.Clone(o.Text(configSharedRootDirAt)))
|
|
return nil
|
|
}
|
|
|
|
// ---- XDP ---------------------------------------------------------------
|
|
|
|
const (
|
|
xDPModeAt = 0
|
|
xDPIfaceNameAt = 8
|
|
xDPSize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*XDP)(nil)
|
|
|
|
// MarshalZAP writes XDP from constant offsets.
|
|
func (x *XDP) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(xDPSize + 256)
|
|
ob := b.StartObject(xDPSize)
|
|
ob.SetInt64(xDPModeAt, int64(x.Mode))
|
|
ob.SetText(xDPIfaceNameAt, string(x.IfaceName))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads XDP out of the buffer that arrived.
|
|
func (x *XDP) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("XDP: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Mode = XDPMode(o.Int64(xDPModeAt))
|
|
x.IfaceName = string(strings.Clone(o.Text(xDPIfaceNameAt)))
|
|
return nil
|
|
}
|