l3af-project/l3afd

Cilium ebpf link pkg errors on windows.

sanfern opened this issue · 9 comments

go vet command is failing on windows for ebpf/link pkg

Image: windows-2022
Version: 20230226.1

Go version: 1.18.6

  go vet -tags WINDOWS ./...
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    GOPATH: C:\Users\runneradmin\go
go: downloading github.com/rs/zerolog v1.[2](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:2)8.0
go: downloading github.com/swaggo/http-swagger v1.[3](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:3).3
go: downloading github.com/robfig/config v0.0.0-201[4](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:4)1207224736-0f78[5](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:5)29c8c7e
go: downloading github.com/go-chi/chi/v5 v5.0.8
go: downloading github.com/swaggo/swag v1.8.7
go: downloading github.com/golang/mock v1.[6](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:7).0
go: downloading github.com/prometheus/client_golang v1.14.0
go: downloading github.com/cilium/ebpf v0.10.0
go: downloading github.com/florianl/go-tc v0.4.1
go: downloading github.com/mitchellh/go-ps v1.0.0
go: downloading golang.org/x/sys v0.2.0
go: downloading github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe
go: downloading github.com/mattn/go-colorable v0.1.12
go: downloading github.com/KyleBanks/depth v1.2.1
go: downloading github.com/go-openapi/jsonreference v0.20.0
go: downloading github.com/go-openapi/spec v0.20.6
go: downloading golang.org/x/tools v0.1.12
go: downloading github.com/prometheus/client_model v0.3.0
go: downloading github.com/prometheus/common v0.3[7](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:8).0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.2
go: downloading github.com/golang/protobuf v1.5.2
go: downloading google.golang.org/protobuf v1.2[8](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:9).1
go: downloading github.com/josharian/native v1.0.0
go: downloading github.com/mdlayher/netlink v1.6.0
go: downloading github.com/mattn/go-isatty v0.0.14
go: downloading github.com/go-openapi/jsonpointer v0.1[9](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:10).5
go: downloading golang.org/x/net v0.0.0-20220722155237-a158d28d115b
go: downloading github.com/go-openapi/swag v0.19.15
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/mailru/easyjson v0.7.6
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/josharian/intern v1.0.0
# github.com/cilium/ebpf/link
Error: C:\Users\runneradmin\go\pkg\mod\github.com\cilium\ebpf@v0.[10](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:11).0\link\socket_filter.go:[18](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:19):[34](https://github.com/l3af-project/l3afd/actions/runs/4365841805/jobs/7635025497#step:8:35): cannot use int(fd) (value of type int) as type syscall.Handle in argument to syscall.SetsockoptInt
Error: C:\Users\runneradmin\go\pkg\mod\github.com\cilium\ebpf@v0.10.0\link\socket_filter.go:34:34: cannot use int(fd) (value of type int) as type syscall.Handle in argument to syscall.SetsockoptInt
Error: Process completed with exit code 1.

@sanfern I don't have permissions to add someone to the list of members that an issue can be assigned to. Can you add evershalik so we can reassign this issue?

@sanfern, Did you manage to remove the go vet -tags WINDOWS ./... step in the yml file for CI build in windows? Any updates on whether the error is consistent?

@sanfern, Did you manage to remove the go vet -tags WINDOWS ./... step in the yml file for CI build in windows? Any updates on whether the error is consistent?

Why remove it?

@dthaler There were two proposals during this week's meeting:
either 1. modify the attachXDP program and investigate whether the AttachSocketFilter in Cilium repo is causing the failure
Or 2. Remove this line from CI windows since this line is for sanity check of structs

It is the AttachSocketFilter in cilium repo causing this failure.

PS E:\git> git clone https://github.com/cilium/ebpf

Cloning into 'ebpf'... remote: Enumerating objects: 9270, done. remote: Counting objects: 100% (2738/2738), done. remote: Compressing objects: 100% (520/520), done. remote: Total 9270 (delta 2294), reused 2275 (delta 2211), pack-reused 6532 Receiving objects: 100% (9270/9270), 17.70 MiB | 27.92 MiB/s, done. Resolving deltas: 100% (6622/6622), done. PS E:\git> go vet -tags WINDOWS ./... pattern ./...: directory prefix . does not contain main module or its selected dependencies

PS E:\git> cd ebpf

PS E:\git\ebpf> go vet -tags WINDOWS ./...
go: downloading github.com/frankban/quicktest v1.14.5
go: downloading golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2
# github.com/cilium/ebpf/internal/testutils
internal\testutils\cgroup.go:58:21: undefined: unix.Stat_t
internal\testutils\cgroup.go:59:14: undefined: unix.Fstat
# github.com/cilium/ebpf/internal/testutils
vet.exe: internal\testutils\cgroup.go:58:21: undefined: unix.Stat_t
# github.com/cilium/ebpf/link
link\socket_filter.go:18:34: cannot use int(fd) (value of type int) as syscall.Handle value in argument to syscall.SetsockoptInt
link\socket_filter.go:34:34: cannot use int(fd) (value of type int) as syscall.Handle value in argument to syscall.SetsockoptInt

PR to test - #252
Got same error disabling go vet and go tests.

Can we add "//go:build !WINDOWS" tag to this file https://github.com/cilium/ebpf/blob/master/link/socket_filter.go? Or use a forked cilium branch with this tag for the time being?

@sanfern: I looked at the draft PR #252 and it seems that with disabling the go vet , we still have trouble. You even commented the function related to AttachXDP for windows. THe failure is not related to AttachXDP.
The build for windows in here is failing because it is still accessing socket_filter.go although the socket_filter.go is defined for UNIX in Cilium repo. I also checked and the socket_filter.go is only used in socket_filter_test.go. Can we remove this directory from Windows build CmakeLists.txt?

@sanfern there is a fix pushed to the cilium repo for this issue, could you please retry?