vendor: bump runc to 1.0.1
The commands used were (roughly): hack/pin-dependency.sh github.com/opencontainers/runc v1.0.1 hack/lint-dependencies.sh # Follow its recommendations. hack/pin-dependency.sh github.com/cilium/ebpf v0.6.2 hack/pin-dependency.sh github.com/opencontainers/selinux v1.8.2 hack/pin-dependency.sh github.com/sirupsen/logrus v1.8.1 # Recheck. hack/lint-dependencies.sh GO111MODULE=on go mod edit -dropreplace github.com/willf/bitset hack/update-vendor.sh # Recheck. hack/lint-dependencies.sh hack/update-internal-modules.sh # Recheck. hack/lint-dependencies.sh Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
181
vendor/github.com/cilium/ebpf/syscalls.go
generated
vendored
181
vendor/github.com/cilium/ebpf/syscalls.go
generated
vendored
@@ -3,6 +3,7 @@ package ebpf
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"unsafe"
|
||||
|
||||
"github.com/cilium/ebpf/internal"
|
||||
@@ -10,19 +11,10 @@ import (
|
||||
"github.com/cilium/ebpf/internal/unix"
|
||||
)
|
||||
|
||||
// Generic errors returned by BPF syscalls.
|
||||
var ErrNotExist = errors.New("requested object does not exist")
|
||||
|
||||
// bpfObjName is a null-terminated string made up of
|
||||
// 'A-Za-z0-9_' characters.
|
||||
type bpfObjName [unix.BPF_OBJ_NAME_LEN]byte
|
||||
|
||||
// newBPFObjName truncates the result if it is too long.
|
||||
func newBPFObjName(name string) bpfObjName {
|
||||
var result bpfObjName
|
||||
copy(result[:unix.BPF_OBJ_NAME_LEN-1], name)
|
||||
return result
|
||||
}
|
||||
// ErrNotExist is returned when loading a non-existing map or program.
|
||||
//
|
||||
// Deprecated: use os.ErrNotExist instead.
|
||||
var ErrNotExist = os.ErrNotExist
|
||||
|
||||
// invalidBPFObjNameChar returns true if char may not appear in
|
||||
// a BPF object name.
|
||||
@@ -45,21 +37,6 @@ func invalidBPFObjNameChar(char rune) bool {
|
||||
}
|
||||
}
|
||||
|
||||
type bpfMapCreateAttr struct {
|
||||
mapType MapType
|
||||
keySize uint32
|
||||
valueSize uint32
|
||||
maxEntries uint32
|
||||
flags uint32
|
||||
innerMapFd uint32 // since 4.12 56f668dfe00d
|
||||
numaNode uint32 // since 4.14 96eabe7a40aa
|
||||
mapName bpfObjName // since 4.15 ad5b177bd73f
|
||||
mapIfIndex uint32
|
||||
btfFd uint32
|
||||
btfKeyTypeID btf.TypeID
|
||||
btfValueTypeID btf.TypeID
|
||||
}
|
||||
|
||||
type bpfMapOpAttr struct {
|
||||
mapFd uint32
|
||||
padding uint32
|
||||
@@ -86,10 +63,10 @@ type bpfMapInfo struct {
|
||||
value_size uint32
|
||||
max_entries uint32
|
||||
map_flags uint32
|
||||
name bpfObjName // since 4.15 ad5b177bd73f
|
||||
ifindex uint32 // since 4.16 52775b33bb50
|
||||
btf_vmlinux_value_type_id uint32 // since 5.6 85d33df357b6
|
||||
netns_dev uint64 // since 4.16 52775b33bb50
|
||||
name internal.BPFObjName // since 4.15 ad5b177bd73f
|
||||
ifindex uint32 // since 4.16 52775b33bb50
|
||||
btf_vmlinux_value_type_id uint32 // since 5.6 85d33df357b6
|
||||
netns_dev uint64 // since 4.16 52775b33bb50
|
||||
netns_ino uint64
|
||||
btf_id uint32 // since 4.18 78958fca7ead
|
||||
btf_key_type_id uint32 // since 4.18 9b2cf328b2ec
|
||||
@@ -104,11 +81,11 @@ type bpfProgLoadAttr struct {
|
||||
logLevel uint32
|
||||
logSize uint32
|
||||
logBuf internal.Pointer
|
||||
kernelVersion uint32 // since 4.1 2541517c32be
|
||||
progFlags uint32 // since 4.11 e07b98d9bffe
|
||||
progName bpfObjName // since 4.15 067cae47771c
|
||||
progIfIndex uint32 // since 4.15 1f6f4cb7ba21
|
||||
expectedAttachType AttachType // since 4.17 5e43f899b03a
|
||||
kernelVersion uint32 // since 4.1 2541517c32be
|
||||
progFlags uint32 // since 4.11 e07b98d9bffe
|
||||
progName internal.BPFObjName // since 4.15 067cae47771c
|
||||
progIfIndex uint32 // since 4.15 1f6f4cb7ba21
|
||||
expectedAttachType AttachType // since 4.17 5e43f899b03a
|
||||
progBTFFd uint32
|
||||
funcInfoRecSize uint32
|
||||
funcInfo internal.Pointer
|
||||
@@ -132,7 +109,7 @@ type bpfProgInfo struct {
|
||||
created_by_uid uint32
|
||||
nr_map_ids uint32
|
||||
map_ids internal.Pointer
|
||||
name bpfObjName // since 4.15 067cae47771c
|
||||
name internal.BPFObjName // since 4.15 067cae47771c
|
||||
ifindex uint32
|
||||
gpl_compatible uint32
|
||||
netns_dev uint64
|
||||
@@ -188,7 +165,7 @@ func bpfProgLoad(attr *bpfProgLoadAttr) (*internal.FD, error) {
|
||||
fd, err := internal.BPF(internal.BPF_PROG_LOAD, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
// As of ~4.20 the verifier can be interrupted by a signal,
|
||||
// and returns EAGAIN in that case.
|
||||
if err == unix.EAGAIN {
|
||||
if errors.Is(err, unix.EAGAIN) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -205,23 +182,14 @@ func bpfProgTestRun(attr *bpfProgTestRunAttr) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func bpfMapCreate(attr *bpfMapCreateAttr) (*internal.FD, error) {
|
||||
fd, err := internal.BPF(internal.BPF_MAP_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return internal.NewFD(uint32(fd)), nil
|
||||
}
|
||||
|
||||
var haveNestedMaps = internal.FeatureTest("nested maps", "4.12", func() error {
|
||||
_, err := bpfMapCreate(&bpfMapCreateAttr{
|
||||
mapType: ArrayOfMaps,
|
||||
keySize: 4,
|
||||
valueSize: 4,
|
||||
maxEntries: 1,
|
||||
_, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{
|
||||
MapType: uint32(ArrayOfMaps),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
// Invalid file descriptor.
|
||||
innerMapFd: ^uint32(0),
|
||||
InnerMapFd: ^uint32(0),
|
||||
})
|
||||
if errors.Is(err, unix.EINVAL) {
|
||||
return internal.ErrNotSupported
|
||||
@@ -235,12 +203,44 @@ var haveNestedMaps = internal.FeatureTest("nested maps", "4.12", func() error {
|
||||
var haveMapMutabilityModifiers = internal.FeatureTest("read- and write-only maps", "5.2", func() error {
|
||||
// This checks BPF_F_RDONLY_PROG and BPF_F_WRONLY_PROG. Since
|
||||
// BPF_MAP_FREEZE appeared in 5.2 as well we don't do a separate check.
|
||||
m, err := bpfMapCreate(&bpfMapCreateAttr{
|
||||
mapType: Array,
|
||||
keySize: 4,
|
||||
valueSize: 4,
|
||||
maxEntries: 1,
|
||||
flags: unix.BPF_F_RDONLY_PROG,
|
||||
m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Array),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
Flags: unix.BPF_F_RDONLY_PROG,
|
||||
})
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
_ = m.Close()
|
||||
return nil
|
||||
})
|
||||
|
||||
var haveMmapableMaps = internal.FeatureTest("mmapable maps", "5.5", func() error {
|
||||
// This checks BPF_F_MMAPABLE, which appeared in 5.5 for array maps.
|
||||
m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Array),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
Flags: unix.BPF_F_MMAPABLE,
|
||||
})
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
_ = m.Close()
|
||||
return nil
|
||||
})
|
||||
|
||||
var haveInnerMaps = internal.FeatureTest("inner maps", "5.10", func() error {
|
||||
// This checks BPF_F_INNER_MAP, which appeared in 5.10.
|
||||
m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Array),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
Flags: unix.BPF_F_INNER_MAP,
|
||||
})
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
@@ -329,7 +329,7 @@ func objGetNextID(cmd internal.BPFCmd, start uint32) (uint32, error) {
|
||||
startID: start,
|
||||
}
|
||||
_, err := internal.BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr))
|
||||
return attr.nextID, wrapObjError(err)
|
||||
return attr.nextID, err
|
||||
}
|
||||
|
||||
func bpfMapBatch(cmd internal.BPFCmd, m *internal.FD, inBatch, outBatch, keys, values internal.Pointer, count uint32, opts *BatchOptions) (uint32, error) {
|
||||
@@ -355,32 +355,21 @@ func bpfMapBatch(cmd internal.BPFCmd, m *internal.FD, inBatch, outBatch, keys, v
|
||||
return attr.count, wrapMapError(err)
|
||||
}
|
||||
|
||||
func wrapObjError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if errors.Is(err, unix.ENOENT) {
|
||||
return fmt.Errorf("%w", ErrNotExist)
|
||||
}
|
||||
|
||||
return errors.New(err.Error())
|
||||
}
|
||||
|
||||
func wrapMapError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if errors.Is(err, unix.ENOENT) {
|
||||
return ErrKeyNotExist
|
||||
return internal.SyscallError(ErrKeyNotExist, unix.ENOENT)
|
||||
}
|
||||
|
||||
if errors.Is(err, unix.EEXIST) {
|
||||
return ErrKeyExist
|
||||
return internal.SyscallError(ErrKeyExist, unix.EEXIST)
|
||||
}
|
||||
|
||||
if errors.Is(err, unix.ENOTSUPP) {
|
||||
return ErrNotSupported
|
||||
return internal.SyscallError(ErrNotSupported, unix.ENOTSUPP)
|
||||
}
|
||||
|
||||
return err
|
||||
@@ -417,15 +406,15 @@ func bpfGetMapInfoByFD(fd *internal.FD) (*bpfMapInfo, error) {
|
||||
}
|
||||
|
||||
var haveObjName = internal.FeatureTest("object names", "4.15", func() error {
|
||||
attr := bpfMapCreateAttr{
|
||||
mapType: Array,
|
||||
keySize: 4,
|
||||
valueSize: 4,
|
||||
maxEntries: 1,
|
||||
mapName: newBPFObjName("feature_test"),
|
||||
attr := internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Array),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
MapName: internal.NewBPFObjName("feature_test"),
|
||||
}
|
||||
|
||||
fd, err := bpfMapCreate(&attr)
|
||||
fd, err := internal.BPFMapCreate(&attr)
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
@@ -439,15 +428,15 @@ var objNameAllowsDot = internal.FeatureTest("dot in object names", "5.2", func()
|
||||
return err
|
||||
}
|
||||
|
||||
attr := bpfMapCreateAttr{
|
||||
mapType: Array,
|
||||
keySize: 4,
|
||||
valueSize: 4,
|
||||
maxEntries: 1,
|
||||
mapName: newBPFObjName(".test"),
|
||||
attr := internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Array),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: 1,
|
||||
MapName: internal.NewBPFObjName(".test"),
|
||||
}
|
||||
|
||||
fd, err := bpfMapCreate(&attr)
|
||||
fd, err := internal.BPFMapCreate(&attr)
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
@@ -458,14 +447,14 @@ var objNameAllowsDot = internal.FeatureTest("dot in object names", "5.2", func()
|
||||
|
||||
var haveBatchAPI = internal.FeatureTest("map batch api", "5.6", func() error {
|
||||
var maxEntries uint32 = 2
|
||||
attr := bpfMapCreateAttr{
|
||||
mapType: Hash,
|
||||
keySize: 4,
|
||||
valueSize: 4,
|
||||
maxEntries: maxEntries,
|
||||
attr := internal.BPFMapCreateAttr{
|
||||
MapType: uint32(Hash),
|
||||
KeySize: 4,
|
||||
ValueSize: 4,
|
||||
MaxEntries: maxEntries,
|
||||
}
|
||||
|
||||
fd, err := bpfMapCreate(&attr)
|
||||
fd, err := internal.BPFMapCreate(&attr)
|
||||
if err != nil {
|
||||
return internal.ErrNotSupported
|
||||
}
|
||||
@@ -487,5 +476,5 @@ func bpfObjGetFDByID(cmd internal.BPFCmd, id uint32) (*internal.FD, error) {
|
||||
id: id,
|
||||
}
|
||||
ptr, err := internal.BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr))
|
||||
return internal.NewFD(uint32(ptr)), wrapObjError(err)
|
||||
return internal.NewFD(uint32(ptr)), err
|
||||
}
|
||||
|
Reference in New Issue
Block a user