Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending invalid payload to API causes panic #469

Closed
richardcase opened this issue Jun 26, 2022 · 1 comment · Fixed by #470
Closed

Sending invalid payload to API causes panic #469

richardcase opened this issue Jun 26, 2022 · 1 comment · Fixed by #470
Labels
area/api Indicates an issue or PR relates to the APIs kind/bug Something isn't working needs-investigation Requires more information (from opener or investigation) before work can begin priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.

Comments

@richardcase
Copy link
Member

What happened:
Sending an invalid payload to CreateMicroVM, like what you’d send to the ListMicroVMs (e.g.) { namespace: "ayx" }, crashes flintlock with the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc0 pc=0x141da69]

goroutine 164 [running]:
[github.com/weaveworks-liquidmetal/flintlock/infrastructure/grpc.convertMicroVMToModel(0x186b440](http://github.com/weaveworks-liquidmetal/flintlock/infrastructure/grpc.convertMicroVMToModel(0x186b440)?)
                /root/workspace/repos/flintlock/infrastructure/grpc/convert.go:16 +0x29
[github.com/weaveworks-liquidmetal/flintlock/infrastructure/grpc.(*server).CreateMicroVM(0xc000993b60](http://github.com/weaveworks-liquidmetal/flintlock/infrastructure/grpc.(*server).CreateMicroVM(0xc000993b60), {0x186b440, 0xc000826570}, 0xc0007ac040)
                /root/workspace/repos/flintlock/infrastructure/grpc/server.go:49 +0xb2
[github.com/weaveworks-liquidmetal/flintlock/api/services/microvm/v1alpha1._MicroVM_CreateMicroVM_Handler.func1({0x186b440](http://github.com/weaveworks-liquidmetal/flintlock/api/services/microvm/v1alpha1._MicroVM_CreateMicroVM_Handler.func1(%7B0x186b440), 0xc000826570}, {0x15f2f20?, 0xc0007ac040})
                /root/workspace/repos/flintlock/api/services/microvm/v1alpha1/microvms_grpc.pb.go:160 +0x78
[github.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1({0x186b440](http://github.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1(%7B0x186b440), 0xc000826570}, {0x15f2f20, 0xc0007ac040}, 0xc0006d2af0?, 0xc00000e4e0)
                /root/go/pkg/mod/[github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0/server_metrics.go:107](http://github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0/server_metrics.go:107) +0x87
[github.com/weaveworks-liquidmetal/flintlock/api/services/microvm/v1alpha1._MicroVM_CreateMicroVM_Handler({0x15b6460](http://github.com/weaveworks-liquidmetal/flintlock/api/services/microvm/v1alpha1._MicroVM_CreateMicroVM_Handler(%7B0x15b6460)?, 0xc000993b60}, {0x186b440, 0xc000826570}, 0xc0007a8120, 0xc0001a4450)
                /root/workspace/repos/flintlock/api/services/microvm/v1alpha1/microvms_grpc.pb.go:162 +0x138
[google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002e88c0](http://google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002e88c0), {0x1870158, 0xc0007ae4e0}, 0xc0001c6360, 0xc000993ce0, 0x21c8e60, 0x0)
                /root/go/pkg/mod/[google.golang.org/grpc@v1.47.0/server.go:1283](http://google.golang.org/grpc@v1.47.0/server.go:1283) +0xcfd
[google.golang.org/grpc.(*Server).handleStream(0xc0002e88c0](http://google.golang.org/grpc.(*Server).handleStream(0xc0002e88c0), {0x1870158, 0xc0007ae4e0}, 0xc0001c6360, 0x0)
                /root/go/pkg/mod/[google.golang.org/grpc@v1.47.0/server.go:1620](http://google.golang.org/grpc@v1.47.0/server.go:1620) +0xa1b
[google.golang.org/grpc.(*Server).serveStreams.func1.2()](http://google.golang.org/grpc.(*Server).serveStreams.func1.2())
                /root/go/pkg/mod/[google.golang.org/grpc@v1.47.0/server.go:922](http://google.golang.org/grpc@v1.47.0/server.go:922) +0x98
created by [google.golang.org/grpc.(*Server).serveStreams.func1](http://google.golang.org/grpc.(*Server).serveStreams.func1)
                /root/go/pkg/mod/[google.golang.org/grpc@v1.47.0/server.go:920](http://google.golang.org/grpc@v1.47.0/server.go:920) +0x28a

What did you expect to happen:
Sending an invalid payload should not cause a panic.

How to reproduce it:

Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]

Environment:

  • flintlock version:
  • containerd version:
  • OS (e.g. from /etc/os-release):
@richardcase richardcase added kind/bug Something isn't working area/api Indicates an issue or PR relates to the APIs priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. needs-investigation Requires more information (from opener or investigation) before work can begin labels Jun 26, 2022
@Callisto13
Copy link
Member

reproduced: Request sent without *types.MicroVMSpec which caused a panic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Indicates an issue or PR relates to the APIs kind/bug Something isn't working needs-investigation Requires more information (from opener or investigation) before work can begin priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants