Files
zeekayandHanzo Dev e1280967b6 Give the last two payloads a wire to state
A prometheus Data held its labels in a map, and control.ExecArgs held the
live kernel objects an exec runs against -- a mount namespace, an fd
table, a limit set. Neither has offsets, so neither payload could state
a layout.

Labels become a list, which also retires the O(n^2) walk that existed to
read a map in sorted order. The kernel objects move to control.Env, which
is what the sentry supplies and what a call arriving on the wire cannot:
a namespace is a reference, not a value.

Every urpc payload now states its own wire.


Co-authored-by: Hanzo Dev <[email protected]>
2026-09-22 23:10:33 -07:00

74 lines
2.4 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 auth
import (
"fmt"
zap "github.com/zap-proto/go"
)
// ---- TaskCapabilities --------------------------------------------------
const (
taskCapabilitiesPermittedCapsAt = 0
taskCapabilitiesInheritableCapsAt = 8
taskCapabilitiesEffectiveCapsAt = 16
taskCapabilitiesBoundingCapsAt = 24
taskCapabilitiesAmbientCapsAt = 32
taskCapabilitiesSize = 40
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*TaskCapabilities)(nil)
// MarshalZAP writes TaskCapabilities from constant offsets.
func (x *TaskCapabilities) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(taskCapabilitiesSize + 256)
ob := b.StartObject(taskCapabilitiesSize)
ob.SetUint64(taskCapabilitiesPermittedCapsAt, uint64(x.PermittedCaps))
ob.SetUint64(taskCapabilitiesInheritableCapsAt, uint64(x.InheritableCaps))
ob.SetUint64(taskCapabilitiesEffectiveCapsAt, uint64(x.EffectiveCaps))
ob.SetUint64(taskCapabilitiesBoundingCapsAt, uint64(x.BoundingCaps))
ob.SetUint64(taskCapabilitiesAmbientCapsAt, uint64(x.AmbientCaps))
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads TaskCapabilities out of the buffer that arrived.
func (x *TaskCapabilities) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("TaskCapabilities: %w", err)
}
o := m.Root()
x.PermittedCaps = CapabilitySet(o.Uint64(taskCapabilitiesPermittedCapsAt))
x.InheritableCaps = CapabilitySet(o.Uint64(taskCapabilitiesInheritableCapsAt))
x.EffectiveCaps = CapabilitySet(o.Uint64(taskCapabilitiesEffectiveCapsAt))
x.BoundingCaps = CapabilitySet(o.Uint64(taskCapabilitiesBoundingCapsAt))
x.AmbientCaps = CapabilitySet(o.Uint64(taskCapabilitiesAmbientCapsAt))
return nil
}